Add network settings graphql endpoints

What does this MR do and why?

Followup to !229563 (merged) - which added the setting data to the database.

This MR adds graphql endpoints for instance-level and TLG allowed/denied domain list settings. These settings are arrays of allowed / denied domains and will be editable via a paginated editor in the front-end in a followup MR. The MR only provides the read functionality, and a followup with have the mutations for saving changes.

References

Relates to https://gitlab.com/gitlab-org/gitlab/-/work_items/593149

How to set up and validate locally

Add some data for your instance:

::Ai::Setting.instance.update!(allowed_domains: (1..30).map { |x| "instance_domain#{x}.com" })

Add some data for a namespace:

namespace = ::Namespace.find_by_path "gitlab-duo"
namespace.update(ai_allowed_domains: (1..30).map { |x| "namespace_domain_#{x}.com" })

Query your instance:

query domainSettings {
  aiDomainSettings(domainSettingType: ALLOWED, first:10, after:null, search:"") {
    nodes
    pageInfo { hasNextPage endCursor }
  }
}

Query a namespace:

query domainSettingsForNamespace {
  namespace(fullPath: "gitlab-duo") {
    id,
    name,
    aiDomainSettings(domainSettingType: ALLOWED, first:20, after:null, search:"") {
      nodes
      pageInfo { hasNextPage endCursor }
    }
  }
}

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Roman Eisner

Merge request reports

Loading