jdalrymple/gitbeaker

View on GitHub
packages/core/src/resources/ApplicationSettings.ts

Summary

Maintainability
A
0 mins
Test Coverage
import { BaseResource } from '@gitbeaker/requester-utils';
import { RequestHelper } from '../infrastructure';
import type { BaseRequestOptions, GitlabAPIResponse, ShowExpanded, Sudo } from '../infrastructure';

export interface ApplicationSettingsSchema extends Record<string, unknown> {
  admin_mode?: boolean;
  admin_notification_email?: string;
  abuse_notification_email?: string;
  after_sign_out_path?: string;
  after_sign_up_text?: string;
  akismet_api_key?: string;
  akismet_enabled?: boolean;
  allow_group_owners_to_manage_ldap?: boolean;
  allow_local_requests_from_hooks_and_services?: boolean;
  allow_local_requests_from_system_hooks?: boolean;
  allow_local_requests_from_web_hooks_and_services?: boolean;
  allow_runner_registration_token?: boolean;
  archive_builds_in_human_readable?: string;
  asset_proxy_enabled?: boolean;
  asset_proxy_secret_key?: string;
  asset_proxy_url?: string;
  asset_proxy_whitelist?: string | string[];
  asset_proxy_allowlist?: string | string[];
  authorized_keys_enabled?: boolean;
  auto_devops_domain?: string;
  auto_devops_enabled?: boolean;
  automatic_purchased_storage_allocation?: boolean;
  bulk_import_enabled?: boolean;
  can_create_group?: boolean;
  check_namespace_plan?: boolean;
  commit_email_hostname?: string;
  container_expiration_policies_enable_historic_entries?: boolean;
  container_registry_cleanup_tags_service_max_list_size?: number;
  container_registry_delete_tags_service_timeout?: number;
  container_registry_expiration_policies_caching?: boolean;
  container_registry_expiration_policies_worker_capacity?: number;
  container_registry_token_expire_delay?: number;
  package_registry_cleanup_policies_worker_capacity?: number;
  deactivate_dormant_users?: boolean;
  deactivate_dormant_users_period?: number;
  default_artifacts_expire_in?: string;
  default_branch_name?: string;
  default_branch_protection?: number;
  default_ci_config_path?: string;
  default_group_visibility?: string;
  default_preferred_language?: string;
  default_project_creation?: number;
  default_project_visibility?: string;
  default_projects_limit?: number;
  default_snippet_visibility?: string;
  default_syntax_highlighting_theme?: number;
  delayed_project_deletion?: boolean;
  delayed_group_deletion?: boolean;
  deletion_adjourned_period?: number;
  diff_max_patch_bytes?: number;
  diff_max_files?: number;
  diff_max_lines?: number;
  disable_admin_oauth_scopes?: boolean;
  disable_feed_token?: boolean;
  disable_personal_access_token?: boolean;
  disabled_oauth_sign_in_sources?: string[];
  dns_rebinding_protection_enabled?: boolean;
  domain_denylist_enabled?: boolean;
  domain_denylist?: string[];
  domain_allowlist?: string[];
  dsa_key_restriction?: number;
  ecdsa_key_restriction?: number;
  ecdsa_sk_key_restriction?: number;
  ed25519_key_restriction?: number;
  ed25519_sk_key_restriction?: number;
  eks_access_key_id?: string;
  eks_account_id?: string;
  eks_integration_enabled?: boolean;
  eks_secret_access_key?: string;
  elasticsearch_aws_access_key?: string;
  elasticsearch_aws_region?: string;
  elasticsearch_aws_secret_access_key?: string;
  elasticsearch_aws?: boolean;
  elasticsearch_indexed_field_length_limit?: number;
  elasticsearch_indexed_file_size_limit_kb?: number;
  elasticsearch_indexing?: boolean;
  elasticsearch_limit_indexing?: boolean;
  elasticsearch_max_bulk_concurrency?: number;
  elasticsearch_max_bulk_size_mb?: number;
  elasticsearch_namespace_ids?: number[];
  elasticsearch_project_ids?: number[];
  elasticsearch_search?: boolean;
  elasticsearch_url?: string;
  elasticsearch_username?: string;
  elasticsearch_password?: string;
  email_additional_text?: string;
  email_author_in_body?: boolean;
  email_confirmation_setting?: string;
  enabled_git_access_protocol?: string;
  enforce_namespace_storage_limit?: boolean;
  enforce_terms?: boolean;
  external_auth_client_cert?: string;
  external_auth_client_key_pass?: string;
  external_auth_client_key?: string;
  external_authorization_service_default_label?: string;
  external_authorization_service_enabled?: boolean;
  external_authorization_service_timeout?: number;
  external_authorization_service_url?: string;
  external_pipeline_validation_service_url?: string;
  external_pipeline_validation_service_token?: string;
  external_pipeline_validation_service_timeout?: number;
  file_template_project_id?: number;
  first_day_of_week?: number;
  geo_node_allowed_ips?: string;
  geo_status_timeout?: number;
  git_two_factor_session_expiry?: number;
  gitaly_timeout_default?: number;
  gitaly_timeout_fast?: number;
  gitaly_timeout_medium?: number;
  gitlab_dedicated_instance?: boolean;
  grafana_enabled?: boolean;
  grafana_url?: string;
  gravatar_enabled?: boolean;
  group_owners_can_manage_default_branch_protection?: boolean;
  hashed_storage_enabled?: boolean;
  help_page_hide_commercial_content?: boolean;
  help_page_support_url?: string;
  help_page_text?: string;
  help_text?: string;
  hide_third_party_offers?: boolean;
  home_page_url?: string;
  housekeeping_enabled?: boolean;
  housekeeping_optimize_repository_period?: number;
  html_emails_enabled?: boolean;
  import_sources?: string[];
  in_product_marketing_emails_enabled?: boolean;
  invisible_captcha_enabled?: boolean;
  issues_create_limit?: number;
  keep_latest_artifact?: boolean;
  local_markdown_version?: number;
  mailgun_signing_key?: string;
  mailgun_events_enabled?: boolean;
  maintenance_mode_message?: string;
  maintenance_mode?: boolean;
  max_artifacts_size?: number;
  max_attachment_size?: number;
  max_export_size?: number;
  max_import_size?: number;
  max_pages_size?: number;
  max_personal_access_token_lifetime?: number;
  max_ssh_key_lifetime?: number;
  max_terraform_state_size_bytes?: number;
  metrics_method_call_threshold?: number;
  max_number_of_repository_downloads?: number;
  max_number_of_repository_downloads_within_time_period?: number;
  git_rate_limit_users_allowlist?: string[];
  git_rate_limit_users_alertlist?: number[];
  auto_ban_user_on_excessive_projects_download?: boolean;
  mirror_available?: boolean;
  mirror_capacity_threshold?: number;
  mirror_max_capacity?: number;
  mirror_max_delay?: number;
  maven_package_requests_forwarding?: boolean;
  npm_package_requests_forwarding?: boolean;
  pypi_package_requests_forwarding?: boolean;
  outbound_local_requests_whitelist?: string[];
  pages_domain_verification_enabled?: boolean;
  password_authentication_enabled_for_git?: boolean;
  password_authentication_enabled_for_web?: boolean;
  password_number_required?: boolean;
  password_symbol_required?: boolean;
  password_uppercase_required?: boolean;
  password_lowercase_required?: boolean;
  performance_bar_allowed_group_path?: string;
  personal_access_token_prefix?: string;
  pipeline_limit_per_project_user_sha?: number;
  plantuml_enabled?: boolean;
  plantuml_url?: string;
  polling_interval_multiplier?: number;
  project_export_enabled?: boolean;
  projects_api_rate_limit_unauthenticated?: number;
  prometheus_metrics_enabled?: boolean;
  protected_ci_variables?: boolean;
  push_event_activities_limit?: number;
  push_event_hooks_limit?: number;
  rate_limiting_response_text?: string;
  raw_blob_request_limit?: number;
  search_rate_limit?: number;
  search_rate_limit_unauthenticated?: number;
  recaptcha_enabled?: boolean;
  recaptcha_private_key?: string;
  recaptcha_site_key?: string;
  receive_max_input_size?: number;
  repository_checks_enabled?: boolean;
  repository_size_limit?: number;
  repository_storages_weighted?: Record<string, number>;
  repository_storages?: string[];
  require_admin_approval_after_user_signup?: boolean;
  require_two_factor_authentication?: boolean;
  restricted_visibility_levels?: string[];
  rsa_key_restriction?: number;
  session_expire_delay?: number;
  shared_runners_enabled?: boolean;
  shared_runners_minutes?: number;
  shared_runners_text?: string;
  sidekiq_job_limiter_mode?: string;
  sidekiq_job_limiter_compression_threshold_bytes?: number;
  sidekiq_job_limiter_limit_bytes?: number;
  sign_in_text?: string;
  signup_enabled?: boolean;
  slack_app_enabled?: boolean;
  slack_app_id?: string;
  slack_app_secret?: string;
  slack_app_signing_secret?: string;
  slack_app_verification_token?: string;
  snippet_size_limit?: number;
  snowplow_app_id?: string;
  snowplow_collector_hostname?: string;
  snowplow_cookie_domain?: string;
  snowplow_enabled?: boolean;
  sourcegraph_enabled?: boolean;
  sourcegraph_public_only?: boolean;
  sourcegraph_url?: string;
  spam_check_endpoint_enabled?: boolean;
  spam_check_endpoint_url?: string;
  spam_check_api_key?: string;
  suggest_pipeline_enabled?: boolean;
  terminal_max_session_time?: number;
  terms?: string;
  throttle_authenticated_api_enabled?: boolean;
  throttle_authenticated_api_period_in_seconds?: number;
  throttle_authenticated_api_requests_per_period?: number;
  throttle_authenticated_packages_api_enabled?: boolean;
  throttle_authenticated_packages_api_period_in_seconds?: number;
  throttle_authenticated_packages_api_requests_per_period?: number;
  throttle_authenticated_web_enabled?: boolean;
  throttle_authenticated_web_period_in_seconds?: number;
  throttle_authenticated_web_requests_per_period?: number;
  throttle_unauthenticated_api_enabled?: boolean;
  throttle_unauthenticated_api_period_in_seconds?: number;
  throttle_unauthenticated_api_requests_per_period?: number;
  throttle_unauthenticated_packages_api_enabled?: boolean;
  throttle_unauthenticated_packages_api_period_in_seconds?: number;
  throttle_unauthenticated_packages_api_requests_per_period?: number;
  throttle_unauthenticated_web_enabled?: boolean;
  throttle_unauthenticated_web_period_in_seconds?: number;
  throttle_unauthenticated_web_requests_per_period?: number;
  time_tracking_limit_to_hours?: boolean;
  two_factor_grace_period?: number;
  unique_ips_limit_enabled?: boolean;
  unique_ips_limit_per_user?: number;
  unique_ips_limit_time_window?: number;
  usage_ping_enabled?: boolean;
  user_deactivation_emails_enabled?: boolean;
  user_default_external?: boolean;
  user_default_internal_regex?: string;
  user_defaults_to_private_profile?: boolean;
  user_oauth_applications?: boolean;
  user_show_add_ssh_key_message?: boolean;
  version_check_enabled?: boolean;
  whats_new_variant?: string;
  wiki_page_max_content_bytes?: number;
  jira_connect_application_key?: string;
  jira_connect_proxy_url?: string;
}

export class ApplicationSettings<C extends boolean = false> extends BaseResource<C> {
  show<E extends boolean = false>(
    options?: Sudo & ShowExpanded<E>,
  ): Promise<GitlabAPIResponse<ApplicationSettingsSchema, C, E, void>> {
    return RequestHelper.get<ApplicationSettingsSchema>()(this, 'application/settings', options);
  }

  edit<E extends boolean = false>(
    options?: BaseRequestOptions<E>,
  ): Promise<GitlabAPIResponse<ApplicationSettingsSchema, C, E, void>> {
    return RequestHelper.put<ApplicationSettingsSchema>()(this, 'application/settings', options);
  }
}