sonar

package
v2.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2026 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package sonar is a Go client for the SonarQube web API.

The root type is Client. Create one with NewClient and reach each API area through a typed service field, for example client.Projects, client.Issues or client.Qualitygates. V2 API services are grouped under client.V2.

Authentication

SonarQube supports token authentication (recommended) and basic auth. Both can be supplied at construction via ClientCreateOptions or with the WithToken and WithBasicAuth options:

client, err := sonar.NewClient(nil,
	sonar.WithBaseURL("https://sonarqube.example.com/api/"),
	sonar.WithToken("my-token"),
)

In CI/CD environments the SONAR_URL, SONAR_TOKEN, SONAR_USERNAME, and SONAR_PASSWORD environment variables can be used instead:

client, err := sonar.NewClientFromEnv()

Requests and responses

Every service method takes a context.Context and, where applicable, a typed *<Service><Method>Options struct whose fields are validated before the request is sent. Methods return the decoded response, the raw *http.Response, and an error.

V1 vs V2

V1 endpoints encode parameters as URL query values (url:"" struct tags). V2 endpoints use JSON tags, support a request body, and live under the V2 field; the "v2/" path prefix is added automatically.

Errors

API errors are returned as *ResponseError. Use the sentinel helpers (IsNotFound, IsUnauthorized, IsForbidden, IsConflict, IsRateLimited, IsServerError) to branch on the HTTP status without unwrapping by hand.

Pagination

Paginated V1 endpoints expose both a single-page method (Search) and a convenience method that fetches every page (SearchAll / ListAll).

Resilience

Retries with exponential backoff and jitter are opt-in via WithRetry. The transport can be customized with WithTransportConfig, and arbitrary http.RoundTripper middleware (logging, tracing, metrics) can be attached with WithMiddleware.

Example

Create a client with token authentication and search for projects.

package main

import (
	"context"
	"fmt"

	"github.com/boxboxjason/sonarqube-client-go/v2/sonar"
)

func main() {
	client, err := sonar.NewClient(nil,
		sonar.WithBaseURL("https://sonarqube.example.com/api/"),
		sonar.WithToken("my-token"),
	)
	if err != nil {
		panic(err)
	}

	result, _, err := client.Projects.Search(context.Background(), &sonar.ProjectsSearchOptions{
		Query: "my-service",
	})
	if err != nil {
		panic(err)
	}

	for _, project := range result.Components {
		fmt.Println(project.Key)
	}
}

Index

Examples

Constants

View Source
const (
	// MaxAlmSettingKeyLength is the maximum allowed length for DevOps Platform setting keys.
	MaxAlmSettingKeyLength = 200
	// MaxPatLength is the maximum allowed length for Personal Access Tokens.
	MaxPatLength = 2000
	// MaxUsernameLength is the maximum allowed length for usernames.
	MaxUsernameLength = 2000
	// MaxGitHubRepoKeyLength is the maximum allowed length for GitHub repository keys.
	MaxGitHubRepoKeyLength = 256
	// MaxPageSizeAlmIntegrations is the maximum allowed page size for ALM integrations APIs.
	MaxPageSizeAlmIntegrations = 100
	// MinNewCodeDefinitionDays is the minimum number of days for NUMBER_OF_DAYS new code definition.
	MinNewCodeDefinitionDays = 1
	// MaxNewCodeDefinitionDays is the maximum number of days for NUMBER_OF_DAYS new code definition.
	MaxNewCodeDefinitionDays = 90
)
View Source
const (
	// MaxAlmKeyLength is the maximum length for DevOps Platform setting keys.
	MaxAlmKeyLength = 200
	// MaxAlmURLLength is the maximum length for DevOps Platform URLs.
	MaxAlmURLLength = 2000
	// MaxPersonalAccessTokenLength is the maximum length for Personal Access Tokens.
	MaxPersonalAccessTokenLength = 2000
	// MaxGitHubAppIDLength is the maximum length for GitHub App ID.
	MaxGitHubAppIDLength = 80
	// MaxGitHubClientIDLength is the maximum length for GitHub Client ID.
	MaxGitHubClientIDLength = 80
	// MaxGitHubClientSecretLength is the maximum length for GitHub Client Secret.
	MaxGitHubClientSecretLength = 160
	// MaxGitHubPrivateKeyLength is the maximum length for GitHub App private key.
	MaxGitHubPrivateKeyLength = 2500
	// MaxGitHubWebhookSecretLength is the maximum length for GitHub App Webhook Secret.
	MaxGitHubWebhookSecretLength = 160
	// MaxBitbucketCloudClientIDLength is the maximum length for Bitbucket Cloud Client ID (create).
	MaxBitbucketCloudClientIDLength = 2000
	// MaxBitbucketCloudClientSecretLength is the maximum length for Bitbucket Cloud Client Secret (create).
	MaxBitbucketCloudClientSecretLength = 2000
	// MaxBitbucketCloudClientIDUpdateLength is the maximum length for Bitbucket Cloud Client ID (update).
	MaxBitbucketCloudClientIDUpdateLength = 80
	// MaxBitbucketCloudClientSecretUpdateLength is the maximum length for Bitbucket Cloud Client Secret (update).
	MaxBitbucketCloudClientSecretUpdateLength = 160
	// MaxBitbucketCloudWorkspaceUpdateLength is the maximum length for Bitbucket Cloud Workspace (update).
	MaxBitbucketCloudWorkspaceUpdateLength = 80
	// MaxGitHubRepositoryLength is the maximum length for a GitHub repository binding.
	MaxGitHubRepositoryLength = 256
)
View Source
const (
	// MaxCePageSize is the maximum page size for CE activity queries.
	MaxCePageSize = 1000
	// MaxProjectKeyLength is the maximum length for a project key.
	MaxProjectKeyLength = 400
	// MaxProjectNameLength is the maximum length for a project name (truncated if longer).
	MaxProjectNameLength = 500

	// TaskStatusSuccess represents a successful task status.
	TaskStatusSuccess = "SUCCESS"
	// TaskStatusFailed represents a failed task status.
	TaskStatusFailed = "FAILED"
	// TaskStatusCanceled represents a canceled task status.
	TaskStatusCanceled = "CANCELED"
	// TaskStatusPending represents a pending task status.
	TaskStatusPending = "PENDING"
	// TaskStatusInProgress represents an in-progress task status.
	TaskStatusInProgress = "IN_PROGRESS"

	// TaskTypeReport represents a report task type.
	TaskTypeReport = "REPORT"
	// TaskTypeIssueSync represents an issue synchronization task type.
	TaskTypeIssueSync = "ISSUE_SYNC"
	// TaskTypeAuditPurge represents an audit purge task type.
	TaskTypeAuditPurge = "AUDIT_PURGE"
	// TaskTypeProjectExport represents a project export task type.
	TaskTypeProjectExport = "PROJECT_EXPORT"

	// TaskFieldStacktrace represents the "stacktrace" additional field for task details.
	TaskFieldStacktrace = "stacktrace"
	// TaskFieldScannerContext represents the "scannerContext" additional field for task details.
	TaskFieldScannerContext = "scannerContext"
	// TaskFieldWarnings represents the "warnings" additional field for task details.
	TaskFieldWarnings = "warnings"
)
View Source
const (
	// MaxRuleKeyLengthV2 is the maximum length for a custom rule key in V2 API.
	MaxRuleKeyLengthV2 = 200
	// MaxRuleNameLengthV2 is the maximum length for a custom rule name in V2 API.
	MaxRuleNameLengthV2 = 200
	// MaxTemplateKeyLengthV2 is the maximum length for a rule template key in V2 API.
	MaxTemplateKeyLengthV2 = 200
)
View Source
const (

	// MaxPageSize is the maximum allowed page size for pagination.
	MaxPageSize = 500
	// MinPageSize is the minimum allowed page size for pagination.
	MinPageSize = 1

	// MaxLinkNameLength is the maximum length for a project link name.
	MaxLinkNameLength = 128
	// MaxLinkURLLength is the maximum length for a project link URL.
	MaxLinkURLLength = 2048
	// MaxTokenNameLength is the maximum length for a user token name.
	MaxTokenNameLength = 100
	// MaxBranchNameLength is the maximum length for a branch name.
	MaxBranchNameLength = 255

	// LanguageAzurePipelines is the language key for Azure Pipelines.
	LanguageAzurePipelines = "azurepipelines"
	// LanguageAzureResourceManager is the language key for Azure Resource Manager.
	LanguageAzureResourceManager = "azureresourcemanager"
	// LanguageCloudFormation is the language key for CloudFormation.
	LanguageCloudFormation = "cloudformation"
	// LanguageCS is the language key for C#.
	LanguageCS = "cs"
	// LanguageCSS is the language key for CSS.
	LanguageCSS = "css"
	// LanguageDocker is the language key for Docker.
	LanguageDocker = "docker"
	// LanguageFlex is the language key for Flex.
	LanguageFlex = "flex"
	// LanguageGithubActions is the language key for GitHub Actions.
	LanguageGithubActions = "githubactions"
	// LanguageGo is the language key for Go.
	LanguageGo = "go"
	// LanguageGroovy is the language key for Groovy.
	LanguageGroovy = "groovy"
	// LanguageIPYNB is the language key for Jupyter Notebooks.
	LanguageIPYNB = "ipynb"
	// LanguageJava is the language key for Java.
	LanguageJava = "java"
	// LanguageJS is the language key for JavaScript.
	LanguageJS = "js"
	// LanguageJSON is the language key for JSON.
	LanguageJSON = "json"
	// LanguageJSP is the language key for JSP.
	LanguageJSP = "jsp"
	// LanguageKotlin is the language key for Kotlin.
	LanguageKotlin = "kotlin"
	// LanguageKubernetes is the language key for Kubernetes.
	LanguageKubernetes = "kubernetes"
	// LanguagePHP is the language key for PHP.
	LanguagePHP = "php"
	// LanguagePowershell is the language key for PowerShell.
	LanguagePowershell = "powershell"
	// LanguagePython is the language key for Python.
	LanguagePython = "py"
	// LanguageRuby is the language key for Ruby On Rails.
	LanguageRuby = "ruby"
	// LanguageRust is the language key for Rust.
	LanguageRust = "rust"
	// LanguageScala is the language key for Scala.
	LanguageScala = "scala"
	// LanguageSecrets is the language key for Secrets.
	LanguageSecrets = "secrets"
	// LanguageShell is the language key for Shell scripts.
	LanguageShell = "shell"
	// LanguageTerraform is the language key for Terraform.
	LanguageTerraform = "terraform"
	// LanguageText is the language key for Text files.
	LanguageText = "text"
	// LanguageTypeScript is the language key for TypeScript.
	LanguageTypeScript = "ts"
	// LanguageVBNet is the language key for Visual Basic .NET.
	LanguageVBNet = "vbnet"
	// LanguageWeb is the language key for Web files.
	LanguageWeb = "web"
	// LanguageXML is the language key for XML.
	LanguageXML = "xml"
	// LanguageYAML is the language key for YAML.
	LanguageYAML = "yaml"

	// CleanCodeAttributeCategoryAdaptable is the Clean Code attribute category for adaptability.
	CleanCodeAttributeCategoryAdaptable = "ADAPTABLE"
	// CleanCodeAttributeCategoryConsistent is the Clean Code attribute category for consistency.
	CleanCodeAttributeCategoryConsistent = "CONSISTENT"
	// CleanCodeAttributeCategoryIntentional is the Clean Code attribute category for intentionality.
	CleanCodeAttributeCategoryIntentional = "INTENTIONAL"
	// CleanCodeAttributeCategoryResponsible is the Clean Code attribute category for responsibility.
	CleanCodeAttributeCategoryResponsible = "RESPONSIBLE"

	// CleanCodeAttributeConventional is the Clean Code attribute for conventional code.
	CleanCodeAttributeConventional = "CONVENTIONAL"
	// CleanCodeAttributeFormatted is the Clean Code attribute for formatted code.
	CleanCodeAttributeFormatted = "FORMATTED"
	// CleanCodeAttributeIdentifiable is the Clean Code attribute for identifiable code.
	CleanCodeAttributeIdentifiable = "IDENTIFIABLE"
	// CleanCodeAttributeClear is the Clean Code attribute for clear code.
	CleanCodeAttributeClear = "CLEAR"
	// CleanCodeAttributeComplete is the Clean Code attribute for complete code.
	CleanCodeAttributeComplete = "COMPLETE"
	// CleanCodeAttributeEfficient is the Clean Code attribute for efficient code.
	CleanCodeAttributeEfficient = "EFFICIENT"
	// CleanCodeAttributeLogical is the Clean Code attribute for logical code.
	CleanCodeAttributeLogical = "LOGICAL"
	// CleanCodeAttributeDistinct is the Clean Code attribute for distinct code.
	CleanCodeAttributeDistinct = "DISTINCT"
	// CleanCodeAttributeFocused is the Clean Code attribute for focused code.
	CleanCodeAttributeFocused = "FOCUSED"
	// CleanCodeAttributeModular is the Clean Code attribute for modular code.
	CleanCodeAttributeModular = "MODULAR"
	// CleanCodeAttributeTested is the Clean Code attribute for tested code.
	CleanCodeAttributeTested = "TESTED"
	// CleanCodeAttributeLawful is the Clean Code attribute for lawful code.
	CleanCodeAttributeLawful = "LAWFUL"
	// CleanCodeAttributeRespectful is the Clean Code attribute for respectful code.
	CleanCodeAttributeRespectful = "RESPECTFUL"
	// CleanCodeAttributeTrustworthy is the Clean Code attribute for trustworthy code.
	CleanCodeAttributeTrustworthy = "TRUSTWORTHY"

	// OwaspCategoryA1 is the OWASP category for Injection.
	OwaspCategoryA1 = "a1"
	// OwaspCategoryA2 is the OWASP category for Broken Authentication.
	OwaspCategoryA2 = "a2"
	// OwaspCategoryA3 is the OWASP category for Sensitive Data Exposure.
	OwaspCategoryA3 = "a3"
	// OwaspCategoryA4 is the OWASP category for XML External Entities (XXE).
	OwaspCategoryA4 = "a4"
	// OwaspCategoryA5 is the OWASP category for Broken Access Control.
	OwaspCategoryA5 = "a5"
	// OwaspCategoryA6 is the OWASP category for Security Misconfiguration.
	OwaspCategoryA6 = "a6"
	// OwaspCategoryA7 is the OWASP category for Cross-Site Scripting (XSS).
	OwaspCategoryA7 = "a7"
	// OwaspCategoryA8 is the OWASP category for Insecure Deserialization.
	OwaspCategoryA8 = "a8"
	// OwaspCategoryA9 is the OWASP category for Using Components with Known Vulnerabilities.
	OwaspCategoryA9 = "a9"
	// OwaspCategoryA10 is the OWASP category for Insufficient Logging & Monitoring.
	OwaspCategoryA10 = "a10"

	// OwaspMobileCategoryM1 is the OWASP Mobile category for Improper Platform Usage.
	OwaspMobileCategoryM1 = "m1"
	// OwaspMobileCategoryM2 is the OWASP Mobile category for Insecure Data Storage.
	OwaspMobileCategoryM2 = "m2"
	// OwaspMobileCategoryM3 is the OWASP Mobile category for Insecure Communication.
	OwaspMobileCategoryM3 = "m3"
	// OwaspMobileCategoryM4 is the OWASP Mobile category for Insecure Authentication.
	OwaspMobileCategoryM4 = "m4"
	// OwaspMobileCategoryM5 is the OWASP Mobile category for Insufficient Cryptography.
	OwaspMobileCategoryM5 = "m5"
	// OwaspMobileCategoryM6 is the OWASP Mobile category for Insecure Authorization.
	OwaspMobileCategoryM6 = "m6"
	// OwaspMobileCategoryM7 is the OWASP Mobile category for Client Code Quality.
	OwaspMobileCategoryM7 = "m7"
	// OwaspMobileCategoryM8 is the OWASP Mobile category for Code Tampering.
	OwaspMobileCategoryM8 = "m8"
	// OwaspMobileCategoryM9 is the OWASP Mobile category for Reverse Engineering.
	OwaspMobileCategoryM9 = "m9"
	// OwaspMobileCategoryM10 is the OWASP Mobile category for Extraneous Functionality.
	OwaspMobileCategoryM10 = "m10"

	// SansTop25CategoryInsecureInteraction is the SANS Top 25 category for Insecure Interaction.
	SansTop25CategoryInsecureInteraction = "insecure-interaction"
	// SansTop25CategoryRiskyResource is the SANS Top 25 category for Risky Resource.
	SansTop25CategoryRiskyResource = "risky-resource"
	// SansTop25CategoryPorousDefenses is the SANS Top 25 category for Porous Defenses.
	SansTop25CategoryPorousDefenses = "porous-defenses"

	// SoftwareQualityMaintainability is the software quality characteristic for maintainability.
	SoftwareQualityMaintainability = "MAINTAINABILITY"
	// SoftwareQualityReliability is the software quality characteristic for reliability.
	SoftwareQualityReliability = "RELIABILITY"
	// SoftwareQualitySecurity is the software quality characteristic for security.
	SoftwareQualitySecurity = "SECURITY"

	// InheritanceTypeNone represents no inheritance.
	InheritanceTypeNone = "NONE"
	// InheritanceTypeInherited represents inherited.
	InheritanceTypeInherited = "INHERITED"
	// InheritanceTypeOverrides represents overrides.
	InheritanceTypeOverrides = "OVERRIDES"

	// SelectionFilterAll represents the "all" selection filter.
	SelectionFilterAll = "all"
	// SelectionFilterSelected represents the "selected" selection filter.
	SelectionFilterSelected = "selected"
	// SelectionFilterDeselected represents the "deselected" selection filter.
	SelectionFilterDeselected = "deselected"

	// FieldName represents the "name" field for request parameters.
	FieldName = "name"
	// FieldDescription represents the "description" field for request parameters.
	FieldDescription = "description"
	// FieldCreatedAt represents the "createdAt" field for request parameters.
	FieldCreatedAt = "createdAt"
)
View Source
const (
	// MaxComponentSearchQueryLength is the maximum length for search queries (truncated by API if exceeded).
	MaxComponentSearchQueryLength = 15
	// MinComponentSearchQueryLength is the minimum length for search queries.
	MinComponentSearchQueryLength = 2
	// MinComponentTreeQueryLength is the minimum length for tree search queries.
	MinComponentTreeQueryLength = 3
	// MaxRecentlyBrowsedItems is the maximum number of recently browsed items.
	MaxRecentlyBrowsedItems = 50
	// MinComponentFilterLength is the minimum length for project filter.
	MinComponentFilterLength = 2
)
View Source
const (
	// EnvURL is the base API URL of the SonarQube instance.
	EnvURL = "SONAR_URL"
	// EnvToken is the authentication token (takes precedence over basic auth).
	EnvToken = "SONAR_TOKEN"
	// EnvUsername is the username for basic authentication.
	EnvUsername = "SONAR_USERNAME"
	// EnvPassword is the password for basic authentication.
	EnvPassword = "SONAR_PASSWORD"
	// EnvUserAgent overrides the default User-Agent header.
	EnvUserAgent = "SONAR_USER_AGENT"
	// EnvTimeout sets the HTTP request timeout (parsed as a Go duration string, e.g. "30s", "2m").
	EnvTimeout = "SONAR_TIMEOUT"
)

Environment variable names read by NewClientFromEnv.

View Source
const (
	// FixSuggestionsEnablementEnabledForAllProjects represents the "ENABLED_FOR_ALL_PROJECTS" feature enablement state (enabled for all projects).
	FixSuggestionsEnablementEnabledForAllProjects = "ENABLED_FOR_ALL_PROJECTS"
	// FixSuggestionsEnablementDisabled represents the "DISABLED" feature enablement state.
	FixSuggestionsEnablementDisabled = "DISABLED"
	// FixSuggestionsEnablementEnabledForSomeProjects represents the "ENABLED_FOR_SOME_PROJECTS" feature enablement state.
	FixSuggestionsEnablementEnabledForSomeProjects = "ENABLED_FOR_SOME_PROJECTS"

	// FixSuggestionsBannerTypeEnable represents the "ENABLE" awareness banner interaction type.
	FixSuggestionsBannerTypeEnable = "ENABLE"
	// FixSuggestionsBannerTypeLearnMore represents the "LEARN_MORE" awareness banner interaction type.
	FixSuggestionsBannerTypeLearnMore = "LEARN_MORE"
)
View Source
const (
	// HistoryEntityTypePortfolio identifies a portfolio entity.
	HistoryEntityTypePortfolio = "PORTFOLIO"
	// HistoryEntityTypeProjectBranch identifies a project branch entity.
	HistoryEntityTypeProjectBranch = "PROJECT_BRANCH"
)
View Source
const (
	// MaxHotspotCommentLength is the maximum length for a hotspot comment.
	MaxHotspotCommentLength = 1000
	// MaxHotspotListPageSize is the maximum page size for the List endpoint.
	MaxHotspotListPageSize = 500

	// HotspotStatusToReview represents the "TO_REVIEW" status for a hotspot.
	HotspotStatusToReview = "TO_REVIEW"
	// HotspotStatusReviewed represents the "REVIEWED" status for a hotspot.
	HotspotStatusReviewed = "REVIEWED"

	// HotspotResolutionFixed represents the "FIXED" resolution for a hotspot.
	HotspotResolutionFixed = "FIXED"
	// HotspotResolutionSafe represents the "SAFE" resolution for a hotspot.
	HotspotResolutionSafe = "SAFE"
	// HotspotResolutionAcknowledged represents the "ACKNOWLEDGED" resolution for a hotspot.
	HotspotResolutionAcknowledged = "ACKNOWLEDGED"
)
View Source
const (
	// IssueTransitionConfirm represents the "confirm" transition for issues.
	IssueTransitionConfirm = "confirm"
	// IssueTransitionUnconfirm represents the "unconfirm" transition for issues.
	IssueTransitionUnconfirm = "unconfirm"
	// IssueTransitionReopen represents the "reopen" transition for issues.
	IssueTransitionReopen = "reopen"
	// IssueTransitionResolve represents the "resolve" transition for issues.
	IssueTransitionResolve = "resolve"
	// IssueTransitionFalsePositive represents the "falsepositive" transition for issues.
	IssueTransitionFalsePositive = "falsepositive"
	// IssueTransitionWontFix represents the "wontfix" transition for issues.
	IssueTransitionWontFix = "wontfix"
	// IssueTransitionAccept represents the "accept" transition for issues.
	IssueTransitionAccept = "accept"
	// IssueTransitionClose represents the "close" transition for issues.
	//
	// Deprecated: Since SonarQube 2026.4. The API no longer accepts "close" as a manual transition value.
	IssueTransitionClose = "close"
	// IssueTransitionResolveAsReviewed represents the "resolveasreviewed" transition for issues.
	IssueTransitionResolveAsReviewed = "resolveasreviewed"
	// IssueTransitionResetAsReviewed represents the "resetastoreview" transition for issues.
	IssueTransitionResetAsReviewed = "resetastoreview"

	// IssueStatusOpen represents the "OPEN" status for issues.
	IssueStatusOpen = "OPEN"
	// IssueStatusConfirmed represents the "CONFIRMED" status for issues.
	IssueStatusConfirmed = "CONFIRMED"
	// IssueStatusFalsePositive represents the "FALSE_POSITIVE" status for issues.
	IssueStatusFalsePositive = "FALSE_POSITIVE"
	// IssueStatusAccepted represents the "ACCEPTED" status for issues.
	IssueStatusAccepted = "ACCEPTED"
	// IssueStatusFixed represents the "FIXED" status for issues.
	IssueStatusFixed = "FIXED"
	// IssueStatusInSandbox represents the "IN_SANDBOX" status for issues.
	IssueStatusInSandbox = "IN_SANDBOX"

	// IssueResolutionFixed represents the "FIXED" resolution for issues.
	IssueResolutionFixed = "FIXED"
	// IssueResolutionRemoved represents the "REMOVED" resolution for issues.
	IssueResolutionRemoved = "REMOVED"
	// IssueResolutionFalsePositive represents the "FALSE-POSITIVE" resolution for issues.
	IssueResolutionFalsePositive = "FALSE-POSITIVE"
	// IssueResolutionWontFix represents the "WONTFIX" resolution for issues.
	IssueResolutionWontFix = "WONTFIX"

	// IssueScopeMain represents the "MAIN" scope for issues.
	IssueScopeMain = "MAIN"
	// IssueScopeTest represents the "TEST" scope for issues.
	IssueScopeTest = "TEST"
)
View Source
const (
	// JiraResourceTypeSonarIssue represents the "SONAR_ISSUE" Jira work item resource type.
	JiraResourceTypeSonarIssue = "SONAR_ISSUE"
	// JiraResourceTypeDependencyRisk represents the "DEPENDENCY_RISK" Jira work item resource type.
	JiraResourceTypeDependencyRisk = "DEPENDENCY_RISK"
)
View Source
const (
	// MeasureStrategyAll represents the "all" strategy for measures component tree.
	MeasureStrategyAll = "all"
	// MeasureStrategyChildren represents the "children" strategy for measures component tree.
	MeasureStrategyChildren = "children"
	// MeasureStrategyLeaves represents the "leaves" strategy for measures component tree.
	MeasureStrategyLeaves = "leaves"

	// MeasuresMetricSortFilterAll represents the "all" metric sort filter.
	MeasuresMetricSortFilterAll = "all"
	// MeasuresMetricSortFilterWithMeasuresOnly represents the "withMeasuresOnly" metric sort filter.
	MeasuresMetricSortFilterWithMeasuresOnly = "withMeasuresOnly"
)
View Source
const (
	// NewCodePeriodTypeSpecificAnalysis represents the "SPECIFIC_ANALYSIS" new code period type.
	NewCodePeriodTypeSpecificAnalysis = "SPECIFIC_ANALYSIS"
	// NewCodePeriodTypePreviousVersion represents the "PREVIOUS_VERSION" new code period type.
	NewCodePeriodTypePreviousVersion = "PREVIOUS_VERSION"
	// NewCodePeriodTypeNumberOfDays represents the "NUMBER_OF_DAYS" new code period type.
	NewCodePeriodTypeNumberOfDays = "NUMBER_OF_DAYS"
	// NewCodePeriodTypeReferenceBranch represents the "REFERENCE_BRANCH" new code period type.
	NewCodePeriodTypeReferenceBranch = "REFERENCE_BRANCH"
)
View Source
const (
	// MinPermissionQueryLength is the minimum required length for permission query strings.
	MinPermissionQueryLength = 3

	// PermissionGlobalAdmin is the global admin permission.
	PermissionGlobalAdmin = "admin"
	// PermissionGlobalGateAdmin is the global gate admin permission.
	PermissionGlobalGateAdmin = "gateadmin"
	// PermissionGlobalProfileAdmin is the global profile admin permission.
	PermissionGlobalProfileAdmin = "profileadmin"
	// PermissionGlobalProvisioning is the global provisioning permission.
	PermissionGlobalProvisioning = "provisioning"
	// PermissionGlobalScan is the global scan permission.
	PermissionGlobalScan = "scan"
	// PermissionGlobalApplicationCreator is the global application creator permission.
	PermissionGlobalApplicationCreator = "applicationcreator"
	// PermissionGlobalPortfolioCreator is the global portfolio creator permission.
	PermissionGlobalPortfolioCreator = "portfoliocreator"

	// PermissionProjectAdmin is the project admin permission.
	PermissionProjectAdmin = "admin"
	// PermissionProjectCodeViewer is the project code viewer permission.
	PermissionProjectCodeViewer = "codeviewer"
	// PermissionProjectIssueAdmin is the project issue admin permission.
	PermissionProjectIssueAdmin = "issueadmin"
	// PermissionProjectSecurityHotspotAdmin is the project security hotspot admin permission.
	PermissionProjectSecurityHotspotAdmin = "securityhotspotadmin"
	// PermissionProjectScan is the project scan permission.
	PermissionProjectScan = "scan"
	// PermissionProjectUser is the project user permission.
	PermissionProjectUser = "user"
)
View Source
const (
	// BadgeMetricCoverage represents the coverage metric for badges.
	BadgeMetricCoverage = "coverage"
	// BadgeMetricDuplicatedLinesDensity represents the duplicated lines density metric for badges.
	BadgeMetricDuplicatedLinesDensity = "duplicated_lines_density"
	// BadgeMetricNcloc represents the ncloc metric for badges.
	BadgeMetricNcloc = "ncloc"
	// BadgeMetricAlertStatus represents the alert status metric for badges.
	BadgeMetricAlertStatus = "alert_status"
	// BadgeMetricSecurityHotspots represents the security hotspots metric for badges.
	BadgeMetricSecurityHotspots = "security_hotspots"
	// BadgeMetricBugs represents the bugs metric for badges.
	BadgeMetricBugs = "bugs"
	// BadgeMetricCodeSmells represents the code smells metric for badges.
	BadgeMetricCodeSmells = "code_smells"
	// BadgeMetricVulnerabilities represents the vulnerabilities metric for badges.
	BadgeMetricVulnerabilities = "vulnerabilities"
	// BadgeMetricSqaleRating represents the sqale rating metric for badges.
	BadgeMetricSqaleRating = "sqale_rating"
	// BadgeMetricReliabilityRating represents the reliability rating metric for badges.
	BadgeMetricReliabilityRating = "reliability_rating"
	// BadgeMetricSecurityRating represents the security rating metric for badges.
	BadgeMetricSecurityRating = "security_rating"
	// BadgeMetricSqaleIndex represents the sqale index metric for badges.
	BadgeMetricSqaleIndex = "sqale_index"
	// BadgeMetricSoftwareQualityReliabilityIssues represents the software quality reliability issues metric for badges.
	BadgeMetricSoftwareQualityReliabilityIssues = "software_quality_reliability_issues"
	// BadgeMetricSoftwareQualityMaintainabilityIssues represents the software quality maintainability issues metric for badges.
	BadgeMetricSoftwareQualityMaintainabilityIssues = "software_quality_maintainability_issues"
	// BadgeMetricSoftwareQualitySecurityIssues represents the software quality security issues metric for badges.
	BadgeMetricSoftwareQualitySecurityIssues = "software_quality_security_issues"
	// BadgeMetricSoftwareQualityMaintainabilityRating represents the software quality maintainability rating metric for badges.
	BadgeMetricSoftwareQualityMaintainabilityRating = "software_quality_maintainability_rating"
	// BadgeMetricSoftwareQualityReliabilityRating represents the software quality reliability rating metric for badges.
	BadgeMetricSoftwareQualityReliabilityRating = "software_quality_reliability_rating"
	// BadgeMetricSoftwareQualitySecurityRating represents the software quality security rating metric for badges.
	BadgeMetricSoftwareQualitySecurityRating = "software_quality_security_rating"
	// BadgeMetricSoftwareQualityMaintainabilityRemediationEffort represents the software quality maintainability remediation effort metric for badges.
	BadgeMetricSoftwareQualityMaintainabilityRemediationEffort = "software_quality_maintainability_remediation_effort"
)
View Source
const (
	// ProjectVisibilityPrivate represents private project visibility.
	ProjectVisibilityPrivate = "private"
	// ProjectVisibilityPublic represents public project visibility.
	ProjectVisibilityPublic = "public"

	// ProjectQualifierTRK represents the TRK project qualifier.
	ProjectQualifierTRK = "TRK"
	// ProjectQualifierVW represents the VW project qualifier.
	ProjectQualifierVW = "VW"
	// ProjectQualifierAPP represents the APP project qualifier.
	ProjectQualifierAPP = "APP"
)
View Source
const (
	// MaxQualityGateNameLength is the maximum allowed length for quality gate names.
	MaxQualityGateNameLength = 100
	// MaxConditionErrorLength is the maximum allowed length for condition error thresholds.
	MaxConditionErrorLength = 64
)
View Source
const (
	// MaxRuleKeyLength is the maximum allowed length for rule keys and names.
	MaxRuleKeyLength = 200
	// MinSearchQueryLength is the minimum required length for search queries.
	MinSearchQueryLength = 2

	// RuleRemediationFnTypeConstant represents a constant remediation function type.
	RuleRemediationFnTypeConstant = "CONSTANT_ISSUE"
	// RuleRemediationFnTypeLinear represents a linear remediation function type.
	RuleRemediationFnTypeLinear = "LINEAR"
	// RuleRemediationFnTypeLinearOffset represents a linear offset remediation function type.
	RuleRemediationFnTypeLinearOffset = "LINEAR_OFFSET"

	// RuleSeverityInfo represents the INFO severity level for rules.
	RuleSeverityInfo = "INFO"
	// RuleSeverityMinor represents the MINOR severity level for rules.
	RuleSeverityMinor = "MINOR"
	// RuleSeverityMajor represents the MAJOR severity level for rules.
	RuleSeverityMajor = "MAJOR"
	// RuleSeverityCritical represents the CRITICAL severity level for rules.
	RuleSeverityCritical = "CRITICAL"
	// RuleSeverityBlocker represents the BLOCKER severity level for rules.
	RuleSeverityBlocker = "BLOCKER"

	// RuleImpactSeverityInfo represents the INFO severity level for rule impacts.
	RuleImpactSeverityInfo = "INFO"
	// RuleImpactSeverityLow represents the LOW severity level for rule impacts.
	RuleImpactSeverityLow = "LOW"
	// RuleImpactSeverityMedium represents the MEDIUM severity level for rule impacts.
	RuleImpactSeverityMedium = "MEDIUM"
	// RuleImpactSeverityHigh represents the HIGH severity level for rule impacts.
	RuleImpactSeverityHigh = "HIGH"
	// RuleImpactSeverityBlocker represents the BLOCKER severity level for rule impacts.
	RuleImpactSeverityBlocker = "BLOCKER"

	// RuleTypeCodeSmell represents the CODE_SMELL type for rules.
	RuleTypeCodeSmell = "CODE_SMELL"
	// RuleTypeBug represents the BUG type for rules.
	RuleTypeBug = "BUG"
	// RuleTypeVulnerability represents the VULNERABILITY type for rules.
	RuleTypeVulnerability = "VULNERABILITY"
	// RuleTypeSecurityHotspot represents the SECURITY_HOTSPOT type for rules.
	RuleTypeSecurityHotspot = "SECURITY_HOTSPOT"

	// RuleStatusReady represents the READY status for rules.
	RuleStatusReady = "READY"
	// RuleStatusDeprecated represents the DEPRECATED status for rules.
	RuleStatusDeprecated = "DEPRECATED"
	// RuleStatusBeta represents the BETA status for rules.
	RuleStatusBeta = "BETA"
	// RuleStatusRemoved represents the REMOVED status for rules.
	RuleStatusRemoved = "REMOVED"
)
View Source
const (
	// ScaSbomReportTypeCycloneDX requests a CycloneDX-formatted SBOM report.
	ScaSbomReportTypeCycloneDX = "cyclonedx"
	// ScaSbomReportTypeSpdx23 requests an SPDX 2.3-formatted SBOM report.
	ScaSbomReportTypeSpdx23 = "spdx_23"
	// ScaSbomReportTypeSpdx30 requests an SPDX 3.0-formatted SBOM report. Only the JSON format is
	// supported for this report type.
	ScaSbomReportTypeSpdx30 = "spdx_30"

	// ScaSbomReportFormatJSON requests the report serialized as JSON.
	ScaSbomReportFormatJSON = "json"
	// ScaSbomReportFormatXML requests the report serialized as XML.
	ScaSbomReportFormatXML = "xml"
)

SBOM report type values accepted by the "type" query parameter of GetSbomReport.

View Source
const (
	// ScaLicenseCategoryUnknown represents the "UNKNOWN" license category.
	ScaLicenseCategoryUnknown = "UNKNOWN"
	// ScaLicenseCategoryCopyleftWeak represents the "COPYLEFT_WEAK" license category.
	ScaLicenseCategoryCopyleftWeak = "COPYLEFT_WEAK"
	// ScaLicenseCategoryCopyleftStrong represents the "COPYLEFT_STRONG" license category.
	ScaLicenseCategoryCopyleftStrong = "COPYLEFT_STRONG"
	// ScaLicenseCategoryCopyleftNetwork represents the "COPYLEFT_NETWORK" license category.
	ScaLicenseCategoryCopyleftNetwork = "COPYLEFT_NETWORK"
	// ScaLicenseCategoryCopyleftMaximal represents the "COPYLEFT_MAXIMAL" license category.
	ScaLicenseCategoryCopyleftMaximal = "COPYLEFT_MAXIMAL"
	// ScaLicenseCategoryPermissiveStandard represents the "PERMISSIVE_STANDARD" license category.
	ScaLicenseCategoryPermissiveStandard = "PERMISSIVE_STANDARD"
	// ScaLicenseCategoryPermissiveAmateur represents the "PERMISSIVE_AMATEUR" license category.
	ScaLicenseCategoryPermissiveAmateur = "PERMISSIVE_AMATEUR"
)

Allowed values for the "category-key" path segment of UpdateLicenseProfileCategory.

View Source
const (
	// ScaLicensePolicyDeny represents the "DENY" license policy.
	ScaLicensePolicyDeny = "DENY"
	// ScaLicensePolicyAllow represents the "ALLOW" license policy.
	ScaLicensePolicyAllow = "ALLOW"
)

Allowed values for the "policy" field of license category and license policy update requests.

View Source
const (
	// ScaAnalysisStatusFailed indicates the analysis failed.
	ScaAnalysisStatusFailed = "FAILED"
	// ScaAnalysisStatusOutdated indicates the analysis is outdated.
	ScaAnalysisStatusOutdated = "OUTDATED"
	// ScaAnalysisStatusCompleted indicates the analysis completed successfully.
	ScaAnalysisStatusCompleted = "COMPLETED"
)

Analysis status values for ScaAnalysisResource.Status.

View Source
const (
	// ScaTransitionConfirm confirms the risk.
	ScaTransitionConfirm = "CONFIRM"
	// ScaTransitionReopen reopens the risk.
	ScaTransitionReopen = "REOPEN"
	// ScaTransitionSafe marks the risk as safe.
	ScaTransitionSafe = "SAFE"
	// ScaTransitionFixed marks the risk as fixed.
	ScaTransitionFixed = "FIXED"
	// ScaTransitionAccept accepts the risk.
	ScaTransitionAccept = "ACCEPT"
)

Transition key values accepted by ScaChangeStatusRequest.TransitionKey.

View Source
const (
	// SoftwareQualityReportsAccessibilityStandardWCAG represents the "wcag" accessibility standard.
	SoftwareQualityReportsAccessibilityStandardWCAG = "wcag"

	// SoftwareQualityReportsAccessibilityVersion20 represents accessibility standard version "2.0".
	SoftwareQualityReportsAccessibilityVersion20 = "2.0"
	// SoftwareQualityReportsAccessibilityVersion21 represents accessibility standard version "2.1".
	SoftwareQualityReportsAccessibilityVersion21 = "2.1"
	// SoftwareQualityReportsAccessibilityVersion22 represents accessibility standard version "2.2".
	SoftwareQualityReportsAccessibilityVersion22 = "2.2"
)
View Source
const (
	// LogLevelTrace represents the TRACE log level.
	LogLevelTrace = "TRACE"
	// LogLevelDebug represents the DEBUG log level.
	LogLevelDebug = "DEBUG"
	// LogLevelInfo represents the INFO log level.
	LogLevelInfo = "INFO"

	// LogNameAccess represents the access log name.
	LogNameAccess = "access"
	// LogNameApp represents the app log name.
	LogNameApp = "app"
	// LogNameCE represents the Compute Engine log name.
	LogNameCE = "ce"
	// LogNameDeprecation represents the deprecation log name.
	LogNameDeprecation = "deprecation"
	// LogNameES represents the Elasticsearch log name.
	LogNameES = "es"
	// LogNameWeb represents the web log name.
	LogNameWeb = "web"
)
View Source
const (
	// MaxGroupNameLength is the maximum allowed length for group names.
	MaxGroupNameLength = 255
	// MaxGroupDescriptionLength is the maximum allowed length for group descriptions.
	MaxGroupDescriptionLength = 200

	// UserGroupFieldMembersCount represents the "membersCount" field for user groups.
	UserGroupFieldMembersCount = "membersCount"
	// UserGroupFieldManaged represents the "managed" field for user groups.
	UserGroupFieldManaged = "managed"
)
View Source
const (
	// TokenTypeUserToken represents a user token that can be used for authentication and project analysis.
	TokenTypeUserToken = "USER_TOKEN"
	// TokenTypeGlobalAnalysisToken represents a global analysis token.
	TokenTypeGlobalAnalysisToken = "GLOBAL_ANALYSIS_TOKEN"
	// TokenTypeProjectAnalysisToken represents a project analysis token.
	TokenTypeProjectAnalysisToken = "PROJECT_ANALYSIS_TOKEN"
)
View Source
const (
	// MaxLoginLength is the maximum length for a user login.
	MaxLoginLength = 255
	// MinLoginLength is the minimum length for a user login.
	MinLoginLength = 2
	// MinPasswordLength is the minimum required length for user passwords.
	MinPasswordLength = 12
	// MaxEmailLength is the maximum length for a user email.
	MaxEmailLength = 100
	// MaxNameLength is the maximum length for a user name.
	MaxNameLength = 200

	// HomepageTypeProject represents the project homepage type.
	HomepageTypeProject = "PROJECT"
	// HomepageTypeProjects represents the projects homepage type.
	HomepageTypeProjects = "PROJECTS"
	// HomepageTypeIssues represents the issues homepage type.
	HomepageTypeIssues = "ISSUES"
	// HomepageTypePortfolios represents the portfolios homepage type.
	HomepageTypePortfolios = "PORTFOLIOS"
	// HomepageTypePortfolio represents the portfolio homepage type.
	HomepageTypePortfolio = "PORTFOLIO"
	// HomepageTypeApplication represents the application homepage type.
	HomepageTypeApplication = "APPLICATION"

	// NoticeTypeEducationPrinciples represents the education principles notice type.
	NoticeTypeEducationPrinciples = "educationPrinciples"
	// NoticeTypeSonarlintAd represents the SonarLint ad notice type.
	NoticeTypeSonarlintAd = "sonarlintAd"
	// NoticeTypeShowDesignAndArchitectureBanner represents the show design and architecture banner notice type.
	NoticeTypeShowDesignAndArchitectureBanner = "showDesignAndArchitectureBanner"
	// NoticeTypeShowNewModesBanner represents the show new modes banner notice type.
	NoticeTypeShowNewModesBanner = "showNewModesBanner"
	// NoticeTypeShowSandboxedIssuesIntro represents the show sandboxed issues intro notice type.
	NoticeTypeShowSandboxedIssuesIntro = "showSandboxedIssuesIntro"
	// NoticeTypeIssueCleanCodeGuide represents the issue clean code guide notice type.
	NoticeTypeIssueCleanCodeGuide = "issueCleanCodeGuide"
	// NoticeTypeIssueNewIssueStatusAndTransitionGuide represents the issue new issue status and transition guide notice type.
	NoticeTypeIssueNewIssueStatusAndTransitionGuide = "issueNewIssueStatusAndTransitionGuide"
	// NoticeTypeShowDesignAndArchitectureOptInBanner represents the show design and architecture opt-in banner notice type.
	NoticeTypeShowDesignAndArchitectureOptInBanner = "showDesignAndArchitectureOptInBanner"
	// NoticeTypeOverviewZeroNewIssuesSimplification represents the overview zero new issues simplification notice type.
	NoticeTypeOverviewZeroNewIssuesSimplification = "overviewZeroNewIssuesSimplification"
	// NoticeTypeShowDesignAndArchitectureTour represents the show design and architecture tour notice type.
	NoticeTypeShowDesignAndArchitectureTour = "showDesignAndArchitectureTour"
	// NoticeTypeShowEnableSca represents the show enable SCA notice type.
	NoticeTypeShowEnableSca = "showEnableSca"
)
View Source
const (
	// MaxLoginLengthV2 is the maximum length for a user login in V2 API.
	MaxLoginLengthV2 = 100
	// MaxExternalLoginLengthV2 is the maximum length for an external login in V2 API.
	MaxExternalLoginLengthV2 = 255
	// MaxExternalIdLengthV2 is the maximum length for an external ID in V2 API.
	MaxExternalIdLengthV2 = 255
)
View Source
const (
	// MaxWebhookNameLength is the maximum length for a webhook name.
	MaxWebhookNameLength = 100
	// MaxWebhookProjectLength is the maximum length for a webhook project key.
	MaxWebhookProjectLength = 400
	// MaxWebhookSecretLength is the maximum length for a webhook secret.
	MaxWebhookSecretLength = 200
	// MinWebhookSecretLength is the minimum length for a webhook secret.
	// Since: 10.6.
	MinWebhookSecretLength = 16
	// MaxWebhookURLLength is the maximum length for a webhook URL.
	MaxWebhookURLLength = 512
	// MaxWebhookKeyLength is the maximum length for a webhook key.
	MaxWebhookKeyLength = 40
)
View Source
const (
	// IntegrationTypeSlack designates the Slack integration type.
	IntegrationTypeSlack = "SLACK"
)
View Source
const (
	// KeyValuePairParts is the expected number of parts when splitting a key=value pair.
	KeyValuePairParts = 2
)
View Source
const (
	// MaxQualityProfileNameLength is the maximum allowed length for quality profile names.
	MaxQualityProfileNameLength = 100
)
View Source
const (
	// MaxSettingValueLength is the maximum length for a setting value.
	MaxSettingValueLength = 4000
)

Variables

View Source
var (
	// ErrInvalidValue is returned when a parameter has an invalid value.
	ErrInvalidValue = errors.New("invalid value")

	// ErrMissingRequired is returned when a required parameter is missing.
	ErrMissingRequired = errors.New("missing required parameter")

	// ErrInvalidFormat is returned when a parameter has an invalid format.
	ErrInvalidFormat = errors.New("invalid format")

	// ErrOutOfRange is returned when a parameter value is out of allowed range.
	ErrOutOfRange = errors.New("value out of range")
)

Functions

func AreValuesAuthorized

func AreValuesAuthorized(values []string, allowed map[string]struct{}, fieldName string) error

AreValuesAuthorized checks if all values in a slice are in the allowed values.

func BuildAuthorizedValuesList

func BuildAuthorizedValuesList(allowed map[string]struct{}) string

BuildAuthorizedValuesList builds a comma-separated string of allowed values.

func CheckResponse

func CheckResponse(resp *http.Response) error

CheckResponse checks the API response for errors.

func Do

func Do(httpClient *http.Client, req *http.Request, dest any) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func EncodeMapToSeparated

func EncodeMapToSeparated(key string, m map[string]string, entrySep, kvSep string) string

EncodeMapToSeparated converts a map[string]string to a URL value with custom separators. This is a helper for encoding map fields that need to be sent in a specific format. For example, impacts=MAINTAINABILITY=HIGH;SECURITY=LOW.

func EncodeSliceToCommaSeparated

func EncodeSliceToCommaSeparated(key string, values []string) string

EncodeSliceToCommaSeparated converts a string slice to a comma-separated URL value. This is a helper for encoding []string fields that need to be sent as comma-separated values.

func IsConflict

func IsConflict(err error) bool

IsConflict reports whether err represents a 409 Conflict response.

func IsForbidden

func IsForbidden(err error) bool

IsForbidden reports whether err represents a 403 Forbidden response.

func IsNotFound

func IsNotFound(err error) bool

IsNotFound reports whether err represents a 404 Not Found response.

Example

Branch on the HTTP status of an API error using the sentinel helpers.

package main

import (
	"context"
	"fmt"

	"github.com/boxboxjason/sonarqube-client-go/v2/sonar"
)

func main() {
	client, err := sonar.NewClient(nil,
		sonar.WithBaseURL("https://sonarqube.example.com/api/"),
		sonar.WithToken("my-token"),
	)
	if err != nil {
		panic(err)
	}

	_, err = client.Projects.Delete(context.Background(), &sonar.ProjectsDeleteOptions{Project: "missing-project"})
	if sonar.IsNotFound(err) {
		fmt.Println("project not found")
	}
}

func IsRateLimited

func IsRateLimited(err error) bool

IsRateLimited reports whether err represents a 429 Too Many Requests response.

func IsServerError

func IsServerError(err error) bool

IsServerError reports whether err represents a 5xx server-side error response.

func IsUnauthorized

func IsUnauthorized(err error) bool

IsUnauthorized reports whether err represents a 401 Unauthorized response.

func IsValueAuthorized

func IsValueAuthorized(value string, allowed map[string]struct{}, fieldName string) error

IsValueAuthorized checks if a value is in the allowed set of values.

func ListToSeparatedString

func ListToSeparatedString(list []string, separator string) string

ListToSeparatedString converts a list of strings into a single string separated by the given separator.

func MapToSeparatedString

func MapToSeparatedString(stringMap map[string]string, entrySeparator string, keyValueSeparator string) string

MapToSeparatedString converts a map of strings into a single string with entries separated by entrySeparator and key-value pairs separated by keyValueSeparator.

func SeparatedStringToList

func SeparatedStringToList(s string, separator string) []string

SeparatedStringToList converts a separated string into a list of strings using the given separator.

func SeparatedStringToMap

func SeparatedStringToMap(inputStr string, entrySeparator string, keyValueSeparator string) map[string]string

SeparatedStringToMap converts a separated string into a map of strings using the given entrySeparator and keyValueSeparator.

func ValidateLanguage

func ValidateLanguage(language string) error

ValidateLanguage checks if the provided language is among the allowed languages.

func ValidateLanguages

func ValidateLanguages(languages []string) error

ValidateLanguages checks if all provided languages are among the allowed languages.

func ValidateMapKeys

func ValidateMapKeys(m map[string]string, allowedKeys map[string]struct{}, fieldName string) error

ValidateMapKeys checks if all keys in a map are in the allowed keys.

func ValidateMapValues

func ValidateMapValues(m map[string]string, allowedValues map[string]struct{}, fieldName string) error

ValidateMapValues checks if all values in a map are in the allowed values.

func ValidateMaxLength

func ValidateMaxLength(value string, maxLen int, fieldName string) error

ValidateMaxLength checks if a string exceeds maximum length.

func ValidateMinLength

func ValidateMinLength(value string, minLen int, fieldName string) error

ValidateMinLength checks if a string is below minimum length.

func ValidatePagination

func ValidatePagination(page, pageSize int64) error

ValidatePagination validates common pagination parameters.

func ValidateRange

func ValidateRange(value, minValue, maxValue int64, fieldName string) error

ValidateRange checks if a numeric value is within a range.

func ValidateRequired

func ValidateRequired(value, fieldName string) error

ValidateRequired checks if a required field is not empty.

Types

type AlmIntegrationsCheckPat

type AlmIntegrationsCheckPat struct{}

AlmIntegrationsCheckPat represents the response from checking a Personal Access Token. Note: The API does not return a response body, validation is indicated by HTTP status.

type AlmIntegrationsCheckPatOptions

type AlmIntegrationsCheckPatOptions struct {
	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
}

AlmIntegrationsCheckPatOptions contains options for checking a Personal Access Token.

type AlmIntegrationsGetGithubClientID

type AlmIntegrationsGetGithubClientID struct {
	// ClientID is the GitHub OAuth client ID for the integration.
	ClientID string `json:"clientId,omitempty"`
}

AlmIntegrationsGetGithubClientID represents the response from getting a GitHub client ID.

type AlmIntegrationsGetGithubClientIDOptions

type AlmIntegrationsGetGithubClientIDOptions struct {
	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
}

AlmIntegrationsGetGithubClientIDOptions contains options for getting a GitHub client ID.

type AlmIntegrationsImportAzureProjectOptions deprecated

type AlmIntegrationsImportAzureProjectOptions struct {
	// AlmSetting is the DevOps Platform configuration key.
	// This parameter is optional if you have only one Azure integration.
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// NewCodeDefinitionType is the project new code definition type.
	// Allowed values: PREVIOUS_VERSION, NUMBER_OF_DAYS, REFERENCE_BRANCH
	NewCodeDefinitionType string `url:"newCodeDefinitionType,omitempty"`
	// ProjectName is the Azure project name (required).
	// Maximum length: 200 characters
	ProjectName string `url:"projectName,omitempty"`
	// RepositoryName is the Azure repository name (required).
	// Maximum length: 200 characters
	RepositoryName string `url:"repositoryName,omitempty"`
	// NewCodeDefinitionValue is the project new code definition value.
	// Required when NewCodeDefinitionType is NUMBER_OF_DAYS (value between 1 and 90).
	// No value expected for PREVIOUS_VERSION and REFERENCE_BRANCH.
	NewCodeDefinitionValue int64 `url:"newCodeDefinitionValue,omitempty"`
}

AlmIntegrationsImportAzureProjectOptions contains options for importing an Azure DevOps project.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

type AlmIntegrationsImportBitbucketCloudRepoOptions deprecated

type AlmIntegrationsImportBitbucketCloudRepoOptions struct {
	// AlmSetting is the DevOps Platform configuration key.
	// This parameter is optional if you have only one Bitbucket Cloud integration.
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// NewCodeDefinitionType is the project new code definition type.
	// Allowed values: PREVIOUS_VERSION, NUMBER_OF_DAYS, REFERENCE_BRANCH
	NewCodeDefinitionType string `url:"newCodeDefinitionType,omitempty"`
	// RepositorySlug is the Bitbucket Cloud repository slug (required).
	// Maximum length: 200 characters
	RepositorySlug string `url:"repositorySlug,omitempty"`
	// NewCodeDefinitionValue is the project new code definition value.
	// Required when NewCodeDefinitionType is NUMBER_OF_DAYS (value between 1 and 90).
	// No value expected for PREVIOUS_VERSION and REFERENCE_BRANCH.
	NewCodeDefinitionValue int64 `url:"newCodeDefinitionValue,omitempty"`
}

AlmIntegrationsImportBitbucketCloudRepoOptions contains options for importing a Bitbucket Cloud repository.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

type AlmIntegrationsImportBitbucketServerProjectOptions deprecated

type AlmIntegrationsImportBitbucketServerProjectOptions struct {
	// AlmSetting is the DevOps Platform configuration key.
	// This parameter is optional if you have only one Bitbucket Server integration.
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// NewCodeDefinitionType is the project new code definition type.
	// Allowed values: PREVIOUS_VERSION, NUMBER_OF_DAYS, REFERENCE_BRANCH
	NewCodeDefinitionType string `url:"newCodeDefinitionType,omitempty"`
	// ProjectKey is the Bitbucket Server project key (required).
	// Maximum length: 200 characters
	ProjectKey string `url:"projectKey,omitempty"`
	// RepositorySlug is the Bitbucket Server repository slug (required).
	// Maximum length: 200 characters
	RepositorySlug string `url:"repositorySlug,omitempty"`
	// NewCodeDefinitionValue is the project new code definition value.
	// Required when NewCodeDefinitionType is NUMBER_OF_DAYS (value between 1 and 90).
	// No value expected for PREVIOUS_VERSION and REFERENCE_BRANCH.
	NewCodeDefinitionValue int64 `url:"newCodeDefinitionValue,omitempty"`
}

AlmIntegrationsImportBitbucketServerProjectOptions contains options for importing a Bitbucket Server project.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

type AlmIntegrationsImportGithubProjectOptions deprecated

type AlmIntegrationsImportGithubProjectOptions struct {
	// AlmSetting is the DevOps Platform configuration key.
	// This parameter is optional if you have only one GitHub integration.
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// NewCodeDefinitionType is the project new code definition type.
	// Allowed values: PREVIOUS_VERSION, NUMBER_OF_DAYS, REFERENCE_BRANCH
	NewCodeDefinitionType string `url:"newCodeDefinitionType,omitempty"`
	// RepositoryKey is the GitHub repository key (organization/repoSlug) (required).
	// Maximum length: 256 characters
	RepositoryKey string `url:"repositoryKey,omitempty"`
	// NewCodeDefinitionValue is the project new code definition value.
	// Required when NewCodeDefinitionType is NUMBER_OF_DAYS (value between 1 and 90).
	// No value expected for PREVIOUS_VERSION and REFERENCE_BRANCH.
	NewCodeDefinitionValue int64 `url:"newCodeDefinitionValue,omitempty"`
}

AlmIntegrationsImportGithubProjectOptions contains options for importing a GitHub project.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

type AlmIntegrationsImportGitlabProjectOptions deprecated

type AlmIntegrationsImportGitlabProjectOptions struct {
	// AlmSetting is the DevOps Platform configuration key.
	// This parameter is optional if you have only one GitLab integration.
	AlmSetting string `url:"almSetting,omitempty"`
	// GitlabProjectId is the GitLab project ID (required).
	GitlabProjectId string `url:"gitlabProjectId,omitempty"`
	// NewCodeDefinitionType is the project new code definition type.
	// Allowed values: PREVIOUS_VERSION, NUMBER_OF_DAYS, REFERENCE_BRANCH
	NewCodeDefinitionType string `url:"newCodeDefinitionType,omitempty"`
	// NewCodeDefinitionValue is the project new code definition value.
	// Required when NewCodeDefinitionType is NUMBER_OF_DAYS (value between 1 and 90).
	// No value expected for PREVIOUS_VERSION and REFERENCE_BRANCH.
	NewCodeDefinitionValue int64 `url:"newCodeDefinitionValue,omitempty"`
}

AlmIntegrationsImportGitlabProjectOptions contains options for importing a GitLab project.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

type AlmIntegrationsListAzureProjects

type AlmIntegrationsListAzureProjects struct {
	// Projects is the list of Azure projects.
	Projects []AzureProject `json:"projects,omitempty"`
}

AlmIntegrationsListAzureProjects represents the response from listing Azure projects.

type AlmIntegrationsListAzureProjectsOptions

type AlmIntegrationsListAzureProjectsOptions struct {
	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
}

AlmIntegrationsListAzureProjectsOptions contains options for listing Azure projects.

type AlmIntegrationsListBitbucketServerProjects

type AlmIntegrationsListBitbucketServerProjects struct {
	// Projects is the list of Bitbucket Server projects.
	Projects []BitbucketServerProject `json:"projects,omitempty"`
}

AlmIntegrationsListBitbucketServerProjects represents the response from listing Bitbucket Server projects.

type AlmIntegrationsListBitbucketServerProjectsOptions

type AlmIntegrationsListBitbucketServerProjectsOptions struct {
	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// PageSize is the number of items to return (optional, default: 25, max: 100).
	PageSize int64 `url:"pageSize,omitempty"`
	// Start is the start number for the page (inclusive, optional).
	// If not passed, the first page is assumed.
	Start int64 `url:"start,omitempty"`
}

AlmIntegrationsListBitbucketServerProjectsOptions contains options for listing Bitbucket Server projects.

type AlmIntegrationsListGithubOrganizations

type AlmIntegrationsListGithubOrganizations struct {
	// Organizations is the list of GitHub organizations.
	Organizations []GithubOrganization `json:"organizations,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

AlmIntegrationsListGithubOrganizations represents the response from listing GitHub organizations.

type AlmIntegrationsListGithubOrganizationsOptions

type AlmIntegrationsListGithubOrganizationsOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// Token is the GitHub authorization code (optional).
	// Maximum length: 200 characters
	Token string `url:"token,omitempty"`
}

AlmIntegrationsListGithubOrganizationsOptions contains options for listing GitHub organizations.

type AlmIntegrationsListGithubRepositories

type AlmIntegrationsListGithubRepositories struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Repositories is the list of GitHub repositories.
	Repositories []GithubRepository `json:"repositories,omitempty"`
}

AlmIntegrationsListGithubRepositories represents the response from listing GitHub repositories.

type AlmIntegrationsListGithubRepositoriesOptions

type AlmIntegrationsListGithubRepositoriesOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// Organization is the GitHub organization (required).
	// Maximum length: 200 characters
	Organization string `url:"organization,omitempty"`
	// Query is a filter to limit search to repositories that contain the supplied string (optional).
	Query string `url:"q,omitempty"`
}

AlmIntegrationsListGithubRepositoriesOptions contains options for listing GitHub repositories.

type AlmIntegrationsSearchAzureRepos

type AlmIntegrationsSearchAzureRepos struct {
	// Repositories is the list of Azure repositories.
	Repositories []AzureRepository `json:"repositories,omitempty"`
}

AlmIntegrationsSearchAzureRepos represents the response from searching Azure repositories.

type AlmIntegrationsSearchAzureReposOptions

type AlmIntegrationsSearchAzureReposOptions struct {
	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// ProjectName is the project name filter (optional).
	// Maximum length: 200 characters
	ProjectName string `url:"projectName,omitempty"`
	// SearchQuery is the search query filter (optional).
	// Maximum length: 200 characters
	SearchQuery string `url:"searchQuery,omitempty"`
}

AlmIntegrationsSearchAzureReposOptions contains options for searching Azure repositories.

type AlmIntegrationsSearchBitbucketCloudRepos

type AlmIntegrationsSearchBitbucketCloudRepos struct {
	// IsLastPage indicates if this is the last page of results.
	IsLastPage bool `json:"isLastPage,omitempty"`
	// Paging contains pagination information.
	Paging BitbucketCloudPaging `json:"paging,omitzero"`
	// Repositories is the list of Bitbucket Cloud repositories.
	Repositories []BitbucketCloudRepository `json:"repositories,omitempty"`
}

AlmIntegrationsSearchBitbucketCloudRepos represents the response from searching Bitbucket Cloud repositories.

type AlmIntegrationsSearchBitbucketCloudReposOptions

type AlmIntegrationsSearchBitbucketCloudReposOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// RepositoryName is the repository name filter (optional).
	// Maximum length: 200 characters
	RepositoryName string `url:"repositoryName,omitempty"`
}

AlmIntegrationsSearchBitbucketCloudReposOptions contains options for searching Bitbucket Cloud repositories.

type AlmIntegrationsSearchBitbucketServerRepos

type AlmIntegrationsSearchBitbucketServerRepos struct {
	// IsLastPage indicates if this is the last page of results.
	IsLastPage bool `json:"isLastPage,omitempty"`
	// Repositories is the list of Bitbucket Server repositories.
	Repositories []BitbucketServerRepository `json:"repositories,omitempty"`
}

AlmIntegrationsSearchBitbucketServerRepos represents the response from searching Bitbucket Server repositories.

type AlmIntegrationsSearchBitbucketServerReposOptions

type AlmIntegrationsSearchBitbucketServerReposOptions struct {
	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// PageSize is the number of items to return (optional, default: 25, max: 100).
	PageSize int64 `url:"pageSize,omitempty"`
	// ProjectName is the project name filter (optional).
	// Maximum length: 200 characters
	ProjectName string `url:"projectName,omitempty"`
	// RepositoryName is the repository name filter (optional).
	// Maximum length: 200 characters
	RepositoryName string `url:"repositoryName,omitempty"`
	// Start is the start number for the page (inclusive, optional).
	// If not passed, the first page is assumed.
	Start int64 `url:"start,omitempty"`
}

AlmIntegrationsSearchBitbucketServerReposOptions contains options for searching Bitbucket Server repositories.

type AlmIntegrationsSearchGitlabRepos

type AlmIntegrationsSearchGitlabRepos struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Repositories is the list of GitLab repositories.
	Repositories []GitlabRepository `json:"repositories,omitempty"`
}

AlmIntegrationsSearchGitlabRepos represents the response from searching GitLab repositories.

type AlmIntegrationsSearchGitlabReposOptions

type AlmIntegrationsSearchGitlabReposOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// AlmSetting is the DevOps Platform setting key (required).
	// Maximum length: 200 characters
	AlmSetting string `url:"almSetting,omitempty"`
	// ProjectName is the project name filter (optional).
	// Maximum length: 200 characters
	ProjectName string `url:"projectName,omitempty"`
}

AlmIntegrationsSearchGitlabReposOptions contains options for searching GitLab repositories.

type AlmIntegrationsService

type AlmIntegrationsService struct {
	// contains filtered or unexported fields
}

AlmIntegrationsService handles communication with the DevOps Platform Integration related methods of the SonarQube API. This service manages integrations with Azure DevOps, Bitbucket, GitHub, and GitLab.

func (*AlmIntegrationsService) CheckPat

CheckPat checks the validity of a Personal Access Token for the given DevOps Platform setting. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) GetGithubClientID

GetGithubClientID gets the client ID of a GitHub Integration. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) ImportAzureProject deprecated

ImportAzureProject creates a SonarQube project with the information from the provided Azure DevOps project. Autoconfigures pull request decoration mechanism. Requires the 'Create Projects' permission.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

func (*AlmIntegrationsService) ImportBitbucketCloudRepo deprecated

func (s *AlmIntegrationsService) ImportBitbucketCloudRepo(ctx context.Context, opt *AlmIntegrationsImportBitbucketCloudRepoOptions) (resp *http.Response, err error)

ImportBitbucketCloudRepo creates a SonarQube project with the information from the provided Bitbucket Cloud repository. Autoconfigures pull request decoration mechanism. Requires the 'Create Projects' permission.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

func (*AlmIntegrationsService) ImportBitbucketServerProject deprecated

func (s *AlmIntegrationsService) ImportBitbucketServerProject(ctx context.Context, opt *AlmIntegrationsImportBitbucketServerProjectOptions) (resp *http.Response, err error)

ImportBitbucketServerProject creates a SonarQube project with the information from the provided Bitbucket Server project. Autoconfigures pull request decoration mechanism. Requires the 'Create Projects' permission.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

func (*AlmIntegrationsService) ImportGithubProject deprecated

ImportGithubProject creates a SonarQube project with the information from the provided GitHub repository. Autoconfigures pull request decoration mechanism. If Automatic Provisioning is enabled for GitHub, it will also synchronize permissions from the repository. Requires the 'Create Projects' permission.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

func (*AlmIntegrationsService) ImportGitlabProject deprecated

ImportGitlabProject imports a GitLab project to SonarQube, creating a new project and configuring MR decoration. Requires the 'Create Projects' permission.

Deprecated: Since 10.5 - use /api/v2/dop-translation/bound-projects instead.

func (*AlmIntegrationsService) ListAzureProjects

ListAzureProjects lists Azure projects. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) ListBitbucketServerProjects

ListBitbucketServerProjects lists the Bitbucket Server projects. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) ListGithubOrganizations

ListGithubOrganizations lists GitHub organizations. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) ListGithubRepositories

ListGithubRepositories lists the GitHub repositories for an organization. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) SearchAzureRepos

SearchAzureRepos searches the Azure repositories. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) SearchBitbucketCloudRepos

SearchBitbucketCloudRepos searches the Bitbucket Cloud repositories. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) SearchBitbucketServerRepos

SearchBitbucketServerRepos searches the Bitbucket Server repositories with REPO_ADMIN access. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) SearchGitlabRepos

SearchGitlabRepos searches the GitLab projects. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) SetPat

SetPat sets a Personal Access Token for the given DevOps Platform setting. Requires the 'Create Projects' permission.

func (*AlmIntegrationsService) ValidateCheckPatOpt

func (s *AlmIntegrationsService) ValidateCheckPatOpt(opt *AlmIntegrationsCheckPatOptions) error

ValidateCheckPatOpt validates the options for checking a Personal Access Token.

func (*AlmIntegrationsService) ValidateGetGithubClientIDOpt

func (s *AlmIntegrationsService) ValidateGetGithubClientIDOpt(opt *AlmIntegrationsGetGithubClientIDOptions) error

ValidateGetGithubClientIDOpt validates the options for getting a GitHub client ID.

func (*AlmIntegrationsService) ValidateImportAzureProjectOpt

func (s *AlmIntegrationsService) ValidateImportAzureProjectOpt(opt *AlmIntegrationsImportAzureProjectOptions) error

ValidateImportAzureProjectOpt validates the options for importing an Azure DevOps project.

func (*AlmIntegrationsService) ValidateImportBitbucketCloudRepoOpt

func (s *AlmIntegrationsService) ValidateImportBitbucketCloudRepoOpt(opt *AlmIntegrationsImportBitbucketCloudRepoOptions) error

ValidateImportBitbucketCloudRepoOpt validates the options for importing a Bitbucket Cloud repository.

func (*AlmIntegrationsService) ValidateImportBitbucketServerProjectOpt

func (s *AlmIntegrationsService) ValidateImportBitbucketServerProjectOpt(opt *AlmIntegrationsImportBitbucketServerProjectOptions) error

ValidateImportBitbucketServerProjectOpt validates the options for importing a Bitbucket Server project.

func (*AlmIntegrationsService) ValidateImportGithubProjectOpt

func (s *AlmIntegrationsService) ValidateImportGithubProjectOpt(opt *AlmIntegrationsImportGithubProjectOptions) error

ValidateImportGithubProjectOpt validates the options for importing a GitHub project.

func (*AlmIntegrationsService) ValidateImportGitlabProjectOpt

func (s *AlmIntegrationsService) ValidateImportGitlabProjectOpt(opt *AlmIntegrationsImportGitlabProjectOptions) error

ValidateImportGitlabProjectOpt validates the options for importing a GitLab project.

func (*AlmIntegrationsService) ValidateListAzureProjectsOpt

func (s *AlmIntegrationsService) ValidateListAzureProjectsOpt(opt *AlmIntegrationsListAzureProjectsOptions) error

ValidateListAzureProjectsOpt validates the options for listing Azure projects.

func (*AlmIntegrationsService) ValidateListBitbucketServerProjectsOpt

func (s *AlmIntegrationsService) ValidateListBitbucketServerProjectsOpt(opt *AlmIntegrationsListBitbucketServerProjectsOptions) error

ValidateListBitbucketServerProjectsOpt validates the options for listing Bitbucket Server projects.

func (*AlmIntegrationsService) ValidateListGithubOrganizationsOpt

func (s *AlmIntegrationsService) ValidateListGithubOrganizationsOpt(opt *AlmIntegrationsListGithubOrganizationsOptions) error

ValidateListGithubOrganizationsOpt validates the options for listing GitHub organizations.

func (*AlmIntegrationsService) ValidateListGithubRepositoriesOpt

func (s *AlmIntegrationsService) ValidateListGithubRepositoriesOpt(opt *AlmIntegrationsListGithubRepositoriesOptions) error

ValidateListGithubRepositoriesOpt validates the options for listing GitHub repositories.

func (*AlmIntegrationsService) ValidateSearchAzureReposOpt

func (s *AlmIntegrationsService) ValidateSearchAzureReposOpt(opt *AlmIntegrationsSearchAzureReposOptions) error

ValidateSearchAzureReposOpt validates the options for searching Azure repositories.

func (*AlmIntegrationsService) ValidateSearchBitbucketCloudReposOpt

func (s *AlmIntegrationsService) ValidateSearchBitbucketCloudReposOpt(opt *AlmIntegrationsSearchBitbucketCloudReposOptions) error

ValidateSearchBitbucketCloudReposOpt validates the options for searching Bitbucket Cloud repositories.

func (*AlmIntegrationsService) ValidateSearchBitbucketServerReposOpt

func (s *AlmIntegrationsService) ValidateSearchBitbucketServerReposOpt(opt *AlmIntegrationsSearchBitbucketServerReposOptions) error

ValidateSearchBitbucketServerReposOpt validates the options for searching Bitbucket Server repositories.

func (*AlmIntegrationsService) ValidateSearchGitlabReposOpt

func (s *AlmIntegrationsService) ValidateSearchGitlabReposOpt(opt *AlmIntegrationsSearchGitlabReposOptions) error

ValidateSearchGitlabReposOpt validates the options for searching GitLab repositories.

func (*AlmIntegrationsService) ValidateSetPatOpt

func (s *AlmIntegrationsService) ValidateSetPatOpt(opt *AlmIntegrationsSetPatOptions) error

ValidateSetPatOpt validates the options for setting a Personal Access Token.

type AlmIntegrationsSetPatOptions

type AlmIntegrationsSetPatOptions struct {
	// AlmSetting is the DevOps Platform configuration key.
	// This parameter is optional if you have only one single DevOps Platform integration.
	AlmSetting string `url:"almSetting,omitempty"`
	// Pat is the Personal Access Token (required).
	// Maximum length: 2000 characters
	Pat string `url:"pat,omitempty"`
	// Username is the username (optional, used for Bitbucket Cloud).
	// Maximum length: 2000 characters
	Username string `url:"username,omitempty"`
}

AlmIntegrationsSetPatOptions contains options for setting a Personal Access Token.

type AlmSetting

type AlmSetting struct {
	// Alm is the type of DevOps Platform (azure, bitbucket, bitbucketcloud, github, gitlab).
	Alm string `json:"alm,omitempty"`
	// Key is the unique setting key.
	Key string `json:"key,omitempty"`
	// URL is the DevOps Platform URL.
	URL string `json:"url,omitempty"`
}

AlmSetting represents a single DevOps Platform setting in the list.

type AlmSettingsCountBinding

type AlmSettingsCountBinding struct {
	// Key is the DevOps Platform setting key.
	Key string `json:"key,omitempty"`
	// Projects is the number of projects bound to this setting.
	Projects int64 `json:"projects,omitempty"`
}

AlmSettingsCountBinding represents the response from counting project bindings.

type AlmSettingsCountBindingOptions

type AlmSettingsCountBindingOptions struct {
	// AlmSetting is the DevOps Platform setting key.
	// This field is required.
	AlmSetting string `url:"almSetting"`
}

AlmSettingsCountBindingOptions contains parameters for the CountBinding method.

type AlmSettingsCreateAzureOptions

type AlmSettingsCreateAzureOptions struct {
	// Key is the unique key of the Azure DevOps instance setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// PersonalAccessToken is the Azure DevOps personal access token.
	// This field is required. Maximum length: 2000 characters.
	PersonalAccessToken string `url:"personalAccessToken"`
	// URL is the Azure API URL.
	// This field is required. Maximum length: 2000 characters.
	URL string `url:"url"`
}

AlmSettingsCreateAzureOptions contains parameters for the CreateAzure method.

type AlmSettingsCreateBitbucketCloudOptions

type AlmSettingsCreateBitbucketCloudOptions struct {
	// ClientID is the Bitbucket Cloud Client ID.
	// This field is required. Maximum length: 2000 characters.
	ClientID string `url:"clientId"`
	// ClientSecret is the Bitbucket Cloud Client Secret.
	// This field is required. Maximum length: 2000 characters.
	ClientSecret string `url:"clientSecret"`
	// Key is the unique key of the Bitbucket Cloud setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// Workspace is the Bitbucket Cloud workspace ID.
	// This field is required.
	Workspace string `url:"workspace"`
}

AlmSettingsCreateBitbucketCloudOptions contains parameters for the CreateBitbucketCloud method.

type AlmSettingsCreateBitbucketOptions

type AlmSettingsCreateBitbucketOptions struct {
	// Key is the unique key of the Bitbucket instance setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// PersonalAccessToken is the Bitbucket personal access token.
	// This field is required. Maximum length: 2000 characters.
	PersonalAccessToken string `url:"personalAccessToken"`
	// URL is the BitBucket Server API URL.
	// This field is required. Maximum length: 2000 characters.
	URL string `url:"url"`
}

AlmSettingsCreateBitbucketOptions contains parameters for the CreateBitbucket method.

type AlmSettingsCreateGithubFromManifestOptions added in v2.2.0

type AlmSettingsCreateGithubFromManifestOptions struct {
	// Auth indicates whether to also set up GitHub authentication (sign-in) using this App.
	// Allowed values: true, false, yes, no
	// This field is optional. Default: false.
	Auth string `url:"auth,omitempty"`
	// Devops indicates whether to create the DevOps Platform integration (project import / PR analysis) for this App.
	// Allowed values: true, false, yes, no
	// This field is optional. Default: true.
	Devops string `url:"devops,omitempty"`
	// Key is the unique key of the GitHub instance setting that will be created. Required when Devops is true.
	// This field is optional. Maximum length: 200 characters.
	Key string `url:"key,omitempty"`
	// Name is the suggested name for the GitHub App (the user can change it on GitHub).
	// Defaults to 'SonarQube - <add_unique_name>'.
	// This field is optional. Maximum length: 200 characters.
	Name string `url:"name,omitempty"`
	// Organization is the GitHub organization the App should be created under.
	// Leave empty to create it under the user's personal account.
	// This field is optional. Maximum length: 200 characters.
	Organization string `url:"organization,omitempty"`
}

AlmSettingsCreateGithubFromManifestOptions contains parameters for the CreateGithubFromManifest method.

type AlmSettingsCreateGithubOptions

type AlmSettingsCreateGithubOptions struct {
	// AppID is the GitHub App ID.
	// This field is required. Maximum length: 80 characters.
	AppID string `url:"appId"`
	// ClientID is the GitHub App Client ID.
	// This field is required. Maximum length: 80 characters.
	ClientID string `url:"clientId"`
	// ClientSecret is the GitHub App Client Secret.
	// This field is required. Maximum length: 160 characters.
	ClientSecret string `url:"clientSecret"`
	// Key is the unique key of the GitHub instance setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// PrivateKey is the GitHub App private key.
	// This field is required. Maximum length: 2500 characters.
	PrivateKey string `url:"privateKey"`
	// URL is the GitHub API URL.
	// This field is required. Maximum length: 2000 characters.
	URL string `url:"url"`
	// WebhookSecret is the GitHub App Webhook Secret.
	// This field is optional. Maximum length: 160 characters.
	WebhookSecret string `url:"webhookSecret,omitempty"`
}

AlmSettingsCreateGithubOptions contains parameters for the CreateGithub method.

type AlmSettingsCreateGitlabOptions

type AlmSettingsCreateGitlabOptions struct {
	// Key is the unique key of the GitLab instance setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// PersonalAccessToken is the GitLab personal access token.
	// This field is required. Maximum length: 2000 characters.
	PersonalAccessToken string `url:"personalAccessToken"`
	// URL is the GitLab API URL.
	// This field is required. Maximum length: 2000 characters.
	URL string `url:"url"`
}

AlmSettingsCreateGitlabOptions contains parameters for the CreateGitlab method.

type AlmSettingsDeleteBindingOptions added in v2.2.0

type AlmSettingsDeleteBindingOptions struct {
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
}

AlmSettingsDeleteBindingOptions contains parameters for the DeleteBinding method.

type AlmSettingsDeleteOptions

type AlmSettingsDeleteOptions struct {
	// Key is the DevOps Platform Setting key.
	// This field is required.
	Key string `url:"key"`
}

AlmSettingsDeleteOptions contains parameters for the Delete method.

type AlmSettingsGetBinding

type AlmSettingsGetBinding struct {
	// Alm is the type of DevOps Platform (azure, bitbucket, bitbucketcloud, github, gitlab).
	Alm string `json:"alm,omitempty"`
	// InlineAnnotationsEnabled indicates if inline annotations are enabled (Azure only, since 2025.1).
	InlineAnnotationsEnabled bool `json:"inlineAnnotationsEnabled,omitempty"`
	// Key is the DevOps Platform setting key.
	Key string `json:"key,omitempty"`
	// Monorepo indicates if monorepo feature is enabled (Azure only, since 8.7).
	Monorepo bool `json:"monorepo,omitempty"`
	// Repository is the repository identifier.
	Repository string `json:"repository,omitempty"`
	// RepositoryURL is the URL to the repository (GitHub, GitLab, Azure since 2025.6).
	RepositoryURL string `json:"repositoryUrl,omitempty"`
	// Slug is the repository slug (Bitbucket).
	Slug string `json:"slug,omitempty"`
	// SummaryCommentEnabled indicates if summary comments are enabled.
	SummaryCommentEnabled bool `json:"summaryCommentEnabled,omitempty"`
	// URL is the DevOps Platform URL.
	URL string `json:"url,omitempty"`
}

AlmSettingsGetBinding represents the response from getting a project binding.

type AlmSettingsGetBindingOptions

type AlmSettingsGetBindingOptions struct {
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
}

AlmSettingsGetBindingOptions contains parameters for the GetBinding method.

type AlmSettingsGithubManifest added in v2.2.0

type AlmSettingsGithubManifest struct {
	// Manifest is the GitHub App Manifest JSON to be POSTed to GitHub by the browser.
	Manifest string `json:"manifest,omitempty"`
	// State is the single-use state token to be POSTed to GitHub alongside the manifest.
	State string `json:"state,omitempty"`
}

AlmSettingsGithubManifest represents the response from initiating the GitHub App Manifest flow.

type AlmSettingsList

type AlmSettingsList struct {
	// AlmSettings is the list of available DevOps Platform settings.
	AlmSettings []AlmSetting `json:"almSettings,omitempty"`
}

AlmSettingsList represents the response from listing available ALM settings.

type AlmSettingsListDefinitions

type AlmSettingsListDefinitions struct {
	// Azure contains Azure DevOps settings.
	Azure []AzureDefinition `json:"azure,omitempty"`
	// Bitbucket contains Bitbucket Server settings.
	Bitbucket []BitbucketDefinition `json:"bitbucket,omitempty"`
	// BitbucketCloud contains Bitbucket Cloud settings.
	BitbucketCloud []BitbucketCloudDefinition `json:"bitbucketcloud,omitempty"`
	// Github contains GitHub settings.
	Github []GithubDefinition `json:"github,omitempty"`
	// Gitlab contains GitLab settings.
	Gitlab []GitlabDefinition `json:"gitlab,omitempty"`
}

AlmSettingsListDefinitions represents the response from listing all ALM setting definitions.

type AlmSettingsListOptions

type AlmSettingsListOptions struct {
	// Project is the project key.
	// This field is optional.
	Project string `url:"project,omitempty"`
}

AlmSettingsListOptions contains parameters for the List method.

type AlmSettingsService

type AlmSettingsService struct {
	// contains filtered or unexported fields
}

AlmSettingsService handles communication with the DevOps Platform Settings related methods of the SonarQube API. This service manages configuration of Azure DevOps, Bitbucket, Bitbucket Cloud, GitHub, and GitLab integrations for project bindings.

func (*AlmSettingsService) CountBinding

CountBinding counts the number of projects bound to a DevOps Platform setting. Requires the 'Administer System' permission.

API endpoint: GET /api/alm_settings/count_binding. Since: 8.1.

func (*AlmSettingsService) CreateAzure

CreateAzure creates an Azure DevOps instance setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/create_azure. Since: 8.1.

func (*AlmSettingsService) CreateBitbucket

CreateBitbucket creates a Bitbucket Server instance setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/create_bitbucket. Since: 8.1.

func (*AlmSettingsService) CreateBitbucketCloud

CreateBitbucketCloud configures a new instance of Bitbucket Cloud. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/create_bitbucketcloud. Since: 8.7.

func (*AlmSettingsService) CreateGithub

CreateGithub creates a GitHub instance setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/create_github. Since: 8.1.

func (*AlmSettingsService) CreateGithubFromManifest added in v2.2.0

CreateGithubFromManifest creates a GitHub App configuration from a manifest. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/create_github_from_manifest. Since: 2026.4.

func (*AlmSettingsService) CreateGitlab

CreateGitlab creates a GitLab instance setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/create_gitlab. Since: 8.1.

func (*AlmSettingsService) Delete

Delete deletes a DevOps Platform setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/delete. Since: 8.1.

func (*AlmSettingsService) DeleteBinding added in v2.2.0

DeleteBinding deletes the DevOps Platform binding of a project. Requires the 'Administer' permission on the project.

API endpoint: POST /api/alm_settings/delete_binding. Since: 8.1.

func (*AlmSettingsService) GetBinding

GetBinding gets the DevOps Platform binding of a given project. Requires the 'Browse' permission on the project.

API endpoint: GET /api/alm_settings/get_binding. Since: 8.1.

func (*AlmSettingsService) List

List lists DevOps Platform settings available for a given project, sorted by DevOps Platform key. Requires the 'Administer project' permission if the 'project' parameter is provided, requires the 'Create Projects' permission otherwise.

API endpoint: GET /api/alm_settings/list. Since: 8.1.

func (*AlmSettingsService) ListDefinitions

ListDefinitions lists DevOps Platform settings, sorted by created date. Requires the 'Administer System' permission.

API endpoint: GET /api/alm_settings/list_definitions. Since: 8.1.

func (*AlmSettingsService) SetAzureBinding added in v2.2.0

SetAzureBinding binds an Azure DevOps instance to a project. If the project is already bound to a previous Azure DevOps instance, the binding will be updated to the new one. Requires the 'Administer' permission on the project.

API endpoint: POST /api/alm_settings/set_azure_binding. Since: 8.1.

func (*AlmSettingsService) SetBitbucketBinding added in v2.2.0

SetBitbucketBinding binds a Bitbucket Server instance to a project. If the project is already bound to a previous Bitbucket instance, the binding will be updated to the new one. Requires the 'Administer' permission on the project.

API endpoint: POST /api/alm_settings/set_bitbucket_binding. Since: 8.1.

func (*AlmSettingsService) SetBitbucketCloudBinding added in v2.2.0

SetBitbucketCloudBinding binds a Bitbucket Cloud setting to a project. If the project is already bound to a different Bitbucket Cloud setting, the binding will be updated to the new one. Requires the 'Administer' permission on the project.

API endpoint: POST /api/alm_settings/set_bitbucketcloud_binding. Since: 8.7.

func (*AlmSettingsService) SetGithubBinding added in v2.2.0

SetGithubBinding binds a GitHub instance to a project. If the project is already bound to a previous GitHub instance, the binding will be updated to the new one. Requires the 'Administer' permission on the project.

API endpoint: POST /api/alm_settings/set_github_binding. Since: 8.1.

func (*AlmSettingsService) SetGitlabBinding added in v2.2.0

SetGitlabBinding binds a GitLab instance to a project. If the project is already bound to a previous GitLab instance, the binding will be updated to the new one. Requires the 'Administer' permission on the project.

API endpoint: POST /api/alm_settings/set_gitlab_binding. Since: 8.1.

func (*AlmSettingsService) UpdateAzure

UpdateAzure updates an Azure DevOps instance setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/update_azure. Since: 8.1.

func (*AlmSettingsService) UpdateBitbucket

UpdateBitbucket updates a Bitbucket Server instance setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/update_bitbucket. Since: 8.1.

func (*AlmSettingsService) UpdateBitbucketCloud

UpdateBitbucketCloud updates a Bitbucket Cloud setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/update_bitbucketcloud. Since: 8.7.

func (*AlmSettingsService) UpdateGithub

UpdateGithub updates a GitHub instance setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/update_github. Since: 8.1.

func (*AlmSettingsService) UpdateGitlab

UpdateGitlab updates a GitLab instance setting. Requires the 'Administer System' permission.

API endpoint: POST /api/alm_settings/update_gitlab. Since: 8.1.

func (*AlmSettingsService) Validate

Validate validates a DevOps Platform setting by checking connectivity and permissions. Requires the 'Administer System' permission.

API endpoint: GET /api/alm_settings/validate. Since: 8.6.

func (*AlmSettingsService) ValidateCountBindingOpt

func (s *AlmSettingsService) ValidateCountBindingOpt(opt *AlmSettingsCountBindingOptions) error

ValidateCountBindingOpt validates the options for the CountBinding method.

func (*AlmSettingsService) ValidateCreateAzureOpt

func (s *AlmSettingsService) ValidateCreateAzureOpt(opt *AlmSettingsCreateAzureOptions) error

ValidateCreateAzureOpt validates the options for the CreateAzure method.

func (*AlmSettingsService) ValidateCreateBitbucketCloudOpt

func (s *AlmSettingsService) ValidateCreateBitbucketCloudOpt(opt *AlmSettingsCreateBitbucketCloudOptions) error

ValidateCreateBitbucketCloudOpt validates the options for the CreateBitbucketCloud method.

func (*AlmSettingsService) ValidateCreateBitbucketOpt

func (s *AlmSettingsService) ValidateCreateBitbucketOpt(opt *AlmSettingsCreateBitbucketOptions) error

ValidateCreateBitbucketOpt validates the options for the CreateBitbucket method.

func (*AlmSettingsService) ValidateCreateGithubFromManifestOpt added in v2.2.0

func (s *AlmSettingsService) ValidateCreateGithubFromManifestOpt(opt *AlmSettingsCreateGithubFromManifestOptions) error

ValidateCreateGithubFromManifestOpt validates the options for the CreateGithubFromManifest method.

func (*AlmSettingsService) ValidateCreateGithubOpt

func (s *AlmSettingsService) ValidateCreateGithubOpt(opt *AlmSettingsCreateGithubOptions) error

ValidateCreateGithubOpt validates the options for the CreateGithub method.

func (*AlmSettingsService) ValidateCreateGitlabOpt

func (s *AlmSettingsService) ValidateCreateGitlabOpt(opt *AlmSettingsCreateGitlabOptions) error

ValidateCreateGitlabOpt validates the options for the CreateGitlab method.

func (*AlmSettingsService) ValidateDeleteBindingOpt added in v2.2.0

func (s *AlmSettingsService) ValidateDeleteBindingOpt(opt *AlmSettingsDeleteBindingOptions) error

ValidateDeleteBindingOpt validates the options for the DeleteBinding method.

func (*AlmSettingsService) ValidateDeleteOpt

func (s *AlmSettingsService) ValidateDeleteOpt(opt *AlmSettingsDeleteOptions) error

ValidateDeleteOpt validates the options for the Delete method.

func (*AlmSettingsService) ValidateGetBindingOpt

func (s *AlmSettingsService) ValidateGetBindingOpt(opt *AlmSettingsGetBindingOptions) error

ValidateGetBindingOpt validates the options for the GetBinding method.

func (*AlmSettingsService) ValidateListOpt

func (s *AlmSettingsService) ValidateListOpt(opt *AlmSettingsListOptions) error

ValidateListOpt validates the options for the List method.

func (*AlmSettingsService) ValidateSetAzureBindingOpt added in v2.2.0

func (s *AlmSettingsService) ValidateSetAzureBindingOpt(opt *AlmSettingsSetAzureBindingOptions) error

ValidateSetAzureBindingOpt validates the options for the SetAzureBinding method.

func (*AlmSettingsService) ValidateSetBitbucketBindingOpt added in v2.2.0

func (s *AlmSettingsService) ValidateSetBitbucketBindingOpt(opt *AlmSettingsSetBitbucketBindingOptions) error

ValidateSetBitbucketBindingOpt validates the options for the SetBitbucketBinding method.

func (*AlmSettingsService) ValidateSetBitbucketCloudBindingOpt added in v2.2.0

func (s *AlmSettingsService) ValidateSetBitbucketCloudBindingOpt(opt *AlmSettingsSetBitbucketCloudBindingOptions) error

ValidateSetBitbucketCloudBindingOpt validates the options for the SetBitbucketCloudBinding method.

func (*AlmSettingsService) ValidateSetGithubBindingOpt added in v2.2.0

func (s *AlmSettingsService) ValidateSetGithubBindingOpt(opt *AlmSettingsSetGithubBindingOptions) error

ValidateSetGithubBindingOpt validates the options for the SetGithubBinding method.

func (*AlmSettingsService) ValidateSetGitlabBindingOpt added in v2.2.0

func (s *AlmSettingsService) ValidateSetGitlabBindingOpt(opt *AlmSettingsSetGitlabBindingOptions) error

ValidateSetGitlabBindingOpt validates the options for the SetGitlabBinding method.

func (*AlmSettingsService) ValidateUpdateAzureOpt

func (s *AlmSettingsService) ValidateUpdateAzureOpt(opt *AlmSettingsUpdateAzureOptions) error

ValidateUpdateAzureOpt validates the options for the UpdateAzure method.

func (*AlmSettingsService) ValidateUpdateBitbucketCloudOpt

func (s *AlmSettingsService) ValidateUpdateBitbucketCloudOpt(opt *AlmSettingsUpdateBitbucketCloudOptions) error

ValidateUpdateBitbucketCloudOpt validates the options for the UpdateBitbucketCloud method.

func (*AlmSettingsService) ValidateUpdateBitbucketOpt

func (s *AlmSettingsService) ValidateUpdateBitbucketOpt(opt *AlmSettingsUpdateBitbucketOptions) error

ValidateUpdateBitbucketOpt validates the options for the UpdateBitbucket method.

func (*AlmSettingsService) ValidateUpdateGithubOpt

func (s *AlmSettingsService) ValidateUpdateGithubOpt(opt *AlmSettingsUpdateGithubOptions) error

ValidateUpdateGithubOpt validates the options for the UpdateGithub method.

func (*AlmSettingsService) ValidateUpdateGitlabOpt

func (s *AlmSettingsService) ValidateUpdateGitlabOpt(opt *AlmSettingsUpdateGitlabOptions) error

ValidateUpdateGitlabOpt validates the options for the UpdateGitlab method.

func (*AlmSettingsService) ValidateValidateOpt

func (s *AlmSettingsService) ValidateValidateOpt(opt *AlmSettingsValidateOptions) error

ValidateValidateOpt validates the options for the Validate method.

type AlmSettingsSetAzureBindingOptions added in v2.2.0

type AlmSettingsSetAzureBindingOptions struct {
	// InlineAnnotationsEnabled enables inline annotations during Pull Request decoration.
	// This field is optional (since 2025.1). Default: true.
	InlineAnnotationsEnabled *bool `url:"inlineAnnotationsEnabled,omitempty"`
	// AlmSetting is the Azure DevOps setting key.
	// This field is required. Maximum length: 200 characters.
	AlmSetting string `url:"almSetting"`
	// Project is the SonarQube project key.
	// This field is required.
	Project string `url:"project"`
	// ProjectName is the Azure DevOps project name.
	// This field is required (since 8.6).
	ProjectName string `url:"projectName"`
	// RepositoryName is the Azure DevOps repository name.
	// This field is required (since 8.6).
	RepositoryName string `url:"repositoryName"`
	// Monorepo indicates if this project is part of a monorepo.
	// This field is required (since 8.7).
	Monorepo bool `url:"monorepo"`
}

AlmSettingsSetAzureBindingOptions contains parameters for the SetAzureBinding method.

type AlmSettingsSetBitbucketBindingOptions added in v2.2.0

type AlmSettingsSetBitbucketBindingOptions struct {
	// AlmSetting is the Bitbucket Server setting key.
	// This field is required. Maximum length: 200 characters.
	AlmSetting string `url:"almSetting"`
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
	// Repository is the Bitbucket Server repository key.
	// This field is required.
	Repository string `url:"repository"`
	// Slug is the Bitbucket Server repository slug.
	// This field is required.
	Slug string `url:"slug"`
	// Monorepo indicates if this project is part of a monorepo.
	// This field is required (since 8.7).
	Monorepo bool `url:"monorepo"`
}

AlmSettingsSetBitbucketBindingOptions contains parameters for the SetBitbucketBinding method.

type AlmSettingsSetBitbucketCloudBindingOptions added in v2.2.0

type AlmSettingsSetBitbucketCloudBindingOptions struct {
	// AlmSetting is the Bitbucket Cloud setting key.
	// This field is required. Maximum length: 200 characters.
	AlmSetting string `url:"almSetting"`
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
	// Repository is the Bitbucket Cloud repository key.
	// This field is required.
	Repository string `url:"repository"`
	// Monorepo indicates if this project is part of a monorepo.
	// This field is required (since 8.8).
	Monorepo bool `url:"monorepo"`
}

AlmSettingsSetBitbucketCloudBindingOptions contains parameters for the SetBitbucketCloudBinding method.

type AlmSettingsSetGithubBindingOptions added in v2.2.0

type AlmSettingsSetGithubBindingOptions struct {
	// SummaryCommentEnabled enables/disables the analysis summary in the PR discussion tab.
	// This field is optional (since 8.3). Default: true.
	SummaryCommentEnabled *bool `url:"summaryCommentEnabled,omitempty"`
	// AlmSetting is the GitHub setting key.
	// This field is required. Maximum length: 200 characters.
	AlmSetting string `url:"almSetting"`
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
	// Repository is the GitHub repository.
	// This field is required. Maximum length: 256 characters.
	Repository string `url:"repository"`
	// Monorepo indicates if this project is part of a monorepo.
	// This field is required (since 8.7).
	Monorepo bool `url:"monorepo"`
}

AlmSettingsSetGithubBindingOptions contains parameters for the SetGithubBinding method.

type AlmSettingsSetGitlabBindingOptions added in v2.2.0

type AlmSettingsSetGitlabBindingOptions struct {
	// AlmSetting is the GitLab setting key.
	// This field is required. Maximum length: 200 characters.
	AlmSetting string `url:"almSetting"`
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
	// Repository is the GitLab project ID.
	// This field is required.
	Repository string `url:"repository"`
	// Monorepo indicates if this project is part of a monorepo.
	// This field is required (since 8.7).
	Monorepo bool `url:"monorepo"`
}

AlmSettingsSetGitlabBindingOptions contains parameters for the SetGitlabBinding method.

type AlmSettingsUpdateAzureOptions

type AlmSettingsUpdateAzureOptions struct {
	// Key is the unique key of the Azure instance setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// NewKey is the optional new value for the unique key.
	// Maximum length: 200 characters.
	NewKey string `url:"newKey,omitempty"`
	// PersonalAccessToken is the Azure DevOps personal access token.
	// This field is optional (since 8.7). Maximum length: 2000 characters.
	PersonalAccessToken string `url:"personalAccessToken,omitempty"`
	// URL is the Azure API URL.
	// This field is required. Maximum length: 2000 characters.
	URL string `url:"url"`
}

AlmSettingsUpdateAzureOptions contains parameters for the UpdateAzure method.

type AlmSettingsUpdateBitbucketCloudOptions

type AlmSettingsUpdateBitbucketCloudOptions struct {
	// ClientID is the Bitbucket Cloud Client ID.
	// This field is required. Maximum length: 80 characters.
	ClientID string `url:"clientId"`
	// ClientSecret is the optional new value for the Bitbucket Cloud client secret.
	// Maximum length: 160 characters.
	ClientSecret string `url:"clientSecret,omitempty"`
	// Key is the unique key of the Bitbucket Cloud setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// NewKey is the optional new value for the unique key.
	// Maximum length: 200 characters.
	NewKey string `url:"newKey,omitempty"`
	// Workspace is the Bitbucket Cloud workspace ID.
	// This field is required. Maximum length: 80 characters.
	Workspace string `url:"workspace"`
}

AlmSettingsUpdateBitbucketCloudOptions contains parameters for the UpdateBitbucketCloud method.

type AlmSettingsUpdateBitbucketOptions

type AlmSettingsUpdateBitbucketOptions struct {
	// Key is the unique key of the Bitbucket instance setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// NewKey is the optional new value for the unique key.
	// Maximum length: 200 characters.
	NewKey string `url:"newKey,omitempty"`
	// PersonalAccessToken is the Bitbucket personal access token.
	// This field is optional (since 8.7). Maximum length: 2000 characters.
	PersonalAccessToken string `url:"personalAccessToken,omitempty"`
	// URL is the Bitbucket API URL.
	// This field is required. Maximum length: 2000 characters.
	URL string `url:"url"`
}

AlmSettingsUpdateBitbucketOptions contains parameters for the UpdateBitbucket method.

type AlmSettingsUpdateGithubOptions

type AlmSettingsUpdateGithubOptions struct {
	// AppID is the GitHub API ID.
	// This field is required. Maximum length: 80 characters.
	AppID string `url:"appId"`
	// ClientID is the GitHub App Client ID.
	// This field is required. Maximum length: 80 characters.
	ClientID string `url:"clientId"`
	// ClientSecret is the GitHub App Client Secret.
	// This field is optional (since 8.7). Maximum length: 160 characters.
	ClientSecret string `url:"clientSecret,omitempty"`
	// Key is the unique key of the GitHub instance setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// NewKey is the optional new value for the unique key.
	// Maximum length: 200 characters.
	NewKey string `url:"newKey,omitempty"`
	// PrivateKey is the GitHub App private key.
	// This field is optional (since 8.7). Maximum length: 2500 characters.
	PrivateKey string `url:"privateKey,omitempty"`
	// URL is the GitHub API URL.
	// This field is required. Maximum length: 2000 characters.
	URL string `url:"url"`
	// WebhookSecret is the GitHub App Webhook Secret.
	// This field is optional. Maximum length: 160 characters.
	WebhookSecret string `url:"webhookSecret,omitempty"`
}

AlmSettingsUpdateGithubOptions contains parameters for the UpdateGithub method.

type AlmSettingsUpdateGitlabOptions

type AlmSettingsUpdateGitlabOptions struct {
	// Key is the unique key of the GitLab instance setting.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
	// NewKey is the optional new value for the unique key.
	// Maximum length: 200 characters.
	NewKey string `url:"newKey,omitempty"`
	// PersonalAccessToken is the GitLab personal access token.
	// This field is optional (since 8.7). Maximum length: 2000 characters.
	PersonalAccessToken string `url:"personalAccessToken,omitempty"`
	// URL is the GitLab API URL.
	// This field is required. Maximum length: 2000 characters.
	URL string `url:"url"`
}

AlmSettingsUpdateGitlabOptions contains parameters for the UpdateGitlab method.

type AlmSettingsValidateOptions

type AlmSettingsValidateOptions struct {
	// Key is the unique key of the DevOps Platform settings.
	// This field is required. Maximum length: 200 characters.
	Key string `url:"key"`
}

AlmSettingsValidateOptions contains parameters for the Validate method.

type AlmSettingsValidation

type AlmSettingsValidation struct {
	// Errors contains validation error messages, if any.
	Errors []AlmValidationError `json:"errors,omitempty"`
}

AlmSettingsValidation represents the response from validating a DevOps Platform setting.

type AlmValidationError

type AlmValidationError struct {
	// Msg is the error message.
	Msg string `json:"msg,omitempty"`
}

AlmValidationError represents a single validation error.

type AnalysisActiveRule

type AnalysisActiveRule struct {
	// CreatedAt is the datetime when the rule was created.
	CreatedAt string `json:"createdAt,omitempty"`
	// DeprecatedKeys is the list of deprecated rule keys.
	DeprecatedKeys []AnalysisRuleKey `json:"deprecatedKeys,omitempty"`
	// Impacts is a map of software quality to impact severity.
	Impacts map[string]string `json:"impacts,omitempty"`
	// InternalKey is the internal key of the rule.
	InternalKey string `json:"internalKey,omitempty"`
	// Language is the programming language key.
	Language string `json:"language,omitempty"`
	// Name is the rule name.
	Name string `json:"name,omitempty"`
	// Params is the list of rule parameters.
	Params []AnalysisParam `json:"params,omitempty"`
	// QProfileKey is the quality profile key.
	QProfileKey string `json:"qProfileKey,omitempty"`
	// RuleKey is the rule key.
	RuleKey AnalysisRuleKey `json:"ruleKey,omitzero"`
	// Severity is the rule severity.
	Severity string `json:"severity,omitempty"`
	// TemplateRuleKey is the template rule key if this is a custom rule.
	TemplateRuleKey string `json:"templateRuleKey,omitempty"`
	// UpdatedAt is the datetime when the rule was last updated.
	UpdatedAt string `json:"updatedAt,omitempty"`
}

AnalysisActiveRule represents an active rule for a project.

type AnalysisActiveRuleOptions

type AnalysisActiveRuleOptions struct {
	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
}

AnalysisActiveRuleOptions contains query parameters for the GetActiveRules method.

type AnalysisCacheClearOptions

type AnalysisCacheClearOptions struct {
	// Branch filters which project's branch's cached data will be cleared.
	// The 'Project' parameter must be set when using this.
	Branch string `url:"branch,omitempty"`
	// Project filters which project's cached data will be cleared.
	Project string `url:"project,omitempty"`
}

AnalysisCacheClearOptions contains parameters for the Clear method.

type AnalysisCacheGetOptions

type AnalysisCacheGetOptions struct {
	// Branch key. If not provided, main branch will be used.
	Branch string `url:"branch,omitempty"`
	// Project key.
	// This field is required.
	Project string `url:"project"`
}

AnalysisCacheGetOptions contains parameters for the Get method.

type AnalysisCacheService

type AnalysisCacheService struct {
	// contains filtered or unexported fields
}

AnalysisCacheService handles communication with the analysis cache related methods of the SonarQube API. This service provides access to scanner's cached data for branches.

func (*AnalysisCacheService) Clear

Clear clears all or part of the scanner's cached data. Requires global administration permission.

API endpoint: POST /api/analysis_cache/clear. WARNING: This is an internal API and may change without notice.

func (*AnalysisCacheService) Get

Get returns the scanner's cached data for a branch. Requires scan permission on the project. Data is returned gzipped if the corresponding 'Accept-Encoding' header is set in the request. The response body contains the raw binary data; the caller is responsible for reading and closing it.

API endpoint: GET /api/analysis_cache/get.

func (*AnalysisCacheService) ValidateClearOpt

func (s *AnalysisCacheService) ValidateClearOpt(opt *AnalysisCacheClearOptions) error

ValidateClearOpt validates the options for the Clear method. Currently, there are no required fields.

func (*AnalysisCacheService) ValidateGetOpt

func (s *AnalysisCacheService) ValidateGetOpt(opt *AnalysisCacheGetOptions) error

ValidateGetOpt validates the options for the Get method.

type AnalysisEngineInfo

type AnalysisEngineInfo struct {
	// Filename is the scanner engine filename.
	Filename string `json:"filename,omitempty"`
	// Sha256 is the SHA-256 checksum of the scanner engine.
	Sha256 string `json:"sha256,omitempty"`
}

AnalysisEngineInfo represents metadata for the Scanner Engine.

type AnalysisJre

type AnalysisJre struct {
	// Arch is the CPU architecture (e.g. x64, aarch64).
	Arch string `json:"arch,omitempty"`
	// Filename is the JRE archive filename.
	Filename string `json:"filename,omitempty"`
	// Id is the unique identifier of the JRE.
	Id string `json:"id,omitempty"`
	// JavaPath is the path to the java executable within the archive.
	JavaPath string `json:"javaPath,omitempty"`
	// Os is the operating system (e.g. windows, linux, macos, alpine).
	Os string `json:"os,omitempty"`
	// Sha256 is the SHA-256 checksum of the JRE archive.
	Sha256 string `json:"sha256,omitempty"`
}

AnalysisJre represents metadata for a Java Runtime Environment.

type AnalysisJresOptions

type AnalysisJresOptions struct {
	// Arch filters JREs by CPU architecture (x64, aarch64).
	Arch string `json:"arch,omitempty"`
	// Os filters JREs by operating system (windows, linux, macos, alpine).
	Os string `json:"os,omitempty"`
}

AnalysisJresOptions contains query parameters for the GetJresMetadata method.

type AnalysisParam

type AnalysisParam struct {
	// Key is the parameter key.
	Key string `json:"key,omitempty"`
	// Value is the parameter value.
	Value string `json:"value,omitempty"`
}

AnalysisParam represents a rule parameter key-value pair.

type AnalysisReportsQueueStatus

type AnalysisReportsQueueStatus struct {
	// IsEmpty indicates whether the Compute Engine queue is empty.
	IsEmpty bool
}

AnalysisReportsQueueStatus represents the response from checking if the Compute Engine queue is empty.

type AnalysisReportsService

type AnalysisReportsService struct {
	// contains filtered or unexported fields
}

AnalysisReportsService handles communication with the analysis reports related methods of the SonarQube API. This service provides information about Compute Engine tasks.

func (*AnalysisReportsService) QueueStatus

QueueStatus checks if the queue of Compute Engine is empty. Returns an AnalysisReportsQueueStatus indicating whether the queue is empty.

API endpoint: GET /api/analysis_reports/is_queue_empty. WARNING: this is an internal API and may change without notice.

type AnalysisRuleKey

type AnalysisRuleKey struct {
	// Repository is the rule repository key.
	Repository string `json:"repository,omitempty"`
	// Rule is the rule identifier within the repository.
	Rule string `json:"rule,omitempty"`
}

AnalysisRuleKey represents a rule key composed of a repository and rule identifier.

type AnalysisService

type AnalysisService struct {
	// contains filtered or unexported fields
}

AnalysisService handles communication with the Analysis related methods of the SonarQube V2 API.

func (*AnalysisService) DownloadJre

func (s *AnalysisService) DownloadJre(ctx context.Context, jreID string, writer io.Writer) (*http.Response, error)

DownloadJre downloads a JRE binary by ID into the provided writer. Set the Accept header to "application/octet-stream" to receive the binary.

func (*AnalysisService) DownloadScannerEngine

func (s *AnalysisService) DownloadScannerEngine(ctx context.Context, writer io.Writer) (*http.Response, error)

DownloadScannerEngine downloads the Scanner Engine binary into the provided writer.

func (*AnalysisService) GetActiveRules

GetActiveRules returns all active rules for a specific project. Used by the scanner-engine.

func (*AnalysisService) GetJreMetadata

func (s *AnalysisService) GetJreMetadata(ctx context.Context, jreID string) (*AnalysisJre, *http.Response, error)

GetJreMetadata returns metadata for a single JRE by ID.

func (*AnalysisService) GetJresMetadata

func (s *AnalysisService) GetJresMetadata(ctx context.Context, opt *AnalysisJresOptions) ([]AnalysisJre, *http.Response, error)

GetJresMetadata returns metadata for all available JREs, optionally filtered by operating system and CPU architecture.

func (*AnalysisService) GetScannerEngineMetadata

func (s *AnalysisService) GetScannerEngineMetadata(ctx context.Context) (*AnalysisEngineInfo, *http.Response, error)

GetScannerEngineMetadata returns metadata for the Scanner Engine.

func (*AnalysisService) GetVersion

func (s *AnalysisService) GetVersion(ctx context.Context) (*string, *http.Response, error)

GetVersion returns the Scanner Engine version as a plain text string.

func (*AnalysisService) ValidateActiveRulesOpt

func (s *AnalysisService) ValidateActiveRulesOpt(opt *AnalysisActiveRuleOptions) error

ValidateActiveRulesOpt validates the AnalysisActiveRuleOptions.

type Application

type Application struct {
	// Key is the application key.
	Key string `json:"key,omitempty"`
	// Name is the application name.
	Name string `json:"name,omitempty"`
	// Description is the application description.
	Description string `json:"description,omitempty"`
	// Visibility is the application visibility (public or private).
	Visibility string `json:"visibility,omitempty"`
	// Projects is the list of projects in the application.
	Projects []string `json:"projects,omitempty"`
}

Application represents a SonarQube application.

type ApplicationBranch

type ApplicationBranch struct {
	// Name is the branch name.
	Name string `json:"name,omitempty"`
	// IsMain indicates whether this is the main branch.
	IsMain bool `json:"isMain,omitempty"`
}

ApplicationBranch represents a branch of an application.

type ApplicationDetails

type ApplicationDetails struct {
	// Key is the application key.
	Key string `json:"key,omitempty"`
	// Name is the application name.
	Name string `json:"name,omitempty"`
	// Description is the application description.
	Description string `json:"description,omitempty"`
	// Visibility is the application visibility.
	Visibility string `json:"visibility,omitempty"`
	// Branch is the name of the branch currently being viewed.
	Branch string `json:"branch,omitempty"`
	// IsMain indicates whether the currently viewed branch is the main branch.
	IsMain bool `json:"isMain,omitempty"`
	// Tags is the list of tags assigned to the application.
	Tags []string `json:"tags,omitempty"`
	// Projects is the list of projects configured in the application.
	Projects []ApplicationProject `json:"projects,omitempty"`
	// Branches is the list of branches of the application.
	Branches []ApplicationBranch `json:"branches,omitempty"`
}

ApplicationDetails represents detailed information about an application.

type ApplicationLeakPeriod

type ApplicationLeakPeriod struct {
	// Project is the project key.
	Project string `json:"project,omitempty"`
	// ProjectName is the project name.
	ProjectName string `json:"projectName,omitempty"`
	// Date is the start date of the new code period.
	Date string `json:"date,omitempty"`
}

ApplicationLeakPeriod represents the new code period start date for a project within an application.

type ApplicationProject

type ApplicationProject struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
	// Branch is the project branch used in this application branch.
	Branch string `json:"branch,omitempty"`
	// IsMain indicates whether the project branch is the main branch.
	IsMain bool `json:"isMain,omitempty"`
	// Enabled indicates whether the project is enabled in the application.
	Enabled bool `json:"enabled,omitempty"`
	// Selected indicates whether the project is selected in the application.
	Selected bool `json:"selected,omitempty"`
}

ApplicationProject represents a project configured within an application.

type ApplicationsAddProjectOptions

type ApplicationsAddProjectOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Project is the project key. This field is required.
	Project string `url:"project"`
}

ApplicationsAddProjectOptions contains parameters for the AddProject method.

type ApplicationsCreate

type ApplicationsCreate struct {
	// Application contains the created application.
	Application Application `json:"application,omitzero"`
}

ApplicationsCreate represents the response from the create endpoint.

type ApplicationsCreateBranchOptions

type ApplicationsCreateBranchOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Branch is the branch name. This field is required.
	Branch string `url:"branch"`
	// Project is the list of project keys (can be specified multiple times). This field is required.
	Project []string `url:"project"`
	// ProjectBranch is the list of project branch names (can be specified multiple times). This field is required.
	ProjectBranch []string `url:"projectBranch"`
}

ApplicationsCreateBranchOptions contains parameters for the CreateBranch method.

type ApplicationsCreateOptions

type ApplicationsCreateOptions struct {
	// Description is the application description. Optional.
	Description string `url:"description,omitempty"`
	// Key is the application key. Optional, will be generated from name if not provided.
	Key string `url:"key,omitempty"`
	// Name is the application name. This field is required.
	Name string `url:"name"`
	// Visibility is the application visibility (public or private). Optional.
	Visibility string `url:"visibility,omitempty"`
}

ApplicationsCreateOptions contains parameters for the Create method.

type ApplicationsDeleteBranchOptions

type ApplicationsDeleteBranchOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Branch is the branch name. This field is required.
	Branch string `url:"branch"`
}

ApplicationsDeleteBranchOptions contains parameters for the DeleteBranch method.

type ApplicationsDeleteOptions

type ApplicationsDeleteOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
}

ApplicationsDeleteOptions contains parameters for the Delete method.

type ApplicationsRefreshOptions

type ApplicationsRefreshOptions struct {
	// Key is the application key. If not specified, all applications are refreshed. Optional.
	Key string `url:"key,omitempty"`
}

ApplicationsRefreshOptions contains parameters for the Refresh method.

type ApplicationsRemoveProjectOptions

type ApplicationsRemoveProjectOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Project is the project key. This field is required.
	Project string `url:"project"`
}

ApplicationsRemoveProjectOptions contains parameters for the RemoveProject method.

type ApplicationsSearchProjects

type ApplicationsSearchProjects struct {
	// Projects is the list of projects in the application.
	Projects []ApplicationProject `json:"projects,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

ApplicationsSearchProjects represents the response from the search_projects endpoint.

type ApplicationsSearchProjectsOptions

type ApplicationsSearchProjectsOptions struct {
	PaginationArgs

	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Query limits search to project names containing this string. Optional.
	Query string `url:"q,omitempty"`
	// Selected filters by selection state (selected, deselected, all). Optional.
	Selected string `url:"selected,omitempty"`
}

ApplicationsSearchProjectsOptions contains parameters for the SearchProjects method.

type ApplicationsService

type ApplicationsService struct {
	// contains filtered or unexported fields
}

ApplicationsService handles communication with the application related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*ApplicationsService) AddProject

AddProject adds a project to an application. Requires 'Administrator' permission on the application.

API endpoint: POST /api/applications/add_project. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) Create

Create creates a new application. Requires 'Administer System' or 'Create Applications' permission.

API endpoint: POST /api/applications/create. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) CreateBranch

CreateBranch creates a new branch on an application. Requires 'Administrator' permission on the application.

API endpoint: POST /api/applications/create_branch. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) Delete

Delete deletes an application definition. Requires 'Administrator' permission on the application.

API endpoint: POST /api/applications/delete. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) DeleteBranch

DeleteBranch deletes a branch on an application. Requires 'Administrator' permission on the application.

API endpoint: POST /api/applications/delete_branch. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) Refresh

Refresh triggers a recomputation of an application's measures. Requires 'Administer System' or 'Administer' rights on the application.

API endpoint: POST /api/applications/refresh. Since: 8.6. Enterprise Edition only.

func (*ApplicationsService) RemoveProject

RemoveProject removes a project from an application. Requires 'Administrator' permission on the application.

API endpoint: POST /api/applications/remove_project. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) SearchAllProjects

SearchAllProjects fetches all pages from SearchProjects and returns a flat slice of projects. Requires 'Administrator' permission on the application.

Enterprise Edition only.

func (*ApplicationsService) SearchProjects

SearchProjects lists projects manually selected in an application. Requires 'Administrator' permission on the application.

API endpoint: GET /api/applications/search_projects. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) SetTags

SetTags sets tags on an application. Requires 'Administer' permission on the application.

API endpoint: POST /api/applications/set_tags. Since: 8.3. Enterprise Edition only.

func (*ApplicationsService) Show

Show returns an application and its associated projects. Requires 'Browse' permission on the application and on its child projects.

API endpoint: GET /api/applications/show. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) ShowLeak

ShowLeak returns an application and its associated projects with new code period metrics. Requires 'Browse' permission on the application and on its child projects.

API endpoint: GET /api/applications/show_leak. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) Update

Update updates an application. Requires 'Administrator' permission on the application.

API endpoint: POST /api/applications/update. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) UpdateBranch

UpdateBranch updates a branch on an application. Requires 'Administrator' permission on the application.

API endpoint: POST /api/applications/update_branch. Since: 7.3. Enterprise Edition only.

func (*ApplicationsService) ValidateAddProjectOpt

func (s *ApplicationsService) ValidateAddProjectOpt(opt *ApplicationsAddProjectOptions) error

ValidateAddProjectOpt validates the options for the AddProject method.

func (*ApplicationsService) ValidateCreateBranchOpt

func (s *ApplicationsService) ValidateCreateBranchOpt(opt *ApplicationsCreateBranchOptions) error

ValidateCreateBranchOpt validates the options for the CreateBranch method.

func (*ApplicationsService) ValidateCreateOpt

func (s *ApplicationsService) ValidateCreateOpt(opt *ApplicationsCreateOptions) error

ValidateCreateOpt validates the options for the Create method.

func (*ApplicationsService) ValidateDeleteBranchOpt

func (s *ApplicationsService) ValidateDeleteBranchOpt(opt *ApplicationsDeleteBranchOptions) error

ValidateDeleteBranchOpt validates the options for the DeleteBranch method.

func (*ApplicationsService) ValidateDeleteOpt

func (s *ApplicationsService) ValidateDeleteOpt(opt *ApplicationsDeleteOptions) error

ValidateDeleteOpt validates the options for the Delete method.

func (*ApplicationsService) ValidateRemoveProjectOpt

func (s *ApplicationsService) ValidateRemoveProjectOpt(opt *ApplicationsRemoveProjectOptions) error

ValidateRemoveProjectOpt validates the options for the RemoveProject method.

func (*ApplicationsService) ValidateSearchProjectsOpt

func (s *ApplicationsService) ValidateSearchProjectsOpt(opt *ApplicationsSearchProjectsOptions) error

ValidateSearchProjectsOpt validates the options for the SearchProjects method.

func (*ApplicationsService) ValidateSetTagsOpt

func (s *ApplicationsService) ValidateSetTagsOpt(opt *ApplicationsSetTagsOptions) error

ValidateSetTagsOpt validates the options for the SetTags method.

func (*ApplicationsService) ValidateShowLeakOpt

func (s *ApplicationsService) ValidateShowLeakOpt(opt *ApplicationsShowLeakOptions) error

ValidateShowLeakOpt validates the options for the ShowLeak method.

func (*ApplicationsService) ValidateShowOpt

func (s *ApplicationsService) ValidateShowOpt(opt *ApplicationsShowOptions) error

ValidateShowOpt validates the options for the Show method.

func (*ApplicationsService) ValidateUpdateBranchOpt

func (s *ApplicationsService) ValidateUpdateBranchOpt(opt *ApplicationsUpdateBranchOptions) error

ValidateUpdateBranchOpt validates the options for the UpdateBranch method.

func (*ApplicationsService) ValidateUpdateOpt

func (s *ApplicationsService) ValidateUpdateOpt(opt *ApplicationsUpdateOptions) error

ValidateUpdateOpt validates the options for the Update method.

type ApplicationsSetTagsOptions

type ApplicationsSetTagsOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Tags is the list of tags to set on the application. This field is required.
	Tags []string `url:"tags,comma"`
}

ApplicationsSetTagsOptions contains parameters for the SetTags method.

type ApplicationsShow

type ApplicationsShow struct {
	// Application contains the application details.
	Application ApplicationDetails `json:"application,omitzero"`
}

ApplicationsShow represents the response from the show endpoint.

type ApplicationsShowLeak

type ApplicationsShowLeak struct {
	// Leaks is the list of new code period dates per project in the application.
	Leaks []ApplicationLeakPeriod `json:"leaks,omitempty"`
}

ApplicationsShowLeak represents the response from the show_leak endpoint.

type ApplicationsShowLeakOptions

type ApplicationsShowLeakOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Branch is the branch name. Optional.
	Branch string `url:"branch,omitempty"`
}

ApplicationsShowLeakOptions contains parameters for the ShowLeak method.

type ApplicationsShowOptions

type ApplicationsShowOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Branch is the branch name. Optional.
	Branch string `url:"branch,omitempty"`
}

ApplicationsShowOptions contains parameters for the Show method.

type ApplicationsUpdateBranchOptions

type ApplicationsUpdateBranchOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Branch is the current branch name. This field is required.
	Branch string `url:"branch"`
	// Name is the new branch name. This field is required.
	Name string `url:"name"`
	// Project is the list of project keys. This field is required.
	Project []string `url:"project"`
	// ProjectBranch is the list of project branch names. This field is required.
	ProjectBranch []string `url:"projectBranch"`
}

ApplicationsUpdateBranchOptions contains parameters for the UpdateBranch method.

type ApplicationsUpdateOptions

type ApplicationsUpdateOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Description is the new description for the application. Optional.
	Description string `url:"description,omitempty"`
	// Name is the new name for the application. This field is required.
	Name string `url:"name"`
}

ApplicationsUpdateOptions contains parameters for the Update method.

type ArchitectureConstraint added in v2.2.2

type ArchitectureConstraint struct {
	// From is the key of the source node.
	From string `json:"from,omitempty"`
	// To is the key of the destination node.
	To string `json:"to,omitempty"`
}

ArchitectureConstraint is a directed "from -> to" edge constraint used by intended-architecture groups and model perspectives.

type ArchitectureCreateDirectiveOptions added in v2.2.2

type ArchitectureCreateDirectiveOptions struct {
	// ProjectId is the project identifier. This field is required.
	ProjectId string `json:"projectId"`
	// Origin describes where the directive originated from. Optional.
	Origin string `json:"origin,omitempty"`
	// DirectiveData is the change the directive applies. This field is required.
	DirectiveData ArchitectureDirectiveData `json:"directiveData"`
}

ArchitectureCreateDirectiveOptions contains the request body for the CreateDirective method.

type ArchitectureCreateModelOptions added in v2.2.2

type ArchitectureCreateModelOptions struct {
	// Model is the perspective set that makes up the model. Optional.
	Model *ArchitectureModelData `json:"model,omitempty"`
	// ProjectId is the project identifier. This field is required.
	ProjectId string `json:"projectId"`
	// OrganizationId is the identifier of the owning organization. Optional.
	OrganizationId string `json:"organizationId,omitempty"`
	// Data is an opaque, implementation-defined payload. Optional.
	Data string `json:"data,omitempty"`
}

ArchitectureCreateModelOptions contains the request body for the CreateModel method.

type ArchitectureDirective added in v2.2.2

type ArchitectureDirective struct {
	// Id is the directive's unique identifier.
	Id string `json:"id,omitempty"`
	// ProjectId is the identifier of the project the directive belongs to.
	ProjectId string `json:"projectId,omitempty"`
	// Origin describes where the directive originated from.
	Origin string `json:"origin,omitempty"`
	// DirectiveData is the change the directive applies.
	DirectiveData ArchitectureDirectiveData `json:"directiveData,omitzero"`
}

ArchitectureDirective represents a stored architecture directive.

type ArchitectureDirectiveData added in v2.2.2

type ArchitectureDirectiveData struct {
	// ToNodeKey is the key of the destination node. May be empty depending on Type.
	ToNodeKey string `json:"toNodeKey,omitempty"`
	// FromNodeKey is the key of the source node.
	FromNodeKey string `json:"fromNodeKey,omitempty"`
	// GraphPerspective is the perspective the directive applies to.
	GraphPerspective string `json:"graphPerspective,omitempty"`
	// GraphType is the graph type. One of "file_graph", "namespace_graph".
	GraphType string `json:"graphType,omitempty"`
	// GraphEcoSystem is the language ecosystem. One of "java", "js", "ts", "py", "cs".
	GraphEcoSystem string `json:"graphEcoSystem,omitempty"`
	// Type is the directive type. One of "REMOVE_EDGE", "RENAME_NODE", "MOVE_NODE".
	Type string `json:"type,omitempty"`
	// Description is an optional human-readable description.
	Description string `json:"description,omitempty"`
}

ArchitectureDirectiveData describes the change a directive applies to an architecture graph.

type ArchitectureDirectivesList added in v2.2.2

type ArchitectureDirectivesList struct {
	// Directives is the current page of directives.
	Directives []ArchitectureDirective `json:"directives,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

ArchitectureDirectivesList is the paginated response returned by ListDirectives.

type ArchitectureFileGraphOptions

type ArchitectureFileGraphOptions struct {
	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
	// BranchKey is the branch key. This field is required.
	BranchKey string `json:"branchKey"`
	// Source is the language/analyzer that produced this graph, e.g. "java", "python", "js".
	// This field is required.
	Source string `json:"source"`
}

ArchitectureFileGraphOptions contains parameters for the FileGraph method.

type ArchitectureGraphMetadata added in v2.2.0

type ArchitectureGraphMetadata map[string]any

ArchitectureGraphMetadata represents the metadata of a single graph as returned by SearchGraphs. The SonarQube V2 API spec declares this as a generic/loosely typed schema, so it is decoded into a string-keyed map rather than a fixed struct.

type ArchitectureIntendedGroup added in v2.2.2

type ArchitectureIntendedGroup struct {
	// Label is the group label.
	Label string `json:"label,omitempty"`
	// Interface indicates whether the group is an interface group.
	Interface *bool `json:"interface,omitempty"`
	// InterfaceAccess indicates whether interface access is allowed.
	InterfaceAccess *bool `json:"interfaceAccess,omitempty"`
	// Patterns is the list of glob patterns that assign nodes to the group.
	Patterns []string `json:"patterns,omitempty"`
	// Groups is the list of nested sub-groups.
	Groups []ArchitectureIntendedGroup `json:"groups,omitempty"`
}

ArchitectureIntendedGroup is a node grouping in an intended-architecture export.

type ArchitectureIntendedItem added in v2.2.2

type ArchitectureIntendedItem struct {
	// Id is the intended-architecture item identifier.
	Id string `json:"id,omitempty"`
	// Language is the language ecosystem. One of "java", "js", "ts", "py", "cs".
	Language string `json:"language,omitempty"`
	// Type is the item type. One of "file", "namespace".
	Type string `json:"type,omitempty"`
	// Constraints is the list of "from -> to" edge constraints.
	Constraints []ArchitectureConstraint `json:"constraints,omitempty"`
	// Groups is the list of node groups.
	Groups []ArchitectureIntendedGroup `json:"groups,omitempty"`
}

ArchitectureIntendedItem is one entry of an intended-architecture export.

type ArchitectureIntendedOptions added in v2.2.2

type ArchitectureIntendedOptions struct {
	// ProjectId is the project identifier. This field is required.
	ProjectId string `json:"projectId"`
}

ArchitectureIntendedOptions contains parameters for the GetIntendedArchitecture method.

type ArchitectureListDirectivesOptions added in v2.2.2

type ArchitectureListDirectivesOptions struct {
	PaginationParamsV2

	// ProjectId is the project identifier. This field is required.
	ProjectId string `json:"projectId"`
}

ArchitectureListDirectivesOptions contains parameters for the ListDirectives method.

type ArchitectureListSnapshotsOptions added in v2.2.2

type ArchitectureListSnapshotsOptions struct {
	PaginationParamsV2

	// OrganizationId is the owning organization identifier. This field is required.
	OrganizationId string `json:"organizationId"`
	// BranchId is the branch identifier. This field is required.
	BranchId string `json:"branchId"`
}

ArchitectureListSnapshotsOptions contains parameters for the ListSnapshots method.

type ArchitectureModel added in v2.2.2

type ArchitectureModel struct {
	// Id is the model's unique identifier.
	Id string `json:"id,omitempty"`
	// ProjectId is the identifier of the project the model belongs to.
	ProjectId string `json:"projectId,omitempty"`
	// OrganizationId is the identifier of the owning organization.
	OrganizationId string `json:"organizationId,omitempty"`
	// Data is an opaque, implementation-defined payload.
	Data string `json:"data,omitempty"`
	// Model is the perspective set that makes up the model.
	Model ArchitectureModelData `json:"model,omitzero"`
}

ArchitectureModel represents a stored architecture model.

type ArchitectureModelData added in v2.2.2

type ArchitectureModelData struct {
	// Perspectives is the list of model perspectives.
	Perspectives []ArchitectureModelPerspective `json:"perspectives,omitempty"`
}

ArchitectureModelData is the perspective set that makes up a model.

type ArchitectureModelGroup added in v2.2.2

type ArchitectureModelGroup struct {
	// Label is the group label.
	Label string `json:"label,omitempty"`
	// Description is an optional description.
	Description string `json:"description,omitempty"`
	// PatternId identifies the pattern set the group is derived from.
	PatternId string `json:"patternId,omitempty"`
	// Interface indicates whether the group is an interface group.
	Interface *bool `json:"interface,omitempty"`
	// InterfaceAccess indicates whether interface access is allowed.
	InterfaceAccess *bool `json:"interfaceAccess,omitempty"`
	// Patterns is the list of glob patterns that assign nodes to the group.
	Patterns []string `json:"patterns,omitempty"`
	// Groups is the list of nested sub-groups.
	Groups []ArchitectureModelGroup `json:"groups,omitempty"`
}

ArchitectureModelGroup is a node grouping within a model perspective.

type ArchitectureModelPerspective added in v2.2.2

type ArchitectureModelPerspective struct {
	// Qualifiers is the node qualifier the perspective applies to. One of "file", "namespace".
	Qualifiers string `json:"qualifiers,omitempty"`
	// Language is the language ecosystem. One of "java", "js", "ts", "py", "cs".
	Language string `json:"language,omitempty"`
	// Label is an optional perspective label.
	Label string `json:"label,omitempty"`
	// Description is an optional perspective description.
	Description string `json:"description,omitempty"`
	// Groups is the list of node groups.
	Groups []ArchitectureModelGroup `json:"groups,omitempty"`
	// Constraints is the list of "from -> to" edge constraints.
	Constraints []ArchitectureConstraint `json:"constraints,omitempty"`
}

ArchitectureModelPerspective is one perspective (a language/qualifier view) of a model.

type ArchitectureModelsListOptions added in v2.2.2

type ArchitectureModelsListOptions struct {
	// ProjectId is the project identifier. This field is required.
	ProjectId string `json:"projectId"`
}

ArchitectureModelsListOptions contains parameters for the ListModels method.

type ArchitectureProjectConfiguration added in v2.2.2

type ArchitectureProjectConfiguration struct {
	// ProjectId is the project identifier.
	ProjectId string `json:"projectId,omitempty"`
	// IntendedArchitecture is the raw intended-architecture definition, if any.
	IntendedArchitecture string `json:"intendedArchitecture,omitempty"`
	// BoundaryDescriptors is the list of boundary descriptor keys.
	BoundaryDescriptors []string `json:"boundaryDescriptors,omitempty"`
	// Directives is the list of directive identifiers applied to the project.
	Directives []string `json:"directives,omitempty"`
}

ArchitectureProjectConfiguration describes the architecture configuration of a project.

type ArchitectureProjectConfigurationsOptions added in v2.2.2

type ArchitectureProjectConfigurationsOptions struct {
	// ProjectId filters by project identifier. Optional.
	ProjectId string `json:"projectId,omitempty"`
	// ProjectKey filters by project key. Optional.
	ProjectKey string `json:"projectKey,omitempty"`
}

ArchitectureProjectConfigurationsOptions contains parameters for the GetProjectConfigurations and GetPrivateProjectConfigurations methods. At least one of ProjectId or ProjectKey should be provided.

type ArchitectureScannerDataOptions added in v2.2.2

type ArchitectureScannerDataOptions struct {
	// AnalysisId is the analysis identifier. This field is required.
	AnalysisId string `json:"analysisId"`
}

ArchitectureScannerDataOptions contains the request body for the InitiateScannerDataUpload method.

type ArchitectureScannerDataUpload added in v2.2.2

type ArchitectureScannerDataUpload struct {
	// Id is the identifier of the pending upload.
	Id string `json:"id,omitempty"`
	// UploadUrl is the URL to upload the scanner data to.
	UploadUrl string `json:"uploadUrl,omitempty"`
}

ArchitectureScannerDataUpload is returned by InitiateScannerDataUpload and carries the URL the scanner should PUT its data to.

type ArchitectureSearchGraphsOptions added in v2.2.0

type ArchitectureSearchGraphsOptions struct {
	// ProjectKey is the key of the project. This field is required.
	ProjectKey string `json:"projectKey"`
	// BranchKey is the key of the branch. This field is required.
	BranchKey string `json:"branchKey"`
}

ArchitectureSearchGraphsOptions contains parameters for the SearchGraphs method.

type ArchitectureService

type ArchitectureService struct {
	// contains filtered or unexported fields
}

ArchitectureService handles communication with the architecture V2 API endpoints. This service is only available in Enterprise Edition. The underlying endpoint is marked internal by SonarQube (x-sonar-internal) and its request/response contract may change without notice between SonarQube versions.

func (*ArchitectureService) CreateDirective added in v2.2.2

CreateDirective stores a new architecture directive for a project.

API endpoint: POST /api/v2/architecture/directives. Enterprise Edition only.

func (*ArchitectureService) CreateModel added in v2.2.2

CreateModel stores a new architecture model for a project.

API endpoint: POST /api/v2/architecture/models. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) DeleteDirective added in v2.2.2

func (s *ArchitectureService) DeleteDirective(ctx context.Context, directiveID string) (*http.Response, error)

DeleteDirective removes an architecture directive by id.

API endpoint: DELETE /api/v2/architecture/directives/{id}. Enterprise Edition only.

func (*ArchitectureService) DeleteModel added in v2.2.2

func (s *ArchitectureService) DeleteModel(ctx context.Context, modelID string) (*http.Response, error)

DeleteModel removes an architecture model by id.

API endpoint: DELETE /api/v2/architecture/models/{id}. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) FileGraph

FileGraph returns the file dependency graph for a project branch, for the given source language. Requires 'Browse' permission on the project.

The SonarQube API documents this endpoint's response as an opaque JSON string; its exact payload format (e.g. serialized graph nodes/edges, DOT graph text) is not published, so the decoded string is returned as-is for callers to parse as needed.

API endpoint: GET /api/v2/architecture/file-graph. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) GetDirective added in v2.2.2

func (s *ArchitectureService) GetDirective(ctx context.Context, directiveID string) (*ArchitectureDirective, *http.Response, error)

GetDirective returns a single architecture directive by id.

API endpoint: GET /api/v2/architecture/directives/{id}. Enterprise Edition only.

func (*ArchitectureService) GetGraph added in v2.2.0

func (s *ArchitectureService) GetGraph(ctx context.Context, graphID string) (*string, *http.Response, error)

GetGraph returns the graph data for the given graph ID, as produced by analysis. Requires 'Browse' permission on the project.

The SonarQube API documents this endpoint's response as an opaque string (content type "application/graph+json"); its exact payload format is not published, so the decoded string is returned as-is for callers to parse as needed.

API endpoint: GET /api/v2/architecture/graphs/{id}. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) GetIntendedArchitecture added in v2.2.2

GetIntendedArchitecture exports the intended architecture defined for a project.

API endpoint: GET /api/v2/architecture/intended. Enterprise Edition only.

func (*ArchitectureService) GetModel added in v2.2.2

GetModel returns a single architecture model by id.

API endpoint: GET /api/v2/architecture/models/{id}. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) GetPrivateProjectConfigurations added in v2.2.2

GetPrivateProjectConfigurations returns architecture configurations for one or more projects via the internal variant of the endpoint.

API endpoint: GET /api/v2/architecture/private/architecture/project-configurations. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) GetProjectConfigurations added in v2.2.2

GetProjectConfigurations returns architecture configurations for one or more projects.

API endpoint: GET /api/v2/architecture/project-configurations. Enterprise Edition only.

func (*ArchitectureService) GetStructure added in v2.2.2

GetStructure returns the structure graph(s) for a branch and language ecosystem.

API endpoint: GET /api/v2/architecture/structure. Enterprise Edition only.

func (*ArchitectureService) InitiateScannerDataUpload added in v2.2.2

InitiateScannerDataUpload registers a scanner-data upload for an analysis and returns the URL the scanner should upload its report to.

API endpoint: POST /api/v2/architecture/scanner-data. Enterprise Edition only.

func (*ArchitectureService) ListDirectives added in v2.2.2

ListDirectives returns the paginated list of architecture directives stored for a project.

API endpoint: GET /api/v2/architecture/directives. Enterprise Edition only.

func (*ArchitectureService) ListModels added in v2.2.2

ListModels returns the architecture models stored for a project.

API endpoint: GET /api/v2/architecture/models. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) ListSnapshots added in v2.2.2

ListSnapshots returns the paginated list of architecture snapshots for a branch.

API endpoint: GET /api/v2/architecture/snapshots. Enterprise Edition only.

func (*ArchitectureService) SearchGraphs added in v2.2.0

SearchGraphs returns the metadata of all graphs currently available for a project branch. This endpoint does not include the graph data itself; use GetGraph to retrieve it. Requires 'Browse' permission on the project.

API endpoint: GET /api/v2/architecture/graphs. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) StoreAnalysis added in v2.2.2

StoreAnalysis stores architecture analysis data and returns the created analysis identifier as reported by the server.

API endpoint: POST /api/v2/architecture/analysis. Enterprise Edition only.

func (*ArchitectureService) UpdateModel added in v2.2.2

UpdateModel applies a merge-patch update to an architecture model.

API endpoint: PATCH /api/v2/architecture/models/{id}. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ArchitectureService) UploadScannerData added in v2.2.2

UploadScannerData uploads a scanner data report directly as multipart/form-data.

API endpoint: POST /api/v2/architecture/scanner-data-upload. Enterprise Edition only.

func (*ArchitectureService) ValidateCreateDirectiveOpt added in v2.2.2

func (s *ArchitectureService) ValidateCreateDirectiveOpt(opt *ArchitectureCreateDirectiveOptions) error

ValidateCreateDirectiveOpt validates the options for the CreateDirective method.

func (*ArchitectureService) ValidateCreateModelOpt added in v2.2.2

func (s *ArchitectureService) ValidateCreateModelOpt(opt *ArchitectureCreateModelOptions) error

ValidateCreateModelOpt validates the options for the CreateModel method.

func (*ArchitectureService) ValidateDirectiveIDOpt added in v2.2.2

func (s *ArchitectureService) ValidateDirectiveIDOpt(directiveID string) error

ValidateDirectiveIDOpt validates a directive id path parameter.

func (*ArchitectureService) ValidateFileGraphOpt

func (s *ArchitectureService) ValidateFileGraphOpt(opt *ArchitectureFileGraphOptions) error

ValidateFileGraphOpt validates the options for the FileGraph method.

func (*ArchitectureService) ValidateGetGraphOpt added in v2.2.0

func (s *ArchitectureService) ValidateGetGraphOpt(graphID string) error

ValidateGetGraphOpt validates the graphID parameter for the GetGraph method.

func (*ArchitectureService) ValidateIntendedOpt added in v2.2.2

func (s *ArchitectureService) ValidateIntendedOpt(opt *ArchitectureIntendedOptions) error

ValidateIntendedOpt validates the options for the GetIntendedArchitecture method.

func (*ArchitectureService) ValidateListDirectivesOpt added in v2.2.2

func (s *ArchitectureService) ValidateListDirectivesOpt(opt *ArchitectureListDirectivesOptions) error

ValidateListDirectivesOpt validates the options for the ListDirectives method.

func (*ArchitectureService) ValidateListModelsOpt added in v2.2.2

func (s *ArchitectureService) ValidateListModelsOpt(opt *ArchitectureModelsListOptions) error

ValidateListModelsOpt validates the options for the ListModels method.

func (*ArchitectureService) ValidateListSnapshotsOpt added in v2.2.2

func (s *ArchitectureService) ValidateListSnapshotsOpt(opt *ArchitectureListSnapshotsOptions) error

ValidateListSnapshotsOpt validates the options for the ListSnapshots method.

func (*ArchitectureService) ValidateModelIDOpt added in v2.2.2

func (s *ArchitectureService) ValidateModelIDOpt(modelID string) error

ValidateModelIDOpt validates a model id path parameter.

func (*ArchitectureService) ValidateScannerDataOpt added in v2.2.2

func (s *ArchitectureService) ValidateScannerDataOpt(opt *ArchitectureScannerDataOptions) error

ValidateScannerDataOpt validates the options for the InitiateScannerDataUpload method.

func (*ArchitectureService) ValidateSearchGraphsOpt added in v2.2.0

func (s *ArchitectureService) ValidateSearchGraphsOpt(opt *ArchitectureSearchGraphsOptions) error

ValidateSearchGraphsOpt validates the options for the SearchGraphs method.

func (*ArchitectureService) ValidateStructureOpt added in v2.2.2

func (s *ArchitectureService) ValidateStructureOpt(opt *ArchitectureStructureOptions) error

ValidateStructureOpt validates the options for the GetStructure method.

func (*ArchitectureService) ValidateUploadScannerDataOpt added in v2.2.2

func (s *ArchitectureService) ValidateUploadScannerDataOpt(opt *ArchitectureUploadScannerDataOptions) error

ValidateUploadScannerDataOpt validates the options for the UploadScannerData method.

type ArchitectureSnapshot added in v2.2.2

type ArchitectureSnapshot struct {
	// Id is the snapshot identifier.
	Id string `json:"id,omitempty"`
	// ProjectId is the project identifier.
	ProjectId string `json:"projectId,omitempty"`
	// OrganizationId is the owning organization identifier.
	OrganizationId string `json:"organizationId,omitempty"`
	// BranchId is the branch identifier.
	BranchId string `json:"branchId,omitempty"`
	// AnalysisId is the analysis identifier, if any.
	AnalysisId string `json:"analysisId,omitempty"`
	// AnalysisDate is the analysis date, if any.
	AnalysisDate string `json:"analysisDate,omitempty"`
	// AggregatedMeasures holds the measures aggregated across every ecosystem.
	AggregatedMeasures ArchitectureSnapshotMeasures `json:"aggregatedMeasures,omitzero"`
	// Measures holds the per-ecosystem measures.
	Measures []ArchitectureSnapshotEcosystemMeasures `json:"measures,omitempty"`
}

ArchitectureSnapshot represents a single architecture analysis snapshot.

type ArchitectureSnapshotEcosystemMeasures added in v2.2.2

type ArchitectureSnapshotEcosystemMeasures struct {
	// Ecosystem is the language ecosystem. One of "java", "js", "ts", "py", "cs".
	Ecosystem string `json:"ecosystem,omitempty"`
	// Values holds the measures for the ecosystem.
	Values ArchitectureSnapshotMeasures `json:"values,omitzero"`
}

ArchitectureSnapshotEcosystemMeasures pairs a language ecosystem with its measures.

type ArchitectureSnapshotMeasures added in v2.2.2

type ArchitectureSnapshotMeasures struct {
	// ArchitectureCoverage is the fraction of the graph covered by the intended architecture.
	ArchitectureCoverage string `json:"architectureCoverage,omitempty"`
	// ArchitectureCoverageSummary is a human-readable coverage summary.
	ArchitectureCoverageSummary string `json:"architectureCoverageSummary,omitempty"`
	// NumStructuralDirectives is the number of structural directives.
	NumStructuralDirectives string `json:"numStructuralDirectives,omitempty"`
	// NumRelationshipDirectives is the number of relationship directives.
	NumRelationshipDirectives string `json:"numRelationshipDirectives,omitempty"`
	// NumUnimplemented is the number of unimplemented intended elements.
	NumUnimplemented string `json:"numUnimplemented,omitempty"`
	// NumWeakTangledNodes is the number of weakly tangled nodes.
	NumWeakTangledNodes string `json:"numWeakTangledNodes,omitempty"`
	// NumMisplaced is the number of misplaced nodes.
	NumMisplaced string `json:"numMisplaced,omitempty"`
	// NumTangles is the number of tangles.
	NumTangles string `json:"numTangles,omitempty"`
	// NumSplitNodes is the number of split nodes.
	NumSplitNodes string `json:"numSplitNodes,omitempty"`
	// NumWeakTangles is the number of weak tangles.
	NumWeakTangles string `json:"numWeakTangles,omitempty"`
	// NumGraphNodes is the number of nodes in the graph.
	NumGraphNodes string `json:"numGraphNodes,omitempty"`
	// NumGraphEdges is the number of edges in the graph.
	NumGraphEdges string `json:"numGraphEdges,omitempty"`
	// NumDisallowed is the number of disallowed edges.
	NumDisallowed string `json:"numDisallowed,omitempty"`
	// NumInterfaceIssues is the number of interface issues.
	NumInterfaceIssues string `json:"numInterfaceIssues,omitempty"`
	// MaxWeakTangleSize is the size of the largest weak tangle.
	MaxWeakTangleSize string `json:"maxWeakTangleSize,omitempty"`
	// NumStructuralIssues is the number of structural issues.
	NumStructuralIssues string `json:"numStructuralIssues,omitempty"`
}

ArchitectureSnapshotMeasures holds the aggregated architecture measures of a snapshot.

type ArchitectureSnapshotsList added in v2.2.2

type ArchitectureSnapshotsList struct {
	// Snapshots is the current page of snapshots.
	Snapshots []ArchitectureSnapshot `json:"snapshots,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

ArchitectureSnapshotsList is the paginated response returned by ListSnapshots.

type ArchitectureStoreAnalysisOptions added in v2.2.2

type ArchitectureStoreAnalysisOptions struct {
	// AnalysisId is the analysis identifier. Optional.
	AnalysisId string `json:"analysisId,omitempty"`
	// CeTaskId is the Compute Engine task identifier. Optional.
	CeTaskId string `json:"ceTaskId,omitempty"`
}

ArchitectureStoreAnalysisOptions contains the request body for the StoreAnalysis method.

type ArchitectureStructureEdge added in v2.2.2

type ArchitectureStructureEdge struct {
	// ToId is the identifier of the destination node.
	ToId int `json:"toId,omitempty"`
	// Weight is the edge weight.
	Weight int `json:"weight,omitempty"`
}

ArchitectureStructureEdge is a directed, weighted edge between two structure nodes.

type ArchitectureStructureGraph added in v2.2.2

type ArchitectureStructureGraph struct {
	// Id is the graph identifier.
	Id string `json:"id,omitempty"`
	// Nodes is the list of top-level nodes.
	Nodes []ArchitectureStructureNode `json:"nodes,omitempty"`
	// NodeCount is the total number of nodes in the graph.
	NodeCount int `json:"nodeCount,omitempty"`
	// EdgeCount is the total number of edges in the graph.
	EdgeCount int `json:"edgeCount,omitempty"`
}

ArchitectureStructureGraph is a structure graph for one language ecosystem.

type ArchitectureStructureNode added in v2.2.2

type ArchitectureStructureNode struct {
	// Name is the node name.
	Name string `json:"name,omitempty"`
	// Kind is the node kind.
	Kind string `json:"kind,omitempty"`
	// MappedKind is the node kind mapped to a canonical taxonomy, if any.
	MappedKind string `json:"mappedKind,omitempty"`
	// Edges is the list of outgoing edges.
	Edges []ArchitectureStructureEdge `json:"edges,omitempty"`
	// Nodes is the list of nested child nodes.
	Nodes []ArchitectureStructureNode `json:"nodes,omitempty"`
	// Id is the node identifier, unique within the graph.
	Id int `json:"id,omitempty"`
}

ArchitectureStructureNode is a node of a structure graph. Nodes nest recursively.

type ArchitectureStructureOptions added in v2.2.2

type ArchitectureStructureOptions struct {
	// OrganizationId is the owning organization identifier. This field is required.
	OrganizationId string `json:"organizationId"`
	// BranchId is the branch identifier. This field is required.
	BranchId string `json:"branchId"`
	// Ecosystem is the language ecosystem. This field is required.
	// One of "java", "js", "ts", "py", "cs".
	Ecosystem string `json:"ecosystem"`
}

ArchitectureStructureOptions contains parameters for the GetStructure method.

type ArchitectureUpdateModelOptions added in v2.2.2

type ArchitectureUpdateModelOptions struct {
	// Model is the perspective set that makes up the model. Optional.
	Model *ArchitectureModelData `json:"model,omitempty"`
	// Data is an opaque, implementation-defined payload. Optional.
	Data string `json:"data,omitempty"`
}

ArchitectureUpdateModelOptions contains the merge-patch request body for the UpdateModel method.

type ArchitectureUploadScannerDataOptions added in v2.2.2

type ArchitectureUploadScannerDataOptions struct {
	// CeTaskId is the Compute Engine task identifier. This field is required.
	CeTaskId string
	// Payload is the scanner data report bytes. This field is required.
	Payload io.Reader
	// PayloadFilename is the file name to attach to the multipart part. Optional;
	// defaults to "payload".
	PayloadFilename string
}

ArchitectureUploadScannerDataOptions contains parameters for the UploadScannerData method.

type AtlassianAuthURLOptions added in v2.2.0

type AtlassianAuthURLOptions struct {
	// SonarOrganizationKey is the key of the SonarQube organization initiating
	// the Jira OAuth flow. This field is required.
	SonarOrganizationKey string `json:"sonarOrganizationKey"`
	// SonarOrganizationUuid is the UUID of the SonarQube organization initiating
	// the Jira OAuth flow. This field is required.
	SonarOrganizationUuid string `json:"sonarOrganizationUuid"`
}

AtlassianAuthURLOptions contains query parameters for generating the Jira OAuth authentication URL.

type AtlassianAuthenticationConfigureOptions added in v2.2.0

type AtlassianAuthenticationConfigureOptions struct {
	// ClientId is the Atlassian 3LO App Client ID. This field is required.
	ClientId string `json:"clientId"`
	// Secret is the Atlassian 3LO App Secret. This field is required.
	Secret string `json:"secret"`
}

AtlassianAuthenticationConfigureOptions contains parameters for creating or updating the Atlassian OAuth application configuration.

type AtlassianAuthenticationDetails added in v2.2.0

type AtlassianAuthenticationDetails struct {
	// ClientId is the Atlassian 3LO App Client ID.
	ClientId string `json:"clientId,omitempty"`
}

AtlassianAuthenticationDetails represents the Atlassian OAuth application configuration. Only the client ID is ever returned by the API; the secret is write-only and never echoed back for security purposes.

type AtlassianService added in v2.2.0

type AtlassianService struct {
	// contains filtered or unexported fields
}

AtlassianService handles communication with the Atlassian (Jira/Confluence Connect) related methods of the SonarQube V2 API.

func (*AtlassianService) CreateOrUpdateApplicationConfiguration added in v2.2.0

CreateOrUpdateApplicationConfiguration creates or updates the Atlassian Authentication details (client ID and secret) used for the Jira/Confluence OAuth integration.

func (*AtlassianService) GetApplicationConfiguration added in v2.2.0

func (s *AtlassianService) GetApplicationConfiguration(ctx context.Context) (*AtlassianAuthenticationDetails, *http.Response, error)

GetApplicationConfiguration fetches the Atlassian Authentication details if they exist. Only the client ID is returned, for security purposes. Requires authenticated user.

func (*AtlassianService) GetAuthURL added in v2.2.0

GetAuthURL generates the authentication URL to start the Jira OAuth flow for the given SonarQube organization. Requires authenticated user.

func (*AtlassianService) ValidateAuthURLOpt added in v2.2.0

func (s *AtlassianService) ValidateAuthURLOpt(opt *AtlassianAuthURLOptions) error

ValidateAuthURLOpt validates the AtlassianAuthURLOptions.

func (*AtlassianService) ValidateConfigureApplicationOpt added in v2.2.0

func (s *AtlassianService) ValidateConfigureApplicationOpt(opt *AtlassianAuthenticationConfigureOptions) error

ValidateConfigureApplicationOpt validates the AtlassianAuthenticationConfigureOptions.

type AuditLogsDownloadOptions

type AuditLogsDownloadOptions struct {
	// From is the start datetime in ISO 8601 format. This field is required.
	From string `url:"from"`
	// To is the end datetime in ISO 8601 format. This field is required.
	To string `url:"to"`
}

AuditLogsDownloadOptions contains parameters for the Download method.

type AuditLogsService

type AuditLogsService struct {
	// contains filtered or unexported fields
}

AuditLogsService handles communication with the audit logs related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*AuditLogsService) Download

Download downloads the audit logs for the given time range as raw JSON bytes. Requires 'Administer System' permission.

API endpoint: GET /api/audit_logs/download. Since: 9.1. Enterprise Edition only.

func (*AuditLogsService) ValidateDownloadOpt

func (s *AuditLogsService) ValidateDownloadOpt(opt *AuditLogsDownloadOptions) error

ValidateDownloadOpt validates the options for the Download method.

type AuthenticationLoginOptions

type AuthenticationLoginOptions struct {
	// Login is the login/username of the user.
	// This field is required.
	Login string `url:"login"`
	// Password is the password of the user.
	// This field is required.
	Password string `url:"password"`
}

AuthenticationLoginOptions contains parameters for the Login method.

type AuthenticationService

type AuthenticationService struct {
	// contains filtered or unexported fields
}

AuthenticationService handles communication with the authentication related methods of the SonarQube API. This service handles user authentication.

func (*AuthenticationService) Login

Login authenticates a user.

API endpoint: POST /api/authentication/login.

func (*AuthenticationService) Logout

Logout logs out the current user.

API endpoint: POST /api/authentication/logout.

func (*AuthenticationService) Validate

Validate checks if the current credentials are valid.

API endpoint: GET /api/authentication/validate.

func (*AuthenticationService) ValidateLoginOpt

func (s *AuthenticationService) ValidateLoginOpt(opt *AuthenticationLoginOptions) error

ValidateLoginOpt validates the options for the Login method.

type AuthenticationValidation

type AuthenticationValidation struct {
	// Valid indicates whether the credentials are valid.
	Valid bool `json:"valid,omitempty"`
}

AuthenticationValidation represents the response from validating credentials.

type AuthorizationsCreateGroupMembershipOptions

type AuthorizationsCreateGroupMembershipOptions struct {
	// GroupId is the ID of the group.
	GroupId string `json:"groupId,omitempty"`
	// UserId is the ID of the user.
	UserId string `json:"userId,omitempty"`
}

AuthorizationsCreateGroupMembershipOptions contains parameters for creating a group membership.

type AuthorizationsCreateGroupOptions

type AuthorizationsCreateGroupOptions struct {
	// Description is the group description. Maximum 200 characters.
	Description string `json:"description,omitempty"`
	// Name is the group name. Must be unique. The value 'anyone' is reserved.
	// This field is required. Must be between 1 and 255 characters.
	Name string `json:"name"`
}

AuthorizationsCreateGroupOptions contains parameters for creating a group.

type AuthorizationsGroup

type AuthorizationsGroup struct {
	// Default indicates whether this is a default group.
	Default bool `json:"default,omitempty"`
	// Description is the group description.
	Description string `json:"description,omitempty"`
	// Id is the group's unique identifier.
	Id string `json:"id,omitempty"`
	// Managed indicates whether the group is managed externally.
	Managed bool `json:"managed,omitempty"`
	// Name is the group name.
	Name string `json:"name,omitempty"`
}

AuthorizationsGroup represents a group returned by V2 API endpoints.

type AuthorizationsGroupMembership

type AuthorizationsGroupMembership struct {
	// GroupId is the group's unique identifier.
	GroupId string `json:"groupId,omitempty"`
	// Id is the membership's unique identifier.
	Id string `json:"id,omitempty"`
	// UserId is the user's unique identifier.
	UserId string `json:"userId,omitempty"`
}

AuthorizationsGroupMembership represents a group membership returned by V2 API endpoints.

type AuthorizationsGroupMembershipsSearch

type AuthorizationsGroupMembershipsSearch struct {
	// GroupMemberships is the list of group memberships.
	GroupMemberships []AuthorizationsGroupMembership `json:"groupMemberships,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

AuthorizationsGroupMembershipsSearch represents the response from searching group memberships.

type AuthorizationsGroupsSearch

type AuthorizationsGroupsSearch struct {
	// Groups is the list of groups.
	Groups []AuthorizationsGroup `json:"groups,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

AuthorizationsGroupsSearch represents the response from searching groups.

type AuthorizationsSearchGroupMembershipsOptions

type AuthorizationsSearchGroupMembershipsOptions struct {
	PaginationParamsV2

	// GroupId filters memberships by group ID.
	GroupId string `json:"groupId,omitempty"`
	// UserId filters memberships by user ID.
	UserId string `json:"userId,omitempty"`
}

AuthorizationsSearchGroupMembershipsOptions contains query parameters for the SearchGroupMemberships method.

type AuthorizationsSearchGroupsOptions

type AuthorizationsSearchGroupsOptions struct {
	PaginationParamsV2

	// Managed filters managed or non-managed groups.
	Managed *bool `json:"managed,omitempty"`
	// Query filters on group name (partial match, case insensitive).
	Query string `json:"q,omitempty"`
	// UserId filters groups containing the user. Only available for system administrators.
	// Internal: this parameter is marked as internal in the SonarQube API.
	UserId string `json:"userId,omitempty"`
}

AuthorizationsSearchGroupsOptions contains query parameters for the SearchGroups method.

type AuthorizationsService

type AuthorizationsService struct {
	// contains filtered or unexported fields
}

AuthorizationsService handles communication with the Authorizations related methods of the SonarQube V2 API.

func (*AuthorizationsService) CreateGroup

CreateGroup creates a new group.

func (*AuthorizationsService) CreateGroupMembership

CreateGroupMembership adds a user to a group.

func (*AuthorizationsService) DeleteGroup

func (s *AuthorizationsService) DeleteGroup(ctx context.Context, groupID string) (*http.Response, error)

DeleteGroup deletes a group by ID.

func (*AuthorizationsService) DeleteGroupMembership

func (s *AuthorizationsService) DeleteGroupMembership(ctx context.Context, membershipID string) (*http.Response, error)

DeleteGroupMembership removes a user from a group.

func (*AuthorizationsService) GetGroup

GetGroup retrieves a single group by ID.

func (*AuthorizationsService) SearchGroupMemberships

SearchGroupMemberships returns a list of group memberships matching the search criteria.

func (*AuthorizationsService) SearchGroups

SearchGroups returns a list of groups matching the search criteria. The results are sorted alphabetically by group name.

func (*AuthorizationsService) UpdateGroup

UpdateGroup updates a group's name or description.

func (*AuthorizationsService) ValidateCreateGroupMembershipRequest

func (s *AuthorizationsService) ValidateCreateGroupMembershipRequest(opt *AuthorizationsCreateGroupMembershipOptions) error

ValidateCreateGroupMembershipRequest validates the AuthorizationsCreateGroupMembershipOptions.

func (*AuthorizationsService) ValidateCreateGroupRequest

func (s *AuthorizationsService) ValidateCreateGroupRequest(opt *AuthorizationsCreateGroupOptions) error

ValidateCreateGroupRequest validates the AuthorizationsCreateGroupOptions.

func (*AuthorizationsService) ValidateSearchGroupMembershipsOpt

func (s *AuthorizationsService) ValidateSearchGroupMembershipsOpt(opt *AuthorizationsSearchGroupMembershipsOptions) error

ValidateSearchGroupMembershipsOpt validates the AuthorizationsSearchGroupMembershipsOptions.

func (*AuthorizationsService) ValidateSearchGroupsOpt

func (s *AuthorizationsService) ValidateSearchGroupsOpt(opt *AuthorizationsSearchGroupsOptions) error

ValidateSearchGroupsOpt validates the AuthorizationsSearchGroupsOptions.

func (*AuthorizationsService) ValidateUpdateGroupRequest

func (s *AuthorizationsService) ValidateUpdateGroupRequest(groupID string, opt *AuthorizationsUpdateGroupOptions) error

ValidateUpdateGroupRequest validates the AuthorizationsUpdateGroupOptions.

type AuthorizationsUpdateGroupOptions

type AuthorizationsUpdateGroupOptions struct {
	// Description is the group description. Maximum 200 characters.
	// Use nil to leave unchanged, or a pointer to an empty string to clear it.
	Description *string `json:"description,omitempty"`
	// Name is the group name. Must be between 1 and 255 characters.
	Name string `json:"name,omitempty"`
}

AuthorizationsUpdateGroupOptions contains parameters for updating a group. All fields are optional (PATCH merge semantics).

type AzureDefinition

type AzureDefinition struct {
	// Key is the unique setting key.
	Key string `json:"key,omitempty"`
	// URL is the Azure DevOps API URL (since 8.6).
	URL string `json:"url,omitempty"`
}

AzureDefinition represents an Azure DevOps setting definition.

type AzureProject

type AzureProject struct {
	// Description is the project description.
	Description string `json:"description,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
}

AzureProject represents an Azure DevOps project.

type AzureRepository

type AzureRepository struct {
	// Name is the repository name.
	Name string `json:"name,omitempty"`
	// ProjectName is the parent project name.
	ProjectName string `json:"projectName,omitempty"`
}

AzureRepository represents an Azure DevOps repository.

type BatchFileData

type BatchFileData struct {
	Hash     string `json:"hash,omitempty"`
	Revision string `json:"revision,omitempty"`
}

BatchFileData contains file hash and revision information.

type BatchFileOptions

type BatchFileOptions struct {
	Name string `url:"name,omitempty"` // Description:"File name",ExampleValue:"batch-library-2.3.jar"
}

BatchFileOptions contains parameters for the File endpoint.

type BatchProject

type BatchProject struct {
	FileDataByModuleAndPath map[string]map[string]BatchFileData `json:"fileDataByModuleAndPath,omitempty"`
	LastAnalysisDate        int64                               `json:"lastAnalysisDate,omitempty"`
	Timestamp               int64                               `json:"timestamp,omitempty"`
}

BatchProject contains the response from the Project endpoint.

type BatchProjectOptions

type BatchProjectOptions struct {
	Branch      string `url:"branch,omitempty"`      // Description:"Branch key",ExampleValue:"feature/my_branch"
	Key         string `url:"key,omitempty"`         // Description:"Project key",ExampleValue:"my_project"
	Profile     string `url:"profile,omitempty"`     // Description:"Profile name",ExampleValue:"SonarQube Way"
	PullRequest string `url:"pullRequest,omitempty"` // Description:"Pull request id",ExampleValue:"5461"
}

BatchProjectOptions contains parameters for the Project endpoint.

type BatchService

type BatchService struct {
	// contains filtered or unexported fields
}

BatchService provides access to the /batch API endpoints for scanner JAR files and referentials.

func (*BatchService) GetFile

func (s *BatchService) GetFile(ctx context.Context, opt *BatchFileOptions) (v []byte, resp *http.Response, err error)

GetFile downloads a JAR file listed in the index (see batch/index). This endpoint returns binary data for the requested JAR file.

func (*BatchService) GetIndex

func (s *BatchService) GetIndex(ctx context.Context) (v *string, resp *http.Response, err error)

GetIndex lists the JAR files to be downloaded by scanners. Returns a list of JAR file names and their hashes.

func (*BatchService) GetProject

func (s *BatchService) GetProject(ctx context.Context, opt *BatchProjectOptions) (v *BatchProject, resp *http.Response, err error)

GetProject returns project repository information including file hashes for incremental analysis.

func (*BatchService) ValidateGetFileOpt

func (s *BatchService) ValidateGetFileOpt(opt *BatchFileOptions) error

ValidateGetFileOpt validates the options for the GetFile endpoint.

func (*BatchService) ValidateGetProjectOpt

func (s *BatchService) ValidateGetProjectOpt(opt *BatchProjectOptions) error

ValidateGetProjectOpt validates the options for the GetProject endpoint.

type BitbucketCloudDefinition

type BitbucketCloudDefinition struct {
	// ClientID is the OAuth client ID.
	ClientID string `json:"clientId,omitempty"`
	// Key is the unique setting key.
	Key string `json:"key,omitempty"`
	// Workspace is the Bitbucket Cloud workspace ID.
	Workspace string `json:"workspace,omitempty"`
}

BitbucketCloudDefinition represents a Bitbucket Cloud setting definition.

type BitbucketCloudPaging

type BitbucketCloudPaging struct {
	// PageIndex is the current page index.
	PageIndex int64 `json:"pageIndex,omitempty"`
	// PageSize is the page size.
	PageSize int64 `json:"pageSize,omitempty"`
}

BitbucketCloudPaging represents pagination info for Bitbucket Cloud APIs.

type BitbucketCloudRepository

type BitbucketCloudRepository struct {
	// Name is the repository name.
	Name string `json:"name,omitempty"`
	// ProjectKey is the project key.
	ProjectKey string `json:"projectKey,omitempty"`
	// Slug is the repository slug.
	Slug string `json:"slug,omitempty"`
	// SqProjectKey is the SonarQube project key if already imported.
	SqProjectKey string `json:"sqProjectKey,omitempty"`
	// UUID is the repository UUID.
	UUID string `json:"uuid,omitempty"`
	// Workspace is the workspace slug.
	Workspace string `json:"workspace,omitempty"`
}

BitbucketCloudRepository represents a Bitbucket Cloud repository.

type BitbucketDefinition

type BitbucketDefinition struct {
	// Key is the unique setting key.
	Key string `json:"key,omitempty"`
	// URL is the Bitbucket Server API URL.
	URL string `json:"url,omitempty"`
}

BitbucketDefinition represents a Bitbucket Server setting definition.

type BitbucketServerProject

type BitbucketServerProject struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
}

BitbucketServerProject represents a Bitbucket Server project.

type BitbucketServerRepository

type BitbucketServerRepository struct {
	// Name is the repository name.
	Name string `json:"name,omitempty"`
	// ProjectKey is the project key.
	ProjectKey string `json:"projectKey,omitempty"`
	// Slug is the repository slug.
	Slug string `json:"slug,omitempty"`
	// SqProjectKey is the SonarQube project key if already imported.
	SqProjectKey string `json:"sqProjectKey,omitempty"`
	// UUID is the repository UUID.
	UUID string `json:"uuid,omitempty"`
	// Workspace is the workspace slug.
	Workspace string `json:"workspace,omitempty"`
}

BitbucketServerRepository represents a Bitbucket Server repository.

type CeActivity

type CeActivity struct {
	// Paging contains pagination information.
	Paging CeTaskPaging `json:"paging,omitzero"`
	// Tasks is the list of tasks.
	Tasks []CeTask `json:"tasks,omitempty"`
}

CeActivity represents the response from searching CE tasks.

type CeActivityOptions

type CeActivityOptions struct {
	CePaginationArgs

	// Component is the key of the component (project) to filter on.
	Component string `url:"component,omitempty"`
	// MaxExecutedAt is the maximum date of end of task processing (inclusive).
	// Format: ISO 8601 datetime (e.g., 2017-10-19T13:00:00+0200).
	MaxExecutedAt string `url:"maxExecutedAt,omitempty"`
	// MinSubmittedAt is the minimum date of task submission (inclusive).
	// Format: ISO 8601 datetime (e.g., 2017-10-19T13:00:00+0200).
	MinSubmittedAt string `url:"minSubmittedAt,omitempty"`
	// OnlyCurrents filters on the last tasks (only the most recent finished task by project).
	OnlyCurrents bool `url:"onlyCurrents,omitempty"`
	// Query limits search to component names containing the string, component keys matching exactly,
	// or task IDs matching exactly.
	Query string `url:"q,omitempty"`
	// Statuses filters by task statuses.
	// Allowed values: SUCCESS, FAILED, CANCELED, PENDING, IN_PROGRESS.
	Statuses []string `url:"status,omitempty,comma"`
	// Type filters by task type.
	// Allowed values: REPORT, ISSUE_SYNC, AUDIT_PURGE, PROJECT_EXPORT.
	Type string `url:"type,omitempty"`
}

CeActivityOptions contains parameters for the Activity method.

type CeActivityStatus

type CeActivityStatus struct {
	// Failing is the number of failing tasks.
	Failing int64 `json:"failing,omitempty"`
	// InProgress is the number of in-progress tasks.
	InProgress int64 `json:"inProgress,omitempty"`
	// Pending is the number of pending tasks.
	Pending int64 `json:"pending,omitempty"`
	// PendingTime is the total pending time in milliseconds (only included when there are pending tasks).
	PendingTime int64 `json:"pendingTime,omitempty"`
}

CeActivityStatus represents CE activity metrics.

type CeActivityStatusOptions

type CeActivityStatusOptions struct {
	// Component is the key of the component (project) to filter on.
	Component string `url:"component,omitempty"`
}

CeActivityStatusOptions contains parameters for the ActivityStatus method.

type CeAnalysisComponent

type CeAnalysisComponent struct {
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Warnings is the list of analysis warnings.
	Warnings []CeAnalysisWarning `json:"warnings,omitempty"`
}

CeAnalysisComponent represents a component with its analysis warnings.

type CeAnalysisStatus

type CeAnalysisStatus struct {
	// Component contains the component information with warnings.
	Component CeAnalysisComponent `json:"component,omitzero"`
}

CeAnalysisStatus represents the analysis status of a component.

type CeAnalysisStatusOptions

type CeAnalysisStatusOptions struct {
	// Branch is the branch key.
	Branch string `url:"branch,omitempty"`
	// Component is the component key.
	// This field is required.
	Component string `url:"component"`
	// PullRequest is the pull request ID.
	PullRequest string `url:"pullRequest,omitempty"`
}

CeAnalysisStatusOptions contains parameters for the AnalysisStatus method.

type CeAnalysisWarning

type CeAnalysisWarning struct {
	// Dismissable indicates if the warning can be dismissed.
	Dismissable bool `json:"dismissable,omitempty"`
	// Key is the unique key of the warning.
	Key string `json:"key,omitempty"`
	// Message is the warning message.
	Message string `json:"message,omitempty"`
}

CeAnalysisWarning represents a warning from analysis.

type CeCancelOptions

type CeCancelOptions struct {
	// ID is the ID of the task to cancel.
	// This field is required.
	ID string `url:"id"`
}

CeCancelOptions contains parameters for the Cancel method.

type CeComponent

type CeComponent struct {
	// Current is the last executed task.
	Current CeTask `json:"current,omitzero"`
	// Queue contains pending and in-progress tasks.
	Queue []CeQueuedTask `json:"queue,omitempty"`
}

CeComponent represents the pending, in-progress, and last executed tasks for a component.

type CeComponentOptions

type CeComponentOptions struct {
	// Component is the component key.
	// This field is required.
	Component string `url:"component"`
}

CeComponentOptions contains parameters for the Component method.

type CeDismissAnalysisWarningOptions

type CeDismissAnalysisWarningOptions struct {
	// Component is the key of the project.
	// This field is required.
	Component string `url:"component"`
	// Warning is the key of the warning to dismiss.
	// This field is required.
	Warning string `url:"warning"`
}

CeDismissAnalysisWarningOptions contains parameters for the DismissAnalysisWarning method.

type CeIndexationStatus

type CeIndexationStatus struct {
	// CompletedCount is the number of projects with completed indexing.
	CompletedCount int64 `json:"completedCount,omitempty"`
	// HasFailures indicates if there are indexation failures.
	HasFailures bool `json:"hasFailures,omitempty"`
	// IsCompleted indicates if indexation is complete.
	IsCompleted bool `json:"isCompleted,omitempty"`
	// Total is the total number of projects to index.
	Total int64 `json:"total,omitempty"`
}

CeIndexationStatus represents the indexation status.

type CeInfo

type CeInfo struct {
	// WorkersPauseStatus is the pause status of CE workers.
	WorkersPauseStatus string `json:"workersPauseStatus,omitempty"`
}

CeInfo represents Compute Engine information.

type CePaginationArgs

type CePaginationArgs struct {
	// Page is the response page number. Must be strictly greater than 0.
	Page int64 `url:"p,omitempty"`
	// PageSize is the response page size. Must be greater than 0 and less than or equal to 1000.
	PageSize int64 `url:"ps,omitempty"`
}

CePaginationArgs contains pagination parameters specific to CE (supports up to 1000).

func (*CePaginationArgs) Validate

func (p *CePaginationArgs) Validate() error

Validate validates the CE pagination arguments.

type CeQueuedTask

type CeQueuedTask struct {
	// ComponentID is the component identifier.
	ComponentID string `json:"componentId,omitempty"`
	// ComponentKey is the component key.
	ComponentKey string `json:"componentKey,omitempty"`
	// ComponentName is the component name.
	ComponentName string `json:"componentName,omitempty"`
	// ComponentQualifier is the component qualifier.
	ComponentQualifier string `json:"componentQualifier,omitempty"`
	// ID is the unique identifier of the task.
	ID string `json:"id,omitempty"`
	// Organization is the organization key (deprecated).
	Organization string `json:"organization,omitempty"`
	// Status is the task status.
	Status string `json:"status,omitempty"`
	// SubmittedAt is the timestamp when the task was submitted.
	SubmittedAt string `json:"submittedAt,omitempty"`
	// Type is the task type.
	Type string `json:"type,omitempty"`
}

CeQueuedTask represents a task in the queue (pending or in-progress).

type CeService

type CeService struct {
	// contains filtered or unexported fields
}

CeService handles communication with the Compute Engine related methods of the SonarQube API. This service provides information on Compute Engine tasks, including task activity, status, and management operations.

func (*CeService) Activity

func (s *CeService) Activity(ctx context.Context, opt *CeActivityOptions) (*CeActivity, *http.Response, error)

Activity searches for CE tasks. Requires the system administration permission, or project administration permission if component is set.

API endpoint: GET /api/ce/activity. Since: 5.2.

func (*CeService) ActivityStatus

ActivityStatus returns CE activity related metrics. Requires 'Administer System' permission or 'Administer' rights on the specified project.

API endpoint: GET /api/ce/activity_status. Since: 5.5.

func (*CeService) AnalysisStatus

AnalysisStatus gets the analysis status of a given component: a project, branch or pull request. Requires 'Browse' permission on the specified component.

API endpoint: GET /api/ce/analysis_status. Since: 7.4.

func (*CeService) Cancel

func (s *CeService) Cancel(ctx context.Context, opt *CeCancelOptions) (*http.Response, error)

Cancel cancels a pending task. In-progress tasks cannot be canceled. Requires 'Administer System' or 'Administer' rights on the project related to the task.

API endpoint: POST /api/ce/cancel. Since: 5.2.

func (*CeService) CancelAll

func (s *CeService) CancelAll(ctx context.Context) (*http.Response, error)

CancelAll cancels all pending tasks. Requires system administration permission. In-progress tasks are not canceled.

API endpoint: POST /api/ce/cancel_all. Since: 5.2.

func (*CeService) Component

func (s *CeService) Component(ctx context.Context, opt *CeComponentOptions) (*CeComponent, *http.Response, error)

Component gets the pending tasks, in-progress tasks and the last executed task of a given component (usually a project). Requires 'Browse' permission on the specified component.

API endpoint: GET /api/ce/component. Since: 5.2.

func (*CeService) DismissAnalysisWarning

func (s *CeService) DismissAnalysisWarning(ctx context.Context, opt *CeDismissAnalysisWarningOptions) (*http.Response, error)

DismissAnalysisWarning permanently dismisses a specific analysis warning. Requires authentication and 'Browse' permission on the specified project.

API endpoint: POST /api/ce/dismiss_analysis_warning. Since: 8.5.

func (*CeService) IndexationStatus

func (s *CeService) IndexationStatus(ctx context.Context) (*CeIndexationStatus, *http.Response, error)

IndexationStatus returns the count of projects with completed issue indexing.

API endpoint: GET /api/ce/indexation_status. Since: 8.4.

func (*CeService) Info

func (s *CeService) Info(ctx context.Context) (*CeInfo, *http.Response, error)

Info gets information about Compute Engine. Requires the system administration permission or system passcode.

API endpoint: GET /api/ce/info. Since: 7.2.

func (*CeService) Pause

func (s *CeService) Pause(ctx context.Context) (*http.Response, error)

Pause requests pause of Compute Engine workers. Requires the system administration permission or system passcode.

API endpoint: POST /api/ce/pause. Since: 7.2.

func (*CeService) Resume

func (s *CeService) Resume(ctx context.Context) (*http.Response, error)

Resume resumes pause of Compute Engine workers. Requires the system administration permission or system passcode.

API endpoint: POST /api/ce/resume. Since: 7.2.

func (*CeService) Submit

func (s *CeService) Submit(ctx context.Context, opt *CeSubmitOptions) (*CeSubmit, *http.Response, error)

Submit submits a scanner report to the queue. Report is processed asynchronously. Requires analysis permission. If the project does not exist, then the provisioning permission is also required.

API endpoint: POST /api/ce/submit. Since: 5.2.

func (*CeService) Task

Task gives Compute Engine task details such as type, status, duration and associated component. Requires 'Administer' at global or project level, or 'Execute Analysis' at global or project level.

API endpoint: GET /api/ce/task. Since: 5.2.

func (*CeService) TaskTypes

func (s *CeService) TaskTypes(ctx context.Context) (*CeTaskTypes, *http.Response, error)

TaskTypes lists available task types.

API endpoint: GET /api/ce/task_types. Since: 5.5.

func (*CeService) ValidateActivityOpt

func (s *CeService) ValidateActivityOpt(opt *CeActivityOptions) error

ValidateActivityOpt validates the options for the Activity method.

func (*CeService) ValidateActivityStatusOpt

func (s *CeService) ValidateActivityStatusOpt(opt *CeActivityStatusOptions) error

ValidateActivityStatusOpt validates the options for the ActivityStatus method.

func (*CeService) ValidateAnalysisStatusOpt

func (s *CeService) ValidateAnalysisStatusOpt(opt *CeAnalysisStatusOptions) error

ValidateAnalysisStatusOpt validates the options for the AnalysisStatus method.

func (*CeService) ValidateCancelOpt

func (s *CeService) ValidateCancelOpt(opt *CeCancelOptions) error

ValidateCancelOpt validates the options for the Cancel method.

func (*CeService) ValidateComponentOpt

func (s *CeService) ValidateComponentOpt(opt *CeComponentOptions) error

ValidateComponentOpt validates the options for the Component method.

func (*CeService) ValidateDismissAnalysisWarningOpt

func (s *CeService) ValidateDismissAnalysisWarningOpt(opt *CeDismissAnalysisWarningOptions) error

ValidateDismissAnalysisWarningOpt validates the options for the DismissAnalysisWarning method.

func (*CeService) ValidateSubmitOpt

func (s *CeService) ValidateSubmitOpt(opt *CeSubmitOptions) error

ValidateSubmitOpt validates the options for the Submit method.

func (*CeService) ValidateTaskOpt

func (s *CeService) ValidateTaskOpt(opt *CeTaskOptions) error

ValidateTaskOpt validates the options for the Task method.

func (*CeService) WorkerCount

func (s *CeService) WorkerCount(ctx context.Context) (*CeWorkerCount, *http.Response, error)

WorkerCount returns the number of Compute Engine workers. Requires the system administration permission.

API endpoint: GET /api/ce/worker_count. Since: 6.5.

type CeSubmit

type CeSubmit struct {
	// ProjectID is the project identifier.
	ProjectID string `json:"projectId,omitempty"`
	// TaskID is the created task identifier.
	TaskID string `json:"taskId,omitempty"`
}

CeSubmit represents the response from submitting a scanner report.

type CeSubmitOptions

type CeSubmitOptions struct {
	// Characteristics contains optional characteristics of the analysis.
	// Can contain multiple key=value pairs.
	Characteristics []string `url:"characteristic,omitempty,comma"`
	// ProjectKey is the key of the project.
	// This field is required. Maximum length is 400 characters.
	ProjectKey string `url:"projectKey"`
	// ProjectName is the optional name of the project.
	// Used only if the project does not exist yet. If longer than 500, it is abbreviated.
	ProjectName string `url:"projectName,omitempty"`
	// Report is the report file content.
	// This field is required. Format is not an API, it changes among SonarQube versions.
	Report string `url:"report"`
}

CeSubmitOptions contains parameters for the Submit method.

type CeTask

type CeTask struct {
	// AnalysisID is the unique identifier of the analysis.
	AnalysisID string `json:"analysisId,omitempty"`
	// Branch is the branch name (if applicable).
	Branch string `json:"branch,omitempty"`
	// BranchType is the type of branch (e.g., "BRANCH", "PULL_REQUEST").
	BranchType string `json:"branchType,omitempty"`
	// ComponentID is the component identifier.
	ComponentID string `json:"componentId,omitempty"`
	// ComponentKey is the component key.
	ComponentKey string `json:"componentKey,omitempty"`
	// ComponentName is the component name.
	ComponentName string `json:"componentName,omitempty"`
	// ComponentQualifier is the component qualifier (e.g., "TRK" for project).
	ComponentQualifier string `json:"componentQualifier,omitempty"`
	// ErrorMessage is the error message if the task failed.
	ErrorMessage string `json:"errorMessage,omitempty"`
	// ErrorStacktrace is the error stacktrace if available and requested.
	ErrorStacktrace string `json:"errorStacktrace,omitempty"`
	// ErrorType is the type of error if the task failed.
	ErrorType string `json:"errorType,omitempty"`
	// ExecutedAt is the timestamp when the task finished execution.
	ExecutedAt string `json:"executedAt,omitempty"`
	// ExecutionTimeMs is the execution time in milliseconds.
	ExecutionTimeMs int64 `json:"executionTimeMs,omitempty"`
	// FinishedAt is the timestamp when the task finished.
	FinishedAt string `json:"finishedAt,omitempty"`
	// HasErrorStacktrace indicates if an error stacktrace is available.
	HasErrorStacktrace bool `json:"hasErrorStacktrace,omitempty"`
	// HasScannerContext indicates if scanner context is available.
	HasScannerContext bool `json:"hasScannerContext,omitempty"`
	// ID is the unique identifier of the task.
	ID string `json:"id,omitempty"`
	// InfoMessages contains informational messages about the task.
	InfoMessages []string `json:"infoMessages,omitempty"`
	// Organization is the organization key (deprecated).
	Organization string `json:"organization,omitempty"`
	// PullRequest is the pull request identifier (if applicable).
	PullRequest string `json:"pullRequest,omitempty"`
	// ScannerContext is the scanner context if requested.
	ScannerContext string `json:"scannerContext,omitempty"`
	// StartedAt is the timestamp when the task started.
	StartedAt string `json:"startedAt,omitempty"`
	// Status is the task status (SUCCESS, FAILED, CANCELED, PENDING, IN_PROGRESS).
	Status string `json:"status,omitempty"`
	// SubmittedAt is the timestamp when the task was submitted.
	SubmittedAt string `json:"submittedAt,omitempty"`
	// SubmitterLogin is the login of the user who submitted the task.
	SubmitterLogin string `json:"submitterLogin,omitempty"`
	// Type is the task type (e.g., "REPORT").
	Type string `json:"type,omitempty"`
	// WarningCount is the number of warnings.
	WarningCount int64 `json:"warningCount,omitempty"`
	// Warnings contains warning messages.
	Warnings []string `json:"warnings,omitempty"`
}

CeTask represents a Compute Engine task.

type CeTaskDetails

type CeTaskDetails struct {
	// Task is the task details.
	Task CeTask `json:"task,omitzero"`
}

CeTaskDetails represents the response from getting task details.

type CeTaskOptions

type CeTaskOptions struct {
	// AdditionalFields is a list of optional fields to be returned in response.
	// Allowed values: stacktrace, scannerContext, warnings.
	AdditionalFields []string `url:"additionalFields,omitempty,comma"`
	// ID is the ID of the task.
	// This field is required.
	ID string `url:"id"`
}

CeTaskOptions contains parameters for the Task method.

type CeTaskPaging

type CeTaskPaging struct {
	// PageIndex is the current page index (1-based).
	PageIndex int64 `json:"pageIndex,omitempty"`
	// PageSize is the number of items per page.
	PageSize int64 `json:"pageSize,omitempty"`
	// Total is the total number of items.
	Total int64 `json:"total,omitempty"`
}

CeTaskPaging represents pagination information for CE queries.

type CeTaskTypes

type CeTaskTypes struct {
	// TaskTypes is the list of available task types.
	TaskTypes []string `json:"taskTypes,omitempty"`
}

CeTaskTypes represents the available task types.

type CeWorkerCount

type CeWorkerCount struct {
	// CanSetWorkerCount indicates if the worker count can be modified.
	CanSetWorkerCount bool `json:"canSetWorkerCount,omitempty"`
	// Value is the number of workers.
	Value int64 `json:"value,omitempty"`
}

CeWorkerCount represents the CE worker count.

type ChangelogDiff

type ChangelogDiff struct {
	// Key is the name of the field that changed.
	Key string `json:"key,omitempty"`
	// OldValue is the previous value of the field.
	OldValue string `json:"oldValue,omitempty"`
	// NewValue is the new value of the field.
	NewValue string `json:"newValue,omitempty"`
}

ChangelogDiff represents a single field change in the changelog.

type ChangelogEntry

type ChangelogEntry struct {
	// User is the login of the user who made the change.
	User string `json:"user,omitempty"`
	// UserName is the display name of the user.
	UserName string `json:"userName,omitempty"`
	// ExternalUser is the external user identifier.
	ExternalUser string `json:"externalUser,omitempty"`
	// Avatar is the avatar hash of the user.
	Avatar string `json:"avatar,omitempty"`
	// CreationDate is the timestamp of the change.
	CreationDate string `json:"creationDate,omitempty"`
	// WebhookSource is the source of the webhook that triggered the change.
	WebhookSource string `json:"webhookSource,omitempty"`
	// Diffs is the list of field changes.
	Diffs []ChangelogDiff `json:"diffs,omitempty"`
	// IsUserActive indicates if the user is active.
	IsUserActive bool `json:"isUserActive,omitempty"`
}

ChangelogEntry represents an entry in the issue changelog.

type ChangelogEvent

type ChangelogEvent struct {
	// Action is the type of action performed (e.g., ACTIVATED, DEACTIVATED, UPDATED).
	Action string `json:"action,omitempty"`
	// AuthorLogin is the login of the user who made the change.
	AuthorLogin string `json:"authorLogin,omitempty"`
	// AuthorName is the name of the user who made the change.
	AuthorName string `json:"authorName,omitempty"`
	// CleanCodeAttributeCategory is the clean code attribute category for the rule.
	CleanCodeAttributeCategory string `json:"cleanCodeAttributeCategory,omitempty"`
	// Date is the timestamp of the event.
	Date string `json:"date,omitempty"`
	// RuleKey is the key of the rule that was affected.
	RuleKey string `json:"ruleKey,omitempty"`
	// RuleName is the name of the rule that was affected.
	RuleName string `json:"ruleName,omitempty"`
	// Params contains the change details.
	Params ChangelogEventParams `json:"params,omitzero"`
	// Impacts contains the impact changes.
	Impacts []ChangelogImpact `json:"impacts,omitempty"`
}

ChangelogEvent represents a single event in the quality profile changelog.

type ChangelogEventParams

type ChangelogEventParams struct {
	// NewCleanCodeAttribute is the new clean code attribute after the change.
	NewCleanCodeAttribute string `json:"newCleanCodeAttribute,omitempty"`
	// NewCleanCodeAttributeCategory is the new clean code attribute category after the change.
	NewCleanCodeAttributeCategory string `json:"newCleanCodeAttributeCategory,omitempty"`
	// OldCleanCodeAttribute is the previous clean code attribute before the change.
	OldCleanCodeAttribute string `json:"oldCleanCodeAttribute,omitempty"`
	// OldCleanCodeAttributeCategory is the previous clean code attribute category before the change.
	OldCleanCodeAttributeCategory string `json:"oldCleanCodeAttributeCategory,omitempty"`
	// PrioritizedRule indicates if the rule was marked as prioritized.
	PrioritizedRule string `json:"prioritizedRule,omitempty"`
	// SonarQubeVersion is the version of SonarQube when the change occurred.
	SonarQubeVersion string `json:"sonarQubeVersion,omitempty"`
	// ImpactChanges contains the impact severity changes.
	ImpactChanges []ImpactChange `json:"impactChanges,omitempty"`
}

ChangelogEventParams represents the parameters of a changelog event.

type ChangelogImpact

type ChangelogImpact struct {
	// SoftwareQuality is the software quality being impacted.
	SoftwareQuality string `json:"softwareQuality,omitempty"`
	// Severity is the impact severity.
	Severity string `json:"severity,omitempty"`
}

ChangelogImpact represents an impact entry in the changelog.

type CleanCodePolicyCreateRuleOptions

type CleanCodePolicyCreateRuleOptions struct {
	// Key is the key of the custom rule to create (must include the repository).
	// This field is required. Maximum 200 characters.
	Key string `json:"key"`
	// TemplateKey is the key of the rule template to base the custom rule on.
	// This field is required. Maximum 200 characters.
	TemplateKey string `json:"templateKey"`
	// Name is the rule name.
	// This field is required. Maximum 200 characters.
	Name string `json:"name"`
	// MarkdownDescription is the rule description in markdown format.
	// This field is required.
	MarkdownDescription string `json:"markdownDescription"`
	// Impacts is the list of software quality impacts.
	// This field is required (at least one impact).
	Impacts []RulesImpact `json:"impacts"`
	// Status is the rule status. Default is "READY".
	// Valid values: BETA, DEPRECATED, READY, REMOVED.
	Status string `json:"status,omitempty"`
	// Parameters is the list of custom rule parameters.
	Parameters []RuleParameterV2 `json:"parameters,omitempty"`
	// CleanCodeAttribute is the clean code attribute for the rule.
	// Valid values: CONVENTIONAL, FORMATTED, IDENTIFIABLE, CLEAR, COMPLETE,
	// EFFICIENT, LOGICAL, DISTINCT, FOCUSED, MODULAR, TESTED, LAWFUL,
	// RESPECTFUL, TRUSTWORTHY.
	CleanCodeAttribute string `json:"cleanCodeAttribute,omitempty"`
	// Severity is the rule severity.
	Severity string `json:"severity,omitempty"`
	// Type is the rule type.
	// Valid values: CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT.
	Type string `json:"type,omitempty"`
}

CleanCodePolicyCreateRuleOptions contains parameters for creating a custom rule via the V2 API.

type CleanCodePolicyService

type CleanCodePolicyService struct {
	// contains filtered or unexported fields
}

CleanCodePolicyService handles communication with the Clean Code Policy related methods of the SonarQube V2 API.

func (*CleanCodePolicyService) CreateRule

CreateRule creates a custom rule based on a template. Requires the 'Administer Quality Profiles' permission.

func (*CleanCodePolicyService) ValidateCreateRuleRequest

func (s *CleanCodePolicyService) ValidateCreateRuleRequest(opt *CleanCodePolicyCreateRuleOptions) error

ValidateCreateRuleRequest validates the CleanCodePolicyCreateRuleOptions.

type Client

type Client struct {
	Applications        *ApplicationsService
	AuditLogs           *AuditLogsService
	AlmIntegrations     *AlmIntegrationsService
	AlmSettings         *AlmSettingsService
	AnalysisCache       *AnalysisCacheService
	AnalysisReports     *AnalysisReportsService
	Authentication      *AuthenticationService
	Batch               *BatchService
	Ce                  *CeService
	Components          *ComponentsService
	Developers          *DevelopersService
	DismissMessage      *DismissMessageService
	Duplications        *DuplicationsService
	Emails              *EmailsService
	Favorites           *FavoritesService
	Features            *FeaturesService
	GithubProvisioning  *GithubProvisioningService
	GovernanceReports   *GovernanceReportsService
	Hotspots            *HotspotsService
	Issues              *IssuesService
	L10N                *L10NService
	Editions            *EditionsService
	Languages           *LanguagesService
	Measures            *MeasuresService
	Views               *ViewsService
	Metrics             *MetricsService
	Monitoring          *MonitoringService
	Navigation          *NavigationService
	NewCodePeriods      *NewCodePeriodsService
	Notifications       *NotificationsService
	Permissions         *PermissionsService
	Plugins             *PluginsService
	ProjectAnalyses     *ProjectAnalysesService
	ProjectBadges       *ProjectBadgesService
	ProjectBranches     *ProjectBranchesService
	ProjectDump         *ProjectDumpService
	ProjectLinks        *ProjectLinksService
	ProjectPullRequests *ProjectPullRequestsService
	ProjectTags         *ProjectTagsService
	Projects            *ProjectsService
	Push                *PushService
	Qualitygates        *QualitygatesService
	Qualityprofiles     *QualityprofilesService
	RegulatoryReports   *RegulatoryReportsService
	Rules               *RulesService
	Saml                *SamlService
	SecurityReports     *SecurityReportsService
	ScimManagement      *ScimManagementService
	Server              *ServerService
	Settings            *SettingsService
	Sources             *SourcesService
	Support             *SupportService
	System              *SystemService
	UserGroups          *UserGroupsService
	UserTokens          *UserTokensService
	Users               *UsersService
	Webhooks            *WebhooksService
	Webservices         *WebservicesService

	// V2 contains all V2 API services.
	V2 *ServicesV2
	// contains filtered or unexported fields
}

Client is the SonarQube API client.

A Client is safe for concurrent use by multiple goroutines, including while its connection or authentication settings are reconfigured at runtime via the SetBaseURL, SetHTTPClient, SetBasicAuth and SetPrivateToken methods (for example to rotate a token). The mutable fields those methods touch are guarded by mu; everything else is set once at construction and not mutated afterwards.

func NewClient

func NewClient(createOpts *ClientCreateOptions, options ...ClientOptionFunc) (*Client, error)

NewClient creates a new SonarQube API client. createOpts can be used to provide initial configuration options. Additional functional options can be provided via options.

func NewClientFromEnv

func NewClientFromEnv(options ...ClientOptionFunc) (*Client, error)

NewClientFromEnv creates a Client configured from SONAR_* environment variables, the convention used across the SDK and its integration tests:

  • SONAR_URL base API URL (defaults to the SDK default when unset)
  • SONAR_TOKEN token authentication (takes precedence over basic auth)
  • SONAR_USERNAME basic-auth username (used with SONAR_PASSWORD)
  • SONAR_PASSWORD basic-auth password
  • SONAR_USER_AGENT optional User-Agent override
  • SONAR_TIMEOUT HTTP request timeout as a Go duration string (e.g. "30s", "2m")

Additional functional options can be supplied and are applied after the environment is read, so they take precedence over the environment.

Example

Configure a client from SONAR_URL and SONAR_TOKEN environment variables.

package main

import (
	"github.com/boxboxjason/sonarqube-client-go/v2/sonar"
)

func main() {
	client, err := sonar.NewClientFromEnv()
	if err != nil {
		panic(err)
	}

	_ = client
}

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

BaseURL returns a copy of the base URL.

func (*Client) Do

func (c *Client) Do(req *http.Request, dest any) (*http.Response, error)

Do sends an API request and returns the API response. The API response is JSON decoded and stored in the value pointed to by v, or returned as an error if an API error has occurred. If v implements the io.Writer interface, the raw response body will be written to v, without attempting to first decode it.

func (*Client) NewSonarQubeAPIRequest

func (c *Client) NewSonarQubeAPIRequest(ctx context.Context, params SonarAPIRequestParameters) (*http.Request, error)

NewSonarQubeAPIRequest creates a new API request based on the provided SonarAPIRequestParameters. It applies default values for any missing parameters, sets authentication and standard headers, and returns an http.Request ready to be sent.

For most use cases, prefer the version-specific helpers:

  • NewSonarQubeV1APIRequest for V1 API endpoints (go-querystring encoding).
  • NewSonarQubeV2APIRequest for V2 API endpoints (JSON-tag encoding, body support).

func (*Client) NewSonarQubeV1APIRequest

func (c *Client) NewSonarQubeV1APIRequest(ctx context.Context, method, path string, opt any) (*http.Request, error)

NewSonarQubeV1APIRequest creates a V1 API request. The path is resolved relative to the client base URL. If opt is non-nil, it is encoded as URL query parameters using go-querystring struct tags and appended to the request URL.

func (*Client) NewSonarQubeV2APIRequest

func (c *Client) NewSonarQubeV2APIRequest(ctx context.Context, method, path string, queryOpt any, body any) (*http.Request, error)

NewSonarQubeV2APIRequest creates a V2 API request. The path is resolved relative to the client base URL with the "v2/" prefix automatically prepended. If queryOpt is non-nil, it is encoded as URL query parameters using JSON struct tags. If body is non-nil, it is JSON-marshaled and used as the request body.

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(urlStr *string) error

SetBaseURL sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

func (*Client) SetBasicAuth

func (c *Client) SetBasicAuth(username, password string)

SetBasicAuth sets the username and password for basic authentication.

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(httpClient *http.Client)

SetHTTPClient sets the HTTP client for API requests.

func (*Client) SetPrivateToken

func (c *Client) SetPrivateToken(token string)

SetPrivateToken sets the token for private token authentication.

type ClientCreateOptions

type ClientCreateOptions struct {
	// URL is the base API URL for the SonarQube instance.
	URL *string
	// Username is the username for basic authentication.
	Username *string
	// Password is the password for basic authentication.
	Password *string
	// Token is the token for private token authentication.
	Token *string
	// HttpClient is the HTTP client to use for API requests.
	HttpClient *http.Client
	// UserAgent is the User-Agent header to use for API requests.
	UserAgent *string
	// Timeout sets the request timeout on the SDK-managed HTTP client.
	// Ignored when HttpClient is also set. A zero value keeps the default of
	// defaultHTTPTimeout.
	Timeout *time.Duration
}

ClientCreateOptions contains options for creating a new Client. Everything is optional and will not throw an error if not provided.

type ClientOptionFunc

type ClientOptionFunc func(*Client) error

ClientOptionFunc can be used to customize a new SonarQube API client.

func WithBaseURL

func WithBaseURL(urlStr string) ClientOptionFunc

WithBaseURL is a ClientOptionFunc that sets the base URL for API requests to a custom endpoint. urlStr should always be specified with a trailing slash.

func WithBasicAuth

func WithBasicAuth(username, password string) ClientOptionFunc

WithBasicAuth is a ClientOptionFunc that sets the username and password for basic authentication.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOptionFunc

WithHTTPClient is a ClientOptionFunc that sets the HTTP client for API requests.

func WithMiddleware

func WithMiddleware(middlewares ...Middleware) ClientOptionFunc

WithMiddleware is a ClientOptionFunc that appends HTTP transport middleware to the client. Middleware is applied outermost-first: middlewares[0] wraps the rest of the chain. When WithHTTPClient is also used, middleware wraps that client's transport.

Example

Attach a request-logging middleware to the client transport. Middleware sits inside the retry layer, so it observes every individual attempt. The same pattern wraps tracing/metrics transports such as otelhttp.NewTransport.

package main

import (
	"log"
	"net/http"
	"time"

	"github.com/boxboxjason/sonarqube-client-go/v2/sonar"
)

// roundTripperFunc adapts a function to http.RoundTripper.
type roundTripperFunc func(*http.Request) (*http.Response, error)

func (f roundTripperFunc) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) }

// Attach a request-logging middleware to the client transport. Middleware sits
// inside the retry layer, so it observes every individual attempt. The same
// pattern wraps tracing/metrics transports such as otelhttp.NewTransport.
func main() {
	loggingMiddleware := func(next http.RoundTripper) http.RoundTripper {
		return roundTripperFunc(func(req *http.Request) (*http.Response, error) {
			start := time.Now()
			resp, err := next.RoundTrip(req)
			log.Printf("sonar %s %s (%s)", req.Method, req.URL.Path, time.Since(start))

			return resp, err
		})
	}

	client, err := sonar.NewClient(nil,
		sonar.WithBaseURL("https://sonar.example.com/api/"),
		sonar.WithToken("my-token"),
		sonar.WithMiddleware(loggingMiddleware),
	)
	if err != nil {
		panic(err)
	}

	_ = client
}

func WithRetry

func WithRetry(opts RetryOptions) ClientOptionFunc

WithRetry is a ClientOptionFunc that enables opt-in retry with exponential backoff and full jitter around the HTTP transport. Retry is disabled by default.

Example

Enable retries with exponential backoff for transient server errors.

package main

import (
	"time"

	"github.com/boxboxjason/sonarqube-client-go/v2/sonar"
)

func main() {
	client, err := sonar.NewClient(nil,
		sonar.WithBaseURL("https://sonarqube.example.com/api/"),
		sonar.WithToken("my-token"),
		sonar.WithRetry(sonar.RetryOptions{
			MaxAttempts:          3,
			InitialDelay:         100 * time.Millisecond,
			MaxDelay:             2 * time.Second,
			RetryableStatusCodes: []int{502, 503, 504},
		}),
	)
	if err != nil {
		panic(err)
	}

	_ = client
}

func WithSchemaObserver added in v2.2.1

func WithSchemaObserver(observer SchemaObserver) ClientOptionFunc

WithSchemaObserver is a ClientOptionFunc that registers a callback invoked after every successfully decoded API response with any SchemaMismatch found between the raw response body and the destination struct. It is intended for test suites that want strict validation that the SDK's modeled response types still match what the SonarQube API actually returns; it has no effect on decoding itself and is nil (disabled) by default.

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOptionFunc

WithTimeout is a ClientOptionFunc that sets the request timeout on the SDK-managed HTTP client. It bounds the total duration of each request. A zero value keeps the default of defaultHTTPTimeout; pass a custom *http.Client via WithHTTPClient if you need to disable the timeout entirely. It is ignored when WithHTTPClient is also used.

func WithToken

func WithToken(token string) ClientOptionFunc

WithToken is a ClientOptionFunc that sets the token for private token authentication.

func WithTransportConfig

func WithTransportConfig(cfg TransportConfig) ClientOptionFunc

WithTransportConfig is a ClientOptionFunc that configures the SDK-managed HTTP transport. It is ignored when WithHTTPClient is also used.

func WithUserAgent

func WithUserAgent(userAgent string) ClientOptionFunc

WithUserAgent is a ClientOptionFunc that sets the User-Agent header for API requests.

type CommaSeparatedSlice

type CommaSeparatedSlice []string

CommaSeparatedSlice is a custom type for URL encoding string slices as comma-separated values.

func (CommaSeparatedSlice) EncodeValues

func (s CommaSeparatedSlice) EncodeValues(key string, v *url.Values) error

EncodeValues implements the query.Encoder interface for custom URL encoding.

type ComponentAncestor

type ComponentAncestor struct {
	// AnalysisDate is the last analysis date.
	AnalysisDate string `json:"analysisDate,omitempty"`
	// Description is the component description.
	Description string `json:"description,omitempty"`
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Path is the path to the component.
	Path string `json:"path,omitempty"`
	// Qualifier is the component qualifier.
	Qualifier string `json:"qualifier,omitempty"`
	// Tags is the list of tags.
	Tags []string `json:"tags,omitempty"`
	// Version is the component version.
	Version string `json:"version,omitempty"`
	// Visibility is the component visibility.
	Visibility string `json:"visibility,omitempty"`
}

ComponentAncestor represents an ancestor component in show results.

type ComponentDetails

type ComponentDetails struct {
	// AnalysisDate is the last analysis date.
	AnalysisDate string `json:"analysisDate,omitempty"`
	// IsAiCodeFixEnabled indicates if the AI CodeFix feature is enabled for this component.
	IsAiCodeFixEnabled bool `json:"isAiCodeFixEnabled,omitempty"`
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Language is the component language.
	Language string `json:"language,omitempty"`
	// LeakPeriodDate is the leak period date.
	LeakPeriodDate string `json:"leakPeriodDate,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// NeedIssueSync indicates if issue synchronization is needed for this component.
	NeedIssueSync bool `json:"needIssueSync,omitempty"`
	// Path is the path to the component.
	Path string `json:"path,omitempty"`
	// Qualifier is the component qualifier.
	Qualifier string `json:"qualifier,omitempty"`
	// Tags is the list of tags associated with the component.
	Tags []string `json:"tags,omitempty"`
	// Version is the component version.
	Version string `json:"version,omitempty"`
	// Visibility is the visibility of the component (public or private).
	Visibility string `json:"visibility,omitempty"`
}

ComponentDetails represents detailed component information in show results.

type ComponentFacet

type ComponentFacet struct {
	// Property is the facet property name.
	Property string `json:"property,omitempty"`
	// Values is the list of facet values.
	Values []ComponentFacetValue `json:"values,omitempty"`
}

ComponentFacet represents a facet in search projects results.

type ComponentFacetValue

type ComponentFacetValue struct {
	// Count is the number of items matching this value.
	Count int64 `json:"count,omitempty"`
	// Val is the facet value.
	Val string `json:"val,omitempty"`
}

ComponentFacetValue represents a value in a facet.

type ComponentMeasures

type ComponentMeasures struct {
	// Debt is the technical debt of the component.
	Debt string `json:"debt,omitempty"`
	// DebtRatio is the technical debt ratio of the component.
	DebtRatio string `json:"debtRatio,omitempty"`
	// DuplicationDensity is the duplication density.
	DuplicationDensity string `json:"duplicationDensity,omitempty"`
	// Issues is the number of issues.
	Issues string `json:"issues,omitempty"`
	// Lines is the number of lines.
	Lines string `json:"lines,omitempty"`
	// SqaleRating is the SQALE maintainability rating.
	SqaleRating string `json:"sqaleRating,omitempty"`
}

ComponentMeasures represents measures for a component (used in App response).

type ComponentProject

type ComponentProject struct {
	// AiCodeAssurance is the AI code assurance status.
	AiCodeAssurance string `json:"aiCodeAssurance,omitempty"`
	// ContainsAiCode indicates if the project contains AI-generated code.
	ContainsAiCode bool `json:"containsAiCode,omitempty"`
	// IsAiCodeFixEnabled indicates if AI code fix is enabled.
	IsAiCodeFixEnabled bool `json:"isAiCodeFixEnabled,omitempty"`
	// IsFavorite indicates if the project is a favorite.
	IsFavorite bool `json:"isFavorite,omitempty"`
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
	// Qualifier is the project qualifier.
	Qualifier string `json:"qualifier,omitempty"`
	// Tags is the list of tags.
	Tags []string `json:"tags,omitempty"`
	// UUID is the project UUID.
	UUID string `json:"uuid,omitempty"`
	// Visibility is the project visibility.
	Visibility string `json:"visibility,omitempty"`
}

ComponentProject represents a project in search projects results.

type ComponentSearchItem

type ComponentSearchItem struct {
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Project is the project key containing this component.
	Project string `json:"project,omitempty"`
	// Qualifier is the component qualifier (TRK, DIR, FIL, etc.).
	Qualifier string `json:"qualifier,omitempty"`
}

ComponentSearchItem represents a component in search results.

type ComponentSuggestionGroup

type ComponentSuggestionGroup struct {
	// Items is the list of suggestions in this group.
	Items []ComponentSuggestionItem `json:"items,omitempty"`
	// More is the count of additional results available.
	More int64 `json:"more,omitempty"`
	// Query is the qualifier for this group.
	Query string `json:"q,omitempty"`
}

ComponentSuggestionGroup represents a group of suggestions by qualifier.

type ComponentSuggestionItem

type ComponentSuggestionItem struct {
	// IsFavorite indicates if the component is a favorite.
	IsFavorite bool `json:"isFavorite,omitempty"`
	// IsRecentlyBrowsed indicates if the component was recently browsed.
	IsRecentlyBrowsed bool `json:"isRecentlyBrowsed,omitempty"`
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Match is the display name with emphasis on matching characters.
	Match string `json:"match,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Project is the project key.
	Project string `json:"project,omitempty"`
}

ComponentSuggestionItem represents an item in suggestions results.

type ComponentTag

type ComponentTag struct {
	// Key is the tag name.
	Key string `json:"key,omitempty"`
	// Value is the count of issues with this tag.
	Value int64 `json:"value,omitempty"`
}

ComponentTag represents a tag with its count.

type ComponentTreeBase

type ComponentTreeBase struct {
	// Description is the component description.
	Description string `json:"description,omitempty"`
	// IsAiCodeFixEnabled indicates if the AI CodeFix feature is enabled for this component.
	IsAiCodeFixEnabled bool `json:"isAiCodeFixEnabled,omitempty"`
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Qualifier is the component qualifier.
	Qualifier string `json:"qualifier,omitempty"`
	// Tags is the list of tags.
	Tags []string `json:"tags,omitempty"`
	// Visibility is the component visibility.
	Visibility string `json:"visibility,omitempty"`
}

ComponentTreeBase represents the base component in tree results.

type ComponentTreeItem

type ComponentTreeItem struct {
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Language is the component language.
	Language string `json:"language,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Path is the path to the component.
	Path string `json:"path,omitempty"`
	// Qualifier is the component qualifier.
	Qualifier string `json:"qualifier,omitempty"`
}

ComponentTreeItem represents a component in tree results.

type ComponentsApp

type ComponentsApp struct {
	// CanCreateManualIssue indicates if manual issues can be created.
	CanCreateManualIssue bool `json:"canCreateManualIssue,omitempty"`
	// CanMarkAsFavorite indicates if the component can be marked as favorite.
	CanMarkAsFavorite bool `json:"canMarkAsFavorite,omitempty"`
	// Fav indicates if the component is a favorite.
	Fav bool `json:"fav,omitempty"`
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// LongName is the long name of the component.
	LongName string `json:"longName,omitempty"`
	// Measures contains component measures.
	Measures ComponentMeasures `json:"measures,omitzero"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Project is the project key.
	Project string `json:"project,omitempty"`
	// ProjectName is the project name.
	ProjectName string `json:"projectName,omitempty"`
	// Query is the component qualifier.
	Query string `json:"q,omitempty"`
	// UUID is the component UUID.
	UUID string `json:"uuid,omitempty"`
}

ComponentsApp represents the response from the App method. Contains coverage data required for rendering the component viewer.

type ComponentsAppOptions

type ComponentsAppOptions struct {
	// Branch is the branch key. Not available in the community edition.
	// Either branch or pullRequest can be provided, not both.
	Branch string `url:"branch,omitempty"`
	// Component is the component key.
	// This field is required.
	Component string `url:"component"`
	// PullRequest is the pull request id. Not available in the community edition.
	// Either branch or pullRequest can be provided, not both.
	PullRequest string `url:"pullRequest,omitempty"`
}

ComponentsAppOptions contains parameters for the App method.

type ComponentsSearch

type ComponentsSearch struct {
	// Components is the list of found components.
	Components []ComponentSearchItem `json:"components,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging"`
}

ComponentsSearch represents the response from the Search method. Contains a list of components and pagination information.

type ComponentsSearchOptions

type ComponentsSearchOptions struct {
	// PaginationArgs contains the pagination parameters.
	PaginationArgs `url:",inline"`

	// Query limits search to component names that contain the supplied string
	// or component keys that are exactly the same as the supplied string.
	// The value length must be between 2 and 15 (inclusive) characters.
	// Longer values will be truncated.
	Query string `url:"q,omitempty"`
	// Qualifiers is the list of component qualifiers to filter by.
	// Allowed values: TRK (Projects).
	// This field is required.
	Qualifiers []string `url:"qualifiers,comma"`
}

ComponentsSearchOptions contains parameters for the Search method.

type ComponentsSearchProjects

type ComponentsSearchProjects struct {
	// Components is the list of found projects.
	Components []ComponentProject `json:"components,omitempty"`
	// Facets is the list of computed facets.
	Facets []ComponentFacet `json:"facets,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging"`
}

ComponentsSearchProjects represents the response from the SearchProjects method. Contains a list of projects, facets, and pagination information.

type ComponentsSearchProjectsOptions

type ComponentsSearchProjectsOptions struct {
	// PaginationArgs contains the pagination parameters.
	PaginationArgs `url:",inline"`

	// Ascending indicates ascending sort order.
	// Default: true.
	Ascending bool `url:"asc,omitempty"`
	// Fields is the list of fields to be returned in response.
	// Allowed values: analysisDate, leakPeriodDate, _all.
	Fields []string `url:"f,omitempty,comma"`
	// Facets is the list of facets to be computed.
	// No facet is computed by default.
	Facets []string `url:"facets,omitempty,comma"`
	// Filter is the filter expression for projects on name, key, measure value,
	// quality gate, language, tag or whether a project is a favorite.
	// The filter must be URL-encoded.
	Filter string `url:"filter,omitempty"`
	// Sort is the sort field.
	// Allowed values: alert_status, analysisDate, coverage, creationDate, etc.
	Sort string `url:"s,omitempty"`
}

ComponentsSearchProjectsOptions contains parameters for the SearchProjects method.

type ComponentsService

type ComponentsService struct {
	// contains filtered or unexported fields
}

ComponentsService handles communication with the Components related methods of the SonarQube API. Get information about a component (file, directory, project, ...) and its ancestors or descendants.

func (*ComponentsService) App

App returns coverage data required for rendering the component viewer. Either branch or pull request can be provided, not both. Requires the following permission: 'Browse'.

This is an internal API and may change without notice.

Since: 4.4.

func (*ComponentsService) Search

Search searches for components.

Since: 6.3.

func (*ComponentsService) SearchProjects

SearchProjects searches for projects.

This is an internal API and may change without notice.

Since: 6.2.

func (*ComponentsService) Show

Show returns a component (file, directory, project, portfolio…) and its ancestors. The ancestors are ordered from the parent to the root project. Requires the following permission: 'Browse' on the project of the specified component.

Since: 5.4.

func (*ComponentsService) Suggestions

Suggestions returns component suggestions for the top-right search engine. The result contains component search results grouped by their qualifiers. Each result contains the component key, name, and optionally a display name with emphasis on matching characters.

This is an internal API and may change without notice.

Since: 4.2.

func (*ComponentsService) Tree

Tree navigates through components based on the chosen strategy. Requires the following permission: 'Browse' on the specified project. When limiting search with the q parameter, directories are not returned.

Since: 5.4.

func (*ComponentsService) ValidateAppOpt

func (s *ComponentsService) ValidateAppOpt(opt *ComponentsAppOptions) error

ValidateAppOpt validates the options for the App method.

func (*ComponentsService) ValidateSearchOpt

func (s *ComponentsService) ValidateSearchOpt(opt *ComponentsSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

func (*ComponentsService) ValidateSearchProjectsOpt

func (s *ComponentsService) ValidateSearchProjectsOpt(opt *ComponentsSearchProjectsOptions) error

ValidateSearchProjectsOpt validates the options for the SearchProjects method.

func (*ComponentsService) ValidateShowOpt

func (s *ComponentsService) ValidateShowOpt(opt *ComponentsShowOptions) error

ValidateShowOpt validates the options for the Show method.

func (*ComponentsService) ValidateSuggestionsOpt

func (s *ComponentsService) ValidateSuggestionsOpt(opt *ComponentsSuggestionsOptions) error

ValidateSuggestionsOpt validates the options for the Suggestions method.

func (*ComponentsService) ValidateTreeOpt

func (s *ComponentsService) ValidateTreeOpt(opt *ComponentsTreeOptions) error

ValidateTreeOpt validates the options for the Tree method.

type ComponentsShow

type ComponentsShow struct {
	// Ancestors is the list of ancestor components, ordered from parent to root.
	Ancestors []ComponentAncestor `json:"ancestors,omitempty"`
	// Component contains detailed component information.
	Component ComponentDetails `json:"component"`
}

ComponentsShow represents the response from the Show method. Contains a component and its ancestors.

type ComponentsShowOptions

type ComponentsShowOptions struct {
	// Branch is the branch key. Not available in the community edition.
	Branch string `url:"branch,omitempty"`
	// Component is the component key.
	// This field is required.
	Component string `url:"component"`
	// PullRequest is the pull request id. Not available in the community edition.
	PullRequest string `url:"pullRequest,omitempty"`
}

ComponentsShowOptions contains parameters for the Show method.

type ComponentsSuggestions

type ComponentsSuggestions struct {
	// Projects is the list of project suggestions (deprecated, use Results).
	Projects []any `json:"projects,omitempty"`
	// Results is the list of suggestion groups by qualifier.
	Results []ComponentSuggestionGroup `json:"results,omitempty"`
}

ComponentsSuggestions represents the response from the Suggestions method. Contains search results grouped by qualifier.

type ComponentsSuggestionsOptions

type ComponentsSuggestionsOptions struct {
	// More is the category for which to display the next 20 results.
	// Allowed values: VW, SVW, APP, TRK.
	More string `url:"more,omitempty"`
	// RecentlyBrowsed is the list of component keys that have recently been browsed.
	// Only the first 50 items will be used. Order is not taken into account.
	RecentlyBrowsed []string `url:"recentlyBrowsed,omitempty,comma"`
	// Search is the search query. Can contain several search tokens separated by spaces.
	// Minimum length: 2 characters.
	Search string `url:"s,omitempty"`
}

ComponentsSuggestionsOptions contains parameters for the Suggestions method.

type ComponentsTree

type ComponentsTree struct {
	// BaseComponent is the base component from which the tree navigation starts.
	BaseComponent ComponentTreeBase `json:"baseComponent"`
	// Components is the list of descendant components.
	Components []ComponentTreeItem `json:"components,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging"`
}

ComponentsTree represents the response from the Tree method. Contains the base component, its descendants, and pagination information.

type ComponentsTreeOptions

type ComponentsTreeOptions struct {
	// PaginationArgs contains the pagination parameters.
	PaginationArgs `url:",inline"`

	// Ascending indicates ascending sort order.
	// Default: true.
	Ascending bool `url:"asc,omitempty"`
	// Branch is the branch key. Not available in the community edition.
	Branch string `url:"branch,omitempty"`
	// Component is the base component key. The search is based on this component.
	// This field is required.
	Component string `url:"component"`
	// PullRequest is the pull request id. Not available in the community edition.
	PullRequest string `url:"pullRequest,omitempty"`
	// Query limits search to component names that contain the supplied string
	// or component keys that are exactly the same as the supplied string.
	// Minimum length: 3 characters.
	Query string `url:"q,omitempty"`
	// Qualifiers is the list of component qualifiers to filter by.
	// Allowed values: UTS, FIL, DIR, TRK.
	Qualifiers []string `url:"qualifiers,omitempty,comma"`
	// Sort is the list of sort fields.
	// Allowed values: name, path, qualifier.
	// Default: name.
	Sort []string `url:"s,omitempty,comma"`
	// Strategy is the strategy to search for base component descendants.
	// Allowed values: all, children, leaves.
	// Default: all.
	Strategy string `url:"strategy,omitempty"`
}

ComponentsTreeOptions contains parameters for the Tree method.

type ComputeEngineTasks

type ComputeEngineTasks struct {
	// InProgress is the number of tasks currently in progress.
	InProgress int64 `json:"In Progress,omitempty"`
	// LongestTimePendingMs is the longest time a task has been pending in milliseconds.
	LongestTimePendingMs int64 `json:"Longest Time Pending (ms),omitempty"`
	// MaxWorkerCount is the maximum number of worker threads.
	MaxWorkerCount int64 `json:"Max Worker Count,omitempty"`
	// Pending is the number of pending tasks.
	Pending int64 `json:"Pending,omitempty"`
	// ProcessedWithError is the number of tasks that completed with errors.
	ProcessedWithError int64 `json:"Processed With Error,omitempty"`
	// ProcessedWithSuccess is the number of tasks that completed successfully.
	ProcessedWithSuccess int64 `json:"Processed With Success,omitempty"`
	// ProcessingTimeMs is the total processing time in milliseconds.
	ProcessingTimeMs int64 `json:"Processing Time (ms),omitempty"`
	// WorkerCount is the current number of worker threads.
	WorkerCount int64 `json:"Worker Count,omitempty"`
	// WorkersPaused indicates if workers are currently paused.
	WorkersPaused bool `json:"Workers Paused,omitempty"`
}

ComputeEngineTasks contains Compute Engine task information.

type DatabaseConnectionPool

type DatabaseConnectionPool struct {
	// PoolActiveConnections is the number of active connections.
	PoolActiveConnections int64 `json:"Pool Active Connections,omitempty"`
	// PoolIdleConnections is the number of idle connections.
	PoolIdleConnections int64 `json:"Pool Idle Connections,omitempty"`
	// PoolMaxConnections is the maximum number of connections.
	PoolMaxConnections int64 `json:"Pool Max Connections,omitempty"`
	// PoolMaxLifetimeMs is the maximum lifetime of a connection in milliseconds.
	PoolMaxLifetimeMs int64 `json:"Pool Max Lifetime (ms),omitempty"`
	// PoolMaxWaitMs is the maximum wait time for a connection in milliseconds.
	PoolMaxWaitMs int64 `json:"Pool Max Wait (ms),omitempty"`
	// PoolMinIdleConnections is the minimum number of idle connections.
	PoolMinIdleConnections int64 `json:"Pool Min Idle Connections,omitempty"`
	// PoolTotalConnections is the total number of connections.
	PoolTotalConnections int64 `json:"Pool Total Connections,omitempty"`
}

DatabaseConnectionPool contains database connection pool information.

type DatabaseInfo

type DatabaseInfo struct {
	// Database is the database name.
	Database string `json:"Database,omitempty"`
	// DatabaseVersion is the database version.
	DatabaseVersion string `json:"Database Version,omitempty"`
	// DefaultTransactionIsolation is the default transaction isolation level.
	DefaultTransactionIsolation string `json:"Default transaction isolation,omitempty"`
	// Driver is the database driver name.
	Driver string `json:"Driver,omitempty"`
	// DriverVersion is the database driver version.
	DriverVersion string `json:"Driver Version,omitempty"`
	// URL is the database connection URL.
	URL string `json:"URL,omitempty"`
	// Username is the database username.
	Username string `json:"Username,omitempty"`
}

DatabaseInfo contains database information.

type DeveloperEvent

type DeveloperEvent struct {
	// Category is the type of event.
	Category string `json:"category,omitempty"`
	// Link is the URL to more information about the event.
	Link string `json:"link,omitempty"`
	// Message is the event message.
	Message string `json:"message,omitempty"`
	// Project is the project key associated with the event.
	Project string `json:"project,omitempty"`
}

DeveloperEvent represents an event in the developer activity feed.

type DevelopersSearchEvents

type DevelopersSearchEvents struct {
	// Events is the list of developer events.
	Events []DeveloperEvent `json:"events,omitempty"`
}

DevelopersSearchEvents represents the response from the search events endpoint.

type DevelopersSearchEventsOptions

type DevelopersSearchEventsOptions struct {
	// From is a list of datetimes.
	// Filter events created after the given date (exclusive).
	// This field is required.
	From []string `url:"from,comma"`
	// Projects is a list of project keys to search notifications for.
	// This field is required.
	Projects []string `url:"projects,comma"`
}

DevelopersSearchEventsOptions contains parameters for the SearchEvents method.

type DevelopersService

type DevelopersService struct {
	// contains filtered or unexported fields
}

DevelopersService handles communication with the developers related methods of the SonarQube API. This service provides data needed by SonarLint.

func (*DevelopersService) SearchEvents

SearchEvents searches for developer events. Requires authentication. When issue indexing is in progress, returns 503 service unavailable HTTP code.

API endpoint: GET /api/developers/search_events. WARNING: This is an internal API and may change without notice.

func (*DevelopersService) ValidateSearchEventsOpt

func (s *DevelopersService) ValidateSearchEventsOpt(opt *DevelopersSearchEventsOptions) error

ValidateSearchEventsOpt validates the options for the SearchEvents method.

type DismissMessageCheck

type DismissMessageCheck struct {
	// Dismissed indicates whether the message has been dismissed.
	Dismissed bool `json:"dismissed,omitempty"`
}

DismissMessageCheck represents the response from checking if a message has been dismissed.

type DismissMessageCheckOptions

type DismissMessageCheckOptions struct {
	// MessageType is the type of the message to check.
	// This field is required.
	MessageType string `url:"messageType"`
	// ProjectKey is the project key.
	// This field is required.
	ProjectKey string `url:"projectKey"`
}

DismissMessageCheckOptions contains parameters for the Check method.

type DismissMessageDismissOptions

type DismissMessageDismissOptions struct {
	// MessageType is the type of the message to dismiss.
	// This field is required.
	MessageType string `url:"messageType"`
	// ProjectKey is the project key.
	// This field is required.
	ProjectKey string `url:"projectKey"`
}

DismissMessageDismissOptions contains parameters for the Dismiss method.

type DismissMessageService

type DismissMessageService struct {
	// contains filtered or unexported fields
}

DismissMessageService handles communication with the message dismissal related methods of the SonarQube API. This service manages message dismissal for users.

func (*DismissMessageService) Check

Check checks if a message has been dismissed.

API endpoint: GET /api/dismiss_message/check. Since: 10.2.

func (*DismissMessageService) Dismiss

Dismiss dismisses a message for the current user.

API endpoint: POST /api/dismiss_message/dismiss. Since: 10.2.

func (*DismissMessageService) ValidateCheckOpt

func (s *DismissMessageService) ValidateCheckOpt(opt *DismissMessageCheckOptions) error

ValidateCheckOpt validates the options for the Check method.

func (*DismissMessageService) ValidateDismissOpt

func (s *DismissMessageService) ValidateDismissOpt(opt *DismissMessageDismissOptions) error

ValidateDismissOpt validates the options for the Dismiss method.

type DopSetting

type DopSetting struct {
	// AppID is the application ID of the DevOps Platform setting.
	AppID string `json:"appId,omitempty"`
	// Id is the unique identifier of the DevOps Platform setting.
	Id string `json:"id,omitempty"`
	// Key is the key of the DevOps Platform setting.
	Key string `json:"key,omitempty"`
	// Type is the type of DevOps Platform (github, gitlab, azure, bitbucketcloud, bitbucket_server).
	Type string `json:"type,omitempty"`
	// URL is the URL of the DevOps Platform instance.
	URL string `json:"url,omitempty"`
}

DopSetting represents a DevOps Platform integration setting.

type DopTranslationBoundProject

type DopTranslationBoundProject struct {
	// BindingId is the identifier of the binding between the project and the DevOps platform.
	BindingId string `json:"bindingId,omitempty"`
	// NewProjectCreated is true if a new project was created, false if an existing project was bound.
	NewProjectCreated bool `json:"newProjectCreated,omitempty"`
	// ProjectId is the identifier of the created project.
	ProjectId string `json:"projectId,omitempty"`
}

DopTranslationBoundProject represents the response from creating or updating a bound project.

type DopTranslationBoundProjectOptions

type DopTranslationBoundProjectOptions struct {
	// DevOpsPlatformSettingId is the identifier of the DevOps platform configuration.
	// This field is required.
	DevOpsPlatformSettingId string `json:"devOpsPlatformSettingId"`
	// Monorepo indicates whether the project is part of a monorepo.
	// This field is required.
	Monorepo bool `json:"monorepo"`
	// NewCodeDefinitionType is the project new code definition type.
	// Allowed values: PREVIOUS_VERSION, NUMBER_OF_DAYS, REFERENCE_BRANCH.
	NewCodeDefinitionType string `json:"newCodeDefinitionType,omitempty"`
	// NewCodeDefinitionValue is the project new code definition value.
	NewCodeDefinitionValue string `json:"newCodeDefinitionValue,omitempty"`
	// ProjectIdentifier is the identifier of the DevOps platform project.
	// Only needed for Azure and BitBucket Server platforms.
	ProjectIdentifier string `json:"projectIdentifier,omitempty"`
	// ProjectKey is the key of the project to create.
	// This field is required.
	ProjectKey string `json:"projectKey"`
	// ProjectName is the name of the project to create.
	// This field is required.
	ProjectName string `json:"projectName"`
	// RepositoryIdentifier is the identifier of the DevOps platform repository to import.
	// This field is required.
	RepositoryIdentifier string `json:"repositoryIdentifier"`
}

DopTranslationBoundProjectOptions contains parameters for creating or updating a bound project.

type DopTranslationDopSettings

type DopTranslationDopSettings struct {
	// DopSettings is the list of DevOps Platform settings.
	DopSettings []DopSetting `json:"dopSettings,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

DopTranslationDopSettings represents the response from listing all DevOps Platform settings.

type DopTranslationGenerateInstallationTokenOptions added in v2.3.0

type DopTranslationGenerateInstallationTokenOptions struct {
	// Project is the key of the project whose bound repository the token is
	// scoped to. This field is required.
	Project string `json:"project"`
}

DopTranslationGenerateInstallationTokenOptions contains parameters for minting a GitHub App installation token.

type DopTranslationGithubInstallationToken added in v2.3.0

type DopTranslationGithubInstallationToken struct {
	// Token is the short-lived GitHub App installation token.
	Token string `json:"token,omitempty"`
	// ExpiresAt is the token expiration timestamp.
	ExpiresAt string `json:"expiresAt,omitempty"`
}

DopTranslationGithubInstallationToken represents a minted, short-lived GitHub App installation token scoped to the bound repository of a project.

type DopTranslationJfrogEvidence added in v2.2.0

type DopTranslationJfrogEvidence map[string]any

DopTranslationJfrogEvidence represents a JFrog evidence statement for a Compute Engine task, in the in-toto Statement format. The SonarQube API spec declares this as a generic/loosely typed schema, so it is decoded into a string-keyed map rather than a fixed struct.

type DopTranslationService

type DopTranslationService struct {
	// contains filtered or unexported fields
}

DopTranslationService handles communication with the DevOps Platform Translation related methods of the SonarQube V2 API.

func (*DopTranslationService) CreateBoundProject

CreateBoundProject creates a SonarQube project with the information from the provided DevOps platform project. Requires the 'Create Projects' permission and a configured Personal Access Token.

func (*DopTranslationService) CreateOrUpdateBoundProject

CreateOrUpdateBoundProject creates a SonarQube project bound to a DevOps platform repository, or updates the binding if the project already exists. This is an idempotent operation. Requires the 'Create Projects' permission and a configured Personal Access Token.

func (*DopTranslationService) GenerateInstallationToken added in v2.3.0

GenerateInstallationToken mints a short-lived GitHub App installation token, scoped to the bound repository of the given project. Requires the 'Administer System' permission.

This endpoint is marked internal by SonarQube (x-sonar-internal) and its request/response contract may change without notice between SonarQube versions.

API endpoint: POST /api/v2/dop-translation/github-installation-tokens.

func (*DopTranslationService) GetDopSettings

GetDopSettings lists all DevOps Platform Integration settings. Requires the 'Create Projects' permission.

func (*DopTranslationService) GetJfrogEvidence added in v2.2.0

GetJfrogEvidence returns a JFrog evidence statement for the specified Compute Engine task. The evidence contains quality gate status and conditions in the in-toto Statement format. Requires 'Browse' permission on the project associated with the task.

API endpoint: GET /api/v2/dop-translation/jfrog-evidence/{taskId}.

func (*DopTranslationService) ValidateCreateBoundProjectRequest

func (s *DopTranslationService) ValidateCreateBoundProjectRequest(opt *DopTranslationBoundProjectOptions) error

ValidateCreateBoundProjectRequest validates the DopTranslationBoundProjectOptions.

func (*DopTranslationService) ValidateGenerateInstallationTokenRequest added in v2.3.0

func (s *DopTranslationService) ValidateGenerateInstallationTokenRequest(opt *DopTranslationGenerateInstallationTokenOptions) error

ValidateGenerateInstallationTokenRequest validates the DopTranslationGenerateInstallationTokenOptions.

type DuplicatedFile

type DuplicatedFile struct {
	// Key is the file key.
	Key string `json:"key,omitempty"`
	// Name is the file name.
	Name string `json:"name,omitempty"`
	// ProjectName is the name of the project containing this file.
	ProjectName string `json:"projectName,omitempty"`
}

DuplicatedFile represents a file that contains duplicated code.

type DuplicationBlock

type DuplicationBlock struct {
	// Ref is the reference to the file in the Files map.
	//nolint:tagliatelle // API uses _ref as the field name.
	Ref string `json:"_ref,omitempty"`
	// From is the starting line number.
	From int64 `json:"from,omitempty"`
	// Size is the number of lines in the duplicated block.
	Size int64 `json:"size,omitempty"`
}

DuplicationBlock represents a block of duplicated code.

type DuplicationGroup

type DuplicationGroup struct {
	// Blocks is the list of code blocks in this duplication group.
	Blocks []DuplicationBlock `json:"blocks,omitempty"`
}

DuplicationGroup represents a group of duplicated code blocks.

type DuplicationsService

type DuplicationsService struct {
	// contains filtered or unexported fields
}

DuplicationsService handles communication with the duplications related methods of the SonarQube API. This service provides duplication information for projects.

func (*DuplicationsService) Show

Show returns duplications for a file. Requires Browse permission on file's project.

API endpoint: GET /api/duplications/show. Since: 4.4.

func (*DuplicationsService) ValidateShowOpt

func (s *DuplicationsService) ValidateShowOpt(opt *DuplicationsShowOptions) error

ValidateShowOpt validates the options for the Show method.

type DuplicationsShow

type DuplicationsShow struct {
	// Duplications is the list of duplication groups.
	Duplications []DuplicationGroup `json:"duplications,omitempty"`
	// Files is a map of file references to file information.
	// Keys are numeric strings like "1", "2", "3".
	Files map[string]DuplicatedFile `json:"files,omitempty"`
}

DuplicationsShow represents the response from showing duplications.

type DuplicationsShowOptions

type DuplicationsShowOptions struct {
	// Branch key.
	// WARNING: This parameter is internal and may change without notice.
	Branch string `url:"branch,omitempty"`
	// Key is the file key.
	// This field is required.
	Key string `url:"key"`
	// PullRequest is the pull request id.
	// WARNING: This parameter is internal and may change without notice.
	PullRequest string `url:"pullRequest,omitempty"`
}

DuplicationsShowOptions contains parameters for the Show method.

type EditionsService

type EditionsService struct {
	// contains filtered or unexported fields
}

EditionsService handles communication with the editions related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*EditionsService) ActivateGracePeriod

func (s *EditionsService) ActivateGracePeriod(ctx context.Context) (*http.Response, error)

ActivateGracePeriod enables a 7-day license grace period when the Server ID is invalid. Requires 'Administer System' permission.

API endpoint: POST /api/editions/activate_grace_period. Since: 10.3. Enterprise Edition only.

func (*EditionsService) Get deprecated

Get returns the details of the current SonarQube Enterprise Edition license. Requires 'Administer System' permission.

Deprecated: Since SonarQube 2025.6. API endpoint: GET /api/editions/show_license. Since: 7.2. Enterprise Edition only.

func (*EditionsService) IsValidLicense

func (s *EditionsService) IsValidLicense(ctx context.Context) (*LicenseIsValid, *http.Response, error)

IsValidLicense returns the validity of the current license.

API endpoint: GET /api/editions/is_valid_license. Since: 7.3. Enterprise Edition only.

func (*EditionsService) Set deprecated

Set activates a new SonarQube Enterprise Edition license. Requires 'Administer System' permission.

Deprecated: Since SonarQube 2025.6. API endpoint: POST /api/editions/set_license. Since: 7.2. Enterprise Edition only.

func (*EditionsService) UnsetLicense deprecated

func (s *EditionsService) UnsetLicense(ctx context.Context) (*http.Response, error)

UnsetLicense removes the current license. Requires 'Administer System' permission.

Deprecated: Since SonarQube 2025.6. API endpoint: POST /api/editions/unset_license. Since: 7.2. Enterprise Edition only.

func (*EditionsService) ValidateSetOpt

func (s *EditionsService) ValidateSetOpt(opt *LicenseSetOptions) error

ValidateSetOpt validates the options for the Set method.

type EmailsSendOptions

type EmailsSendOptions struct {
	// Message is the content of the email.
	// This field is required.
	Message string `url:"message"`
	// Subject is the subject of the email.
	// Optional, defaults to empty.
	Subject string `url:"subject,omitempty"`
	// To is the recipient email address.
	// This field is required.
	To string `url:"to"`
}

EmailsSendOptions contains parameters for the Send method.

type EmailsService

type EmailsService struct {
	// contains filtered or unexported fields
}

EmailsService handles communication with the email related methods of the SonarQube API. This service manages email operations, including sending test emails.

func (*EmailsService) Send

Send tests email configuration by sending an email. Requires 'Administer System' permission.

API endpoint: POST /api/emails/send. WARNING: This is an internal API and may change without notice.

func (*EmailsService) ValidateSendOpt

func (s *EmailsService) ValidateSendOpt(opt *EmailsSendOptions) error

ValidateSendOpt validates the options for the Send method.

type EntitlementsActivateLegacyOptions added in v2.2.0

type EntitlementsActivateLegacyOptions struct {
	// LicenseKey is the new license key to activate. This field is required.
	LicenseKey string `json:"licenseKey"`
}

EntitlementsActivateLegacyOptions contains parameters for activating a license received from Sonar using the legacy flow.

type EntitlementsActivateOfflineOptions added in v2.2.0

type EntitlementsActivateOfflineOptions struct {
	// License is the content of a valid .lic file. This field is required.
	License string `json:"license"`
	// LicenseKey is the license key for the license. This field is required.
	LicenseKey string `json:"licenseKey"`
}

EntitlementsActivateOfflineOptions contains parameters for uploading a license file to complete offline activation.

type EntitlementsActivateOnlineOptions added in v2.2.0

type EntitlementsActivateOnlineOptions struct {
	// LicenseKey is the new license key to activate. This field is required.
	LicenseKey string `json:"licenseKey"`
}

EntitlementsActivateOnlineOptions contains parameters for activating a license online via a third-party license key.

type EntitlementsGetOfflineActivationRequestOptions added in v2.2.0

type EntitlementsGetOfflineActivationRequestOptions struct {
	// LicenseKey is the unique license key associated with the license, in the
	// format 'ABCD-EFGH-IJKL-MNOP'. Sent as the 'License-Key' HTTP header.
	// This field is required.
	LicenseKey string `json:"-"`
}

EntitlementsGetOfflineActivationRequestOptions contains parameters for retrieving a .req file for offline license activation.

type EntitlementsService added in v2.2.0

type EntitlementsService struct {
	// contains filtered or unexported fields
}

EntitlementsService handles communication with the Entitlements related methods of the SonarQube V2 API. It covers license activation/deactivation (online, offline and legacy flows) and purchasable feature listing.

This service is only available in Enterprise Edition. All underlying endpoints are marked internal by SonarQube (x-sonar-internal) and their request/response contract may change without notice between SonarQube versions.

It supersedes the deprecated V1 license methods on EditionsService (Get, Set, UnsetLicense), which are deprecated since SonarQube 2025.6.

func (*EntitlementsService) ActivateLegacy added in v2.2.0

ActivateLegacy activates a new SonarQube Enterprise Edition license using a license key received from Sonar. Only license keys received from Sonar are accepted. Requires 'Administer System' permission.

API endpoint: POST /api/v2/entitlements/legacy-activation. Enterprise Edition only.

func (*EntitlementsService) ActivateOffline added in v2.2.0

ActivateOffline uploads a license file to complete offline activation. The content should be the text of the license file, along with a valid license key. Requires 'Administer System' permission.

API endpoint: POST /api/v2/entitlements/offline-activation. Enterprise Edition only.

func (*EntitlementsService) ActivateOnline added in v2.2.0

ActivateOnline activates a new SonarQube Enterprise Edition license using a third-party license key. Only third party license keys are accepted. Requires 'Administer System' permission.

API endpoint: POST /api/v2/entitlements/online-activation. Enterprise Edition only.

func (*EntitlementsService) DeactivateOffline added in v2.2.0

func (s *EntitlementsService) DeactivateOffline(ctx context.Context) (*string, *http.Response, error)

DeactivateOffline fully deactivates a license that was activated using the offline method (e.g. in cases of migrating the installation to a new server). Requires 'Administer System' permission.

API endpoint: POST /api/v2/entitlements/offline-deactivation. Enterprise Edition only.

func (*EntitlementsService) DeleteLicense added in v2.2.0

func (s *EntitlementsService) DeleteLicense(ctx context.Context) (*http.Response, error)

DeleteLicense deletes the current license. Both license keys received from Sonar and from a 3rd party system can be removed. Requires 'Administer System' permission.

API endpoint: DELETE /api/v2/entitlements/license. Enterprise Edition only.

func (*EntitlementsService) GetLicense added in v2.2.0

func (s *EntitlementsService) GetLicense(ctx context.Context) (*LicenseV2, *http.Response, error)

GetLicense returns information about the current license. Requires 'Administer System' permission.

API endpoint: GET /api/v2/entitlements/license. Enterprise Edition only.

func (*EntitlementsService) GetOfflineActivationRequest added in v2.2.0

GetOfflineActivationRequest retrieves a .req file for offline activation of a license. The license key must be passed via the License-Key HTTP header. Requires 'Administer System' permission.

API endpoint: GET /api/v2/entitlements/offline-activation. Enterprise Edition only.

func (*EntitlementsService) GetPurchasableFeatures added in v2.2.0

func (s *EntitlementsService) GetPurchasableFeatures(ctx context.Context) ([]PurchasableFeatureV2, *http.Response, error)

GetPurchasableFeatures returns the list of all available purchasable features for this edition, including the ones already purchased.

API endpoint: GET /api/v2/entitlements/purchasable-features. Enterprise Edition only.

func (*EntitlementsService) UpdateLicense added in v2.2.0

func (s *EntitlementsService) UpdateLicense(ctx context.Context) (*http.Response, error)

UpdateLicense fetches the latest information about the license and updates it on the SonarQube Server instance. Requires 'Administer System' permission.

API endpoint: PATCH /api/v2/entitlements/license. Enterprise Edition only.

func (*EntitlementsService) ValidateActivateLegacyOpt added in v2.2.0

func (s *EntitlementsService) ValidateActivateLegacyOpt(opt *EntitlementsActivateLegacyOptions) error

ValidateActivateLegacyOpt validates the options for the ActivateLegacy method.

func (*EntitlementsService) ValidateActivateOfflineOpt added in v2.2.0

func (s *EntitlementsService) ValidateActivateOfflineOpt(opt *EntitlementsActivateOfflineOptions) error

ValidateActivateOfflineOpt validates the options for the ActivateOffline method.

func (*EntitlementsService) ValidateActivateOnlineOpt added in v2.2.0

func (s *EntitlementsService) ValidateActivateOnlineOpt(opt *EntitlementsActivateOnlineOptions) error

ValidateActivateOnlineOpt validates the options for the ActivateOnline method.

func (*EntitlementsService) ValidateGetOfflineActivationRequestOpt added in v2.2.0

func (s *EntitlementsService) ValidateGetOfflineActivationRequestOpt(opt *EntitlementsGetOfflineActivationRequestOptions) error

ValidateGetOfflineActivationRequestOpt validates the options for the GetOfflineActivationRequest method.

type Favorite

type Favorite struct {
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Qualifier is the component qualifier (e.g., TRK for project).
	Qualifier string `json:"qualifier,omitempty"`
}

Favorite represents a favorited component.

type FavoritesAddOptions

type FavoritesAddOptions struct {
	// Component is the component key.
	// Only components with qualifiers TRK, VW, SVW, APP are supported.
	// This field is required.
	Component string `url:"component"`
}

FavoritesAddOptions contains parameters for the Add method.

type FavoritesRemoveOptions

type FavoritesRemoveOptions struct {
	// Component is the component key.
	// This field is required.
	Component string `url:"component"`
}

FavoritesRemoveOptions contains parameters for the Remove method.

type FavoritesSearch

type FavoritesSearch struct {
	// Favorites is the list of favorited components.
	Favorites []Favorite `json:"favorites,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

FavoritesSearch represents the response from searching favorites.

type FavoritesSearchOptions

type FavoritesSearchOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`
}

FavoritesSearchOptions contains parameters for the Search method.

type FavoritesService

type FavoritesService struct {
	// contains filtered or unexported fields
}

FavoritesService handles communication with the favorites related methods of the SonarQube API. This service manages user favorites.

func (*FavoritesService) Add

Add adds a component as favorite for the authenticated user. Only 100 components by qualifier can be added as favorite. Requires authentication and the 'Browse' permission on the component.

API endpoint: POST /api/favorites/add. Since: 6.3.

func (*FavoritesService) Remove

Remove removes a component as favorite for the authenticated user. Requires authentication.

API endpoint: POST /api/favorites/remove. Since: 6.3.

func (*FavoritesService) Search

Search searches for the authenticated user favorites. Requires authentication.

API endpoint: GET /api/favorites/search. Since: 6.3.

func (*FavoritesService) ValidateAddOpt

func (s *FavoritesService) ValidateAddOpt(opt *FavoritesAddOptions) error

ValidateAddOpt validates the options for the Add method.

func (*FavoritesService) ValidateRemoveOpt

func (s *FavoritesService) ValidateRemoveOpt(opt *FavoritesRemoveOptions) error

ValidateRemoveOpt validates the options for the Remove method.

func (*FavoritesService) ValidateSearchOpt

func (s *FavoritesService) ValidateSearchOpt(opt *FavoritesSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

type FeaturesList

type FeaturesList []string

FeaturesList represents the list of supported features returned by the API. This is a simple slice of feature names.

type FeaturesService

type FeaturesService struct {
	// contains filtered or unexported fields
}

FeaturesService handles communication with the features related methods of the SonarQube API. This service provides information about features available in SonarQube.

func (*FeaturesService) List

List returns the list of supported features in the SonarQube instance.

API endpoint: GET /api/features/list. WARNING: This is an internal API and may change without notice.

type FixSuggestion

type FixSuggestion struct {
	// Id is the unique identifier of the fix suggestion.
	Id string `json:"id,omitempty"`
	// IssueId is the identifier of the issue this suggestion addresses.
	IssueId string `json:"issueId,omitempty"`
	// Explanation describes the reasoning behind the proposed fix.
	Explanation string `json:"explanation,omitempty"`
	// Changes is the list of code changes to apply.
	Changes []FixSuggestionChange `json:"changes,omitempty"`
}

FixSuggestion represents an AI-generated fix suggestion for an issue.

type FixSuggestionChange

type FixSuggestionChange struct {
	// StartLine is the starting line of the code to replace.
	StartLine int `json:"startLine,omitempty"`
	// EndLine is the ending line of the code to replace.
	EndLine int `json:"endLine,omitempty"`
	// NewCode is the replacement code proposed by the AI.
	NewCode string `json:"newCode,omitempty"`
}

FixSuggestionChange represents a code change proposed by an AI fix suggestion.

type FixSuggestionIssueAvailability

type FixSuggestionIssueAvailability struct {
	// IssueId is the issue identifier.
	IssueId string `json:"issueId,omitempty"`
	// AiSuggestion indicates whether an AI suggestion is available.
	AiSuggestion string `json:"aiSuggestion,omitempty"`
}

FixSuggestionIssueAvailability represents fix suggestion availability for an issue.

type FixSuggestionProvider

type FixSuggestionProvider struct {
	// Type is the provider type (e.g. AZURE_OPENAI, AWS_BEDROCK, CUSTOM, OPENAI).
	Type string `json:"type,omitempty"`
	// Name is the display name of the provider.
	Name string `json:"name,omitempty"`
	// SelfHosted indicates whether this is a self-hosted provider.
	SelfHosted bool `json:"selfHosted,omitempty"`
	// Selected indicates whether this provider is currently selected.
	Selected bool `json:"selected,omitempty"`
	// Model is the name of the selected model, if any.
	Model string `json:"model,omitempty"`
	// Recommended indicates whether this provider/model is recommended.
	Recommended bool `json:"recommended,omitempty"`
	// Config contains provider-specific configuration key/value pairs.
	Config map[string]string `json:"config,omitempty"`
	// Headers contains custom HTTP headers for self-hosted/custom providers.
	Headers []any `json:"headers,omitempty"`
}

FixSuggestionProvider represents a configured LLM provider for fix suggestions.

type FixSuggestionsAwarenessBanner

type FixSuggestionsAwarenessBanner struct {
	// Id is the interaction identifier.
	Id string `json:"id,omitempty"`
}

FixSuggestionsAwarenessBanner represents the response from a banner interaction.

type FixSuggestionsAwarenessBannerOptions

type FixSuggestionsAwarenessBannerOptions struct {
	// BannerType is the type of banner interaction that occurred. This field is required.
	// Allowed values: ENABLE, LEARN_MORE.
	BannerType string `json:"bannerType"`
}

FixSuggestionsAwarenessBannerOptions contains parameters for the AwarenessBannerInteraction method.

type FixSuggestionsCreateOptions

type FixSuggestionsCreateOptions struct {
	// IssueId is the issue identifier to generate a fix for. This field is required.
	IssueId string `json:"issueId"`
}

FixSuggestionsCreateOptions contains parameters for the CreateSuggestion method.

type FixSuggestionsFeatureEnablement

type FixSuggestionsFeatureEnablement struct {
	// Enablement is the enablement state.
	Enablement string `json:"enablement,omitempty"`
	// EnabledProjectKeys lists project keys where the feature is enabled.
	EnabledProjectKeys []string `json:"enabledProjectKeys,omitempty"`
	// Providers is the list of configured LLM providers.
	Providers []FixSuggestionProvider `json:"providers,omitempty"`
}

FixSuggestionsFeatureEnablement represents the AI CodeFix feature enablement state.

type FixSuggestionsIssueOptions

type FixSuggestionsIssueOptions struct {
	// IssueId is the issue identifier. This field is required.
	IssueId string `json:"issueId"`
}

FixSuggestionsIssueOptions contains parameters for the GetIssueAvailability method.

type FixSuggestionsLlmModel

type FixSuggestionsLlmModel struct {
	// Key is the model key.
	Key string `json:"key,omitempty"`
	// Name is the display name.
	Name string `json:"name,omitempty"`
	// Recommended indicates whether this is the recommended model.
	Recommended bool `json:"recommended,omitempty"`
}

FixSuggestionsLlmModel represents a supported LLM model.

type FixSuggestionsLlmProvider

type FixSuggestionsLlmProvider struct {
	// Key is the provider key.
	Key string `json:"key,omitempty"`
	// Name is the display name.
	Name string `json:"name,omitempty"`
	// SelfHosted indicates whether this is a self-hosted provider.
	SelfHosted bool `json:"selfHosted,omitempty"`
	// Models is the list of models available from this provider.
	Models []FixSuggestionsLlmModel `json:"models,omitempty"`
}

FixSuggestionsLlmProvider represents a supported LLM provider.

type FixSuggestionsService

type FixSuggestionsService struct {
	// contains filtered or unexported fields
}

FixSuggestionsService handles communication with the AI fix suggestions V2 API endpoints. This service is only available in Enterprise Edition with AI features enabled.

func (*FixSuggestionsService) AwarenessBannerInteraction

AwarenessBannerInteraction records a user interaction with the AI awareness banner. Requires authentication.

API endpoint: POST /api/v2/fix-suggestions/feature-enablements/awareness-banner-interactions. Enterprise Edition only.

func (*FixSuggestionsService) CreateSuggestion

CreateSuggestion generates an AI fix suggestion for the given issue. Requires 'Browse' permission on the project.

API endpoint: POST /api/v2/fix-suggestions/ai-suggestions. Enterprise Edition only.

func (*FixSuggestionsService) GetEnablement

GetEnablement returns the AI CodeFix feature enablement configuration. Requires 'Administer System' permission.

API endpoint: GET /api/v2/fix-suggestions/feature-enablements. Enterprise Edition only.

func (*FixSuggestionsService) GetIssueAvailability

GetIssueAvailability checks whether an AI fix suggestion is available for the given issue. Requires 'Browse' permission on the project.

API endpoint: GET /api/v2/fix-suggestions/issues/{issueId}. Enterprise Edition only.

func (*FixSuggestionsService) GetServiceInfo

GetServiceInfo returns the AI CodeFix service status and subscription information. Requires 'Administer System' permission.

API endpoint: GET /api/v2/fix-suggestions/service-info. Enterprise Edition only.

func (*FixSuggestionsService) GetSubscriptionType deprecated

GetSubscriptionType returns the AI CodeFix subscription type. Requires 'Administer System' permission.

API endpoint: GET /api/v2/fix-suggestions/service-info/subscription-type. Enterprise Edition only.

Deprecated: This endpoint has been removed from the SonarQube API as of version 2026.3 and will return an error if called.

func (*FixSuggestionsService) GetSupportedLlmProviders

func (s *FixSuggestionsService) GetSupportedLlmProviders(ctx context.Context) ([]FixSuggestionsLlmProvider, *http.Response, error)

GetSupportedLlmProviders returns the list of supported LLM providers. Requires 'Administer System' permission.

API endpoint: GET /api/v2/fix-suggestions/supported-llm-providers. The endpoint returns a bare JSON array (confirmed against the SonarQube server implementation), not an object wrapping a "providers" field. Enterprise Edition only.

func (*FixSuggestionsService) GetSupportedRules added in v2.2.0

GetSupportedRules returns the list of rules for which a fix suggestion can be generated. Requires 'Administer System' permission.

API endpoint: GET /api/v2/fix-suggestions/supported-rules. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*FixSuggestionsService) SetEnablement

SetEnablement enables or disables the AI CodeFix feature. Requires 'Administer System' permission.

API endpoint: PATCH /api/v2/fix-suggestions/feature-enablements. Enterprise Edition only.

func (*FixSuggestionsService) ValidateAwarenessBannerOpt

func (s *FixSuggestionsService) ValidateAwarenessBannerOpt(opt *FixSuggestionsAwarenessBannerOptions) error

ValidateAwarenessBannerOpt validates the options for the AwarenessBannerInteraction method.

func (*FixSuggestionsService) ValidateCreateSuggestionOpt

func (s *FixSuggestionsService) ValidateCreateSuggestionOpt(opt *FixSuggestionsCreateOptions) error

ValidateCreateSuggestionOpt validates the options for the CreateSuggestion method.

func (*FixSuggestionsService) ValidateGetIssueAvailabilityOpt

func (s *FixSuggestionsService) ValidateGetIssueAvailabilityOpt(opt *FixSuggestionsIssueOptions) error

ValidateGetIssueAvailabilityOpt validates the options for the GetIssueAvailability method.

func (*FixSuggestionsService) ValidateSetEnablementOpt

func (s *FixSuggestionsService) ValidateSetEnablementOpt(opt *FixSuggestionsSetEnablementOptions) error

ValidateSetEnablementOpt validates the options for the SetEnablement method.

type FixSuggestionsServiceInfo

type FixSuggestionsServiceInfo struct {
	// Status is the current service status.
	Status string `json:"status,omitempty"`
	// IsEnabled indicates whether the service is enabled.
	IsEnabled bool `json:"isEnabled,omitempty"`
	// SubscriptionType is the subscription type.
	SubscriptionType string `json:"subscriptionType,omitempty"`
}

FixSuggestionsServiceInfo represents the AI CodeFix service status.

type FixSuggestionsSetEnablementOptions

type FixSuggestionsSetEnablementOptions struct {
	// Enablement is the desired feature enablement state. This field is required.
	// Allowed values: ENABLED_FOR_ALL_PROJECTS, DISABLED, ENABLED_FOR_SOME_PROJECTS.
	Enablement string `json:"enablement"`
}

FixSuggestionsSetEnablementOptions contains parameters for the SetEnablement method.

type FixSuggestionsSubscriptionType

type FixSuggestionsSubscriptionType struct {
	// SubscriptionType is the subscription type string.
	SubscriptionType string `json:"subscriptionType,omitempty"`
}

FixSuggestionsSubscriptionType represents the subscription type response.

type FixSuggestionsSupportedRules added in v2.2.0

type FixSuggestionsSupportedRules struct {
	// Rules is the list of supported rule keys.
	Rules []string `json:"rules,omitempty"`
}

FixSuggestionsSupportedRules represents the list of rules for which a fix suggestion can be generated.

type FlowLocation

type FlowLocation struct {
	// Msg is the message for this location.
	Msg string `json:"msg,omitempty"`
	// TextRange is the text range of this location.
	TextRange TextRange `json:"textRange,omitzero"`
	// MsgFormattings is the list of message formatting rules.
	MsgFormattings []MessageFormatting `json:"msgFormattings,omitempty"`
}

FlowLocation represents a location in a code flow.

type GithubDefinition

type GithubDefinition struct {
	// AppID is the GitHub App ID.
	AppID string `json:"appId,omitempty"`
	// ClientID is the GitHub App Client ID.
	ClientID string `json:"clientId,omitempty"`
	// Key is the unique setting key.
	Key string `json:"key,omitempty"`
	// URL is the GitHub API URL.
	URL string `json:"url,omitempty"`
}

GithubDefinition represents a GitHub setting definition.

type GithubOrganization

type GithubOrganization struct {
	// Key is the organization key (login).
	Key string `json:"key,omitempty"`
	// Name is the organization display name.
	Name string `json:"name,omitempty"`
}

GithubOrganization represents a GitHub organization.

type GithubProvisioningApplicationStatus

type GithubProvisioningApplicationStatus struct {
	// AutoProvisioning contains the auto-provisioning status.
	AutoProvisioning GithubProvisioningStatus `json:"autoProvisioning,omitzero"`
	// Jit contains the Just-In-Time provisioning status.
	Jit GithubProvisioningJitStatus `json:"jit,omitzero"`
}

GithubProvisioningApplicationStatus represents the provisioning status at the application level.

type GithubProvisioningCheck

type GithubProvisioningCheck struct {
	// Application contains provisioning status for the application level.
	Application GithubProvisioningApplicationStatus `json:"application,omitzero"`
	// Installations contains provisioning status for each GitHub organization/installation.
	Installations []GithubProvisioningInstallation `json:"installations,omitempty"`
}

GithubProvisioningCheck represents the response from checking GitHub provisioning configuration.

type GithubProvisioningInstallation

type GithubProvisioningInstallation struct {
	// AutoProvisioning contains the auto-provisioning status for this installation.
	AutoProvisioning GithubProvisioningStatus `json:"autoProvisioning,omitzero"`
	// Jit contains the Just-In-Time provisioning status for this installation.
	Jit GithubProvisioningJitStatus `json:"jit,omitzero"`
	// Organization is the name of the GitHub organization.
	Organization string `json:"organization,omitempty"`
}

GithubProvisioningInstallation represents the provisioning status for a GitHub organization/installation.

type GithubProvisioningJitStatus

type GithubProvisioningJitStatus struct {
	// ErrorMessage contains an error message if JIT provisioning failed.
	ErrorMessage string `json:"errorMessage,omitempty"`
	// Status is the JIT provisioning status.
	Status string `json:"status,omitempty"`
}

GithubProvisioningJitStatus represents the status of Just-In-Time provisioning.

type GithubProvisioningService

type GithubProvisioningService struct {
	// contains filtered or unexported fields
}

GithubProvisioningService handles communication with the GitHub provisioning related methods of the SonarQube API. This service manages GitHub provisioning operations.

func (*GithubProvisioningService) Check

Check validates the GitHub provisioning configuration.

API endpoint: POST /api/github_provisioning/check. WARNING: This is an internal API and may change without notice.

type GithubProvisioningStatus

type GithubProvisioningStatus struct {
	// ErrorMessage contains an error message if provisioning failed.
	ErrorMessage string `json:"errorMessage,omitempty"`
	// Status is the provisioning status.
	Status string `json:"status,omitempty"`
}

GithubProvisioningStatus represents the status of auto-provisioning.

type GithubRepository

type GithubRepository struct {
	// ID is the repository ID.
	ID int64 `json:"id,omitempty"`
	// Key is the repository key (owner/repo).
	Key string `json:"key,omitempty"`
	// Name is the repository name.
	Name string `json:"name,omitempty"`
	// URL is the repository URL.
	URL string `json:"url,omitempty"`
}

GithubRepository represents a GitHub repository.

type GitlabDefinition

type GitlabDefinition struct {
	// Key is the unique setting key.
	Key string `json:"key,omitempty"`
	// URL is the GitLab API URL (since 8.2).
	URL string `json:"url,omitempty"`
}

GitlabDefinition represents a GitLab setting definition.

type GitlabRepository

type GitlabRepository struct {
	// ID is the GitLab project ID.
	ID int64 `json:"id,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
	// PathName is the full path with namespace.
	PathName string `json:"pathName,omitempty"`
	// PathSlug is the path slug.
	PathSlug string `json:"pathSlug,omitempty"`
	// Slug is the project slug.
	Slug string `json:"slug,omitempty"`
	// URL is the project URL.
	URL string `json:"url,omitempty"`
}

GitlabRepository represents a GitLab repository (project).

type GovernanceReportsDownloadOptions

type GovernanceReportsDownloadOptions struct {
	// BranchKey is the branch key. Optional.
	BranchKey string `url:"branchKey,omitempty"`
	// ComponentID is the component id. Optional.
	ComponentID string `url:"componentId,omitempty"`
	// ComponentKey is the component key. Optional.
	ComponentKey string `url:"componentKey,omitempty"`
}

GovernanceReportsDownloadOptions contains parameters for the Download method.

type GovernanceReportsService

type GovernanceReportsService struct {
	// contains filtered or unexported fields
}

GovernanceReportsService handles communication with the governance reports related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*GovernanceReportsService) Download

Download downloads the PDF report of a portfolio, sub-portfolio, project or application. Requires 'Browse' permission on the component.

API endpoint: GET /api/governance_reports/download. Since: 1.0. Enterprise Edition only.

func (*GovernanceReportsService) Status

Status returns PDF report metadata (action rights, report availability etc.). Requires 'Browse' permission on the component.

API endpoint: GET /api/governance_reports/status. Since: 1.0. Enterprise Edition only.

func (*GovernanceReportsService) Subscribe

Subscribe subscribes the current user to reports for a component. Requires authentication and 'Browse' permission on the component.

API endpoint: POST /api/governance_reports/subscribe. Since: 1.0. Enterprise Edition only.

func (*GovernanceReportsService) Unsubscribe

Unsubscribe unsubscribes the current user from reports for a component. Requires authentication and 'Browse' permission on the component.

API endpoint: POST /api/governance_reports/unsubscribe. Since: 1.0. Enterprise Edition only.

func (*GovernanceReportsService) UpdateFrequency

UpdateFrequency updates the frequency at which a report is sent for a component. Requires 'Administer' permission.

API endpoint: POST /api/governance_reports/update_frequency. Since: 1.0. Enterprise Edition only.

func (*GovernanceReportsService) UpdateRecipients

UpdateRecipients updates the list of users who will receive reports for a component. Requires 'Administer' permission.

API endpoint: POST /api/governance_reports/update_recipients. Since: 1.0. Enterprise Edition only.

func (*GovernanceReportsService) ValidateUpdateRecipientsOpt

func (s *GovernanceReportsService) ValidateUpdateRecipientsOpt(opt *GovernanceReportsUpdateRecipientsOptions) error

ValidateUpdateRecipientsOpt validates the options for the UpdateRecipients method.

type GovernanceReportsStatus

type GovernanceReportsStatus struct {
	// ComponentRecipients is the list of recipient emails configured on the
	// component itself. Only present when component-level recipients exist.
	ComponentRecipients []string `json:"componentRecipients,omitempty"`
	// GlobalRecipients is the list of recipient emails configured at the
	// global level. Only present when global recipients exist.
	GlobalRecipients []string `json:"globalRecipients,omitempty"`
	// GlobalFrequency is the report frequency configured at the global level
	// (e.g. "monthly").
	GlobalFrequency string `json:"globalFrequency,omitempty"`
	// CanDownload indicates whether the current user can download the report.
	CanDownload bool `json:"canDownload"`
	// CanSubscribe indicates whether the current user can subscribe to the report.
	CanSubscribe bool `json:"canSubscribe"`
	// CanAdmin indicates whether the current user can administer the report
	// (update its frequency and recipients).
	CanAdmin bool `json:"canAdmin"`
	// Subscribed indicates whether the current user is subscribed to reports.
	Subscribed bool `json:"subscribed"`
}

GovernanceReportsStatus represents the metadata of a governance report.

Verified against a live SonarQube 2025.2 Enterprise Edition instance: componentKey/hasFile do not exist on the real response; the actual shape is canDownload/canSubscribe/canAdmin/globalFrequency/subscribed, plus componentRecipients/globalRecipients when recipients have been configured.

type GovernanceReportsStatusOptions

type GovernanceReportsStatusOptions struct {
	// BranchKey is the branch key. Optional.
	BranchKey string `url:"branchKey,omitempty"`
	// ComponentID is the component id. Optional.
	ComponentID string `url:"componentId,omitempty"`
	// ComponentKey is the component key. Optional.
	ComponentKey string `url:"componentKey,omitempty"`
}

GovernanceReportsStatusOptions contains parameters for the Status method.

type GovernanceReportsSubscribeOptions

type GovernanceReportsSubscribeOptions struct {
	// BranchKey is the branch key. Optional.
	BranchKey string `url:"branchKey,omitempty"`
	// ComponentID is the component id. Optional.
	ComponentID string `url:"componentId,omitempty"`
	// ComponentKey is the component key. Optional.
	ComponentKey string `url:"componentKey,omitempty"`
}

GovernanceReportsSubscribeOptions contains parameters for the Subscribe method.

type GovernanceReportsUnsubscribeOptions

type GovernanceReportsUnsubscribeOptions struct {
	// BranchKey is the branch key. Optional.
	BranchKey string `url:"branchKey,omitempty"`
	// ComponentID is the component id. Optional.
	ComponentID string `url:"componentId,omitempty"`
	// ComponentKey is the component key. Optional.
	ComponentKey string `url:"componentKey,omitempty"`
}

GovernanceReportsUnsubscribeOptions contains parameters for the Unsubscribe method.

type GovernanceReportsUpdateFrequencyOptions

type GovernanceReportsUpdateFrequencyOptions struct {
	// BranchKey is the branch key. Optional.
	BranchKey string `url:"branchKey,omitempty"`
	// ComponentID is the component id. Optional.
	ComponentID string `url:"componentId,omitempty"`
	// ComponentKey is the component key. Optional.
	ComponentKey string `url:"componentKey,omitempty"`
	// Frequency is the report frequency. Optional. Valid values: daily, weekly, monthly.
	Frequency string `url:"frequency,omitempty"`
}

GovernanceReportsUpdateFrequencyOptions contains parameters for the UpdateFrequency method.

type GovernanceReportsUpdateRecipientsOptions

type GovernanceReportsUpdateRecipientsOptions struct {
	// BranchKey is the branch key. Optional.
	BranchKey string `url:"branchKey,omitempty"`
	// ComponentID is the component id. Optional.
	ComponentID string `url:"componentId,omitempty"`
	// ComponentKey is the component key. Optional.
	ComponentKey string `url:"componentKey,omitempty"`
	// Recipients is the list of recipient emails. This field is required.
	Recipients string `url:"recipients"`
}

GovernanceReportsUpdateRecipientsOptions contains parameters for the UpdateRecipients method.

type HistoryIssueCount added in v2.3.0

type HistoryIssueCount struct {
	// Date is the date and time in ISO 8601 format, including timezone offset.
	Date string `json:"date,omitempty"`
	// Distribution is the list of issue count buckets for the date.
	Distribution []HistoryIssueCountDistribution `json:"distribution,omitempty"`
}

HistoryIssueCount represents the issue count distribution recorded at a given point in time.

type HistoryIssueCountDistribution added in v2.3.0

type HistoryIssueCountDistribution struct {
	// Key is the distribution bucket key. It is empty when the counts are not
	// grouped by any dimension.
	Key string `json:"key,omitempty"`
	// Value is the number of issues in the bucket.
	Value int32 `json:"value,omitempty"`
}

HistoryIssueCountDistribution represents a single bucket of an issue count distribution.

type HistoryIssueCountHistoryOptions added in v2.3.0

type HistoryIssueCountHistoryOptions struct {
	// EntityID is the UUID of the entity to retrieve issue count history for.
	// This field is required.
	EntityID string `json:"entityId"`
	// EntityType is the entity's type. This field is required.
	EntityType string `json:"entityType"`
	// StartDate is the inclusive start of the date range in ISO 8601 format.
	// This field is required and may not be more than 1 year in the past.
	StartDate string `json:"startDate"`
	// EndDate is the inclusive end of the date range in ISO 8601 format.
	// Defaults to the current date and time (UTC) when omitted.
	EndDate string `json:"endDate,omitempty"`
	// Impacts limits results to issues with specific impacts.
	Impacts []string `json:"impacts,omitempty"`
	// IssueTypes limits results to issues with specific types.
	IssueTypes []string `json:"issueTypes,omitempty"`
	// RuleKeys limits results to issues raised by specific rules.
	RuleKeys []string `json:"ruleKeys,omitempty"`
	// Severities limits results to issues with specific severities.
	Severities []string `json:"severities,omitempty"`
	// SliceBy optionally groups issue counts by a specific dimension.
	SliceBy string `json:"sliceBy,omitempty"`
	// Statuses limits results to issues with specific statuses.
	Statuses []string `json:"statuses,omitempty"`
}

HistoryIssueCountHistoryOptions contains parameters for GetIssueCountHistory.

type HistoryIssueCountHistoryResponse added in v2.3.0

type HistoryIssueCountHistoryResponse struct {
	// IssueCountHistory is the ordered list of issue count snapshots.
	IssueCountHistory []HistoryIssueCount `json:"issueCountHistory,omitempty"`
}

HistoryIssueCountHistoryResponse represents the response from GetIssueCountHistory.

type HistoryMeasureEntry added in v2.3.0

type HistoryMeasureEntry struct {
	// Metric is the metric whose value is being recorded (e.g. "coverage").
	Metric string `json:"metric,omitempty"`
	// Type is the type of value the measure contains (e.g. "PERCENT").
	Type string `json:"type,omitempty"`
	// Value is the value of the measure encoded as a string.
	Value string `json:"value,omitempty"`
}

HistoryMeasureEntry represents a single measure value inside a measures history item.

type HistoryMeasureItem added in v2.3.0

type HistoryMeasureItem struct {
	// Date is the date the measures were taken.
	Date string `json:"date,omitempty"`
	// Measures is the list of measure values for the date.
	Measures []HistoryMeasureEntry `json:"measures,omitempty"`
}

HistoryMeasureItem represents the measures recorded at a given point in time.

type HistoryMeasuresHistoryOptions added in v2.3.0

type HistoryMeasuresHistoryOptions struct {
	// EntityType is the type of entity to retrieve measures history for.
	// This field is required. Allowed values: PORTFOLIO, PROJECT_BRANCH.
	EntityType string `json:"entityType"`
	// EntityID is the UUID of the entity. This field is required.
	EntityID string `json:"entityId"`
	// MetricKeys is the list of metric keys to filter by. This field is required.
	MetricKeys []string `json:"metricKeys"`
	// StartDate is the inclusive start of the date range in ISO 8601 format.
	// This field is required.
	StartDate string `json:"startDate"`
	// EndDate is the inclusive end of the date range in ISO 8601 format.
	// Defaults to the current date when omitted.
	EndDate string `json:"endDate,omitempty"`
}

HistoryMeasuresHistoryOptions contains parameters for GetMeasuresHistory.

type HistoryMeasuresHistoryResponse added in v2.3.0

type HistoryMeasuresHistoryResponse struct {
	// MeasuresHistory is the ordered list of measure snapshots.
	MeasuresHistory []HistoryMeasureItem `json:"measuresHistory,omitempty"`
}

HistoryMeasuresHistoryResponse represents the response from GetMeasuresHistory.

type HistoryProjectIssueCount added in v2.3.0

type HistoryProjectIssueCount struct {
	// BranchID is the identifier of the project branch.
	BranchID string `json:"branchId,omitempty"`
	// ProjectName is the display name of the project.
	ProjectName string `json:"projectName,omitempty"`
	// ProjectKey is the key of the project.
	ProjectKey string `json:"projectKey,omitempty"`
	// BranchName is the name of the branch.
	BranchName string `json:"branchName,omitempty"`
	// IssueCount is the number of issues in the project branch.
	IssueCount int64 `json:"issueCount,omitempty"`
	// ReferenceIssueCount is the issue count at the reference date, used for
	// trend computation. It is nil when no reference date was supplied.
	ReferenceIssueCount *int64 `json:"referenceIssueCount,omitempty"`
}

HistoryProjectIssueCount represents the issue count for a single project in a flattened portfolio or application listing.

type HistoryProjectIssueCountsOptions added in v2.3.0

type HistoryProjectIssueCountsOptions struct {
	// PortfolioID is the legacy portfolio ID.
	PortfolioID string `json:"portfolioId,omitempty"`
	// EntityType is the type of the selection whose projects are returned as a
	// flattened list. Must be provided together with EntityID.
	EntityType string `json:"entityType,omitempty"`
	// EntityID is the portfolio ID or application branch ID, according to
	// EntityType. Must be provided together with EntityType.
	EntityID string `json:"entityId,omitempty"`
	// RuleKeys limits results to issues raised by specific rules.
	RuleKeys []string `json:"ruleKeys,omitempty"`
	// Severities limits results to issues with specific severities.
	Severities []string `json:"severities,omitempty"`
	// IssueTypes limits results to issues with specific types.
	IssueTypes []string `json:"issueTypes,omitempty"`
	// Statuses limits results to issues with specific statuses.
	Statuses []string `json:"statuses,omitempty"`
	// Impacts limits results to issues with specific impacts.
	Impacts []string `json:"impacts,omitempty"`
	// NameContains is a case-insensitive search query for project names.
	NameContains string `json:"nameContains,omitempty"`
	// ReferenceDate is the date from which reference measure values are returned
	// for computing trends. Reference values are omitted when this is empty.
	ReferenceDate string `json:"referenceDate,omitempty"`
	// PageIndex is the 1-based index of the page to fetch. Default is 1.
	PageIndex int32 `json:"pageIndex,omitempty"`
	// PageSize is the size of the page to fetch. Default is 50.
	PageSize int32 `json:"pageSize,omitempty"`
	// Sort defines the sort order. Each field is prefixed with '+' for ascending
	// or '-' for descending. Valid fields: issueCount, projectName.
	Sort []string `json:"sort,omitempty"`
	// RequireIssues only returns projects with an issue count greater than 0.
	RequireIssues bool `json:"requireIssues,omitempty"`
}

HistoryProjectIssueCountsOptions contains parameters for GetProjectIssueCounts.

The selection is identified with either the legacy PortfolioID parameter, or with both EntityType and EntityID. The two selector forms are mutually exclusive.

type HistoryProjectIssueCountsResponse added in v2.3.0

type HistoryProjectIssueCountsResponse struct {
	// HiddenProjectCount is the number of projects excluded from the response
	// because the user does not have permission to view them.
	HiddenProjectCount int32 `json:"hiddenProjectCount,omitempty"`
	// ProjectIssueCounts is the flattened list of per-project issue counts.
	ProjectIssueCounts []HistoryProjectIssueCount `json:"projectIssueCounts,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

HistoryProjectIssueCountsResponse represents the response from GetProjectIssueCounts.

type HistoryProjectMeasure added in v2.3.0

type HistoryProjectMeasure struct {
	// BranchID is the identifier of the project branch.
	BranchID string `json:"branchId,omitempty"`
	// BranchName is the name of the branch.
	BranchName string `json:"branchName,omitempty"`
	// Measure is the metric value for the project.
	Measure HistoryProjectMeasureMetric `json:"measure,omitzero"`
	// ProjectKey is the key of the project.
	ProjectKey string `json:"projectKey,omitempty"`
	// ProjectName is the display name of the project.
	ProjectName string `json:"projectName,omitempty"`
}

HistoryProjectMeasure represents the measure value for a single project in a flattened portfolio or application listing.

type HistoryProjectMeasureMetric added in v2.3.0

type HistoryProjectMeasureMetric struct {
	// CurrentValue is the current value of the measure encoded as a string. It
	// is empty when the measure has no current value.
	CurrentValue string `json:"currentValue,omitempty"`
	// Metric is the metric key (e.g. "coverage").
	Metric string `json:"metric,omitempty"`
	// ReferenceValue is the value of the measure at the reference date, used for
	// trend computation. It is empty when there was no value on that date.
	ReferenceValue string `json:"referenceValue,omitempty"`
	// Type identifies the measure's data type (e.g. "PERCENT").
	Type string `json:"type,omitempty"`
}

HistoryProjectMeasureMetric represents the current and reference values of a single metric for a project.

type HistoryProjectMeasuresOptions added in v2.3.0

type HistoryProjectMeasuresOptions struct {
	// MetricKey is the metric key. This field is required.
	MetricKey string `json:"metricKey"`
	// MetricValue filters by exact metric value. Only primitive metric types are
	// supported (not DISTR or DATA).
	MetricValue string `json:"metricValue,omitempty"`
	// NameContains is a case-insensitive search query for project names.
	NameContains string `json:"nameContains,omitempty"`
	// PageIndex is the 1-based index of the page to fetch. Default is 1.
	PageIndex int32 `json:"pageIndex,omitempty"`
	// PageSize is the size of the page to fetch. Default is 50.
	PageSize int32 `json:"pageSize,omitempty"`
	// PortfolioID is the legacy portfolio ID.
	PortfolioID string `json:"portfolioId,omitempty"`
	// EntityType is the type of the selection whose projects are returned as a
	// flattened list. Must be provided together with EntityID.
	EntityType string `json:"entityType,omitempty"`
	// EntityID is the portfolio ID or application branch ID, according to
	// EntityType. Must be provided together with EntityType.
	EntityID string `json:"entityId,omitempty"`
	// ReferenceDate is the date from which reference measure values are returned
	// for computing trends. Reference values are omitted when this is empty.
	ReferenceDate string `json:"referenceDate,omitempty"`
	// Sort defines the sort order. Each field is prefixed with '+' for ascending
	// or '-' for descending. Valid fields: measure.currentValue, projectName.
	Sort []string `json:"sort,omitempty"`
	// RequireValue only returns projects with a non-null metric value.
	RequireValue bool `json:"requireValue,omitempty"`
}

HistoryProjectMeasuresOptions contains parameters for GetProjectMeasures.

The selection is identified with either the legacy PortfolioID parameter, or with both EntityType and EntityID. The two selector forms are mutually exclusive.

type HistoryProjectMeasuresResponse added in v2.3.0

type HistoryProjectMeasuresResponse struct {
	// HiddenProjectCount is the number of projects excluded from the response
	// because the user does not have permission to view them.
	HiddenProjectCount int32 `json:"hiddenProjectCount,omitempty"`
	// ProjectMeasures is the flattened list of per-project measure values.
	ProjectMeasures []HistoryProjectMeasure `json:"projectMeasures,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

HistoryProjectMeasuresResponse represents the response from GetProjectMeasures.

type HistoryService added in v2.3.0

type HistoryService struct {
	// contains filtered or unexported fields
}

HistoryService handles communication with the history related methods of the SonarQube V2 API (the "/history" endpoints: measures history, issue count history, and the flattened per-project measure and issue count listings for a portfolio or application).

func (*HistoryService) GetIssueCountHistory added in v2.3.0

GetIssueCountHistory returns the history of issue counts for an entity. The maximum resolution for history data is one day and all history is recorded in the UTC timezone. Issue counts carry forward for days with no changes.

API endpoint: GET /api/v2/history/issue-count-history.

func (*HistoryService) GetMeasuresHistory added in v2.3.0

GetMeasuresHistory returns the history of measures for the given entity.

API endpoint: GET /api/v2/history/measures-history.

func (*HistoryService) GetProjectIssueCounts added in v2.3.0

GetProjectIssueCounts returns issue counts for the flattened list of projects in a portfolio or application. The selection is identified with either the legacy PortfolioID parameter, or with both EntityType and EntityID.

API endpoint: GET /api/v2/history/project-issue-counts.

func (*HistoryService) GetProjectMeasures added in v2.3.0

GetProjectMeasures returns current measure values for the flattened list of projects in a portfolio or application. The selection is identified with either the legacy PortfolioID parameter, or with both EntityType and EntityID.

API endpoint: GET /api/v2/history/project-measures.

func (*HistoryService) ValidateIssueCountHistoryOpt added in v2.3.0

func (s *HistoryService) ValidateIssueCountHistoryOpt(opt *HistoryIssueCountHistoryOptions) error

ValidateIssueCountHistoryOpt validates the options for GetIssueCountHistory.

func (*HistoryService) ValidateMeasuresHistoryOpt added in v2.3.0

func (s *HistoryService) ValidateMeasuresHistoryOpt(opt *HistoryMeasuresHistoryOptions) error

ValidateMeasuresHistoryOpt validates the options for GetMeasuresHistory.

func (*HistoryService) ValidateProjectIssueCountsOpt added in v2.3.0

func (s *HistoryService) ValidateProjectIssueCountsOpt(opt *HistoryProjectIssueCountsOptions) error

ValidateProjectIssueCountsOpt validates the options for GetProjectIssueCounts.

func (*HistoryService) ValidateProjectMeasuresOpt added in v2.3.0

func (s *HistoryService) ValidateProjectMeasuresOpt(opt *HistoryProjectMeasuresOptions) error

ValidateProjectMeasuresOpt validates the options for GetProjectMeasures.

type HotspotChangelogEntry

type HotspotChangelogEntry struct {
	// Diffs is the list of changes made.
	Diffs []HotspotDiff `json:"diffs,omitempty"`
	// Avatar is the URL to the user's avatar.
	Avatar string `json:"avatar,omitempty"`
	// CreationDate is the timestamp when the change was made.
	CreationDate string `json:"creationDate,omitempty"`
	// User is the login of the user who made the change.
	User string `json:"user,omitempty"`
	// UserName is the display name of the user who made the change.
	UserName string `json:"userName,omitempty"`
	// IsUserActive indicates if the user is active.
	IsUserActive bool `json:"isUserActive,omitempty"`
}

HotspotChangelogEntry represents a changelog entry for a hotspot.

type HotspotComment

type HotspotComment struct {
	// CreatedAt is the timestamp when the comment was created.
	CreatedAt string `json:"createdAt,omitempty"`
	// HTMLText is the HTML-formatted text of the comment.
	HTMLText string `json:"htmlText,omitempty"`
	// Key is the unique identifier of the comment.
	Key string `json:"key,omitempty"`
	// Login is the login of the user who created the comment.
	Login string `json:"login,omitempty"`
	// Markdown is the Markdown-formatted text of the comment.
	Markdown string `json:"markdown,omitempty"`
	// Updatable indicates if the comment can be updated by the current user.
	Updatable bool `json:"updatable,omitempty"`
}

HotspotComment represents a comment on a hotspot.

type HotspotComponent

type HotspotComponent struct {
	// Key is the unique identifier of the component.
	Key string `json:"key,omitempty"`
	// LongName is the long name of the component.
	LongName string `json:"longName,omitempty"`
	// Name is the short name of the component.
	Name string `json:"name,omitempty"`
	// Path is the path to the component file.
	Path string `json:"path,omitempty"`
	// Qualifier is the component qualifier (FIL, DIR, etc.).
	Qualifier string `json:"qualifier,omitempty"`
}

HotspotComponent represents a component in a hotspots response.

type HotspotDiff

type HotspotDiff struct {
	// Key is the identifier of the changed field.
	Key string `json:"key,omitempty"`
	// NewValue is the new value after the change.
	NewValue string `json:"newValue,omitempty"`
	// OldValue is the old value before the change.
	OldValue string `json:"oldValue,omitempty"`
}

HotspotDiff represents a single change in a changelog entry.

type HotspotMessageFormatting

type HotspotMessageFormatting struct {
	// Type is the type of formatting.
	Type string `json:"type,omitempty"`
	// End is the ending position of the formatting.
	End int64 `json:"end,omitempty"`
	// Start is the starting position of the formatting.
	Start int64 `json:"start,omitempty"`
}

HotspotMessageFormatting represents a formatting rule for messages.

type HotspotProject

type HotspotProject struct {
	// Key is the unique identifier of the project.
	Key string `json:"key,omitempty"`
	// LongName is the long name of the project.
	LongName string `json:"longName,omitempty"`
	// Name is the short name of the project.
	Name string `json:"name,omitempty"`
	// Qualifier is the project qualifier.
	Qualifier string `json:"qualifier,omitempty"`
}

HotspotProject represents a project in a hotspot show response.

type HotspotRule

type HotspotRule struct {
	// Key is the rule key.
	Key string `json:"key,omitempty"`
	// Name is the rule name.
	Name string `json:"name,omitempty"`
	// SecurityCategory is the security category of the rule.
	SecurityCategory string `json:"securityCategory,omitempty"`
	// VulnerabilityProbability is the probability of vulnerability.
	VulnerabilityProbability string `json:"vulnerabilityProbability,omitempty"`
}

HotspotRule represents a rule in a hotspot show response.

type HotspotSummary

type HotspotSummary struct {
	// Assignee is the login of the user assigned to this hotspot.
	Assignee string `json:"assignee,omitempty"`
	// Author is the SCM author of the code where the hotspot was found.
	Author string `json:"author,omitempty"`
	// Component is the key of the component where the hotspot was found.
	Component string `json:"component,omitempty"`
	// CreationDate is the timestamp when the hotspot was created.
	CreationDate string `json:"creationDate,omitempty"`
	// Flows is the list of code flows related to this hotspot.
	Flows []any `json:"flows,omitempty"`
	// Key is the unique identifier of the hotspot.
	Key string `json:"key,omitempty"`
	// Line is the line number where the hotspot was found.
	Line int64 `json:"line,omitempty"`
	// Message is the main message describing the hotspot.
	Message string `json:"message,omitempty"`
	// MessageFormattings is the list of message formatting rules.
	MessageFormattings []any `json:"messageFormattings,omitempty"`
	// Project is the key of the project containing the hotspot.
	Project string `json:"project,omitempty"`
	// RuleKey is the key of the rule that raised this hotspot.
	RuleKey string `json:"ruleKey,omitempty"`
	// SecurityCategory is the security category of the hotspot.
	SecurityCategory string `json:"securityCategory,omitempty"`
	// Status is the current status of the hotspot.
	Status string `json:"status,omitempty"`
	// UpdateDate is the timestamp when the hotspot was last updated.
	UpdateDate string `json:"updateDate,omitempty"`
	// VulnerabilityProbability is the probability that this hotspot is a vulnerability.
	VulnerabilityProbability string `json:"vulnerabilityProbability,omitempty"`
}

HotspotSummary represents a hotspot summary in list/search results.

type HotspotUser

type HotspotUser struct {
	// Login is the login of the user.
	Login string `json:"login,omitempty"`
	// Name is the display name of the user.
	Name string `json:"name,omitempty"`
	// Active indicates if the user is active.
	Active bool `json:"active,omitempty"`
}

HotspotUser represents a user in a hotspots response.

type HotspotsAddCommentOptions

type HotspotsAddCommentOptions struct {
	// Comment is the comment text.
	// This field is required. Maximum length: 1000 characters.
	Comment string `url:"comment"`
	// Hotspot is the key of the Security Hotspot.
	// This field is required.
	Hotspot string `url:"hotspot"`
}

HotspotsAddCommentOptions contains parameters for the AddComment method.

type HotspotsAssignOptions

type HotspotsAssignOptions struct {
	// Assignee is the login of the assignee with 'Browse' project permission.
	// This field is optional (since 8.9).
	Assignee string `url:"assignee,omitempty"`
	// Comment is a comment provided with the assign action.
	// This field is optional.
	Comment string `url:"comment,omitempty"`
	// Hotspot is the key of the Security Hotspot.
	// This field is required.
	Hotspot string `url:"hotspot"`
}

HotspotsAssignOptions contains parameters for the Assign method.

type HotspotsChangeStatusOptions

type HotspotsChangeStatusOptions struct {
	// Comment is optional comment text.
	// This field is optional.
	Comment string `url:"comment,omitempty"`
	// Hotspot is the key of the Security Hotspot.
	// This field is required.
	Hotspot string `url:"hotspot"`
	// Resolution is the resolution when new status is REVIEWED.
	// Allowed values: FIXED, SAFE, ACKNOWLEDGED.
	// This field is optional.
	Resolution string `url:"resolution,omitempty"`
	// Status is the new status of the Security Hotspot.
	// Allowed values: TO_REVIEW, REVIEWED.
	// This field is required.
	Status string `url:"status"`
}

HotspotsChangeStatusOptions contains parameters for the ChangeStatus method.

type HotspotsDeleteCommentOptions

type HotspotsDeleteCommentOptions struct {
	// Comment is the key of the comment to delete.
	// This field is required.
	Comment string `url:"comment"`
}

HotspotsDeleteCommentOptions contains parameters for the DeleteComment method.

type HotspotsEditComment

type HotspotsEditComment struct {
	// CreatedAt is the timestamp when the comment was created.
	CreatedAt string `json:"createdAt,omitempty"`
	// HTMLText is the HTML-formatted text of the comment.
	HTMLText string `json:"htmlText,omitempty"`
	// Key is the unique identifier of the comment.
	Key string `json:"key,omitempty"`
	// Login is the login of the user who created the comment.
	Login string `json:"login,omitempty"`
	// Markdown is the Markdown-formatted text of the comment.
	Markdown string `json:"markdown,omitempty"`
	// Updatable indicates if the comment can be updated by the current user.
	Updatable bool `json:"updatable,omitempty"`
}

HotspotsEditComment represents the response from editing a hotspot comment.

type HotspotsEditCommentOptions

type HotspotsEditCommentOptions struct {
	// Comment is the key of the comment to edit.
	// This field is required.
	Comment string `url:"comment"`
	// Text is the new comment text.
	// This field is required. Maximum length: 1000 characters.
	Text string `url:"text"`
}

HotspotsEditCommentOptions contains parameters for the EditComment method.

type HotspotsList

type HotspotsList struct {
	// Components is the list of components referenced by the hotspots.
	Components []HotspotComponent `json:"components,omitempty"`
	// Hotspots is the list of hotspots.
	Hotspots []HotspotSummary `json:"hotspots,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging"`
}

HotspotsList represents the response from listing hotspots.

type HotspotsListOptions

type HotspotsListOptions struct {
	// PaginationArgs contains the pagination parameters.
	PaginationArgs `url:",inline"`

	// Branch is the branch key. Not available in the community edition.
	// This field is optional.
	Branch string `url:"branch,omitempty"`
	// Project is the key of the project.
	// This field is required.
	Project string `url:"project"`
	// PullRequest is the pull request id. Not available in the community edition.
	// This field is optional.
	PullRequest string `url:"pullRequest,omitempty"`
	// Resolution filters by resolution when status is REVIEWED.
	// Allowed values: FIXED, SAFE, ACKNOWLEDGED.
	// This field is optional.
	Resolution string `url:"resolution,omitempty"`
	// Status filters by hotspot status.
	// Allowed values: TO_REVIEW, REVIEWED.
	// This field is optional.
	Status string `url:"status,omitempty"`
	// InNewCodePeriod filters to only Security Hotspots created in the new code period.
	// This field is optional. Default: false.
	InNewCodePeriod bool `url:"inNewCodePeriod,omitempty"`
}

HotspotsListOptions contains parameters for the List method.

type HotspotsPullOptions

type HotspotsPullOptions struct {
	// Languages is a comma-separated list of languages.
	// If not present, all hotspots regardless of their language are returned.
	// This field is optional.
	Languages []string `url:"languages,omitempty,comma"`
	// BranchName is the branch name for which hotspots are fetched.
	// This field is required.
	BranchName string `url:"branchName"`
	// ProjectKey is the project key for which hotspots are fetched.
	// This field is required.
	ProjectKey string `url:"projectKey"`
	// ChangedSince is a timestamp. If present, only hotspots modified after this
	// timestamp are returned (both open and closed).
	// This field is optional.
	ChangedSince int64 `url:"changedSince,omitempty"`
}

HotspotsPullOptions contains parameters for the Pull method.

type HotspotsSearch

type HotspotsSearch struct {
	// Components is the list of components referenced by the hotspots.
	Components []HotspotComponent `json:"components,omitempty"`
	// Hotspots is the list of hotspots.
	Hotspots []HotspotSummary `json:"hotspots,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging"`
}

HotspotsSearch represents the response from searching hotspots.

type HotspotsSearchOptions

type HotspotsSearchOptions struct {
	// PaginationArgs contains the pagination parameters.
	PaginationArgs `url:",inline"`

	// Casa is a comma-separated list of CASA categories.
	// This field is optional. Since: 10.7.
	Casa []string `url:"casa,omitempty,comma"`
	// ComplianceStandards is a list of compliance standards.
	// This field is optional. Since: 2025.6.
	ComplianceStandards []string `url:"complianceStandards,omitempty,comma"`
	// Cwe is a comma-separated list of CWE numbers.
	// This field is optional. Since: 8.8.
	Cwe []string `url:"cwe,omitempty,comma"`
	// Files is a comma-separated list of files to filter hotspots.
	// This field is optional. Since: 9.0.
	Files []string `url:"files,omitempty,comma"`
	// Hotspots is a comma-separated list of Security Hotspot keys.
	// This parameter is required unless Project is provided.
	// This field is optional.
	Hotspots []string `url:"hotspots,omitempty,comma"`
	// OwaspAsvs40 is a comma-separated list of OWASP ASVS v4.0 categories or rules.
	// This field is optional. Since: 9.7.
	OwaspAsvs40 []string `url:"owaspAsvs-4.0,omitempty,comma"`
	// OwaspTop10 is a comma-separated list of OWASP 2017 Top 10 lowercase categories.
	// This field is optional. Since: 8.6.
	OwaspTop10 []string `url:"owaspTop10,omitempty,comma"`
	// OwaspTop102021 is a comma-separated list of OWASP 2021 Top 10 lowercase categories.
	// This field is optional. Since: 9.4.
	OwaspTop102021 []string `url:"owaspTop10-2021,omitempty,comma"`
	// PciDss32 is a comma-separated list of PCI DSS v3.2 categories.
	// This field is optional. Since: 9.6.
	PciDss32 []string `url:"pciDss-3.2,omitempty,comma"`
	// PciDss40 is a comma-separated list of PCI DSS v4.0 categories.
	// This field is optional. Since: 9.6.
	PciDss40 []string `url:"pciDss-4.0,omitempty,comma"`
	// SansTop25 is a comma-separated list of SANS Top 25 categories.
	// This field is optional. Since: 8.6. Deprecated since: 10.0.
	SansTop25 []string `url:"sansTop25,omitempty,comma"`
	// SonarsourceSecurity is a comma-separated list of SonarSource security categories.
	// Use 'others' to select issues not associated with any category.
	// This field is optional. Since: 8.6.
	SonarsourceSecurity []string `url:"sonarsourceSecurity,omitempty,comma"`
	// StigASDV5R3 is a comma-separated list of STIG V5R3 lowercase categories.
	// This field is optional. Since: 10.7.
	StigASDV5R3 []string `url:"stig-ASD_V5R3,omitempty,comma"`
	// Branch is the branch key. Not available in the community edition.
	// This field is optional.
	Branch string `url:"branch,omitempty"`
	// OwaspAsvsLevel filters hotspots with lower or equal OWASP ASVS level.
	// Should be used in combination with OwaspAsvs40.
	// Allowed values: 1, 2, 3.
	// This field is optional. Since: 9.7.
	OwaspAsvsLevel string `url:"owaspAsvsLevel,omitempty"`
	// Project is the key of the project or application.
	// This parameter is required unless Hotspots is provided.
	// This field is optional.
	Project string `url:"project,omitempty"`
	// PullRequest is the pull request id. Not available in the community edition.
	// This field is optional.
	PullRequest string `url:"pullRequest,omitempty"`
	// Resolution filters by resolution when status is REVIEWED.
	// Allowed values: FIXED, SAFE, ACKNOWLEDGED.
	// This field is optional.
	Resolution string `url:"resolution,omitempty"`
	// Status filters by hotspot status.
	// Allowed values: TO_REVIEW, REVIEWED.
	// This field is optional.
	Status string `url:"status,omitempty"`
	// InNewCodePeriod filters to only Security Hotspots created in the new code period.
	// This field is optional. Default: false. Since: 9.5.
	InNewCodePeriod bool `url:"inNewCodePeriod,omitempty"`
	// OnlyMine filters to only hotspots assigned to the current user.
	// This field is optional.
	OnlyMine bool `url:"onlyMine,omitempty"`
}

HotspotsSearchOptions contains parameters for the Search method.

type HotspotsService

type HotspotsService struct {
	// contains filtered or unexported fields
}

HotspotsService handles communication with the Security Hotspots related methods of the SonarQube API. Security Hotspots are security-sensitive pieces of code that require a review to assess whether they are vulnerabilities.

func (*HotspotsService) AddComment deprecated

AddComment adds a comment to a Security Hotspot. Requires authentication and the 'Browse' permission on the project.

Deprecated: Since SonarQube 2026.4. API endpoint: POST /api/hotspots/add_comment. Since: 8.1. Internal: true.

func (*HotspotsService) Assign deprecated

Assign assigns a hotspot to an active user. Requires authentication and 'Browse' permission on the project.

Deprecated: Since SonarQube 2026.4. API endpoint: POST /api/hotspots/assign. Since: 8.2. Internal: true.

func (*HotspotsService) ChangeStatus deprecated

ChangeStatus changes the status of a Security Hotspot. Requires the 'Administer Security Hotspot' permission.

Deprecated: Since SonarQube 2026.4. API endpoint: POST /api/hotspots/change_status. Since: 8.1.

func (*HotspotsService) DeleteComment deprecated

DeleteComment deletes a comment from a Security Hotspot. Requires authentication and the 'Browse' permission on the project.

Deprecated: Since SonarQube 2026.4. API endpoint: POST /api/hotspots/delete_comment. Since: 8.2. Internal: true.

func (*HotspotsService) EditComment deprecated

EditComment edits a comment on a Security Hotspot. Requires authentication and the 'Browse' permission on the project.

Deprecated: Since SonarQube 2026.4. API endpoint: POST /api/hotspots/edit_comment. Since: 8.2. Internal: true.

func (*HotspotsService) List deprecated

List lists Security Hotspots. This endpoint is used in degraded mode when issue indexing is running. Requires the 'Browse' permission on the specified project.

Note: Total number of Security Hotspots will always equal the page size, as counting all issues is not supported.

Deprecated: Since SonarQube 2026.4. API endpoint: GET /api/hotspots/list. Since: 10.2. Internal: true.

func (*HotspotsService) ListAll

ListAll fetches all pages from List and returns a flat slice of hotspots.

func (*HotspotsService) Pull deprecated

Pull fetches and returns all (unless filtered) hotspots for a given branch. The hotspots returned are not paginated, so the response size can be big. Requires 'Browse' permission on the project.

Deprecated: Since SonarQube 2026.4. API endpoint: GET /api/hotspots/pull. Since: 10.1. Internal: true.

func (*HotspotsService) Search deprecated

Search searches for Security Hotspots. Requires the 'Browse' permission on the specified project(s). For applications, also requires 'Browse' permission on child projects. Returns 503 Service Unavailable when issue indexing is in progress.

Deprecated: Since SonarQube 2026.4. API endpoint: GET /api/hotspots/search. Since: 8.1.

func (*HotspotsService) SearchAll

SearchAll fetches all pages from Search and returns a flat slice of hotspots.

func (*HotspotsService) Show deprecated

Show provides the details of a Security Hotspot.

Deprecated: Since SonarQube 2026.4. API endpoint: GET /api/hotspots/show. Since: 8.1.

func (*HotspotsService) ValidateAddCommentOpt

func (s *HotspotsService) ValidateAddCommentOpt(opt *HotspotsAddCommentOptions) error

ValidateAddCommentOpt validates the options for the AddComment method.

func (*HotspotsService) ValidateAssignOpt

func (s *HotspotsService) ValidateAssignOpt(opt *HotspotsAssignOptions) error

ValidateAssignOpt validates the options for the Assign method.

func (*HotspotsService) ValidateChangeStatusOpt

func (s *HotspotsService) ValidateChangeStatusOpt(opt *HotspotsChangeStatusOptions) error

ValidateChangeStatusOpt validates the options for the ChangeStatus method.

func (*HotspotsService) ValidateDeleteCommentOpt

func (s *HotspotsService) ValidateDeleteCommentOpt(opt *HotspotsDeleteCommentOptions) error

ValidateDeleteCommentOpt validates the options for the DeleteComment method.

func (*HotspotsService) ValidateEditCommentOpt

func (s *HotspotsService) ValidateEditCommentOpt(opt *HotspotsEditCommentOptions) error

ValidateEditCommentOpt validates the options for the EditComment method.

func (*HotspotsService) ValidateListOpt

func (s *HotspotsService) ValidateListOpt(opt *HotspotsListOptions) error

ValidateListOpt validates the options for the List method.

func (*HotspotsService) ValidatePullOpt

func (s *HotspotsService) ValidatePullOpt(opt *HotspotsPullOptions) error

ValidatePullOpt validates the options for the Pull method.

func (*HotspotsService) ValidateSearchOpt

func (s *HotspotsService) ValidateSearchOpt(opt *HotspotsSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

func (*HotspotsService) ValidateShowOpt

func (s *HotspotsService) ValidateShowOpt(opt *HotspotsShowOptions) error

ValidateShowOpt validates the options for the Show method.

type HotspotsShow

type HotspotsShow struct {
	// Assignee is the login of the user assigned to this hotspot.
	Assignee string `json:"assignee,omitempty"`
	// Author is the SCM author of the code where the hotspot was found.
	Author string `json:"author,omitempty"`
	// CanChangeStatus indicates if the current user can change the hotspot status.
	CanChangeStatus bool `json:"canChangeStatus,omitempty"`
	// Changelog is the list of changes made to this hotspot.
	Changelog []HotspotChangelogEntry `json:"changelog,omitempty"`
	// CodeVariants is the list of code variants affected by this hotspot.
	CodeVariants []string `json:"codeVariants,omitempty"`
	// Comment is the list of comments on this hotspot.
	Comment []HotspotComment `json:"comment,omitempty"`
	// Component is the component where the hotspot was found.
	Component HotspotComponent `json:"component"`
	// CreationDate is the timestamp when the hotspot was created.
	CreationDate string `json:"creationDate,omitempty"`
	// Hash is the hash of the line content for tracking purposes.
	Hash string `json:"hash,omitempty"`
	// Key is the unique identifier of the hotspot.
	Key string `json:"key,omitempty"`
	// Line is the line number where the hotspot was found.
	Line int64 `json:"line,omitempty"`
	// Message is the main message describing the hotspot.
	Message string `json:"message,omitempty"`
	// MessageFormattings is the list of message formatting rules.
	MessageFormattings []HotspotMessageFormatting `json:"messageFormattings,omitempty"`
	// Project is the project containing the hotspot.
	Project HotspotProject `json:"project"`
	// Rule is the rule that raised this hotspot.
	Rule HotspotRule `json:"rule"`
	// Status is the current status of the hotspot.
	Status string `json:"status,omitempty"`
	// UpdateDate is the timestamp when the hotspot was last updated.
	UpdateDate string `json:"updateDate,omitempty"`
	// Users is the list of users referenced by this hotspot.
	Users []HotspotUser `json:"users,omitempty"`
}

HotspotsShow represents the response from showing hotspot details.

type HotspotsShowOptions

type HotspotsShowOptions struct {
	// Hotspot is the key of the Security Hotspot.
	// This field is required.
	Hotspot string `url:"hotspot"`
}

HotspotsShowOptions contains parameters for the Show method.

type ImpactChange

type ImpactChange struct {
	// SoftwareQuality is the software quality being impacted.
	SoftwareQuality string `json:"softwareQuality,omitempty"`
	// OldSeverity is the previous severity level.
	OldSeverity string `json:"oldSeverity,omitempty"`
	// NewSeverity is the new severity level.
	NewSeverity string `json:"newSeverity,omitempty"`
}

ImpactChange represents a change in impact severity.

type IntegrationsIntegrationConfiguration added in v2.2.0

type IntegrationsIntegrationConfiguration struct {
	// Id is the unique identifier of the integration configuration.
	Id string `json:"id,omitempty"`
	// IntegrationType is the type of integration. Allowed values: SLACK.
	IntegrationType string `json:"integrationType,omitempty"`
	// ClientId is the client ID of the integration application.
	ClientId string `json:"clientId,omitempty"`
	// AppId is the identifier of the integration application.
	AppId string `json:"appId,omitempty"`
}

IntegrationsIntegrationConfiguration represents a workspace-level third-party integration configuration (e.g. a Slack app install).

type IntegrationsIntegrationConfigurationCreateOptions added in v2.2.0

type IntegrationsIntegrationConfigurationCreateOptions struct {
	// IntegrationType is the type of integration to configure.
	// Allowed values: SLACK. This field is required.
	IntegrationType string `json:"integrationType"`
	// ClientId is the client ID of the integration application. This field is required.
	ClientId string `json:"clientId"`
	// ClientSecret is the client secret of the integration application. This field is required.
	ClientSecret string `json:"clientSecret"`
	// SigningSecret is the signing secret used to validate incoming webhook
	// requests from the integration provider. This field is required.
	SigningSecret string `json:"signingSecret"`
}

IntegrationsIntegrationConfigurationCreateOptions contains parameters for creating an integration configuration.

type IntegrationsIntegrationConfigurationPatchOptions added in v2.2.0

type IntegrationsIntegrationConfigurationPatchOptions struct {
	// ClientId is the new client ID of the integration application.
	ClientId string `json:"clientId,omitempty"`
	// ClientSecret is the new client secret of the integration application.
	ClientSecret string `json:"clientSecret,omitempty"`
	// SigningSecret is the new signing secret used to validate incoming
	// webhook requests from the integration provider.
	SigningSecret string `json:"signingSecret,omitempty"`
}

IntegrationsIntegrationConfigurationPatchOptions contains parameters for updating an integration configuration. All fields are optional (PATCH merge semantics).

type IntegrationsIntegrationConfigurationSearch added in v2.2.0

type IntegrationsIntegrationConfigurationSearch struct {
	// IntegrationConfigurations is the list of integration configurations.
	IntegrationConfigurations []IntegrationsIntegrationConfiguration `json:"integrationConfigurations,omitempty"`
}

IntegrationsIntegrationConfigurationSearch represents the response from listing integration configurations.

type IntegrationsListIntegrationConfigurationsOptions added in v2.2.0

type IntegrationsListIntegrationConfigurationsOptions struct {
	// IntegrationType filters configurations by integration type.
	// Allowed values: SLACK. This field is required.
	IntegrationType string `json:"integrationType"`
}

IntegrationsListIntegrationConfigurationsOptions contains query parameters for the ListIntegrationConfigurations method.

type IntegrationsService added in v2.2.0

type IntegrationsService struct {
	// contains filtered or unexported fields
}

IntegrationsService handles communication with the generic third-party integrations (e.g. Slack) related methods of the SonarQube V2 API.

func (*IntegrationsService) CreateIntegrationConfiguration added in v2.2.0

CreateIntegrationConfiguration creates a configuration for a third-party integration (e.g. installing a Slack app for a workspace). Requires global administrator permission.

func (*IntegrationsService) CreateUserBinding added in v2.2.0

CreateUserBinding creates a new user binding between a SonarQube user and their external chat account (e.g. Slack). This endpoint is used during the OAuth flow when users connect their accounts via a slash command (e.g. "/sonarqube-server connect").

func (*IntegrationsService) DeleteIntegrationConfiguration added in v2.2.0

func (s *IntegrationsService) DeleteIntegrationConfiguration(ctx context.Context, configurationID string) (*http.Response, error)

DeleteIntegrationConfiguration permanently deletes an integration configuration and all its related data (workspaces, user bindings, and subscriptions). Requires global administrator permission.

func (*IntegrationsService) GetUserBinding added in v2.2.0

func (s *IntegrationsService) GetUserBinding(ctx context.Context, bindingID string) (*IntegrationsUserBinding, *http.Response, error)

GetUserBinding retrieves a user binding by its ID. Users can only access their own bindings unless they have administrative privileges.

func (*IntegrationsService) HandleSlackEvent added in v2.2.0

func (s *IntegrationsService) HandleSlackEvent(ctx context.Context, payload json.RawMessage) (*string, *http.Response, error)

HandleSlackEvent forwards an incoming Slack Events API request (e.g. URL verification or workspace lifecycle events) to the SonarQube server for processing. The payload is the raw JSON body of the Slack event. Slack signature validation is performed server-side before this data is processed. The response is the raw text/plain body returned by the server (e.g. the echoed "challenge" value during URL verification).

func (*IntegrationsService) HandleSlackSlashCommand added in v2.2.0

func (s *IntegrationsService) HandleSlackSlashCommand(ctx context.Context, form url.Values) (*http.Response, error)

HandleSlackSlashCommand forwards an incoming Slack slash command request (e.g. "/sonarqube-server connect") to the SonarQube server for processing. The request body is form-encoded (application/x-www-form-urlencoded) and typically contains the standard Slack slash-command fields (command, text, user_id, team_id, response_url, etc.). Slack signature validation is performed server-side before this data is processed.

func (*IntegrationsService) ListIntegrationConfigurations added in v2.2.0

ListIntegrationConfigurations lists the integration configurations for the given integration type. Requires global administrator permission.

func (*IntegrationsService) UpdateIntegrationConfiguration added in v2.2.0

UpdateIntegrationConfiguration updates an integration configuration. Requires global administrator permission.

func (*IntegrationsService) ValidateCreateIntegrationConfigurationOpt added in v2.2.0

func (s *IntegrationsService) ValidateCreateIntegrationConfigurationOpt(opt *IntegrationsIntegrationConfigurationCreateOptions) error

ValidateCreateIntegrationConfigurationOpt validates the IntegrationsIntegrationConfigurationCreateOptions.

func (*IntegrationsService) ValidateCreateUserBindingOpt added in v2.2.0

func (s *IntegrationsService) ValidateCreateUserBindingOpt(opt *IntegrationsUserBindingCreateOptions) error

ValidateCreateUserBindingOpt validates the IntegrationsUserBindingCreateOptions.

func (*IntegrationsService) ValidateListIntegrationConfigurationsOpt added in v2.2.0

func (s *IntegrationsService) ValidateListIntegrationConfigurationsOpt(opt *IntegrationsListIntegrationConfigurationsOptions) error

ValidateListIntegrationConfigurationsOpt validates the IntegrationsListIntegrationConfigurationsOptions.

func (*IntegrationsService) ValidateUpdateIntegrationConfigurationRequest added in v2.2.0

func (s *IntegrationsService) ValidateUpdateIntegrationConfigurationRequest(configurationID string, opt *IntegrationsIntegrationConfigurationPatchOptions) error

ValidateUpdateIntegrationConfigurationRequest validates the parameters for updating an integration configuration.

type IntegrationsUserBinding added in v2.2.0

type IntegrationsUserBinding struct {
	// Id is the unique identifier of the user binding.
	Id string `json:"id,omitempty"`
	// UserId is the identifier of the SonarQube user.
	UserId string `json:"user_id,omitempty"`
	// SlackUserId is the identifier of the bound Slack user.
	SlackUserId string `json:"slack_user_id,omitempty"`
	// SlackWorkspaceId is the identifier of the Slack workspace the user belongs to.
	SlackWorkspaceId string `json:"slack_workspace_id,omitempty"`
	// SlackWorkspaceName is the name of the Slack workspace the user belongs to.
	SlackWorkspaceName string `json:"slack_workspace_name,omitempty"`
	// CreatedAt is the Unix timestamp (in milliseconds) when the binding was created.
	CreatedAt int64 `json:"created_at,omitempty"`
}

IntegrationsUserBinding represents a binding between a SonarQube user and an external chat identity (e.g. a Slack user).

type IntegrationsUserBindingCreateOptions added in v2.2.0

type IntegrationsUserBindingCreateOptions struct {
	// UserId is the identifier of the SonarQube user. This field is required.
	UserId string `json:"userId"`
	// BindingData contains the data required to complete the binding.
	// This field is required.
	BindingData IntegrationsUserBindingData `json:"bindingData"`
}

IntegrationsUserBindingCreateOptions contains parameters for creating a user binding between a SonarQube user and an external chat identity.

type IntegrationsUserBindingData added in v2.2.0

type IntegrationsUserBindingData struct {
	// Code is the OAuth authorization code returned by the external
	// integration provider. This field is required.
	Code string `json:"code"`
}

IntegrationsUserBindingData contains the data required to complete a user binding, such as the OAuth authorization code exchanged during the Slack connect flow.

type Issue

type Issue struct {
	// Key is the unique identifier of the issue.
	Key string `json:"key,omitempty"`
	// Component is the key of the component where the issue was found.
	Component string `json:"component,omitempty"`
	// Project is the key of the project containing the issue.
	Project string `json:"project,omitempty"`
	// Rule is the key of the rule that raised this issue.
	Rule string `json:"rule,omitempty"`
	// Message is the main message describing the issue.
	Message string `json:"message,omitempty"`
	// Line is the line number where the issue was found.
	Line int64 `json:"line,omitempty"`
	// Hash is the hash of the line content for tracking purposes.
	Hash string `json:"hash,omitempty"`
	// IssueStatus is the current status of the issue (OPEN, CONFIRMED, RESOLVED, etc.).
	IssueStatus string `json:"issueStatus,omitempty"`
	// Author is the SCM author of the code where the issue was found.
	Author string `json:"author,omitempty"`
	// Assignee is the login of the user assigned to this issue.
	Assignee string `json:"assignee,omitempty"`
	// Effort is the estimated time to fix the issue.
	Effort string `json:"effort,omitempty"`
	// Debt is the estimated time to fix the issue (legacy field, same as Effort).
	Debt string `json:"debt,omitempty"`
	// CreationDate is the timestamp when the issue was created.
	CreationDate string `json:"creationDate,omitempty"`
	// UpdateDate is the timestamp when the issue was last updated.
	UpdateDate string `json:"updateDate,omitempty"`
	// CleanCodeAttribute is the clean code attribute of the issue.
	CleanCodeAttribute string `json:"cleanCodeAttribute,omitempty"`
	// CleanCodeAttributeCategory is the category of the clean code attribute.
	CleanCodeAttributeCategory string `json:"cleanCodeAttributeCategory,omitempty"`
	// RuleDescriptionContextKey is the context key for the rule description.
	RuleDescriptionContextKey string `json:"ruleDescriptionContextKey,omitempty"`
	// Severity is the severity level of the issue (BLOCKER, CRITICAL, MAJOR, MINOR, INFO).
	Severity string `json:"severity,omitempty"`
	// Status is the status of the issue (legacy field).
	Status string `json:"status,omitempty"`
	// Type is the type of the issue (BUG, VULNERABILITY, CODE_SMELL).
	Type string `json:"type,omitempty"`
	// LinkedTicketStatus is the status of the linked ticket (if any).
	LinkedTicketStatus string `json:"linkedTicketStatus,omitempty"`
	// TextRange is the text range where the issue was found.
	TextRange TextRange `json:"textRange,omitzero"`
	// Actions are the available actions for this issue.
	Actions []string `json:"actions,omitempty"`
	// Transitions are the available workflow transitions for this issue.
	Transitions []string `json:"transitions,omitempty"`
	// Tags is the list of tags associated with this issue.
	Tags []string `json:"tags,omitempty"`
	// InternalTags is the list of internal tags.
	InternalTags []string `json:"internalTags,omitempty"`
	// CodeVariants is the list of code variants affected by this issue.
	CodeVariants []string `json:"codeVariants,omitempty"`
	// Comments is the list of comments on this issue.
	Comments []IssueComment `json:"comments,omitempty"`
	// Impacts is the list of impacts on software quality.
	Impacts []IssueImpact `json:"impacts,omitempty"`
	// Flows is the list of code flows related to this issue.
	Flows []IssueFlow `json:"flows,omitempty"`
	// MessageFormattings is the list of message formatting rules.
	MessageFormattings []MessageFormatting `json:"messageFormattings,omitempty"`
	// QuickFixAvailable indicates if a quick fix is available for this issue.
	QuickFixAvailable bool `json:"quickFixAvailable,omitempty"`
	// PrioritizedRule indicates if the rule is prioritized.
	PrioritizedRule bool `json:"prioritizedRule,omitempty"`
}

Issue represents an issue detected by SonarQube.

type IssueComment

type IssueComment struct {
	// Key is the unique identifier of the comment.
	Key string `json:"key,omitempty"`
	// Login is the login of the user who created the comment.
	Login string `json:"login,omitempty"`
	// HTMLText is the HTML-formatted text of the comment.
	HTMLText string `json:"htmlText,omitempty"`
	// Markdown is the Markdown-formatted text of the comment.
	Markdown string `json:"markdown,omitempty"`
	// CreatedAt is the timestamp when the comment was created.
	CreatedAt string `json:"createdAt,omitempty"`
	// Updatable indicates if the comment can be updated by the current user.
	Updatable bool `json:"updatable,omitempty"`
}

IssueComment represents a comment on an issue.

type IssueComponent

type IssueComponent struct {
	// Key is the unique identifier of the component.
	Key string `json:"key,omitempty"`
	// Name is the short name of the component.
	Name string `json:"name,omitempty"`
	// LongName is the long name of the component.
	LongName string `json:"longName,omitempty"`
	// Path is the path of the component.
	Path string `json:"path,omitempty"`
	// Qualifier is the component qualifier (TRK, DIR, FIL, etc.).
	Qualifier string `json:"qualifier,omitempty"`
	// ID is the internal identifier of the component.
	ID int64 `json:"id,omitempty"`
	// ProjectID is the internal identifier of the project.
	ProjectID int64 `json:"projectId,omitempty"`
	// SubProjectID is the internal identifier of the sub-project.
	SubProjectID int64 `json:"subProjectId,omitempty"`
	// Enabled indicates if the component is enabled.
	Enabled bool `json:"enabled,omitempty"`
}

IssueComponent represents a component in issue responses.

type IssueFacet

type IssueFacet struct {
	// Property is the name of the facet property.
	Property string `json:"property,omitempty"`
	// Values is the list of facet values with their counts.
	Values []IssueFacetValue `json:"values,omitempty"`
}

IssueFacet represents a facet in search results.

type IssueFacetValue

type IssueFacetValue struct {
	// Val is the facet value.
	Val string `json:"val,omitempty"`
	// Count is the number of items matching this facet value.
	Count int64 `json:"count,omitempty"`
}

IssueFacetValue represents a single facet value with its count.

type IssueFlow

type IssueFlow struct {
	// Locations is the list of locations in the flow.
	Locations []FlowLocation `json:"locations,omitempty"`
}

IssueFlow represents a code flow related to an issue.

type IssueImpact

type IssueImpact struct {
	// Severity is the severity of the impact (BLOCKER, HIGH, MEDIUM, LOW, INFO).
	Severity string `json:"severity,omitempty"`
	// SoftwareQuality is the software quality characteristic affected (MAINTAINABILITY, RELIABILITY, SECURITY).
	SoftwareQuality string `json:"softwareQuality,omitempty"`
}

IssueImpact represents the impact of an issue on software quality.

type IssueRule

type IssueRule struct {
	// Key is the unique identifier of the rule.
	Key string `json:"key,omitempty"`
	// Name is the display name of the rule.
	Name string `json:"name,omitempty"`
	// Lang is the language key of the rule.
	Lang string `json:"lang,omitempty"`
	// LangName is the display name of the language.
	LangName string `json:"langName,omitempty"`
	// Status is the status of the rule.
	Status string `json:"status,omitempty"`
}

IssueRule represents a rule in issue responses.

type IssueUser

type IssueUser struct {
	// Login is the login of the user.
	Login string `json:"login,omitempty"`
	// Name is the display name of the user.
	Name string `json:"name,omitempty"`
	// Email is the email of the user.
	Email string `json:"email,omitempty"`
	// Avatar is the avatar hash of the user.
	Avatar string `json:"avatar,omitempty"`
	// Active indicates if the user is active.
	Active bool `json:"active,omitempty"`
}

IssueUser represents a user in issue responses.

type IssuesAddComment

type IssuesAddComment struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issue      Issue            `json:"issue,omitzero"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
}

IssuesAddComment represents the response from adding a comment to an issue.

type IssuesAddCommentOptions

type IssuesAddCommentOptions struct {
	// Issue is the key of the issue to comment on (required).
	Issue string `url:"issue,omitempty"`
	// Text is the comment text (required).
	Text string `url:"text,omitempty"`
}

IssuesAddCommentOptions contains options for adding a comment to an issue.

type IssuesAnticipatedTransitionsOptions

type IssuesAnticipatedTransitionsOptions struct {
	// ProjectKey is the key of the project (required).
	ProjectKey string `url:"projectKey,omitempty"`
}

IssuesAnticipatedTransitionsOptions contains options for anticipated transitions.

type IssuesAssign

type IssuesAssign struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issue      Issue            `json:"issue,omitzero"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
}

IssuesAssign represents the response from assigning an issue.

type IssuesAssignOptions

type IssuesAssignOptions struct {
	// Issue is the key of the issue to assign (required).
	Issue string `url:"issue,omitempty"`
	// Assignee is the login of the assignee. When not set, it will unassign the issue.
	// Use '_me' to assign to the current user.
	Assignee string `url:"assignee,omitempty"`
}

IssuesAssignOptions contains options for assigning an issue.

type IssuesAuthors

type IssuesAuthors struct {
	// Authors is the list of SCM authors.
	Authors []string `json:"authors,omitempty"`
}

IssuesAuthors represents the response from the authors endpoint.

type IssuesAuthorsOptions

type IssuesAuthorsOptions struct {
	// Project is the project key to limit the search.
	Project string `url:"project,omitempty"`
	// Query limits the search to authors that contain the supplied string.
	Query string `url:"q,omitempty"`
	// PageSize is the maximum number of results to return (must be between 1 and 100).
	PageSize int64 `url:"ps,omitempty"`
}

IssuesAuthorsOptions contains options for listing authors.

type IssuesBulkChange

type IssuesBulkChange struct {
	// Total is the total number of issues processed.
	Total int64 `json:"total,omitempty"`
	// Success is the number of successfully changed issues.
	Success int64 `json:"success,omitempty"`
	// Ignored is the number of ignored issues.
	Ignored int64 `json:"ignored,omitempty"`
	// Failures is the number of failed changes.
	Failures int64 `json:"failures,omitempty"`
}

IssuesBulkChange represents the response from a bulk change operation.

type IssuesBulkChangeOptions

type IssuesBulkChangeOptions struct {
	// Issues is the list of issue keys to change (required).
	Issues []string `url:"issues,omitempty,comma"`
	// AddTags is the list of tags to add.
	AddTags []string `url:"add_tags,omitempty,comma"`
	// RemoveTags is the list of tags to remove.
	RemoveTags []string `url:"remove_tags,omitempty,comma"`
	// Assign is the login of the user to assign, or empty to unassign.
	Assign string `url:"assign,omitempty"`
	// Comment is the comment to add (only added if type or severity changes).
	Comment string `url:"comment,omitempty"`
	// DoTransition is the transition to perform.
	// Allowed values: confirm, unconfirm, reopen, resolve, falsepositive, wontfix, resolveasreviewed, resetastoreview, accept
	DoTransition string `url:"do_transition,omitempty"`
	// SetSeverity is the new severity to set.
	// Allowed values: BLOCKER, CRITICAL, MAJOR, MINOR, INFO
	SetSeverity string `url:"set_severity,omitempty"`
	// SetType is the new type to set.
	// Allowed values: BUG, VULNERABILITY, CODE_SMELL, SECURITY_HOTSPOT
	SetType string `url:"set_type,omitempty"`
	// SendNotifications indicates whether to send notifications.
	SendNotifications bool `url:"sendNotifications,omitempty"`
}

IssuesBulkChangeOptions contains options for bulk changing issues.

type IssuesChangelog

type IssuesChangelog struct {
	// Changelog is the list of changelog entries.
	Changelog []ChangelogEntry `json:"changelog,omitempty"`
}

IssuesChangelog represents the response from the changelog endpoint.

type IssuesChangelogOptions

type IssuesChangelogOptions struct {
	// Issue is the key of the issue (required).
	Issue string `url:"issue,omitempty"`
}

IssuesChangelogOptions contains options for retrieving issue changelog.

type IssuesComponentTags

type IssuesComponentTags struct {
	// Tags is the list of tags with their counts.
	Tags []ComponentTag `json:"tags,omitempty"`
}

IssuesComponentTags represents the response from the component tags endpoint.

type IssuesComponentTagsOptions

type IssuesComponentTagsOptions struct {
	// ComponentUuid is the UUID of the component (required).
	ComponentUuid string `url:"componentUuid,omitempty"`
	// CreatedAfter filters issues created after the given date.
	CreatedAfter string `url:"createdAfter,omitempty"`
	// PageSize is the maximum number of tags to return.
	PageSize int64 `url:"ps,omitempty"`
}

IssuesComponentTagsOptions contains options for listing component tags.

type IssuesDeleteComment

type IssuesDeleteComment struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issue      Issue            `json:"issue,omitzero"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
}

IssuesDeleteComment represents the response from deleting a comment.

type IssuesDeleteCommentOptions

type IssuesDeleteCommentOptions struct {
	// Comment is the key of the comment to delete (required).
	Comment string `url:"comment,omitempty"`
}

IssuesDeleteCommentOptions contains options for deleting a comment.

type IssuesDoTransition

type IssuesDoTransition struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issue      Issue            `json:"issue,omitzero"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
}

IssuesDoTransition represents the response from performing a transition.

type IssuesDoTransitionOptions

type IssuesDoTransitionOptions struct {
	// Issue is the key of the issue (required).
	Issue string `url:"issue,omitempty"`
	// Transition is the transition to perform (required).
	// Allowed values: confirm, unconfirm, reopen, resolve, falsepositive, wontfix, resolveasreviewed, resetastoreview, accept, close
	Transition string `url:"transition,omitempty"`
}

IssuesDoTransitionOptions contains options for performing a transition.

type IssuesEditComment

type IssuesEditComment struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issue      Issue            `json:"issue,omitzero"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
}

IssuesEditComment represents the response from editing a comment.

type IssuesEditCommentOptions

type IssuesEditCommentOptions struct {
	// Comment is the key of the comment to edit (required).
	Comment string `url:"comment,omitempty"`
	// Text is the new comment text (required).
	Text string `url:"text,omitempty"`
}

IssuesEditCommentOptions contains options for editing a comment.

type IssuesList

type IssuesList struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issues     []Issue          `json:"issues,omitempty"`
	Paging     Paging           `json:"paging,omitzero"`
}

IssuesList represents the response from the list endpoint.

type IssuesListOptions

type IssuesListOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// Project is the project key (one of Project or Component is required).
	Project string `url:"project,omitempty"`
	// Component is the component key.
	Component string `url:"component,omitempty"`
	// Branch is the branch key (not available in Community Edition).
	Branch string `url:"branch,omitempty"`
	// PullRequest is the pull request ID (not available in Community Edition).
	PullRequest string `url:"pullRequest,omitempty"`
	// Types is the list of issue types to filter by.
	// Allowed values: BUG, VULNERABILITY, CODE_SMELL, SECURITY_HOTSPOT
	Types []string `url:"types,omitempty,comma"`
	// Resolved filters by resolved status. If nil, returns all issues.
	Resolved *bool `url:"resolved,omitempty"`
	// InNewCodePeriod filters issues created in the new code period.
	InNewCodePeriod bool `url:"inNewCodePeriod,omitempty"`
}

IssuesListOptions contains options for listing issues.

type IssuesPullOptions

type IssuesPullOptions struct {
	// ProjectKey is the project key (required).
	ProjectKey string `url:"projectKey,omitempty"`
	// BranchName is the branch name to fetch issues for.
	BranchName string `url:"branchName,omitempty"`
	// Languages is the list of languages to filter by.
	Languages []string `url:"languages,omitempty,comma"`
	// RuleRepositories is the list of rule repositories to filter by.
	RuleRepositories []string `url:"ruleRepositories,omitempty,comma"`
	// ChangedSince is the timestamp to filter issues modified after.
	ChangedSince string `url:"changedSince,omitempty"`
	// ResolvedOnly returns only resolved issues if true.
	ResolvedOnly bool `url:"resolvedOnly,omitempty"`
}

IssuesPullOptions contains options for pulling issues.

type IssuesPullTaintOptions

type IssuesPullTaintOptions struct {
	// ProjectKey is the project key (required).
	ProjectKey string `url:"projectKey,omitempty"`
	// BranchName is the branch name to fetch taint vulnerabilities for.
	BranchName string `url:"branchName,omitempty"`
	// Languages is the list of languages to filter by.
	Languages []string `url:"languages,omitempty,comma"`
	// ChangedSince is the timestamp to filter issues modified after.
	ChangedSince string `url:"changedSince,omitempty"`
}

IssuesPullTaintOptions contains options for pulling taint vulnerabilities.

type IssuesReindexOptions

type IssuesReindexOptions struct {
	// Project is the project key (required).
	Project string `url:"project,omitempty"`
}

IssuesReindexOptions contains options for reindexing issues.

type IssuesSandboxProjectSettings added in v2.2.0

type IssuesSandboxProjectSettings struct {
	SoftwareQualities []IssuesSandboxSoftwareQualityMapping `json:"softwareQualities,omitempty"`
	Types             []IssuesSandboxRuleTypeMapping        `json:"types,omitempty"`
	Enabled           bool                                  `json:"enabled,omitempty"`
	Overridden        bool                                  `json:"overridden,omitempty"`
}

IssuesSandboxProjectSettings represents the project-level issue sandbox settings.

type IssuesSandboxRuleTypeMapping added in v2.2.0

type IssuesSandboxRuleTypeMapping struct {
	// Type is the rule type. This field is required.
	// Allowed values: CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT.
	Type string `json:"type"`
	// Severities is the list of severities. This field is required.
	// Allowed values: BLOCKER, CRITICAL, MAJOR, MINOR, INFO.
	Severities []string `json:"severities"`
}

IssuesSandboxRuleTypeMapping represents a rule type to severities mapping used by sandbox settings when the instance runs in Standard Experience mode.

type IssuesSandboxSettings added in v2.2.0

type IssuesSandboxSettings struct {
	SoftwareQualities []IssuesSandboxSoftwareQualityMapping `json:"softwareQualities,omitempty"`
	Types             []IssuesSandboxRuleTypeMapping        `json:"types,omitempty"`
	Enabled           bool                                  `json:"enabled,omitempty"`
	DefaultValue      bool                                  `json:"defaultValue,omitempty"`
	AllowOverride     bool                                  `json:"allowOverride,omitempty"`
}

IssuesSandboxSettings represents the instance-level issue sandbox settings.

type IssuesSandboxSoftwareQualityMapping added in v2.2.0

type IssuesSandboxSoftwareQualityMapping struct {
	// SoftwareQuality is the software quality. This field is required.
	// Allowed values: MAINTAINABILITY, RELIABILITY, SECURITY.
	SoftwareQuality string `json:"softwareQuality"`
	// ImpactSeverities is the list of impact severities. This field is required.
	// Allowed values: INFO, LOW, MEDIUM, HIGH, BLOCKER.
	ImpactSeverities []string `json:"impactSeverities"`
}

IssuesSandboxSoftwareQualityMapping represents a software quality to impact severities mapping used by sandbox settings when the instance runs in MQR (Multi-Quality Rule) mode.

type IssuesSearch

type IssuesSearch struct {
	Components []IssueComponent `json:"components,omitempty"`
	Facets     []IssueFacet     `json:"facets,omitempty"`
	Issues     []Issue          `json:"issues,omitempty"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
	Paging     Paging           `json:"paging,omitzero"`
	// Page is the current page number (legacy duplicate of Paging.PageIndex).
	Page int64 `json:"p,omitempty"`
	// PageSize is the page size (legacy duplicate of Paging.PageSize).
	PageSize int64 `json:"ps,omitempty"`
	// Total is the total number of issues (legacy duplicate of Paging.Total).
	Total int64 `json:"total,omitempty"`
	// EffortTotal is the total remediation effort, in minutes, of the returned issues.
	EffortTotal int64 `json:"effortTotal,omitempty"`
}

IssuesSearch represents the response from the search endpoint.

type IssuesSearchOptions

type IssuesSearchOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// AdditionalFields is the list of optional fields to return.
	// Allowed values: _all, comments, languages, rules, ruleDescriptionContextKey, transitions, actions, users
	AdditionalFields []string `url:"additionalFields,omitempty,comma"`
	// Assignees is the list of assignee logins. Use '__me__' for current user.
	Assignees []string `url:"assignees,omitempty,comma"`
	// Author is the SCM account to filter by.
	Author string `url:"author,omitempty"`
	// Branch is the branch key (not available in Community Edition).
	Branch string `url:"branch,omitempty"`
	// Casa is the list of CASA categories.
	Casa []string `url:"casa,omitempty,comma"`
	// CleanCodeAttributeCategories is the list of clean code attribute categories.
	// Allowed values: ADAPTABLE, CONSISTENT, INTENTIONAL, RESPONSIBLE
	CleanCodeAttributeCategories []string `url:"cleanCodeAttributeCategories,omitempty,comma"`
	// CodeVariants is the list of code variants.
	CodeVariants []string `url:"codeVariants,omitempty,comma"`
	// ComplianceStandards is the list of compliance standards.
	ComplianceStandards []string `url:"complianceStandards,omitempty,comma"`
	// Components is the list of component keys.
	Components []string `url:"components,omitempty,comma"`
	// CreatedAfter filters issues created after the given date.
	CreatedAfter string `url:"createdAfter,omitempty"`
	// CreatedAt filters issues created during a specific analysis.
	CreatedAt string `url:"createdAt,omitempty"`
	// CreatedBefore filters issues created before the given date.
	CreatedBefore string `url:"createdBefore,omitempty"`
	// CreatedInLast filters issues created in the last time span.
	CreatedInLast string `url:"createdInLast,omitempty"`
	// Cwe is the list of CWE identifiers.
	Cwe []string `url:"cwe,omitempty,comma"`
	// Directories is the list of directories to filter by.
	Directories []string `url:"directories,omitempty,comma"`
	// Facets is the list of facets to compute.
	// Allowed values: projects, files, assigned_to_me, severities, statuses, resolutions, rules, assignees, author, directories, scopes, languages, tags, types, pciDss-3.2, pciDss-4.0, owaspAsvs-4.0, owaspMobileTop10-2024, owaspTop10, owaspTop10-2021, stig-ASD_V5R3, casa, sansTop25, cwe, createdAt, sonarsourceSecurity, codeVariants, cleanCodeAttributeCategories, impactSoftwareQualities, impactSeverities, issueStatuses, prioritizedRule, complianceStandards
	Facets []string `url:"facets,omitempty,comma"`
	// Files is the list of files to filter by.
	Files []string `url:"files,omitempty,comma"`
	// FixedInPullRequest filters issues fixed in the specified pull request.
	FixedInPullRequest string `url:"fixedInPullRequest,omitempty"`
	// ImpactSeverities is the list of impact severities to filter by.
	// Allowed values: BLOCKER, HIGH, MEDIUM, LOW, INFO
	ImpactSeverities []string `url:"impactSeverities,omitempty,comma"`
	// ImpactSoftwareQualities is the list of software qualities to filter by.
	// Allowed values: MAINTAINABILITY, RELIABILITY, SECURITY
	ImpactSoftwareQualities []string `url:"impactSoftwareQualities,omitempty,comma"`
	// InNewCodePeriod filters issues created in the new code period.
	InNewCodePeriod bool `url:"inNewCodePeriod,omitempty"`
	// IssueStatuses is the list of issue statuses to filter by.
	// Allowed values: OPEN, CONFIRMED, FALSE_POSITIVE, ACCEPTED, FIXED, IN_SANDBOX
	IssueStatuses []string `url:"issueStatuses,omitempty,comma"`
	// Issues is the list of issue keys to retrieve.
	Issues []string `url:"issues,omitempty,comma"`
	// Languages is the list of languages to filter by.
	Languages []string `url:"languages,omitempty,comma"`
	// OnComponentOnly returns only issues at the component level.
	OnComponentOnly bool `url:"onComponentOnly,omitempty"`
	// OwaspAsvs40 is the list of OWASP ASVS v4.0 categories.
	OwaspAsvs40 []string `url:"owaspAsvs-4.0,omitempty,comma"`
	// OwaspAsvsLevel is the OWASP ASVS level.
	// Allowed values: 1, 2, 3
	OwaspAsvsLevel int64 `url:"owaspAsvsLevel,omitempty"`
	// OwaspMobileTop102024 is the list of OWASP Mobile Top 10 2024 categories.
	// Allowed values: m1, m2, m3, m4, m5, m6, m7, m8, m9, m10
	OwaspMobileTop102024 []string `url:"owaspMobileTop10-2024,omitempty,comma"`
	// OwaspTop10 is the list of OWASP Top 10 2017 categories.
	// Allowed values: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
	OwaspTop10 []string `url:"owaspTop10,omitempty,comma"`
	// OwaspTop102021 is the list of OWASP Top 10 2021 categories.
	// Allowed values: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
	OwaspTop102021 []string `url:"owaspTop10-2021,omitempty,comma"`
	// PciDss32 is the list of PCI DSS v3.2 categories.
	PciDss32 []string `url:"pciDss-3.2,omitempty,comma"`
	// PciDss40 is the list of PCI DSS v4.0 categories.
	PciDss40 []string `url:"pciDss-4.0,omitempty,comma"`
	// PrioritizedRule filters by prioritized rule status.
	PrioritizedRule bool `url:"prioritizedRule,omitempty"`
	// Projects is the list of project keys.
	Projects []string `url:"projects,omitempty,comma"`
	// PullRequest is the pull request ID (not available in Community Edition).
	PullRequest string `url:"pullRequest,omitempty"`
	// Resolutions is the list of resolutions to filter by.
	// Allowed values: FALSE-POSITIVE, WONTFIX, FIXED, REMOVED
	Resolutions []string `url:"resolutions,omitempty,comma"`
	// Resolved filters by resolved status. If nil, returns all issues.
	Resolved *bool `url:"resolved,omitempty"`
	// Rules is the list of rule keys to filter by.
	Rules []string `url:"rules,omitempty,comma"`
	// Sort is the sort field.
	// Allowed values: CREATION_DATE, CLOSE_DATE, SEVERITY, STATUS, FILE_LINE, HOTSPOTS, UPDATE_DATE
	Sort string `url:"s,omitempty"`
	// SansTop25 is the list of SANS Top 25 categories.
	// Allowed values: insecure-interaction, risky-resource, porous-defenses
	//
	// Deprecated: This filter is deprecated since 10.0
	SansTop25 []string `url:"sansTop25,omitempty,comma"`
	// Scopes is the list of scopes to filter by.
	// Allowed values: MAIN, TEST
	Scopes []string `url:"scopes,omitempty,comma"`
	// Severities is the list of severities to filter by.
	// Allowed values: BLOCKER, CRITICAL, MAJOR, MINOR, INFO
	Severities []string `url:"severities,omitempty,comma"`
	// SonarsourceSecurity is the list of SonarSource security categories.
	// Allowed values: buffer-overflow, sql-injection, rce, object-injection, command-injection, path-traversal-injection, ldap-injection, xpath-injection, log-injection, xxe, xss, dos, ssrf, csrf, http-response-splitting, open-redirect, weak-cryptography, auth, insecure-conf, file-manipulation, encrypt-data, traceability, permission, others
	SonarsourceSecurity []string `url:"sonarsourceSecurity,omitempty,comma"`
	// Statuses is the list of statuses to filter by.
	Statuses []string `url:"statuses,omitempty,comma"`
	// StigAsdV5R3 is the list of STIG V5R3 categories.
	StigAsdV5R3 []string `url:"stig-ASD_V5R3,omitempty,comma"`
	// Tags is the list of tags to filter by.
	Tags []string `url:"tags,omitempty,comma"`
	// TimeZone is the timezone for date resolution.
	TimeZone string `url:"timeZone,omitempty"`
	// Types is the list of issue types to filter by.
	// Allowed values: BUG, VULNERABILITY, CODE_SMELL
	Types []string `url:"types,omitempty,comma"`
	// Assigned filters by assigned status.
	Assigned *bool `url:"assigned,omitempty"`
	// Asc sorts in ascending order.
	Asc bool `url:"asc,omitempty"`

	// FromSonarQubeUpdate matches issues detected because of SonarQube updates.
	FromSonarQubeUpdate *bool `url:"fromSonarQubeUpdate,omitempty"`
	// LinkedTicketStatus filters by linked work item status.
	// Allowed values: LINKED, NOT_LINKED
	LinkedTicketStatus string `url:"linkedTicketStatus,omitempty"`
}

IssuesSearchOptions contains options for searching issues.

type IssuesService

type IssuesService struct {
	// contains filtered or unexported fields
}

IssuesService handles communication with the Issues related methods of the SonarQube API. Issues represent code problems detected by SonarQube during analysis.

func (*IssuesService) AddComment

func (s *IssuesService) AddComment(ctx context.Context, opt *IssuesAddCommentOptions) (v *IssuesAddComment, resp *http.Response, err error)

AddComment adds a comment to an issue. Requires authentication and 'Browse' permission on the project of the specified issue.

func (*IssuesService) AnticipatedTransitions

func (s *IssuesService) AnticipatedTransitions(ctx context.Context, opt *IssuesAnticipatedTransitionsOptions) (resp *http.Response, err error)

AnticipatedTransitions receives a list of anticipated transitions for not yet discovered issues. Requires 'Administer Issues' permission on the specified project. Only 'falsepositive', 'wontfix' and 'accept' transitions are supported. Upon successful execution, the HTTP status code returned is 202 (Accepted).

func (*IssuesService) Assign

func (s *IssuesService) Assign(ctx context.Context, opt *IssuesAssignOptions) (v *IssuesAssign, resp *http.Response, err error)

Assign assigns or unassigns an issue. Requires authentication and 'Browse' permission on the project.

func (*IssuesService) Authors

func (s *IssuesService) Authors(ctx context.Context, opt *IssuesAuthorsOptions) (v *IssuesAuthors, resp *http.Response, err error)

Authors searches SCM accounts which match a given query. Requires authentication. Returns 503 when issue indexing is in progress.

func (*IssuesService) BulkChange

func (s *IssuesService) BulkChange(ctx context.Context, opt *IssuesBulkChangeOptions) (v *IssuesBulkChange, resp *http.Response, err error)

BulkChange performs bulk changes on issues. Up to 500 issues can be updated. Requires authentication.

func (*IssuesService) Changelog

func (s *IssuesService) Changelog(ctx context.Context, opt *IssuesChangelogOptions) (v *IssuesChangelog, resp *http.Response, err error)

Changelog displays the changelog of an issue. Requires 'Browse' permission on the project of the specified issue.

func (*IssuesService) ComponentTags

func (s *IssuesService) ComponentTags(ctx context.Context, opt *IssuesComponentTagsOptions) (v *IssuesComponentTags, resp *http.Response, err error)

ComponentTags lists tags for issues under a given component. Returns 503 when issue indexing is in progress.

func (*IssuesService) DeleteComment

func (s *IssuesService) DeleteComment(ctx context.Context, opt *IssuesDeleteCommentOptions) (v *IssuesDeleteComment, resp *http.Response, err error)

DeleteComment deletes a comment. Requires authentication and 'Browse' permission on the project of the specified issue.

func (*IssuesService) DoTransition

func (s *IssuesService) DoTransition(ctx context.Context, opt *IssuesDoTransitionOptions) (v *IssuesDoTransition, resp *http.Response, err error)

DoTransition performs a workflow transition on an issue. Requires authentication and 'Browse' permission on the project. Transitions 'accept', 'wontfix', and 'falsepositive' require 'Administer Issues' permission. Security hotspot transitions require 'Administer Security Hotspot' permission.

func (*IssuesService) EditComment

func (s *IssuesService) EditComment(ctx context.Context, opt *IssuesEditCommentOptions) (v *IssuesEditComment, resp *http.Response, err error)

EditComment edits a comment. Requires authentication and 'Browse' permission on the project of the specified issue.

func (*IssuesService) List

func (s *IssuesService) List(ctx context.Context, opt *IssuesListOptions) (v *IssuesList, resp *http.Response, err error)

List lists issues in degraded mode when issue indexing is running. Either 'project' or 'component' parameter is required. Requires 'Browse' permission on the specified project.

func (*IssuesService) ListAll

func (s *IssuesService) ListAll(ctx context.Context, opt *IssuesListOptions) ([]Issue, *http.Response, error)

ListAll fetches all pages from List and returns a flat slice of issues.

func (*IssuesService) Pull

func (s *IssuesService) Pull(ctx context.Context, opt *IssuesPullOptions) (v []byte, resp *http.Response, err error)

Pull fetches all issues for a given branch. The issues returned are not paginated, so the response size can be big. Requires 'Browse' permission on the project.

func (*IssuesService) PullTaint

func (s *IssuesService) PullTaint(ctx context.Context, opt *IssuesPullTaintOptions) (v []byte, resp *http.Response, err error)

PullTaint fetches all taint vulnerabilities for a given branch. The vulnerabilities returned are not paginated, so the response size can be big. Requires 'Browse' permission on the project.

func (*IssuesService) Reindex

func (s *IssuesService) Reindex(ctx context.Context, opt *IssuesReindexOptions) (resp *http.Response, err error)

Reindex triggers reindexing of issues for a project. Requires 'Administer System' permission.

func (*IssuesService) Search

func (s *IssuesService) Search(ctx context.Context, opt *IssuesSearchOptions) (v *IssuesSearch, resp *http.Response, err error)

Search searches for issues. Requires 'Browse' permission on the specified project(s). For applications, it also requires 'Browse' permission on child projects. Returns 503 when issue indexing is in progress.

func (*IssuesService) SearchAll

func (s *IssuesService) SearchAll(ctx context.Context, opt *IssuesSearchOptions) ([]Issue, *http.Response, error)

SearchAll fetches all pages from Search and returns a flat slice of issues.

func (*IssuesService) SetSeverity

func (s *IssuesService) SetSeverity(ctx context.Context, opt *IssuesSetSeverityOptions) (v *IssuesSetSeverity, resp *http.Response, err error)

SetSeverity changes the severity of an issue. Requires authentication, 'Browse' and 'Administer Issues' permissions on the project.

func (*IssuesService) SetTags

func (s *IssuesService) SetTags(ctx context.Context, opt *IssuesSetTagsOptions) (v *IssuesSetTags, resp *http.Response, err error)

SetTags sets tags on an issue. Requires authentication and 'Browse' permission on the project.

func (*IssuesService) SetType

func (s *IssuesService) SetType(ctx context.Context, opt *IssuesSetTypeOptions) (v *IssuesSetType, resp *http.Response, err error)

SetType changes the type of an issue. Requires authentication, 'Browse' and 'Administer Issues' permissions on the project.

func (*IssuesService) Tags

func (s *IssuesService) Tags(ctx context.Context, opt *IssuesTagsOptions) (v *IssuesTags, resp *http.Response, err error)

Tags lists tags matching a given query.

func (*IssuesService) ValidateAddCommentOpt

func (s *IssuesService) ValidateAddCommentOpt(opt *IssuesAddCommentOptions) error

ValidateAddCommentOpt validates the options for adding a comment.

func (*IssuesService) ValidateAnticipatedTransitionsOpt

func (s *IssuesService) ValidateAnticipatedTransitionsOpt(opt *IssuesAnticipatedTransitionsOptions) error

ValidateAnticipatedTransitionsOpt validates the options for anticipated transitions.

func (*IssuesService) ValidateAssignOpt

func (s *IssuesService) ValidateAssignOpt(opt *IssuesAssignOptions) error

ValidateAssignOpt validates the options for assigning an issue.

func (*IssuesService) ValidateAuthorsOpt

func (s *IssuesService) ValidateAuthorsOpt(opt *IssuesAuthorsOptions) error

ValidateAuthorsOpt validates the options for listing authors.

func (*IssuesService) ValidateBulkChangeOpt

func (s *IssuesService) ValidateBulkChangeOpt(opt *IssuesBulkChangeOptions) error

ValidateBulkChangeOpt validates the options for bulk change.

func (*IssuesService) ValidateChangelogOpt

func (s *IssuesService) ValidateChangelogOpt(opt *IssuesChangelogOptions) error

ValidateChangelogOpt validates the options for changelog.

func (*IssuesService) ValidateComponentTagsOpt

func (s *IssuesService) ValidateComponentTagsOpt(opt *IssuesComponentTagsOptions) error

ValidateComponentTagsOpt validates the options for component tags.

func (*IssuesService) ValidateDeleteCommentOpt

func (s *IssuesService) ValidateDeleteCommentOpt(opt *IssuesDeleteCommentOptions) error

ValidateDeleteCommentOpt validates the options for deleting a comment.

func (*IssuesService) ValidateDoTransitionOpt

func (s *IssuesService) ValidateDoTransitionOpt(opt *IssuesDoTransitionOptions) error

ValidateDoTransitionOpt validates the options for doing a transition.

func (*IssuesService) ValidateEditCommentOpt

func (s *IssuesService) ValidateEditCommentOpt(opt *IssuesEditCommentOptions) error

ValidateEditCommentOpt validates the options for editing a comment.

func (*IssuesService) ValidateListOpt

func (s *IssuesService) ValidateListOpt(opt *IssuesListOptions) error

ValidateListOpt validates the options for listing issues.

func (*IssuesService) ValidatePullOpt

func (s *IssuesService) ValidatePullOpt(opt *IssuesPullOptions) error

ValidatePullOpt validates the options for pulling issues.

func (*IssuesService) ValidatePullTaintOpt

func (s *IssuesService) ValidatePullTaintOpt(opt *IssuesPullTaintOptions) error

ValidatePullTaintOpt validates the options for pulling taint vulnerabilities.

func (*IssuesService) ValidateReindexOpt

func (s *IssuesService) ValidateReindexOpt(opt *IssuesReindexOptions) error

ValidateReindexOpt validates the options for reindexing.

func (*IssuesService) ValidateSearchOpt

func (s *IssuesService) ValidateSearchOpt(opt *IssuesSearchOptions) error

ValidateSearchOpt validates the options for searching issues.

func (*IssuesService) ValidateSetSeverityOpt

func (s *IssuesService) ValidateSetSeverityOpt(opt *IssuesSetSeverityOptions) error

ValidateSetSeverityOpt validates the options for setting severity.

func (*IssuesService) ValidateSetTagsOpt

func (s *IssuesService) ValidateSetTagsOpt(opt *IssuesSetTagsOptions) error

ValidateSetTagsOpt validates the options for setting tags.

func (*IssuesService) ValidateSetTypeOpt

func (s *IssuesService) ValidateSetTypeOpt(opt *IssuesSetTypeOptions) error

ValidateSetTypeOpt validates the options for setting type.

func (*IssuesService) ValidateTagsOpt

func (s *IssuesService) ValidateTagsOpt(opt *IssuesTagsOptions) error

ValidateTagsOpt validates the options for listing tags.

type IssuesSetSeverity

type IssuesSetSeverity struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issue      Issue            `json:"issue,omitzero"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
}

IssuesSetSeverity represents the response from setting severity.

type IssuesSetSeverityOptions

type IssuesSetSeverityOptions struct {
	// Issue is the key of the issue (required).
	Issue string `url:"issue,omitempty"`
	// Severity is the new severity level.
	// Allowed values: BLOCKER, CRITICAL, MAJOR, MINOR, INFO
	Severity string `url:"severity,omitempty"`
	// Impact is the override of impact severity (cannot be used with Severity).
	Impact string `url:"impact,omitempty"`
}

IssuesSetSeverityOptions contains options for setting severity.

type IssuesSetTags

type IssuesSetTags struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issue      Issue            `json:"issue,omitzero"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
}

IssuesSetTags represents the response from setting tags.

type IssuesSetTagsOptions

type IssuesSetTagsOptions struct {
	// Issue is the key of the issue (required).
	Issue string `url:"issue,omitempty"`
	// Tags is the list of tags to set. Empty list removes all tags.
	Tags []string `url:"tags,omitempty,comma"`
}

IssuesSetTagsOptions contains options for setting tags.

type IssuesSetType

type IssuesSetType struct {
	Components []IssueComponent `json:"components,omitempty"`
	Issue      Issue            `json:"issue,omitzero"`
	Rules      []IssueRule      `json:"rules,omitempty"`
	Users      []IssueUser      `json:"users,omitempty"`
}

IssuesSetType represents the response from setting type.

type IssuesSetTypeOptions

type IssuesSetTypeOptions struct {
	// Issue is the key of the issue (required).
	Issue string `url:"issue,omitempty"`
	// Type is the new issue type (required).
	// Allowed values: BUG, VULNERABILITY, CODE_SMELL
	Type string `url:"type,omitempty"`
}

IssuesSetTypeOptions contains options for setting type.

type IssuesTags

type IssuesTags struct {
	// Tags is the list of available tags.
	Tags []string `json:"tags,omitempty"`
}

IssuesTags represents the response from the tags endpoint.

type IssuesTagsOptions

type IssuesTagsOptions struct {
	// Project is the project key.
	Project string `url:"project,omitempty"`
	// Branch is the branch key.
	Branch string `url:"branch,omitempty"`
	// Query limits the search to tags containing the supplied string.
	Query string `url:"q,omitempty"`
	// PageSize is the maximum number of tags to return.
	PageSize int64 `url:"ps,omitempty"`
	// All includes tags from all branches if true.
	All bool `url:"all,omitempty"`
}

IssuesTagsOptions contains options for listing tags.

type IssuesV2Service added in v2.2.0

type IssuesV2Service struct {
	// contains filtered or unexported fields
}

IssuesV2Service handles communication with the Issues sandbox settings V2 API endpoints (instance-level and project-level issue sandboxing configuration). Named IssuesV2Service (rather than IssuesService) to avoid colliding with the existing V1 IssuesService. This service is only available in Enterprise Edition. The underlying endpoints are marked internal by SonarQube (x-sonar-internal) and their request/response contract may change without notice between SonarQube versions.

func (*IssuesV2Service) GetProjectSandboxSettings added in v2.2.0

func (s *IssuesV2Service) GetProjectSandboxSettings(ctx context.Context, projectKey string) (*IssuesSandboxProjectSettings, *http.Response, error)

GetProjectSandboxSettings fetches the sandbox settings for a specific project. Returns effective configuration including enabled status, software quality overrides, and whether settings are inherited from instance or overridden at project level. Requires 'Administer Project' permission.

API endpoint: GET /api/v2/issues/sandbox-settings/{projectKey}. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*IssuesV2Service) GetSandboxSettings added in v2.2.0

func (s *IssuesV2Service) GetSandboxSettings(ctx context.Context) (*IssuesSandboxSettings, *http.Response, error)

GetSandboxSettings fetches the current instance-level sandbox settings. Returns configuration including enabled status, default value, allowOverride setting, and software qualities or rule types based on current mode. Requires 'Administer System' permission.

API endpoint: GET /api/v2/issues/sandbox-settings. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*IssuesV2Service) UpdateProjectSandboxSettings added in v2.2.0

UpdateProjectSandboxSettings updates the sandbox settings for a specific project. The enabled setting can be changed independently of software quality overrides. When allowOverride is disabled at instance level, software quality changes are not allowed but enabled changes are still permitted. Setting Overridden to false removes project-level software quality overrides to inherit from instance settings. Requires 'Administer Project' permission and the instance sandbox must be enabled.

API endpoint: PATCH /api/v2/issues/sandbox-settings/{projectKey}. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*IssuesV2Service) UpdateSandboxSettings added in v2.2.0

UpdateSandboxSettings updates the instance-level sandbox settings. Sandbox cannot be enabled without providing software qualities or rule types unless they already exist. When disabling allowOverride, all project-level software quality overrides are deleted. Requires 'Administer System' permission.

API endpoint: PATCH /api/v2/issues/sandbox-settings. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*IssuesV2Service) ValidateUpdateProjectSandboxSettingsOpt added in v2.2.0

func (s *IssuesV2Service) ValidateUpdateProjectSandboxSettingsOpt(projectKey string, opt *IssuesV2UpdateProjectSandboxSettingsOptions) error

ValidateUpdateProjectSandboxSettingsOpt validates the parameters for the UpdateProjectSandboxSettings method.

func (*IssuesV2Service) ValidateUpdateSandboxSettingsOpt added in v2.2.0

func (s *IssuesV2Service) ValidateUpdateSandboxSettingsOpt(opt *IssuesV2UpdateSandboxSettingsOptions) error

ValidateUpdateSandboxSettingsOpt validates the options for the UpdateSandboxSettings method.

type IssuesV2UpdateProjectSandboxSettingsOptions added in v2.2.0

type IssuesV2UpdateProjectSandboxSettingsOptions struct {
	Enabled           *bool                                 `json:"enabled,omitempty"`
	Overridden        *bool                                 `json:"overridden,omitempty"`
	SoftwareQualities []IssuesSandboxSoftwareQualityMapping `json:"softwareQualities,omitempty"`
	Types             []IssuesSandboxRuleTypeMapping        `json:"types,omitempty"`
}

IssuesV2UpdateProjectSandboxSettingsOptions contains parameters for updating the sandbox settings of a specific project. All fields are optional (PATCH merge semantics): a nil field is left unchanged server-side.

type IssuesV2UpdateSandboxSettingsOptions added in v2.2.0

type IssuesV2UpdateSandboxSettingsOptions struct {
	// Enabled enables or disables sandbox globally.
	Enabled *bool `json:"enabled,omitempty"`
	// DefaultValue sets the default value applied to new projects.
	DefaultValue *bool `json:"defaultValue,omitempty"`
	// AllowOverride allows or disallows projects to override instance settings.
	// Disabling it deletes all project-level software quality overrides.
	AllowOverride *bool `json:"allowOverride,omitempty"`
	// SoftwareQualities is the list of software quality mappings (MQR mode).
	SoftwareQualities []IssuesSandboxSoftwareQualityMapping `json:"softwareQualities,omitempty"`
	// Types is the list of rule type mappings (Standard Experience mode).
	Types []IssuesSandboxRuleTypeMapping `json:"types,omitempty"`
}

IssuesV2UpdateSandboxSettingsOptions contains parameters for updating the instance-level sandbox settings. All fields are optional (PATCH merge semantics): a nil field is left unchanged server-side.

type JSONEncodedMap

type JSONEncodedMap map[string]any

JSONEncodedMap is a wrapper type for map[string]any that encodes as JSON when used in URL parameters.

func (JSONEncodedMap) EncodeValues

func (m JSONEncodedMap) EncodeValues(key string, values *url.Values) error

EncodeValues implements query.Encoder for JSONEncodedMap. This ensures the map is JSON-encoded when used as a URL parameter.

type JVMState

type JVMState struct {
	// FreeMemoryMB is the free memory in megabytes.
	FreeMemoryMB int64 `json:"Free Memory (MB),omitempty"`
	// HeapCommittedMB is the committed heap memory in megabytes.
	HeapCommittedMB int64 `json:"Heap Committed (MB),omitempty"`
	// HeapInitMB is the initial heap memory in megabytes.
	HeapInitMB int64 `json:"Heap Init (MB),omitempty"`
	// HeapMaxMB is the maximum heap memory in megabytes.
	HeapMaxMB int64 `json:"Heap Max (MB),omitempty"`
	// HeapUsedMB is the used heap memory in megabytes.
	HeapUsedMB int64 `json:"Heap Used (MB),omitempty"`
	// MaxMemoryMB is the maximum memory in megabytes.
	MaxMemoryMB int64 `json:"Max Memory (MB),omitempty"`
	// NonHeapCommittedMB is the committed non-heap memory in megabytes.
	NonHeapCommittedMB int64 `json:"Non Heap Committed (MB),omitempty"`
	// NonHeapInitMB is the initial non-heap memory in megabytes.
	NonHeapInitMB int64 `json:"Non Heap Init (MB),omitempty"`
	// NonHeapUsedMB is the used non-heap memory in megabytes.
	NonHeapUsedMB int64 `json:"Non Heap Used (MB),omitempty"`
	// SystemLoadAverage is the system load average.
	SystemLoadAverage string `json:"System Load Average,omitempty"`
	// Threads is the number of threads.
	Threads int64 `json:"Threads,omitempty"`
}

JVMState contains JVM state information.

type JiraLinkedIssuesCount added in v2.2.0

type JiraLinkedIssuesCount map[string]any

JiraLinkedIssuesCount represents the count of Jira issues linked to a SonarQube project. The exact shape of this object is not published by the SonarQube API.

type JiraOrganizationBinding added in v2.2.0

type JiraOrganizationBinding map[string]any

JiraOrganizationBinding represents the binding between a SonarQube instance (or organization) and a Jira/Atlassian organization. The exact shape of this object is not published by the SonarQube API.

type JiraOrganizationBindingOptions added in v2.2.0

type JiraOrganizationBindingOptions struct {
	// SonarOrganizationUuid is the UUID of the Sonar organization/instance. This field is required.
	SonarOrganizationUuid string `json:"sonarOrganizationUuid"`
}

JiraOrganizationBindingOptions contains parameters identifying the Jira instance binding.

type JiraProject added in v2.2.0

type JiraProject map[string]any

JiraProject represents a Jira project available for binding. The exact shape of this object is not published by the SonarQube API.

type JiraProjectBinding added in v2.2.0

type JiraProjectBinding map[string]any

JiraProjectBinding represents the binding between a SonarQube project and a Jira project. The exact shape of this object is not published by the SonarQube API.

type JiraProjectBindingOptions added in v2.2.0

type JiraProjectBindingOptions struct {
	// SonarProjectId is the identifier of the Sonar project. This field is required.
	SonarProjectId string `json:"sonarProjectId"`
}

JiraProjectBindingOptions contains parameters identifying the Jira project binding of a SonarQube project.

type JiraProjectsOptions added in v2.2.0

type JiraProjectsOptions struct {
	// SonarOrganizationUuid is the UUID of the Sonar organization/instance. This field is required.
	SonarOrganizationUuid string `json:"sonarOrganizationUuid"`
}

JiraProjectsOptions contains parameters for listing the Jira projects available for binding.

type JiraService added in v2.2.0

type JiraService struct {
	// contains filtered or unexported fields
}

JiraService handles communication with the Jira integration related methods of the SonarQube V2 API. This service is only available in Enterprise Edition with the Jira integration feature enabled.

func (*JiraService) BindOrganizationBinding added in v2.2.0

func (s *JiraService) BindOrganizationBinding(ctx context.Context, body JiraOrganizationBinding) (*JiraOrganizationBinding, *http.Response, error)

BindOrganizationBinding binds the specified pending instance binding with the specified Jira cloud ID.

func (*JiraService) CreateOrganizationBinding added in v2.2.0

func (s *JiraService) CreateOrganizationBinding(ctx context.Context, body JiraOrganizationBinding) (*JiraOrganizationBinding, *http.Response, error)

CreateOrganizationBinding receives the 3LO state and authorization code parameters and attempts to create a Jira instance binding. If successful, returns the binding. Otherwise, returns a list of available resources. Requires the global administrator permission.

func (*JiraService) CreateProjectBinding added in v2.2.0

func (s *JiraService) CreateProjectBinding(ctx context.Context, body JiraProjectBinding) (*JiraProjectBinding, *http.Response, error)

CreateProjectBinding creates or updates a Jira project binding for a specific Sonar project. Accepts only authenticated requests.

func (*JiraService) CreateWorkItem added in v2.2.0

func (s *JiraService) CreateWorkItem(ctx context.Context, body JiraWorkItem) (*JiraWorkItem, *http.Response, error)

CreateWorkItem creates a Jira work item for a specific resource. Requires the issue administration permission.

func (*JiraService) DeleteOrganizationBinding added in v2.2.0

func (s *JiraService) DeleteOrganizationBinding(ctx context.Context, opt *JiraOrganizationBindingOptions) (*http.Response, error)

DeleteOrganizationBinding deletes the Jira instance binding from the database. Requires the global administrator permission.

func (*JiraService) DeleteProjectBinding added in v2.2.0

func (s *JiraService) DeleteProjectBinding(ctx context.Context, opt *JiraProjectBindingOptions) (*http.Response, error)

DeleteProjectBinding deletes the Jira project binding for a specific Sonar project. Accepts only authenticated requests.

func (*JiraService) DeleteWorkItems added in v2.2.0

func (s *JiraService) DeleteWorkItems(ctx context.Context, opt *JiraWorkItemsOptions) (*http.Response, error)

DeleteWorkItems deletes the Jira work items associated with a specific resource.

func (*JiraService) GetLinkedIssuesCount added in v2.2.0

func (s *JiraService) GetLinkedIssuesCount(ctx context.Context, sonarProjectID string) (*JiraLinkedIssuesCount, *http.Response, error)

GetLinkedIssuesCount counts the number of Jira issues linked to a specific Sonar project. Accepts only authenticated requests.

func (*JiraService) GetOrganizationBinding added in v2.2.0

GetOrganizationBinding fetches the Jira instance binding. Requires the global administrator permission.

func (*JiraService) GetProjectBinding added in v2.2.0

GetProjectBinding fetches the Jira project binding for a specific Sonar project. Accepts only authenticated requests.

func (*JiraService) GetProjects added in v2.2.0

func (s *JiraService) GetProjects(ctx context.Context, opt *JiraProjectsOptions) ([]JiraProject, *http.Response, error)

GetProjects returns a list of all the available Jira projects.

func (*JiraService) GetUserActions added in v2.2.0

func (s *JiraService) GetUserActions(ctx context.Context, opt *JiraUserActionsOptions) ([]string, *http.Response, error)

GetUserActions returns a list of available user actions for the authenticated user in the context of a specific project. If the user is not authenticated, returns an empty list.

func (*JiraService) GetWorkItems added in v2.2.0

GetWorkItems fetches the Jira work items for a specific Sonar project and resource. Accepts only authenticated requests.

func (*JiraService) GetWorkTypes added in v2.2.0

func (s *JiraService) GetWorkTypes(ctx context.Context, opt *JiraWorkTypesOptions) ([]JiraWorkType, *http.Response, error)

GetWorkTypes returns a list of all the available Jira work types for a specific Jira project. Also checks which work types are selected for a given Sonar project. Conditionally, also includes field metadata.

func (*JiraService) UpdateOrganizationBinding added in v2.2.0

func (s *JiraService) UpdateOrganizationBinding(ctx context.Context, body JiraOrganizationBinding) (*JiraOrganizationBinding, *http.Response, error)

UpdateOrganizationBinding updates properties of an existing Jira organization binding, such as token sharing configuration. Requires the global administrator permission.

func (*JiraService) UpdateProjectBinding added in v2.2.0

func (s *JiraService) UpdateProjectBinding(ctx context.Context, body JiraProjectBinding) (*JiraProjectBinding, *http.Response, error)

UpdateProjectBinding updates an existing Jira project binding for a specific Sonar project. Accepts only authenticated requests.

func (*JiraService) UpdateWorkTypes added in v2.2.0

func (s *JiraService) UpdateWorkTypes(ctx context.Context, body JiraWorkTypeSelection) (*http.Response, error)

UpdateWorkTypes receives a Jira project key and a list of work types and stores the selected work types for the project.

func (*JiraService) ValidateOrganizationBindingOpt added in v2.2.0

func (s *JiraService) ValidateOrganizationBindingOpt(opt *JiraOrganizationBindingOptions) error

ValidateOrganizationBindingOpt validates the JiraOrganizationBindingOptions.

func (*JiraService) ValidateProjectBindingOpt added in v2.2.0

func (s *JiraService) ValidateProjectBindingOpt(opt *JiraProjectBindingOptions) error

ValidateProjectBindingOpt validates the JiraProjectBindingOptions.

func (*JiraService) ValidateProjectsOpt added in v2.2.0

func (s *JiraService) ValidateProjectsOpt(opt *JiraProjectsOptions) error

ValidateProjectsOpt validates the JiraProjectsOptions.

func (*JiraService) ValidateUserActionsOpt added in v2.2.0

func (s *JiraService) ValidateUserActionsOpt(opt *JiraUserActionsOptions) error

ValidateUserActionsOpt validates the JiraUserActionsOptions.

func (*JiraService) ValidateWorkItemsOpt added in v2.2.0

func (s *JiraService) ValidateWorkItemsOpt(opt *JiraWorkItemsOptions) error

ValidateWorkItemsOpt validates the JiraWorkItemsOptions.

func (*JiraService) ValidateWorkTypesOpt added in v2.2.0

func (s *JiraService) ValidateWorkTypesOpt(opt *JiraWorkTypesOptions) error

ValidateWorkTypesOpt validates the JiraWorkTypesOptions.

type JiraUserActionsOptions added in v2.2.0

type JiraUserActionsOptions struct {
	// SonarProjectId is the identifier of the Sonar project. This field is required.
	SonarProjectId string `json:"sonarProjectId"`
}

JiraUserActionsOptions contains parameters for listing the Jira related user actions available for a project.

type JiraWorkItem added in v2.2.0

type JiraWorkItem map[string]any

JiraWorkItem represents a Jira work item linked to a SonarQube issue or dependency risk. The exact shape of this object is not published by the SonarQube API.

type JiraWorkItemsOptions added in v2.2.0

type JiraWorkItemsOptions struct {
	// SonarProjectId is the identifier of the Sonar project. This field is required.
	SonarProjectId string `json:"sonarProjectId"`
	// ResourceId is the identifier of the resource (Sonar issue or dependency risk). This field is required.
	ResourceId string `json:"resourceId"`
	// ResourceType is the type of the resource. This field is required.
	// Allowed values: SONAR_ISSUE, DEPENDENCY_RISK.
	ResourceType string `json:"resourceType"`
}

JiraWorkItemsOptions contains parameters identifying the Jira work items linked to a SonarQube resource.

type JiraWorkType added in v2.2.0

type JiraWorkType map[string]any

JiraWorkType represents a Jira work (issue) type available for a Jira project, optionally including field metadata. The exact shape of this object is not published by the SonarQube API.

type JiraWorkTypeSelection added in v2.2.0

type JiraWorkTypeSelection map[string]any

JiraWorkTypeSelection represents the payload used to save the Jira work types selected for a project. The exact shape of this object is not published by the SonarQube API.

type JiraWorkTypesOptions added in v2.2.0

type JiraWorkTypesOptions struct {
	// JiraProjectKey is the key of the Jira project. This field is required.
	JiraProjectKey string `json:"jiraProjectKey"`
	// SonarOrganizationUuid is the UUID of the Sonar organization/instance. This field is required.
	SonarOrganizationUuid string `json:"sonarOrganizationUuid"`
	// SonarProjectId is the identifier of the Sonar project, used to determine which work
	// types are already selected. Optional.
	SonarProjectId string `json:"sonarProjectId,omitempty"`
	// IncludeFields indicates whether field metadata should be included in the response. Optional.
	IncludeFields bool `json:"includeFields,omitempty"`
}

JiraWorkTypesOptions contains parameters for listing the Jira work types available for a Jira project.

type L10NIndex

type L10NIndex struct {
	// Locale is the locale used.
	Locale string `json:"locale,omitempty"`
	// EffectiveLocale is the locale actually resolved and used to return messages.
	EffectiveLocale string `json:"effectiveLocale,omitempty"`
	// Messages is a map of message keys to their localized values.
	Messages map[string]string `json:"messages,omitempty"`
}

L10NIndex represents the response from getting localization messages.

type L10NIndexOptions

type L10NIndexOptions struct {
	// Locale is the BCP47 language tag, used to override the browser Accept-Language header.
	Locale string `url:"locale,omitempty"`
	// Timestamp is the date of the last cache update.
	Timestamp string `url:"ts,omitempty"`
}

L10NIndexOptions contains parameters for the Index method.

type L10NService

type L10NService struct {
	// contains filtered or unexported fields
}

L10NService handles communication with the localization related methods of the SonarQube API. This service manages localization.

func (*L10NService) GetIndex

func (s *L10NService) GetIndex(ctx context.Context, opt *L10NIndexOptions) (*L10NIndex, *http.Response, error)

GetIndex gets all localization messages for a given locale.

API endpoint: GET /api/l10n/index. Warning: This API is internal and may change without notice.

func (*L10NService) ValidateGetIndexOpt

func (s *L10NService) ValidateGetIndexOpt(opt *L10NIndexOptions) error

ValidateGetIndexOpt validates the options for the GetIndex method.

type Language

type Language struct {
	// Key is the unique identifier for the language.
	Key string `json:"key,omitempty"`
	// Name is the display name of the language.
	Name string `json:"name,omitempty"`
}

Language represents a programming language supported by SonarQube.

type LanguagesList

type LanguagesList struct {
	// Languages is the list of supported programming languages.
	Languages []Language `json:"languages,omitempty"`
}

LanguagesList represents the response from the languages list endpoint.

type LanguagesListOptions

type LanguagesListOptions struct {
	// Query is a pattern to match language keys/names against.
	Query string `url:"q,omitempty"`
	// PageSize is the size of the list to return. Use 0 for all languages.
	// Default is 0.
	PageSize int64 `url:"ps,omitempty"`
}

LanguagesListOptions contains parameters for the List method.

type LanguagesService

type LanguagesService struct {
	// contains filtered or unexported fields
}

LanguagesService handles communication with the languages related methods of the SonarQube API. This service provides information about programming languages supported by SonarQube.

func (*LanguagesService) List

List returns the list of programming languages supported in this SonarQube instance.

API endpoint: GET /api/languages/list. Since: 5.1.

func (*LanguagesService) ValidateListOpt

func (s *LanguagesService) ValidateListOpt(opt *LanguagesListOptions) error

ValidateListOpt validates the options for the List method. Currently, there are no validation rules for this method, but this function is provided for consistency and future extensibility.

type License

type License struct {
	// ContactEmail is the contact email associated with the license.
	ContactEmail string `json:"contactEmail,omitempty"`
	// ExpiresAt is the license expiration date (ISO 8601 format).
	ExpiresAt string `json:"expiresAt,omitempty"`
	// IsExpired indicates whether the license has expired.
	IsExpired bool `json:"isExpired,omitempty"`
	// IsOfficialDistribution indicates whether the SonarQube instance is an
	// official distribution.
	IsOfficialDistribution bool `json:"isOfficialDistribution,omitempty"`
	// IsSupported indicates whether the license is currently valid and supported.
	IsSupported bool `json:"isSupported,omitempty"`
	// IsValidEdition indicates whether the license edition matches the running
	// SonarQube edition.
	IsValidEdition bool `json:"isValidEdition,omitempty"`
	// IsValidServerId indicates whether the license server ID matches the current
	// instance.
	IsValidServerId bool `json:"isValidServerId,omitempty"`
	// LOCsMax is the maximum number of lines of code allowed by the license.
	LOCsMax int64 `json:"locsMax,omitempty"`
	// LOCsRemaining is the number of lines of code remaining before the limit
	// is reached.
	LOCsRemaining int64 `json:"locsRemaining,omitempty"`
	// Organization is the name of the organization the license was issued to.
	Organization string `json:"organization,omitempty"`
	// ProductEdition is the SonarQube edition the license is for.
	ProductEdition string `json:"productEdition,omitempty"`
	// ServerId is the server ID the license is bound to.
	ServerId string `json:"serverId,omitempty"`
	// Type is the license type (e.g. PRODUCTION, EVALUATION).
	Type string `json:"type,omitempty"`
}

License represents a SonarQube Enterprise Edition license.

type LicenseFeatureV2 added in v2.2.0

type LicenseFeatureV2 struct {
	// Name is the name of the feature.
	Name string `json:"name,omitempty"`
	// Parent is the parent feature key, if any.
	Parent string `json:"parent,omitempty"`
	// StartDate is the date from which the feature is enabled.
	StartDate string `json:"startDate,omitempty"`
	// EndDate is the date until which the feature is enabled.
	EndDate string `json:"endDate,omitempty"`
}

LicenseFeatureV2 represents a feature covered by a SonarQube license.

type LicenseGet

type LicenseGet struct {
	// License contains the license details.
	License License `json:"license,omitzero"`
}

LicenseGet wraps the License response from the show_license endpoint.

type LicenseIsValid

type LicenseIsValid struct {
	// IsValid indicates whether the current license is valid.
	IsValid bool `json:"isValid,omitempty"`
}

LicenseIsValid wraps the response from the is_valid_license endpoint.

type LicenseSetOptions

type LicenseSetOptions struct {
	// License is the license key to activate. This field is required.
	License string `url:"license"`
}

LicenseSetOptions contains parameters for the Set method.

type LicenseV2 added in v2.2.0

type LicenseV2 struct {
	LicenseKey             string             `json:"licenseKey,omitempty"`
	LastRefreshDate        string             `json:"lastRefreshDate,omitempty"`
	Edition                string             `json:"edition,omitempty"`
	StartDate              string             `json:"startDate,omitempty"`
	ExpirationDate         string             `json:"expirationDate,omitempty"`
	GracePeriodEndDate     string             `json:"gracePeriodEndDate,omitempty"`
	ServerId               string             `json:"serverId,omitempty"`
	Type                   string             `json:"type,omitempty"`
	ContactEmail           string             `json:"contactEmail,omitempty"`
	Features               []LicenseFeatureV2 `json:"features,omitempty"`
	RemainingLocThreshold  int64              `json:"remainingLocThreshold,omitempty"`
	Loc                    int64              `json:"loc,omitempty"`
	MaxLoc                 int64              `json:"maxLoc,omitempty"`
	ExtraDays              int32              `json:"extraDays,omitempty"`
	GracePeriodExpired     bool               `json:"gracePeriodExpired,omitempty"`
	ActivatedOnline        bool               `json:"activatedOnline,omitempty"`
	CanActivateGracePeriod bool               `json:"canActivateGracePeriod,omitempty"`
	Supported              bool               `json:"supported,omitempty"`
	Expired                bool               `json:"expired,omitempty"`
	Legacy                 bool               `json:"legacy,omitempty"`
	ValidEdition           bool               `json:"validEdition,omitempty"`
	ValidServerId          bool               `json:"validServerId,omitempty"`
	OfficialDistribution   bool               `json:"officialDistribution,omitempty"`
	Disabled               bool               `json:"disabled,omitempty"`
}

LicenseV2 represents detailed information about the current SonarQube license.

type LoggingConfig

type LoggingConfig struct {
	// LogsDir is the directory where logs are stored.
	LogsDir string `json:"Logs Dir,omitempty"`
	// LogsLevel is the current log level.
	LogsLevel string `json:"Logs Level,omitempty"`
}

LoggingConfig contains logging configuration.

type MarketplaceAzureBillingV2

type MarketplaceAzureBillingV2 struct {
	// Message contains an informational message about the billing operation.
	Message string `json:"message,omitempty"`
	// Success indicates whether the billing operation was successful.
	Success bool `json:"success,omitempty"`
}

MarketplaceAzureBillingV2 represents the response from billing an Azure account.

type MarketplaceService

type MarketplaceService struct {
	// contains filtered or unexported fields
}

MarketplaceService handles communication with the Marketplace related methods of the SonarQube V2 API.

func (*MarketplaceService) BillAzureAccount

BillAzureAccount bills the user's Azure account with the cost of the SonarQube Server license. Used by admins.

type Measure

type Measure struct {
	// Period is the period measure value (deprecated).
	Period *MeasurePeriodValue `json:"period,omitempty"`
	// Metric is the metric key.
	Metric string `json:"metric,omitempty"`
	// Value is the measure value.
	Value string `json:"value,omitempty"`
	// BestValue indicates if this is the best possible value.
	BestValue bool `json:"bestValue,omitempty"`
}

Measure represents a single measure.

type MeasureComponent

type MeasureComponent struct {
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Description is the component description.
	Description string `json:"description,omitempty"`
	// Qualifier is the component qualifier.
	Qualifier string `json:"qualifier,omitempty"`
	// Path is the path within the project.
	Path string `json:"path,omitempty"`
	// Language is the programming language.
	Language string `json:"language,omitempty"`
	// Measures is the list of measures for this component.
	Measures []Measure `json:"measures,omitempty"`
}

MeasureComponent represents a component with its measures.

type MeasureHistory

type MeasureHistory struct {
	// Metric is the metric key.
	Metric string `json:"metric,omitempty"`
	// History is the list of historical values.
	History []MeasureHistoryValue `json:"history,omitempty"`
}

MeasureHistory represents a measure with its history.

type MeasureHistoryValue

type MeasureHistoryValue struct {
	// Date is the date of the measure.
	Date string `json:"date,omitempty"`
	// Value is the measure value at that date.
	Value string `json:"value,omitempty"`
}

MeasureHistoryValue represents a historical measure value.

type MeasureMetric

type MeasureMetric struct {
	// Key is the unique metric key.
	Key string `json:"key,omitempty"`
	// Name is the display name.
	Name string `json:"name,omitempty"`
	// Description is the metric description.
	Description string `json:"description,omitempty"`
	// Domain is the metric domain.
	Domain string `json:"domain,omitempty"`
	// Type is the metric type.
	Type string `json:"type,omitempty"`
	// HigherValuesAreBetter indicates if higher values are better.
	HigherValuesAreBetter bool `json:"higherValuesAreBetter,omitempty"`
	// Qualitative indicates if the metric is qualitative.
	Qualitative bool `json:"qualitative,omitempty"`
	// Hidden indicates if the metric is hidden.
	Hidden bool `json:"hidden,omitempty"`
	// DecimalScale is the number of decimal places.
	DecimalScale int64 `json:"decimalScale,omitempty"`
	// BestValue is the best possible value.
	BestValue string `json:"bestValue,omitempty"`
	// WorstValue is the worst possible value.
	WorstValue string `json:"worstValue,omitempty"`
}

MeasureMetric represents a metric definition.

type MeasurePeriod

type MeasurePeriod struct {
	// Mode is the period mode.
	Mode string `json:"mode,omitempty"`
	// Date is the period date.
	Date string `json:"date,omitempty"`
	// Parameter is the period parameter (e.g., branch name, days).
	Parameter string `json:"parameter,omitempty"`
}

MeasurePeriod represents a period definition.

type MeasurePeriodValue

type MeasurePeriodValue struct {
	// Value is the measure value for this period.
	Value string `json:"value,omitempty"`
	// BestValue indicates if this is the best possible value.
	BestValue bool `json:"bestValue,omitempty"`
}

MeasurePeriodValue represents a measure value for a period.

type MeasureSearchResult

type MeasureSearchResult struct {
	// Component is the component key.
	Component string `json:"component,omitempty"`
	// Metric is the metric key.
	Metric string `json:"metric,omitempty"`
	// Value is the measure value.
	Value string `json:"value,omitempty"`
	// BestValue indicates if this is the best possible value.
	BestValue bool `json:"bestValue,omitempty"`
}

MeasureSearchResult represents a measure search result.

type MeasuresComponent

type MeasuresComponent struct {
	// Component is the component with its measures.
	Component MeasureComponent `json:"component,omitzero"`
	// Metrics is the list of metrics definitions.
	Metrics []MeasureMetric `json:"metrics,omitempty"`
	// Period is the period definition.
	Period *MeasurePeriod `json:"period,omitempty"`
}

MeasuresComponent represents the response from getting component measures.

type MeasuresComponentOptions

type MeasuresComponentOptions struct {
	// Component is the component key (required).
	Component string `url:"component,omitempty"`
	// MetricKeys is the list of metric keys to fetch (required).
	MetricKeys []string `url:"metricKeys,omitempty,comma"`
	// AdditionalFields is the list of additional fields to return (optional).
	// Possible values: metrics, period, periods.
	AdditionalFields []string `url:"additionalFields,omitempty,comma"`
	// Branch is the branch key (optional).
	Branch string `url:"branch,omitempty"`
	// PullRequest is the pull request identifier (optional).
	PullRequest string `url:"pullRequest,omitempty"`
}

MeasuresComponentOptions represents options for getting component measures.

type MeasuresComponentTree

type MeasuresComponentTree struct {
	// BaseComponent is the base component from which the tree is computed.
	BaseComponent MeasureComponent `json:"baseComponent,omitzero"`
	// Paging is the pagination info.
	Paging Paging `json:"paging,omitzero"`
	// Components is the list of components with their measures.
	Components []MeasureComponent `json:"components,omitempty"`
	// Metrics is the list of metrics definitions.
	Metrics []MeasureMetric `json:"metrics,omitempty"`
	// Period is the period definition.
	Period *MeasurePeriod `json:"period,omitempty"`
}

MeasuresComponentTree represents the response from getting component tree measures.

type MeasuresComponentTreeOptions

type MeasuresComponentTreeOptions struct {
	PaginationArgs

	// Component is the base component key (required).
	Component string `url:"component,omitempty"`
	// MetricKeys is the list of metric keys to fetch (required).
	MetricKeys []string `url:"metricKeys,omitempty,comma"`
	// AdditionalFields is the list of additional fields to return (optional).
	// Possible values: metrics, period, periods.
	AdditionalFields []string `url:"additionalFields,omitempty,comma"`
	// Asc indicates ascending sort when true, descending when false (optional).
	Asc bool `url:"asc,omitempty"`
	// Branch is the branch key (optional).
	Branch string `url:"branch,omitempty"`
	// MetricPeriodSort is the period to use for metric sorting (optional).
	MetricPeriodSort int64 `url:"metricPeriodSort,omitempty"`
	// MetricSort is the metric key to use for sorting (optional).
	MetricSort string `url:"metricSort,omitempty"`
	// MetricSortFilter specifies which components to sort (optional).
	// Possible values: all, withMeasuresOnly.
	MetricSortFilter string `url:"metricSortFilter,omitempty"`
	// PullRequest is the pull request identifier (optional).
	PullRequest string `url:"pullRequest,omitempty"`
	// Qualifiers filters by component qualifiers (optional).
	// Possible values: BRC, DIR, FIL, TRK, UTS.
	Qualifiers []string `url:"qualifiers,omitempty,comma"`
	// Query is used to filter components by name (optional).
	Query string `url:"q,omitempty"`
	// Sort is the list of sort fields (optional).
	// Possible values: metric, metricPeriod, name, path, qualifier.
	Sort []string `url:"s,omitempty,comma"`
	// Strategy specifies how to traverse the tree (optional).
	// Possible values: all, children, leaves.
	Strategy string `url:"strategy,omitempty"`
}

MeasuresComponentTreeOptions represents options for getting component tree measures.

type MeasuresSearch

type MeasuresSearch struct {
	// Measures is the list of measures.
	Measures []MeasureSearchResult `json:"measures,omitempty"`
}

MeasuresSearch represents the response from searching measures.

type MeasuresSearchHistory

type MeasuresSearchHistory struct {
	// Measures is the list of measures with their history.
	Measures []MeasureHistory `json:"measures,omitempty"`
	// Paging is the pagination info.
	Paging Paging `json:"paging,omitzero"`
}

MeasuresSearchHistory represents the response from getting measures history.

type MeasuresSearchHistoryOptions

type MeasuresSearchHistoryOptions struct {
	PaginationArgs

	// Component is the component key (required).
	Component string `url:"component,omitempty"`
	// Metrics is the list of metric keys (required).
	Metrics []string `url:"metrics,omitempty,comma"`
	// Branch is the branch key (optional).
	Branch string `url:"branch,omitempty"`
	// From is the start date filter (optional).
	// Format: YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ.
	From string `url:"from,omitempty"`
	// PullRequest is the pull request identifier (optional).
	PullRequest string `url:"pullRequest,omitempty"`
	// To is the end date filter (optional).
	// Format: YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ.
	To string `url:"to,omitempty"`
}

MeasuresSearchHistoryOptions represents options for getting measures history.

type MeasuresSearchOptions

type MeasuresSearchOptions struct {
	// MetricKeys is the list of metric keys to fetch (required).
	MetricKeys []string `url:"metricKeys,omitempty,comma"`
	// ProjectKeys is the list of project keys (required).
	ProjectKeys []string `url:"projectKeys,omitempty,comma"`
}

MeasuresSearchOptions represents options for searching measures.

type MeasuresService

type MeasuresService struct {
	// contains filtered or unexported fields
}

MeasuresService handles communication with the Measures related methods of the SonarQube API. Get components or children with specified measures.

Since: 5.4.

func (*MeasuresService) Component

Component returns measures for a component. Requires the following permission: 'Browse' on the project of specified component.

Since: 5.4.

func (*MeasuresService) ComponentTree

ComponentTree returns measures for a component tree. Navigate through components based on the chosen strategy with specified measures. Requires the following permission: 'Browse' on the specified project. When limiting search with the q parameter, directories are not returned.

Since: 5.4.

func (*MeasuresService) Search

Search returns the measures for multiple projects. Requires 'Browse' permission on the projects. At most 100 projects can be provided.

Since: 6.2.

func (*MeasuresService) SearchHistory

SearchHistory returns the history of measures for a component. Pagination is available for the last 1000 analyses. Requires the following permission: 'Browse' on the specified component.

Since: 6.3.

func (*MeasuresService) ValidateComponentOpt

func (s *MeasuresService) ValidateComponentOpt(opt *MeasuresComponentOptions) error

ValidateComponentOpt validates the options for Component.

func (*MeasuresService) ValidateComponentTreeOpt

func (s *MeasuresService) ValidateComponentTreeOpt(opt *MeasuresComponentTreeOptions) error

ValidateComponentTreeOpt validates the options for ComponentTree.

func (*MeasuresService) ValidateSearchHistoryOpt

func (s *MeasuresService) ValidateSearchHistoryOpt(opt *MeasuresSearchHistoryOptions) error

ValidateSearchHistoryOpt validates the options for SearchHistory.

func (*MeasuresService) ValidateSearchOpt

func (s *MeasuresService) ValidateSearchOpt(opt *MeasuresSearchOptions) error

ValidateSearchOpt validates the options for Search.

type MessageFormatting

type MessageFormatting struct {
	// Start is the starting position of the formatting.
	Start int64 `json:"start,omitempty"`
	// End is the ending position of the formatting.
	End int64 `json:"end,omitempty"`
	// Type is the type of formatting (CODE, etc.).
	Type string `json:"type,omitempty"`
}

MessageFormatting represents a formatting rule for messages.

type Metric

type Metric struct {
	// Custom indicates whether this is a custom metric.
	Custom bool `json:"custom,omitempty"`
	// DecimalScale is the number of decimal places to display for this metric.
	DecimalScale int64 `json:"decimalScale,omitempty"`
	// Description is the metric description.
	Description string `json:"description,omitempty"`
	// Direction indicates the metric direction (-1: lower is better, 0: neutral, 1: higher is better).
	Direction int64 `json:"direction,omitempty"`
	// Domain is the metric domain.
	Domain string `json:"domain,omitempty"`
	// Hidden indicates whether the metric is hidden.
	Hidden bool `json:"hidden,omitempty"`
	// ID is the metric identifier.
	ID string `json:"id,omitempty"`
	// Key is the metric key.
	Key string `json:"key,omitempty"`
	// Name is the metric display name.
	Name string `json:"name,omitempty"`
	// Qualitative indicates whether the metric is qualitative.
	Qualitative bool `json:"qualitative,omitempty"`
	// Type is the metric value type.
	Type string `json:"type,omitempty"`
}

Metric represents a SonarQube metric.

type MetricsSearch

type MetricsSearch struct {
	// Metrics is the list of metrics found.
	Metrics []Metric `json:"metrics,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Page is the current page number (legacy duplicate of Paging.PageIndex).
	Page int64 `json:"p,omitempty"`
	// PageSize is the page size (legacy duplicate of Paging.PageSize).
	PageSize int64 `json:"ps,omitempty"`
	// Total is the total number of metrics (legacy duplicate of Paging.Total).
	Total int64 `json:"total,omitempty"`
}

MetricsSearch represents the response from searching metrics.

type MetricsSearchOptions

type MetricsSearchOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`
}

MetricsSearchOptions contains parameters for the Search method.

type MetricsService

type MetricsService struct {
	// contains filtered or unexported fields
}

MetricsService handles communication with the metrics related methods of the SonarQube API. This service provides information about metrics.

func (*MetricsService) Search

Search searches for metrics.

API endpoint: GET /api/metrics/search. Since: 2.6.

func (*MetricsService) SearchAll

SearchAll fetches all pages from Search and returns a flat slice of metrics.

func (*MetricsService) Types

Types lists all available metric types.

API endpoint: GET /api/metrics/types. Since: 2.6.

func (*MetricsService) ValidateSearchOpt

func (s *MetricsService) ValidateSearchOpt(opt *MetricsSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

type MetricsTypes

type MetricsTypes struct {
	// Types is the list of available metric types.
	Types []string `json:"types,omitempty"`
}

MetricsTypes represents the response from listing metric types.

type Middleware

type Middleware func(http.RoundTripper) http.RoundTripper

Middleware is a function that wraps an http.RoundTripper. Use WithMiddleware to attach middleware to the client transport chain.

type MonitoringActiveAlerts added in v2.2.0

type MonitoringActiveAlerts struct {
	// Alerts is the list of currently active admin alerts.
	Alerts []MonitoringAlert `json:"alerts,omitempty"`
}

MonitoringActiveAlerts represents the response from listing active admin alerts.

type MonitoringAlert added in v2.2.0

type MonitoringAlert struct {
	// Key is the unique identifier of the alert.
	Key string `json:"key,omitempty"`
	// Message is a human-readable message describing the alert condition shown to administrators.
	Message string `json:"message,omitempty"`
	// ActiveSince is the timestamp the alert was first triggered, in ISO-8601 format.
	ActiveSince string `json:"activeSince,omitempty"`
}

MonitoringAlert represents a single admin alert whose condition is currently active.

type MonitoringService

type MonitoringService struct {
	// contains filtered or unexported fields
}

MonitoringService handles communication with the monitoring related methods of the SonarQube API. This service provides monitoring metrics in Prometheus format.

func (*MonitoringService) Metrics

func (s *MonitoringService) Metrics(ctx context.Context) (*string, *http.Response, error)

Metrics returns monitoring metrics in Prometheus format. Supports content type 'text/plain' (default) and 'application/openmetrics-text'. This endpoint can be accessed using a Bearer token, which needs to be defined in sonar.properties with the 'sonar.web.systemPasscode' key.

API endpoint: GET /api/monitoring/metrics. Since: 9.3.

type MonitoringServiceV2 added in v2.2.0

type MonitoringServiceV2 struct {
	// contains filtered or unexported fields
}

MonitoringServiceV2 handles communication with the monitoring V2 API endpoints. This service is only available in Enterprise Edition. The underlying endpoint is marked internal by SonarQube (x-sonar-internal) and its request/response contract may change without notice between SonarQube versions.

func (*MonitoringServiceV2) GetActiveAlerts added in v2.2.0

GetActiveAlerts returns the list of admin alerts whose condition is currently active. Each entry contains the alert identifier and a message describing the condition. Requires 'Administer System' permission.

API endpoint: GET /api/v2/monitoring/alerts. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

type MyProject

type MyProject struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
	// Description is the project description.
	Description string `json:"description,omitempty"`
	// LastAnalysisDate is the date of the last analysis.
	LastAnalysisDate string `json:"lastAnalysisDate,omitempty"`
	// QualityGate is the project's quality gate status.
	QualityGate string `json:"qualityGate,omitempty"`
	// Links is the list of project links.
	Links []MyProjectLink `json:"links,omitempty"`
}

MyProject represents a user's project.

type MyProjectLink struct {
	// Name is the link name.
	Name string `json:"name,omitempty"`
	// Type is the link type.
	Type string `json:"type,omitempty"`
	// Href is the link URL.
	Href string `json:"href,omitempty"`
}

MyProjectLink represents a project link in my projects search.

type NavigationBreadcrumb struct {
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// Qualifier is the component qualifier.
	Qualifier string `json:"qualifier,omitempty"`
}

NavigationBreadcrumb represents a breadcrumb item in navigation.

type NavigationComponent struct {
	// AnalysisDate is the date of the last analysis.
	AnalysisDate string `json:"analysisDate,omitempty"`
	// Branch is the branch name of the component.
	Branch string `json:"branch,omitempty"`
	// Breadcrumbs is the list of breadcrumb items for the component.
	Breadcrumbs []NavigationBreadcrumb `json:"breadcrumbs,omitempty"`
	// CanBrowseAllChildProjects indicates if user can browse all child projects.
	CanBrowseAllChildProjects bool `json:"canBrowseAllChildProjects,omitempty"`
	// Configuration contains the component configuration.
	Configuration NavigationConfiguration `json:"configuration,omitzero"`
	// Description is the component description.
	Description string `json:"description,omitempty"`
	// Extensions is the list of available extensions.
	Extensions []NavigationExtension `json:"extensions,omitempty"`
	// ID is the component ID.
	ID string `json:"id,omitempty"`
	// IsFavorite indicates if the component is a favorite.
	IsFavorite bool `json:"isFavorite,omitempty"`
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// Name is the component name.
	Name string `json:"name,omitempty"`
	// QualityGate contains the quality gate information.
	QualityGate NavigationQualityGate `json:"qualityGate,omitzero"`
	// QualityProfiles is the list of quality profiles.
	QualityProfiles []NavigationQualityProfile `json:"qualityProfiles,omitempty"`
	// Version is the component version.
	Version string `json:"version,omitempty"`
	// Visibility is the visibility of the component (public or private).
	Visibility string `json:"visibility,omitempty"`
}

NavigationComponent represents the response from getting component navigation info.

type NavigationComponentOptions struct {
	// Branch is the branch key (optional).
	Branch string `url:"branch,omitempty"`
	// Component is the component key (optional).
	Component string `url:"component,omitempty"`
	// PullRequest is the pull request ID (optional).
	PullRequest string `url:"pullRequest,omitempty"`
}

NavigationComponentOptions represents options for getting component navigation.

type NavigationConfiguration struct {
	// CanAdminArchitecture indicates if the user can administer the architecture feature.
	CanAdminArchitecture bool `json:"canAdminArchitecture,omitempty"`
	// CanApplyPermissionTemplate indicates if the user can apply a permission template to the project.
	CanApplyPermissionTemplate bool `json:"canApplyPermissionTemplate,omitempty"`
	// CanBrowseProject indicates if user can browse the project.
	CanBrowseProject bool `json:"canBrowseProject,omitempty"`
	// CanUpdateProjectVisibilityToPrivate indicates if the user can change the project visibility to private.
	CanUpdateProjectVisibilityToPrivate bool `json:"canUpdateProjectVisibilityToPrivate,omitempty"`
	// Extensions is the list of configuration extensions.
	Extensions []NavigationExtension `json:"extensions,omitempty"`
	// ShowBackgroundTasks indicates if background tasks should be shown.
	ShowBackgroundTasks bool `json:"showBackgroundTasks,omitempty"`
	// ShowHistory indicates if history should be shown.
	ShowHistory bool `json:"showHistory,omitempty"`
	// ShowLinks indicates if links should be shown.
	ShowLinks bool `json:"showLinks,omitempty"`
	// ShowPermissions indicates if permissions should be shown.
	ShowPermissions bool `json:"showPermissions,omitempty"`
	// ShowQualityGates indicates if quality gates should be shown.
	ShowQualityGates bool `json:"showQualityGates,omitempty"`
	// ShowQualityProfiles indicates if quality profiles should be shown.
	ShowQualityProfiles bool `json:"showQualityProfiles,omitempty"`
	// ShowSettings indicates if settings should be shown.
	ShowSettings bool `json:"showSettings,omitempty"`
	// ShowUpdateKey indicates if update key option should be shown.
	ShowUpdateKey bool `json:"showUpdateKey,omitempty"`
}

NavigationConfiguration represents navigation configuration options.

type NavigationExtension struct {
	// Key is the extension key.
	Key string `json:"key,omitempty"`
	// Name is the extension name.
	Name string `json:"name,omitempty"`
}

NavigationExtension represents a navigation extension.

type NavigationGlobal struct {
	// CanAdmin indicates if user has admin permissions.
	CanAdmin bool `json:"canAdmin,omitempty"`
	// DocumentationURL is the URL to the documentation.
	DocumentationURL string `json:"documentationUrl,omitempty"`
	// Edition is the SonarQube edition.
	Edition string `json:"edition,omitempty"`
	// GlobalPages is the list of global pages.
	GlobalPages []NavigationExtension `json:"globalPages,omitempty"`
	// InstanceUsesDefaultAdminCredentials indicates if the instance still uses the default admin credentials.
	InstanceUsesDefaultAdminCredentials bool `json:"instanceUsesDefaultAdminCredentials,omitempty"`
	// LogoURL is the URL to the logo.
	LogoURL string `json:"logoUrl,omitempty"`
	// LogoWidth is the logo width.
	LogoWidth string `json:"logoWidth,omitempty"`
	// NeedIssueSync indicates if issue synchronization is needed.
	NeedIssueSync bool `json:"needIssueSync,omitempty"`
	// ProductionDatabase indicates if this is a production database.
	ProductionDatabase bool `json:"productionDatabase,omitempty"`
	// Qualifiers is the list of supported qualifiers.
	Qualifiers []string `json:"qualifiers,omitempty"`
	// Settings contains global settings.
	Settings NavigationGlobalSettings `json:"settings,omitzero"`
	// Standalone indicates if running in standalone mode.
	Standalone bool `json:"standalone,omitempty"`
	// Version is the SonarQube version.
	Version string `json:"version,omitempty"`
	// VersionEOL is the end of life date for the installed version.
	VersionEOL string `json:"versionEOL,omitempty"`
}

NavigationGlobal represents the response from getting global navigation info.

type NavigationGlobalSettings struct {
	// DeveloperAggregatedInfoDisabled indicates if developer aggregated info is disabled.
	DeveloperAggregatedInfoDisabled string `json:"sonar.developerAggregatedInfo.disabled,omitempty"`
	// EnableGravatar indicates if Gravatar is enabled.
	EnableGravatar string `json:"sonar.lf.enableGravatar,omitempty"`
	// GravatarServerURL is the Gravatar server URL.
	GravatarServerURL string `json:"sonar.lf.gravatarServerUrl,omitempty"`
	// LogoURL is the custom logo URL.
	LogoURL string `json:"sonar.lf.logoUrl,omitempty"`
	// LogoWidthPx is the logo width in pixels.
	LogoWidthPx string `json:"sonar.lf.logoWidthPx,omitempty"`
	// TechnicalDebtRatingGrid is the technical debt rating grid.
	TechnicalDebtRatingGrid string `json:"sonar.technicalDebt.ratingGrid,omitempty"`
	// UpdateCenterActivate indicates if update center is activated.
	UpdateCenterActivate string `json:"sonar.updatecenter.activate,omitempty"`
}

NavigationGlobalSettings represents global navigation settings.

type NavigationMarketplace struct {
	// Ncloc is the total number of lines of code.
	Ncloc int64 `json:"ncloc,omitempty"`
	// ServerID is the server identifier.
	ServerID string `json:"serverId,omitempty"`
}

NavigationMarketplace represents the response from getting marketplace info.

type NavigationQualityGate struct {
	// IsDefault indicates if this is the default quality gate.
	IsDefault bool `json:"isDefault,omitempty"`
	// Key is the quality gate key.
	Key string `json:"key,omitempty"`
	// Name is the quality gate name.
	Name string `json:"name,omitempty"`
}

NavigationQualityGate represents quality gate navigation info.

type NavigationQualityProfile struct {
	// Key is the quality profile key.
	Key string `json:"key,omitempty"`
	// Language is the programming language.
	Language string `json:"language,omitempty"`
	// Name is the quality profile name.
	Name string `json:"name,omitempty"`
}

NavigationQualityProfile represents quality profile navigation info.

type NavigationService struct {
	// contains filtered or unexported fields
}

NavigationService handles communication with the navigation related methods of the SonarQube API. This service provides information required to build navigation UI components.

Since: 5.2.

Component returns navigation information for a component. Requires the 'Browse' permission on the component's project. For applications, it also requires 'Browse' permission on its child projects.

API endpoint: GET /api/navigation/component. Since: 5.2. Internal: true.

Global returns global navigation information for the current user.

API endpoint: GET /api/navigation/global. Since: 5.2. Internal: true.

Marketplace provides data to prefill license request forms. Returns the server ID and the total number of lines of code.

API endpoint: GET /api/navigation/marketplace. Since: 7.2. Internal: true.

Settings returns configuration information for the settings page. This includes plugin-contributed pages and whether to show update center.

API endpoint: GET /api/navigation/settings. Since: 5.2. Internal: true.

func (s *NavigationService) ValidateComponentOpt(opt *NavigationComponentOptions) error

ValidateComponentOpt validates the options for the Component method.

type NavigationSettings struct {
	// Extensions is the list of settings extensions.
	Extensions []NavigationSettingsExtension `json:"extensions,omitempty"`
	// ShowUpdateCenter indicates if update center should be shown.
	ShowUpdateCenter bool `json:"showUpdateCenter,omitempty"`
}

NavigationSettings represents the response from getting settings navigation.

type NavigationSettingsExtension struct {
	// Key is the extension key.
	Key string `json:"key,omitempty"`
	// Name is the extension name.
	Name string `json:"name,omitempty"`
	// URL is the extension URL.
	URL string `json:"url,omitempty"`
}

NavigationSettingsExtension represents a settings extension.

type NewCodePeriod

type NewCodePeriod struct {
	// BranchKey is the branch key.
	BranchKey string `json:"branchKey,omitempty"`
	// EffectiveValue is the effective value of the new code period.
	EffectiveValue string `json:"effectiveValue,omitempty"`
	// Inherited indicates whether the value is inherited from a parent.
	Inherited bool `json:"inherited,omitempty"`
	// ProjectKey is the project key.
	ProjectKey string `json:"projectKey,omitempty"`
	// Type is the type of the new code period.
	Type string `json:"type,omitempty"`
	// Value is the value of the new code period.
	Value string `json:"value,omitempty"`
	// UpdatedAt is the timestamp (Unix epoch milliseconds) of the last update of this new code period.
	UpdatedAt int64 `json:"updatedAt,omitempty"`
}

NewCodePeriod represents a new code period definition.

type NewCodePeriodsList

type NewCodePeriodsList struct {
	// NewCodePeriods is the list of new code periods.
	NewCodePeriods []NewCodePeriod `json:"newCodePeriods,omitempty"`
}

NewCodePeriodsList represents the response from listing new code periods.

type NewCodePeriodsListOptions

type NewCodePeriodsListOptions struct {
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
}

NewCodePeriodsListOptions contains parameters for the List method.

type NewCodePeriodsService

type NewCodePeriodsService struct {
	// contains filtered or unexported fields
}

NewCodePeriodsService handles communication with the new code periods related methods of the SonarQube API. This service manages new code definitions.

func (*NewCodePeriodsService) List

List lists the new code definition for all branches in a project. Requires the permission to browse the project.

API endpoint: GET /api/new_code_periods/list. Since: 8.0.

func (*NewCodePeriodsService) Set

Set updates the new code definition on different levels:

  • Not providing a project key and a branch key will update the default value at global level
  • Project key must be provided to update the value for a project
  • Both project and branch keys must be provided to update the value for a branch

Requires one of the following permissions:

  • 'Administer System' to change the global setting
  • 'Administer' rights on the specified project to change the project setting

API endpoint: POST /api/new_code_periods/set. Since: 8.0.

func (*NewCodePeriodsService) Show

Show shows the new code definition. If the component requested doesn't exist or if no new code definition is set for it, a value is inherited from the project or from the global setting.

Requires one of the following permissions if a component is specified:

  • 'Administer' rights on the specified component
  • 'Execute analysis' rights on the specified component

API endpoint: GET /api/new_code_periods/show. Since: 8.0.

func (*NewCodePeriodsService) Unset

Unset unsets the new code definition for a branch, project or global. It requires the inherited New Code Definition to be compatible with the Clean as You Code methodology.

Requires one of the following permissions:

  • 'Administer System' to change the global setting
  • 'Administer' rights for a specified component

API endpoint: POST /api/new_code_periods/unset. Since: 8.0.

func (*NewCodePeriodsService) ValidateListOpt

func (s *NewCodePeriodsService) ValidateListOpt(opt *NewCodePeriodsListOptions) error

ValidateListOpt validates the options for the List method.

func (*NewCodePeriodsService) ValidateSetOpt

func (s *NewCodePeriodsService) ValidateSetOpt(opt *NewCodePeriodsSetOptions) error

ValidateSetOpt validates the options for the Set method.

func (*NewCodePeriodsService) ValidateShowOpt

func (s *NewCodePeriodsService) ValidateShowOpt(opt *NewCodePeriodsShowOptions) error

ValidateShowOpt validates the options for the Show method.

func (*NewCodePeriodsService) ValidateUnsetOpt

func (s *NewCodePeriodsService) ValidateUnsetOpt(opt *NewCodePeriodsUnsetOptions) error

ValidateUnsetOpt validates the options for the Unset method.

type NewCodePeriodsSetOptions

type NewCodePeriodsSetOptions struct {
	// Branch is the branch key.
	Branch string `url:"branch,omitempty"`
	// Project is the project key.
	Project string `url:"project,omitempty"`
	// Type is the new code period type.
	// This field is required.
	// Allowed values: SPECIFIC_ANALYSIS, PREVIOUS_VERSION, NUMBER_OF_DAYS, REFERENCE_BRANCH.
	// - SPECIFIC_ANALYSIS: can be set at branch level only
	// - PREVIOUS_VERSION: can be set at any level (global, project, branch)
	// - NUMBER_OF_DAYS: can be set at any level (global, project, branch)
	// - REFERENCE_BRANCH: can only be set for projects and branches
	Type string `url:"type"`
	// Value is the new code period value.
	// For SPECIFIC_ANALYSIS: the uuid of an analysis
	// For PREVIOUS_VERSION: no value
	// For NUMBER_OF_DAYS: a number between 1 and 90
	// For REFERENCE_BRANCH: a string (branch name)
	Value string `url:"value,omitempty"`
}

NewCodePeriodsSetOptions contains parameters for the Set method.

type NewCodePeriodsShow

type NewCodePeriodsShow struct {
	// BranchKey is the branch key.
	BranchKey string `json:"branchKey,omitempty"`
	// Inherited indicates whether the value is inherited from a parent.
	Inherited bool `json:"inherited,omitempty"`
	// ProjectKey is the project key.
	ProjectKey string `json:"projectKey,omitempty"`
	// Type is the type of the new code period.
	Type string `json:"type,omitempty"`
	// Value is the value of the new code period.
	Value string `json:"value,omitempty"`
	// UpdatedAt is the timestamp (Unix epoch milliseconds) of the last update of this new code period.
	UpdatedAt int64 `json:"updatedAt,omitempty"`
}

NewCodePeriodsShow represents the response from showing a new code period.

type NewCodePeriodsShowOptions

type NewCodePeriodsShowOptions struct {
	// Branch is the branch key.
	Branch string `url:"branch,omitempty"`
	// Project is the project key.
	Project string `url:"project,omitempty"`
}

NewCodePeriodsShowOptions contains parameters for the Show method.

type NewCodePeriodsUnsetOptions

type NewCodePeriodsUnsetOptions struct {
	// Branch is the branch key.
	Branch string `url:"branch,omitempty"`
	// Project is the project key.
	Project string `url:"project,omitempty"`
}

NewCodePeriodsUnsetOptions contains parameters for the Unset method.

type Notification

type Notification struct {
	// Channel is the notification channel (e.g., email).
	Channel string `json:"channel,omitempty"`
	// Organization is the organization key (deprecated).
	Organization string `json:"organization,omitempty"`
	// Project is the project key.
	Project string `json:"project,omitempty"`
	// ProjectName is the project name.
	ProjectName string `json:"projectName,omitempty"`
	// Type is the notification type.
	Type string `json:"type,omitempty"`
}

Notification represents a configured notification.

type NotificationsAddOptions

type NotificationsAddOptions struct {
	// Channel is the channel through which the notification is sent.
	// Default is email.
	Channel string `url:"channel,omitempty"`
	// Login is the user login. If not provided, the authenticated user is used.
	Login string `url:"login,omitempty"`
	// Project is the project key for per-project notifications.
	Project string `url:"project,omitempty"`
	// Type is the notification type.
	// This field is required.
	Type string `url:"type"`
}

NotificationsAddOptions contains parameters for the Add method.

type NotificationsList

type NotificationsList struct {
	// Channels is the list of available notification channels.
	Channels []string `json:"channels,omitempty"`
	// GlobalTypes is the list of global notification types.
	GlobalTypes []string `json:"globalTypes,omitempty"`
	// Notifications is the list of configured notifications.
	Notifications []Notification `json:"notifications,omitempty"`
	// PerProjectTypes is the list of per-project notification types.
	PerProjectTypes []string `json:"perProjectTypes,omitempty"`
}

NotificationsList represents the response from listing notifications.

type NotificationsListOptions

type NotificationsListOptions struct {
	// Login is the user login. If not provided, the authenticated user is used.
	Login string `url:"login,omitempty"`
}

NotificationsListOptions contains parameters for the List method.

type NotificationsRemoveOptions

type NotificationsRemoveOptions struct {
	// Channel is the channel through which the notification is sent.
	// Default is email.
	Channel string `url:"channel,omitempty"`
	// Login is the user login. If not provided, the authenticated user is used.
	Login string `url:"login,omitempty"`
	// Project is the project key for per-project notifications.
	Project string `url:"project,omitempty"`
	// Type is the notification type.
	// This field is required.
	Type string `url:"type"`
}

NotificationsRemoveOptions contains parameters for the Remove method.

type NotificationsService

type NotificationsService struct {
	// contains filtered or unexported fields
}

NotificationsService handles communication with the notifications related methods of the SonarQube API. This service manages notifications for the authenticated user.

func (*NotificationsService) Add

Add adds a notification for the authenticated user. Requires authentication if no login is provided. Requires system administration if a login is provided. If a project is provided, requires the 'Browse' permission on the specified project.

API endpoint: POST /api/notifications/add. Since: 6.3.

func (*NotificationsService) List

List lists notifications of the authenticated user. Requires authentication if no login is provided. Requires system administration if a login is provided.

API endpoint: GET /api/notifications/list. Since: 6.3.

func (*NotificationsService) Remove

Remove removes a notification for the authenticated user. Requires authentication if no login is provided. Requires system administration if a login is provided.

API endpoint: POST /api/notifications/remove. Since: 6.3.

func (*NotificationsService) ValidateAddOpt

func (s *NotificationsService) ValidateAddOpt(opt *NotificationsAddOptions) error

ValidateAddOpt validates the options for the Add method.

func (*NotificationsService) ValidateListOpt

func (s *NotificationsService) ValidateListOpt(opt *NotificationsListOptions) error

ValidateListOpt validates the options for the List method.

func (*NotificationsService) ValidateRemoveOpt

func (s *NotificationsService) ValidateRemoveOpt(opt *NotificationsRemoveOptions) error

ValidateRemoveOpt validates the options for the Remove method.

type PageResponseV2

type PageResponseV2 struct {
	// PageIndex is the 1-based page index.
	PageIndex int32 `json:"pageIndex,omitempty"`
	// PageSize is the number of items per page.
	PageSize int32 `json:"pageSize,omitempty"`
	// Total is the total number of items.
	Total int32 `json:"total,omitempty"`
}

PageResponseV2 represents the pagination information returned by V2 API endpoints.

type PaginationArgs

type PaginationArgs struct {
	// Page is the response page number. Must be strictly greater than 0.
	Page int64 `url:"p,omitempty"`
	// PageSize is the response page size. Must be greater than 0 and less than or equal to 500.
	PageSize int64 `url:"ps,omitempty"`
}

PaginationArgs contains common pagination parameters for API requests.

func (*PaginationArgs) Validate

func (p *PaginationArgs) Validate() error

Validate validates the pagination arguments.

type PaginationParamsV2

type PaginationParamsV2 struct {
	// PageIndex is the 1-based page index. Default is 1.
	PageIndex int32 `json:"pageIndex,omitempty"`
	// PageSize is the number of results per page. A value of 0 will only return
	// pagination information. Default is 50.
	PageSize int32 `json:"pageSize,omitempty"`
}

PaginationParamsV2 contains common pagination query parameters for V2 API requests.

func (*PaginationParamsV2) Validate

func (p *PaginationParamsV2) Validate() error

Validate validates the V2 pagination parameters.

type Paging

type Paging struct {
	PageIndex int64 `json:"pageIndex,omitempty"`
	PageSize  int64 `json:"pageSize,omitempty"`
	Total     int64 `json:"total,omitempty"`
}

Paging is used in many APIs.

type PermissionGroup

type PermissionGroup struct {
	// Description is the group description.
	Description string `json:"description,omitempty"`
	// ID is the deprecated unique identifier of the group.
	//
	// Deprecated: Since SonarQube 8.4 - use Name instead.
	ID string `json:"id,omitempty"`
	// Managed indicates if the group is externally managed.
	Managed bool `json:"managed,omitempty"`
	// Name is the group name.
	Name string `json:"name,omitempty"`
	// Permissions is the list of permissions granted to the group.
	Permissions []string `json:"permissions,omitempty"`
}

PermissionGroup represents a group with its permissions.

type PermissionTemplate

type PermissionTemplate struct {
	// CreatedAt is the template creation date.
	CreatedAt string `json:"createdAt,omitempty"`
	// Description is the template description.
	Description string `json:"description,omitempty"`
	// ID is the unique identifier of the template.
	ID string `json:"id,omitempty"`
	// Name is the template name.
	Name string `json:"name,omitempty"`
	// Permissions is the list of permissions in the template.
	Permissions []PermissionsTemplatePermission `json:"permissions,omitempty"`
	// ProjectKeyPattern is the regex pattern for matching project keys.
	ProjectKeyPattern string `json:"projectKeyPattern,omitempty"`
	// UpdatedAt is the template last update date.
	UpdatedAt string `json:"updatedAt,omitempty"`
}

PermissionTemplate represents a permission template.

type PermissionUser

type PermissionUser struct {
	// Avatar is the user's avatar URL.
	Avatar string `json:"avatar,omitempty"`
	// Email is the user's email address.
	Email string `json:"email,omitempty"`
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Managed indicates if the user is externally managed.
	Managed bool `json:"managed,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// Permissions is the list of permissions granted to the user.
	Permissions []string `json:"permissions,omitempty"`
}

PermissionUser represents a user with their permissions.

type PermissionsAddGroupOptions

type PermissionsAddGroupOptions struct {
	// GroupName is the group name or 'anyone' (case insensitive).
	// This field is required.
	GroupName string `url:"groupName"`
	// Permission is the permission to grant.
	// This field is required.
	// Global permissions: admin, gateadmin, profileadmin, provisioning, scan, applicationcreator, portfoliocreator.
	// Project permissions: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// ProjectID is the project id. Use either ProjectID or ProjectKey for project permissions.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key. Use either ProjectID or ProjectKey for project permissions.
	ProjectKey string `url:"projectKey,omitempty"`
}

PermissionsAddGroupOptions contains parameters for the AddGroup method.

type PermissionsAddGroupToTemplateOptions

type PermissionsAddGroupToTemplateOptions struct {
	// GroupName is the group name or 'anyone' (case insensitive).
	// This field is required.
	GroupName string `url:"groupName"`
	// Permission is the permission to grant.
	// This field is required.
	// Allowed values: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsAddGroupToTemplateOptions contains parameters for the AddGroupToTemplate method.

type PermissionsAddProjectCreatorToTemplateOptions

type PermissionsAddProjectCreatorToTemplateOptions struct {
	// Permission is the permission to grant to the project creator.
	// This field is required.
	// Allowed values: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsAddProjectCreatorToTemplateOptions contains parameters for the AddProjectCreatorToTemplate method.

type PermissionsAddUserOptions

type PermissionsAddUserOptions struct {
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// Permission is the permission to grant.
	// This field is required.
	// Global permissions: admin, gateadmin, profileadmin, provisioning, scan, applicationcreator, portfoliocreator.
	// Project permissions: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// ProjectID is the project id. Use either ProjectID or ProjectKey for project permissions.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key. Use either ProjectID or ProjectKey for project permissions.
	ProjectKey string `url:"projectKey,omitempty"`
}

PermissionsAddUserOptions contains parameters for the AddUser method.

type PermissionsAddUserToTemplateOptions

type PermissionsAddUserToTemplateOptions struct {
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// Permission is the permission to grant.
	// This field is required.
	// Allowed values: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsAddUserToTemplateOptions contains parameters for the AddUserToTemplate method.

type PermissionsApplyTemplateOptions

type PermissionsApplyTemplateOptions struct {
	// ProjectID is the project id. Use either ProjectID or ProjectKey.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key. Use either ProjectID or ProjectKey.
	ProjectKey string `url:"projectKey,omitempty"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsApplyTemplateOptions contains parameters for the ApplyTemplate method.

type PermissionsBulkApplyTemplateOptions

type PermissionsBulkApplyTemplateOptions struct {
	// AnalyzedBefore filters projects for which last analysis is older than the given date.
	// Either a date (server timezone) or datetime can be provided.
	AnalyzedBefore string `url:"analyzedBefore,omitempty"`
	// OnProvisionedOnly filters to only provisioned projects.
	OnProvisionedOnly bool `url:"onProvisionedOnly,omitempty"`
	// Projects is the list of project keys to restrict the operation to.
	// Maximum 1000 values allowed.
	Projects []string `url:"projects,omitempty,comma"`
	// Query limits search to project names containing the string or project keys matching exactly.
	Query string `url:"q,omitempty"`
	// Qualifiers filters by component qualifiers. Default is TRK (projects).
	Qualifiers string `url:"qualifiers,omitempty"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsBulkApplyTemplateOptions contains parameters for the BulkApplyTemplate method.

type PermissionsCreateTemplate

type PermissionsCreateTemplate struct {
	// PermissionTemplate is the created permission template.
	PermissionTemplate PermissionsTemplateBasic `json:"permissionTemplate,omitzero"`
}

PermissionsCreateTemplate represents the response from creating a permission template.

type PermissionsCreateTemplateOptions

type PermissionsCreateTemplateOptions struct {
	// Description is the template description.
	Description string `url:"description,omitempty"`
	// Name is the template name.
	// This field is required.
	Name string `url:"name"`
	// ProjectKeyPattern is a project key pattern. Must be a valid Java regular expression.
	ProjectKeyPattern string `url:"projectKeyPattern,omitempty"`
}

PermissionsCreateTemplateOptions contains parameters for the CreateTemplate method.

type PermissionsDefaultTemplate

type PermissionsDefaultTemplate struct {
	// Qualifier is the component qualifier (e.g., TRK for projects).
	Qualifier string `json:"qualifier,omitempty"`
	// TemplateID is the ID of the template set as default.
	TemplateID string `json:"templateId,omitempty"`
}

PermissionsDefaultTemplate represents a default template mapping.

type PermissionsDeleteTemplateOptions

type PermissionsDeleteTemplateOptions struct {
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsDeleteTemplateOptions contains parameters for the DeleteTemplate method.

type PermissionsGroups

type PermissionsGroups struct {
	// Groups is the list of groups with their permissions.
	Groups []PermissionGroup `json:"groups,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

PermissionsGroups represents the response from listing groups with permissions.

type PermissionsGroupsOptions

type PermissionsGroupsOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs

	// Permission filters by specific permission.
	// Global permissions: admin, gateadmin, profileadmin, provisioning, scan, applicationcreator, portfoliocreator.
	// Project permissions: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission,omitempty"`
	// ProjectID is the project id for project permissions.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key for project permissions.
	ProjectKey string `url:"projectKey,omitempty"`
	// Query limits search to group names containing the supplied string.
	Query string `url:"q,omitempty"`
}

PermissionsGroupsOptions contains parameters for the Groups method.

type PermissionsRemoveGroupFromTemplateOptions

type PermissionsRemoveGroupFromTemplateOptions struct {
	// GroupName is the group name or 'anyone' (case insensitive).
	// This field is required.
	GroupName string `url:"groupName"`
	// Permission is the permission to revoke.
	// This field is required.
	// Allowed values: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsRemoveGroupFromTemplateOptions contains parameters for the RemoveGroupFromTemplate method.

type PermissionsRemoveGroupOptions

type PermissionsRemoveGroupOptions struct {
	// GroupName is the group name or 'anyone' (case insensitive).
	// This field is required.
	GroupName string `url:"groupName"`
	// Permission is the permission to revoke.
	// This field is required.
	// Global permissions: admin, gateadmin, profileadmin, provisioning, scan, applicationcreator, portfoliocreator.
	// Project permissions: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// ProjectID is the project id. Use either ProjectID or ProjectKey for project permissions.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key. Use either ProjectID or ProjectKey for project permissions.
	ProjectKey string `url:"projectKey,omitempty"`
}

PermissionsRemoveGroupOptions contains parameters for the RemoveGroup method.

type PermissionsRemoveProjectCreatorFromTemplateOptions

type PermissionsRemoveProjectCreatorFromTemplateOptions struct {
	// Permission is the permission to revoke from the project creator.
	// This field is required.
	// Allowed values: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsRemoveProjectCreatorFromTemplateOptions contains parameters for the RemoveProjectCreatorFromTemplate method.

type PermissionsRemoveUserFromTemplateOptions

type PermissionsRemoveUserFromTemplateOptions struct {
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// Permission is the permission to revoke.
	// This field is required.
	// Allowed values: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsRemoveUserFromTemplateOptions contains parameters for the RemoveUserFromTemplate method.

type PermissionsRemoveUserOptions

type PermissionsRemoveUserOptions struct {
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// Permission is the permission to revoke.
	// This field is required.
	// Global permissions: admin, gateadmin, profileadmin, provisioning, scan, applicationcreator, portfoliocreator.
	// Project permissions: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission"`
	// ProjectID is the project id. Use either ProjectID or ProjectKey for project permissions.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key. Use either ProjectID or ProjectKey for project permissions.
	ProjectKey string `url:"projectKey,omitempty"`
}

PermissionsRemoveUserOptions contains parameters for the RemoveUser method.

type PermissionsSearchTemplatePermission added in v2.2.1

type PermissionsSearchTemplatePermission struct {
	// Key is the permission key.
	Key string `json:"key,omitempty"`
	// Name is the permission display name.
	Name string `json:"name,omitempty"`
	// Description is the permission description.
	Description string `json:"description,omitempty"`
}

PermissionsSearchTemplatePermission describes a permission definition available to templates.

type PermissionsSearchTemplates

type PermissionsSearchTemplates struct {
	// DefaultTemplates is the list of default template mappings.
	DefaultTemplates []PermissionsDefaultTemplate `json:"defaultTemplates,omitempty"`
	// PermissionTemplates is the list of permission templates.
	PermissionTemplates []PermissionTemplate `json:"permissionTemplates,omitempty"`
	// Permissions is the list of permission definitions available to templates.
	Permissions []PermissionsSearchTemplatePermission `json:"permissions,omitempty"`
}

PermissionsSearchTemplates represents the response from searching permission templates.

type PermissionsSearchTemplatesOptions

type PermissionsSearchTemplatesOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// Query limits search to permission template names containing the supplied string.
	Query string `url:"q,omitempty"`
}

PermissionsSearchTemplatesOptions contains parameters for the SearchTemplates method.

type PermissionsService

type PermissionsService struct {
	// contains filtered or unexported fields
}

PermissionsService handles communication with the permissions related methods of the SonarQube API. This service manages permission templates and the granting/revoking of permissions at the global and project levels.

func (*PermissionsService) AddGroup

AddGroup adds a permission to a group. This service defaults to global permissions, but can be limited to project permissions by providing project id or project key. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project

API endpoint: POST /api/permissions/add_group. Since: 5.2.

func (*PermissionsService) AddGroupToTemplate

AddGroupToTemplate adds a group to a permission template. The group name must be provided. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/add_group_to_template. Since: 5.2.

func (*PermissionsService) AddProjectCreatorToTemplate

AddProjectCreatorToTemplate adds a project creator to a permission template. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/add_project_creator_to_template. Since: 6.0.

func (*PermissionsService) AddUser

AddUser adds permission to a user. This service defaults to global permissions, but can be limited to project permissions by providing project id or project key. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project

API endpoint: POST /api/permissions/add_user. Since: 5.2.

func (*PermissionsService) AddUserToTemplate

AddUserToTemplate adds a user to a permission template. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/add_user_to_template. Since: 5.2.

func (*PermissionsService) ApplyTemplate

ApplyTemplate applies a permission template to one project. The project id or project key must be provided. The template id or name must be provided. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/apply_template. Since: 5.2.

func (*PermissionsService) BulkApplyTemplate

BulkApplyTemplate applies a permission template to several components. Managed projects will be ignored. The template id or name must be provided. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/bulk_apply_template. Since: 5.5.

func (*PermissionsService) CreateTemplate

CreateTemplate creates a permission template. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/create_template. Since: 5.2.

func (*PermissionsService) DeleteTemplate

DeleteTemplate deletes a permission template. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/delete_template. Since: 5.2.

func (*PermissionsService) Groups

Groups lists the groups with their permissions. This service defaults to global permissions, but can be limited to project permissions by providing project id or project key. This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project

Note: This is an internal API.

API endpoint: GET /api/permissions/groups. Since: 5.2.

func (*PermissionsService) GroupsAll

GroupsAll fetches all pages from Groups and returns a flat slice of groups.

func (*PermissionsService) RemoveGroup

RemoveGroup removes a permission from a group. This service defaults to global permissions, but can be limited to project permissions by providing project id or project key. The group name must be provided. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project

API endpoint: POST /api/permissions/remove_group. Since: 5.2.

func (*PermissionsService) RemoveGroupFromTemplate

RemoveGroupFromTemplate removes a group from a permission template. The group name must be provided. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/remove_group_from_template. Since: 5.2.

func (*PermissionsService) RemoveProjectCreatorFromTemplate

func (s *PermissionsService) RemoveProjectCreatorFromTemplate(ctx context.Context, opt *PermissionsRemoveProjectCreatorFromTemplateOptions) (*http.Response, error)

RemoveProjectCreatorFromTemplate removes a project creator from a permission template. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/remove_project_creator_from_template. Since: 6.0.

func (*PermissionsService) RemoveUser

RemoveUser removes permission from a user. This service defaults to global permissions, but can be limited to project permissions by providing project id or project key. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project

API endpoint: POST /api/permissions/remove_user. Since: 5.2.

func (*PermissionsService) RemoveUserFromTemplate

RemoveUserFromTemplate removes a user from a permission template. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/remove_user_from_template. Since: 5.2.

func (*PermissionsService) SearchTemplates

SearchTemplates lists permission templates. Requires the following permission: 'Administer System'. WARNING: passing an empty OR 0 PageSize argument will return NO templates, only the total count

API endpoint: GET /api/permissions/search_templates. Since: 5.2.

func (*PermissionsService) SetDefaultTemplate

SetDefaultTemplate sets a permission template as default. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/set_default_template. Since: 5.2.

func (*PermissionsService) TemplateGroups

TemplateGroups lists the groups with their permission as individual groups rather than through user affiliation on the chosen template. This service defaults to all groups, but can be limited to groups with a specific permission by providing the desired permission. Requires the following permission: 'Administer System'.

Note: This is an internal API.

API endpoint: GET /api/permissions/template_groups. Since: 5.2.

func (*PermissionsService) TemplateGroupsAll

TemplateGroupsAll fetches all pages from TemplateGroups and returns a flat slice of groups.

func (*PermissionsService) TemplateUsers

TemplateUsers lists the users with their permission as individual users rather than through group affiliation on the chosen template. This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission. Requires the following permission: 'Administer System'.

Note: This is an internal API.

API endpoint: GET /api/permissions/template_users. Since: 5.2.

func (*PermissionsService) TemplateUsersAll

TemplateUsersAll fetches all pages from TemplateUsers and returns a flat slice of users.

func (*PermissionsService) UpdateTemplate

UpdateTemplate updates a permission template. Requires the following permission: 'Administer System'.

API endpoint: POST /api/permissions/update_template. Since: 5.2.

func (*PermissionsService) Users

Users lists the users with their permissions as individual users rather than through group affiliation. This service defaults to global permissions, but can be limited to project permissions by providing project id or project key. This service defaults to all users, but can be limited to users with a specific permission by providing the desired permission. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project

Note: This is an internal API.

API endpoint: GET /api/permissions/users. Since: 5.2.

func (*PermissionsService) UsersAll

UsersAll fetches all pages from Users and returns a flat slice of users.

func (*PermissionsService) ValidateAddGroupOpt

func (s *PermissionsService) ValidateAddGroupOpt(opt *PermissionsAddGroupOptions) error

ValidateAddGroupOpt validates the options for the AddGroup method.

func (*PermissionsService) ValidateAddGroupToTemplateOpt

func (s *PermissionsService) ValidateAddGroupToTemplateOpt(opt *PermissionsAddGroupToTemplateOptions) error

ValidateAddGroupToTemplateOpt validates the options for the AddGroupToTemplate method.

func (*PermissionsService) ValidateAddProjectCreatorToTemplateOpt

func (s *PermissionsService) ValidateAddProjectCreatorToTemplateOpt(opt *PermissionsAddProjectCreatorToTemplateOptions) error

ValidateAddProjectCreatorToTemplateOpt validates the options for the AddProjectCreatorToTemplate method.

func (*PermissionsService) ValidateAddUserOpt

func (s *PermissionsService) ValidateAddUserOpt(opt *PermissionsAddUserOptions) error

ValidateAddUserOpt validates the options for the AddUser method.

func (*PermissionsService) ValidateAddUserToTemplateOpt

func (s *PermissionsService) ValidateAddUserToTemplateOpt(opt *PermissionsAddUserToTemplateOptions) error

ValidateAddUserToTemplateOpt validates the options for the AddUserToTemplate method.

func (*PermissionsService) ValidateApplyTemplateOpt

func (s *PermissionsService) ValidateApplyTemplateOpt(opt *PermissionsApplyTemplateOptions) error

ValidateApplyTemplateOpt validates the options for the ApplyTemplate method.

func (*PermissionsService) ValidateBulkApplyTemplateOpt

func (s *PermissionsService) ValidateBulkApplyTemplateOpt(opt *PermissionsBulkApplyTemplateOptions) error

ValidateBulkApplyTemplateOpt validates the options for the BulkApplyTemplate method.

func (*PermissionsService) ValidateCreateTemplateOpt

func (s *PermissionsService) ValidateCreateTemplateOpt(opt *PermissionsCreateTemplateOptions) error

ValidateCreateTemplateOpt validates the options for the CreateTemplate method.

func (*PermissionsService) ValidateDeleteTemplateOpt

func (s *PermissionsService) ValidateDeleteTemplateOpt(opt *PermissionsDeleteTemplateOptions) error

ValidateDeleteTemplateOpt validates the options for the DeleteTemplate method.

func (*PermissionsService) ValidateGroupsOpt

func (s *PermissionsService) ValidateGroupsOpt(opt *PermissionsGroupsOptions) error

ValidateGroupsOpt validates the options for the Groups method.

func (*PermissionsService) ValidateRemoveGroupFromTemplateOpt

func (s *PermissionsService) ValidateRemoveGroupFromTemplateOpt(opt *PermissionsRemoveGroupFromTemplateOptions) error

ValidateRemoveGroupFromTemplateOpt validates the options for the RemoveGroupFromTemplate method.

func (*PermissionsService) ValidateRemoveGroupOpt

func (s *PermissionsService) ValidateRemoveGroupOpt(opt *PermissionsRemoveGroupOptions) error

ValidateRemoveGroupOpt validates the options for the RemoveGroup method.

func (*PermissionsService) ValidateRemoveProjectCreatorFromTemplateOpt

func (s *PermissionsService) ValidateRemoveProjectCreatorFromTemplateOpt(opt *PermissionsRemoveProjectCreatorFromTemplateOptions) error

ValidateRemoveProjectCreatorFromTemplateOpt validates the options for the RemoveProjectCreatorFromTemplate method.

func (*PermissionsService) ValidateRemoveUserFromTemplateOpt

func (s *PermissionsService) ValidateRemoveUserFromTemplateOpt(opt *PermissionsRemoveUserFromTemplateOptions) error

ValidateRemoveUserFromTemplateOpt validates the options for the RemoveUserFromTemplate method.

func (*PermissionsService) ValidateRemoveUserOpt

func (s *PermissionsService) ValidateRemoveUserOpt(opt *PermissionsRemoveUserOptions) error

ValidateRemoveUserOpt validates the options for the RemoveUser method.

func (*PermissionsService) ValidateSearchTemplatesOpt

func (s *PermissionsService) ValidateSearchTemplatesOpt(opt *PermissionsSearchTemplatesOptions) error

ValidateSearchTemplatesOpt validates the options for the SearchTemplates method.

func (*PermissionsService) ValidateSetDefaultTemplateOpt

func (s *PermissionsService) ValidateSetDefaultTemplateOpt(opt *PermissionsSetDefaultTemplateOptions) error

ValidateSetDefaultTemplateOpt validates the options for the SetDefaultTemplate method.

func (*PermissionsService) ValidateTemplateGroupsOpt

func (s *PermissionsService) ValidateTemplateGroupsOpt(opt *PermissionsTemplateGroupsOptions) error

ValidateTemplateGroupsOpt validates the options for the TemplateGroups method.

func (*PermissionsService) ValidateTemplateUsersOpt

func (s *PermissionsService) ValidateTemplateUsersOpt(opt *PermissionsTemplateUsersOptions) error

ValidateTemplateUsersOpt validates the options for the TemplateUsers method.

func (*PermissionsService) ValidateUpdateTemplateOpt

func (s *PermissionsService) ValidateUpdateTemplateOpt(opt *PermissionsUpdateTemplateOptions) error

ValidateUpdateTemplateOpt validates the options for the UpdateTemplate method.

func (*PermissionsService) ValidateUsersOpt

func (s *PermissionsService) ValidateUsersOpt(opt *PermissionsUsersOptions) error

ValidateUsersOpt validates the options for the Users method.

type PermissionsSetDefaultTemplateOptions

type PermissionsSetDefaultTemplateOptions struct {
	// Qualifier is the project qualifier. Default is TRK (projects).
	Qualifier string `url:"qualifier,omitempty"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsSetDefaultTemplateOptions contains parameters for the SetDefaultTemplate method.

type PermissionsTemplateBasic

type PermissionsTemplateBasic struct {
	// Description is the template description.
	Description string `json:"description,omitempty"`
	// Id is the unique identifier of the template.
	ID string `json:"id,omitempty"`
	// Name is the template name.
	Name string `json:"name,omitempty"`
	// Permissions is the list of permissions in the template.
	Permissions []PermissionsTemplatePermission `json:"permissions,omitempty"`
	// ProjectKeyPattern is the regex pattern for matching project keys.
	ProjectKeyPattern string `json:"projectKeyPattern,omitempty"`
	// CreatedAt is the template creation date.
	CreatedAt string `json:"createdAt,omitempty"`
	// UpdatedAt is the template last update date.
	UpdatedAt string `json:"updatedAt,omitempty"`
}

PermissionsTemplateBasic represents basic permission template info returned on create.

type PermissionsTemplateGroup

type PermissionsTemplateGroup struct {
	// Description is the group description.
	Description string `json:"description,omitempty"`
	// ID is the deprecated unique identifier of the group.
	//
	// Deprecated: Since SonarQube 8.4 - use Name instead.
	ID string `json:"id,omitempty"`
	// Name is the group name.
	Name string `json:"name,omitempty"`
	// Permissions is the list of permissions granted to the group.
	Permissions []string `json:"permissions,omitempty"`
}

PermissionsTemplateGroup represents a group in a permission template.

type PermissionsTemplateGroups

type PermissionsTemplateGroups struct {
	// Groups is the list of groups in the template.
	Groups []PermissionsTemplateGroup `json:"groups,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

PermissionsTemplateGroups represents the response from listing template groups.

type PermissionsTemplateGroupsOptions

type PermissionsTemplateGroupsOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs

	// Permission filters by specific permission.
	// Allowed values: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission,omitempty"`
	// Query limits search to group names containing the supplied string.
	Query string `url:"q,omitempty"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsTemplateGroupsOptions contains parameters for the TemplateGroups method.

type PermissionsTemplatePermission

type PermissionsTemplatePermission struct {
	// GroupsCount is the number of groups with this permission.
	GroupsCount int64 `json:"groupsCount,omitempty"`
	// Key is the permission key.
	Key string `json:"key,omitempty"`
	// UsersCount is the number of users with this permission.
	UsersCount int64 `json:"usersCount,omitempty"`
	// WithProjectCreator indicates if the project creator has this permission.
	WithProjectCreator bool `json:"withProjectCreator,omitempty"`
}

PermissionsTemplatePermission represents a permission entry in a template.

type PermissionsTemplateUpdated

type PermissionsTemplateUpdated struct {
	// CreatedAt is the template creation date.
	CreatedAt string `json:"createdAt,omitempty"`
	// Description is the template description.
	Description string `json:"description,omitempty"`
	// ID is the unique identifier of the template.
	ID string `json:"id,omitempty"`
	// Name is the template name.
	Name string `json:"name,omitempty"`
	// Permissions is the list of permissions in the template.
	Permissions []PermissionsTemplatePermission `json:"permissions,omitempty"`
	// ProjectKeyPattern is the regex pattern for matching project keys.
	ProjectKeyPattern string `json:"projectKeyPattern,omitempty"`
	// UpdatedAt is the template last update date.
	UpdatedAt string `json:"updatedAt,omitempty"`
}

PermissionsTemplateUpdated represents updated permission template info.

type PermissionsTemplateUser

type PermissionsTemplateUser struct {
	// Avatar is the user's avatar URL.
	Avatar string `json:"avatar,omitempty"`
	// Email is the user's email address.
	Email string `json:"email,omitempty"`
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// Permissions is the list of permissions granted to the user.
	Permissions []string `json:"permissions,omitempty"`
}

PermissionsTemplateUser represents a user in a permission template.

type PermissionsTemplateUsers

type PermissionsTemplateUsers struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Users is the list of users in the template.
	Users []PermissionsTemplateUser `json:"users,omitempty"`
}

PermissionsTemplateUsers represents the response from listing template users.

type PermissionsTemplateUsersOptions

type PermissionsTemplateUsersOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs

	// Permission filters by specific permission.
	// Allowed values: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission,omitempty"`
	// Query limits search to user names containing the supplied string.
	Query string `url:"q,omitempty"`
	// TemplateID is the template id. Use either TemplateID or TemplateName.
	TemplateID string `url:"templateId,omitempty"`
	// TemplateName is the template name. Use either TemplateID or TemplateName.
	TemplateName string `url:"templateName,omitempty"`
}

PermissionsTemplateUsersOptions contains parameters for the TemplateUsers method.

type PermissionsUpdateTemplate

type PermissionsUpdateTemplate struct {
	// PermissionTemplate is the updated permission template.
	PermissionTemplate PermissionsTemplateUpdated `json:"permissionTemplate,omitzero"`
}

PermissionsUpdateTemplate represents the response from updating a permission template.

type PermissionsUpdateTemplateOptions

type PermissionsUpdateTemplateOptions struct {
	// Description is the template description.
	Description string `url:"description,omitempty"`
	// ID is the template id.
	// This field is required.
	ID string `url:"id"`
	// Name is the template name.
	Name string `url:"name,omitempty"`
	// ProjectKeyPattern is a project key pattern. Must be a valid Java regular expression.
	ProjectKeyPattern string `url:"projectKeyPattern,omitempty"`
}

PermissionsUpdateTemplateOptions contains parameters for the UpdateTemplate method.

type PermissionsUsers

type PermissionsUsers struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Users is the list of users with their permissions.
	Users []PermissionUser `json:"users,omitempty"`
}

PermissionsUsers represents the response from listing users with permissions.

type PermissionsUsersOptions

type PermissionsUsersOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs

	// Permission filters by specific permission.
	// Global permissions: admin, gateadmin, profileadmin, provisioning, scan, applicationcreator, portfoliocreator.
	// Project permissions: admin, codeviewer, issueadmin, securityhotspotadmin, scan, user.
	Permission string `url:"permission,omitempty"`
	// ProjectID is the project id for project permissions.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key for project permissions.
	ProjectKey string `url:"projectKey,omitempty"`
	// Query limits search to user names containing the supplied string.
	Query string `url:"q,omitempty"`
}

PermissionsUsersOptions contains parameters for the Users method.

type PluginAvailable

type PluginAvailable struct {
	// Category is the plugin category.
	Category string `json:"category,omitempty"`
	// Description is the plugin description.
	Description string `json:"description,omitempty"`
	// EditionBundled indicates if the plugin is bundled with an edition.
	EditionBundled bool `json:"editionBundled,omitempty"`
	// HomepageURL is the plugin homepage URL.
	HomepageURL string `json:"homepageUrl,omitempty"`
	// IssueTrackerURL is the issue tracker URL.
	IssueTrackerURL string `json:"issueTrackerUrl,omitempty"`
	// Key is the plugin key.
	Key string `json:"key,omitempty"`
	// License is the plugin license.
	License string `json:"license,omitempty"`
	// Name is the plugin name.
	Name string `json:"name,omitempty"`
	// OrganizationName is the organization name.
	OrganizationName string `json:"organizationName,omitempty"`
	// OrganizationURL is the organization URL.
	OrganizationURL string `json:"organizationUrl,omitempty"`
	// Release contains release information.
	Release PluginRelease `json:"release,omitzero"`
	// TermsAndConditionsURL is the terms and conditions URL.
	TermsAndConditionsURL string `json:"termsAndConditionsUrl,omitempty"`
	// Update contains update information.
	Update PluginUpdateInfo `json:"update,omitzero"`
}

PluginAvailable represents an available plugin for installation.

type PluginInstalled

type PluginInstalled struct {
	// Description is the plugin description.
	Description string `json:"description,omitempty"`
	// DocumentationPath is the path to documentation.
	//
	// Deprecated: Since 9.8.
	DocumentationPath string `json:"documentationPath,omitempty"`
	// EditionBundled indicates if the plugin is bundled with an edition.
	EditionBundled bool `json:"editionBundled,omitempty"`
	// Filename is the plugin filename.
	Filename string `json:"filename,omitempty"`
	// Hash is the file hash.
	Hash string `json:"hash,omitempty"`
	// HomepageURL is the plugin homepage URL.
	HomepageURL string `json:"homepageUrl,omitempty"`
	// ImplementationBuild is the implementation build.
	ImplementationBuild string `json:"implementationBuild,omitempty"`
	// IssueTrackerURL is the issue tracker URL.
	IssueTrackerURL string `json:"issueTrackerUrl,omitempty"`
	// Key is the plugin key.
	Key string `json:"key,omitempty"`
	// License is the plugin license.
	License string `json:"license,omitempty"`
	// Name is the plugin name.
	Name string `json:"name,omitempty"`
	// OrganizationName is the organization name.
	OrganizationName string `json:"organizationName,omitempty"`
	// OrganizationURL is the organization URL.
	OrganizationURL string `json:"organizationUrl,omitempty"`
	// RequiredForLanguages is the list of languages requiring this plugin.
	RequiredForLanguages []string `json:"requiredForLanguages,omitempty"`
	// Type is the plugin type (bundled or external).
	Type string `json:"type,omitempty"`
	// SonarLintSupported indicates if SonarLint is supported.
	SonarLintSupported bool `json:"sonarLintSupported,omitempty"`
	// UpdatedAt is the timestamp when the plugin was updated.
	UpdatedAt int64 `json:"updatedAt,omitempty"`
	// Version is the plugin version.
	Version string `json:"version,omitempty"`
}

PluginInstalled represents an installed plugin.

type PluginPending

type PluginPending struct {
	// Category is the plugin category.
	Category string `json:"category,omitempty"`
	// Description is the plugin description.
	Description string `json:"description,omitempty"`
	// DocumentationPath is the path to documentation.
	//
	// Deprecated: Since 9.8.
	DocumentationPath string `json:"documentationPath,omitempty"`
	// HomepageURL is the plugin homepage URL.
	HomepageURL string `json:"homepageUrl,omitempty"`
	// ImplementationBuild is the implementation build.
	ImplementationBuild string `json:"implementationBuild,omitempty"`
	// IssueTrackerURL is the issue tracker URL.
	IssueTrackerURL string `json:"issueTrackerUrl,omitempty"`
	// Key is the plugin key.
	Key string `json:"key,omitempty"`
	// License is the plugin license.
	License string `json:"license,omitempty"`
	// Name is the plugin name.
	Name string `json:"name,omitempty"`
	// OrganizationName is the organization name.
	OrganizationName string `json:"organizationName,omitempty"`
	// OrganizationURL is the organization URL.
	OrganizationURL string `json:"organizationUrl,omitempty"`
	// Version is the plugin version.
	Version string `json:"version,omitempty"`
}

PluginPending represents a pending plugin change.

type PluginPendingUpdate

type PluginPendingUpdate struct {
	// Category is the plugin category.
	Category string `json:"category,omitempty"`
	// Description is the plugin description.
	Description string `json:"description,omitempty"`
	// HomepageURL is the plugin homepage URL.
	HomepageURL string `json:"homepageUrl,omitempty"`
	// ImplementationBuild is the implementation build.
	ImplementationBuild string `json:"implementationBuild,omitempty"`
	// IssueTrackerURL is the issue tracker URL.
	IssueTrackerURL string `json:"issueTrackerUrl,omitempty"`
	// Key is the plugin key.
	Key string `json:"key,omitempty"`
	// License is the plugin license.
	License string `json:"license,omitempty"`
	// Name is the plugin name.
	Name string `json:"name,omitempty"`
	// OrganizationName is the organization name.
	OrganizationName string `json:"organizationName,omitempty"`
	// OrganizationURL is the organization URL.
	OrganizationURL string `json:"organizationUrl,omitempty"`
	// Version is the plugin version.
	Version string `json:"version,omitempty"`
}

PluginPendingUpdate represents a pending plugin update.

type PluginRelease

type PluginRelease struct {
	// ChangeLogURL is the changelog URL.
	ChangeLogURL string `json:"changeLogUrl,omitempty"`
	// Date is the release date.
	Date string `json:"date,omitempty"`
	// Description is the release description.
	Description string `json:"description,omitempty"`
	// Version is the release version.
	Version string `json:"version,omitempty"`
}

PluginRelease represents plugin release information.

type PluginRequirement

type PluginRequirement struct {
	// Description is the requirement description.
	Description string `json:"description,omitempty"`
	// Key is the required plugin key.
	Key string `json:"key,omitempty"`
	// Name is the required plugin name.
	Name string `json:"name,omitempty"`
}

PluginRequirement represents a plugin requirement.

type PluginUpdateDetail

type PluginUpdateDetail struct {
	// Release contains release information.
	Release PluginRelease `json:"release,omitzero"`
	// Requires is the list of required plugins.
	Requires []PluginRequirement `json:"requires,omitempty"`
	// Status is the update status.
	Status string `json:"status,omitempty"`
}

PluginUpdateDetail represents details of a plugin update.

type PluginUpdateInfo

type PluginUpdateInfo struct {
	// Requires is the list of required plugins.
	Requires []PluginRequirement `json:"requires,omitempty"`
	// Status is the update status.
	Status string `json:"status,omitempty"`
}

PluginUpdateInfo represents plugin update information.

type PluginWithUpdates

type PluginWithUpdates struct {
	// Category is the plugin category.
	Category string `json:"category,omitempty"`
	// Description is the plugin description.
	Description string `json:"description,omitempty"`
	// EditionBundled indicates if the plugin is bundled with an edition.
	EditionBundled bool `json:"editionBundled,omitempty"`
	// Key is the plugin key.
	Key string `json:"key,omitempty"`
	// License is the plugin license.
	License string `json:"license,omitempty"`
	// Name is the plugin name.
	Name string `json:"name,omitempty"`
	// OrganizationName is the organization name.
	OrganizationName string `json:"organizationName,omitempty"`
	// OrganizationURL is the organization URL.
	OrganizationURL string `json:"organizationUrl,omitempty"`
	// TermsAndConditionsURL is the terms and conditions URL.
	TermsAndConditionsURL string `json:"termsAndConditionsUrl,omitempty"`
	// Updates is the list of available updates.
	Updates []PluginUpdateDetail `json:"updates,omitempty"`
}

PluginWithUpdates represents a plugin with available updates.

type PluginsAvailable

type PluginsAvailable struct {
	// Plugins is the list of available plugins.
	Plugins []PluginAvailable `json:"plugins,omitempty"`
	// UpdateCenterRefresh is the timestamp when Update Center was last refreshed.
	UpdateCenterRefresh string `json:"updateCenterRefresh,omitempty"`
}

PluginsAvailable represents the response from listing available plugins.

type PluginsDownloadOptions

type PluginsDownloadOptions struct {
	// Plugin is the key identifying the plugin to download (required).
	Plugin string `url:"plugin,omitempty"`
}

PluginsDownloadOptions represents options for downloading a plugin.

type PluginsInstallOptions

type PluginsInstallOptions struct {
	// Key is the key identifying the plugin to install (required).
	Key string `url:"key,omitempty"`
}

PluginsInstallOptions represents options for installing a plugin.

type PluginsInstalled

type PluginsInstalled struct {
	// Plugins is the list of installed plugins.
	Plugins []PluginInstalled `json:"plugins,omitempty"`
}

PluginsInstalled represents the response from listing installed plugins.

type PluginsInstalledOptions

type PluginsInstalledOptions struct {
	// Fields is the list of additional fields to return.
	// Possible values: category.
	Fields []string `url:"f,omitempty,comma"`
	// Type filters plugins by type (internal).
	// Possible values: BUNDLED, EXTERNAL.
	Type string `url:"type,omitempty"`
}

PluginsInstalledOptions represents options for listing installed plugins.

type PluginsPending

type PluginsPending struct {
	// Installing is the list of plugins being installed.
	Installing []PluginPending `json:"installing,omitempty"`
	// Removing is the list of plugins being removed.
	Removing []PluginPending `json:"removing,omitempty"`
	// Updating is the list of plugins being updated.
	Updating []PluginPendingUpdate `json:"updating,omitempty"`
}

PluginsPending represents the response from listing pending plugin changes.

type PluginsService

type PluginsService struct {
	// contains filtered or unexported fields
}

PluginsService handles communication with the plugins related methods of the SonarQube API. This service provides management of plugins on the server.

Since: 5.2.

func (*PluginsService) Available

Available returns the list of all available plugins for installation. Plugin information is retrieved from Update Center. Requires 'Administer System' permission.

API endpoint: GET /api/plugins/available. Since: 5.2.

func (*PluginsService) CancelAll

func (s *PluginsService) CancelAll(ctx context.Context) (*http.Response, error)

CancelAll cancels any operation pending on any plugin. Requires user to be authenticated with Administer System permissions.

API endpoint: POST /api/plugins/cancel_all. Since: 5.2.

func (*PluginsService) Download

Download downloads plugin JAR for usage by scanner engine.

API endpoint: GET /api/plugins/download. Since: 7.2. Internal: true.

func (*PluginsService) Install

Install installs the latest version of a plugin specified by its key. Plugin information is retrieved from Update Center. Fails if used on commercial editions or plugin risk consent has not been accepted. Requires user to be authenticated with Administer System permissions.

API endpoint: POST /api/plugins/install. Since: 5.2.

func (*PluginsService) Installed

Installed returns the list of all installed plugins. Requires authentication.

API endpoint: GET /api/plugins/installed. Since: 5.2.

func (*PluginsService) Pending

Pending returns the list of plugins pending installation/removal/update. Requires 'Administer System' permission.

API endpoint: GET /api/plugins/pending. Since: 5.2.

func (*PluginsService) Uninstall

Uninstall uninstalls the plugin specified by its key. Requires user to be authenticated with Administer System permissions.

API endpoint: POST /api/plugins/uninstall. Since: 5.2.

func (*PluginsService) Update

Update updates a plugin to the latest version compatible with the SonarQube instance. Plugin information is retrieved from Update Center. Requires user to be authenticated with Administer System permissions.

API endpoint: POST /api/plugins/update. Since: 5.2.

func (*PluginsService) Updates

Updates lists plugins installed that have at least one newer version available. Plugin information is retrieved from Update Center. Requires 'Administer System' permission.

API endpoint: GET /api/plugins/updates. Since: 5.2.

func (*PluginsService) ValidateDownloadOpt

func (s *PluginsService) ValidateDownloadOpt(opt *PluginsDownloadOptions) error

ValidateDownloadOpt validates the options for the Download method.

func (*PluginsService) ValidateInstallOpt

func (s *PluginsService) ValidateInstallOpt(opt *PluginsInstallOptions) error

ValidateInstallOpt validates the options for the Install method.

func (*PluginsService) ValidateInstalledOpt

func (s *PluginsService) ValidateInstalledOpt(opt *PluginsInstalledOptions) error

ValidateInstalledOpt validates the options for the Installed method.

func (*PluginsService) ValidateUninstallOpt

func (s *PluginsService) ValidateUninstallOpt(opt *PluginsUninstallOptions) error

ValidateUninstallOpt validates the options for the Uninstall method.

func (*PluginsService) ValidateUpdateOpt

func (s *PluginsService) ValidateUpdateOpt(opt *PluginsUpdateOptions) error

ValidateUpdateOpt validates the options for the Update method.

type PluginsUninstallOptions

type PluginsUninstallOptions struct {
	// Key is the key identifying the plugin to uninstall (required).
	Key string `url:"key,omitempty"`
}

PluginsUninstallOptions represents options for uninstalling a plugin.

type PluginsUpdateOptions

type PluginsUpdateOptions struct {
	// Key is the key identifying the plugin to update (required).
	Key string `url:"key,omitempty"`
}

PluginsUpdateOptions represents options for updating a plugin.

type PluginsUpdates

type PluginsUpdates struct {
	// Plugins is the list of plugins with available updates.
	Plugins []PluginWithUpdates `json:"plugins,omitempty"`
	// UpdateCenterRefresh is the timestamp of the last update center refresh.
	UpdateCenterRefresh string `json:"updateCenterRefresh,omitempty"`
}

PluginsUpdates represents the response from listing plugin updates.

type Project

type Project struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
	// Qualifier is the project qualifier (TRK, VW, APP).
	Qualifier string `json:"qualifier,omitempty"`
	// Visibility is the project visibility (public or private).
	Visibility string `json:"visibility,omitempty"`
}

Project represents a project.

type ProjectAnalysesCondition

type ProjectAnalysesCondition struct {
	// Branch is the branch name.
	Branch string `json:"branch,omitempty"`
	// ErrorThreshold is the error threshold.
	ErrorThreshold string `json:"errorThreshold,omitempty"`
	// Metric is the condition metric.
	Metric string `json:"metric,omitempty"`
	// PullRequest is the pull request key.
	PullRequest string `json:"pullRequest,omitempty"`
}

ProjectAnalysesCondition represents a quality gate condition.

type ProjectAnalysesCreateEventOptions

type ProjectAnalysesCreateEventOptions struct {
	// Analysis is the analysis key (required).
	Analysis string `url:"analysis,omitempty"`
	// Category is the event category.
	// Possible values: VERSION, OTHER.
	// Default: OTHER.
	Category string `url:"category,omitempty"`
	// Name is the event name (required).
	Name string `url:"name,omitempty"`
}

ProjectAnalysesCreateEventOptions represents options for creating an event.

type ProjectAnalysesDeleteEventOptions

type ProjectAnalysesDeleteEventOptions struct {
	// Event is the event key (required).
	Event string `url:"event,omitempty"`
}

ProjectAnalysesDeleteEventOptions represents options for deleting an event.

type ProjectAnalysesDeleteOptions

type ProjectAnalysesDeleteOptions struct {
	// Analysis is the analysis key (required).
	Analysis string `url:"analysis,omitempty"`
}

ProjectAnalysesDeleteOptions represents options for deleting an analysis.

type ProjectAnalysesEvent

type ProjectAnalysesEvent struct {
	// Analysis is the analysis key.
	Analysis string `json:"analysis,omitempty"`
	// Category is the event category.
	Category string `json:"category,omitempty"`
	// Description is the event description.
	Description string `json:"description,omitempty"`
	// Key is the event key.
	Key string `json:"key,omitempty"`
	// Name is the event name.
	Name string `json:"name,omitempty"`
	// QualityGate contains quality gate event details.
	QualityGate ProjectAnalysesQualityGate `json:"qualityGate,omitzero"`
}

ProjectAnalysesEvent represents a project analysis event.

type ProjectAnalysesQualityGate

type ProjectAnalysesQualityGate struct {
	// Failing lists failing conditions.
	Failing []ProjectAnalysesCondition `json:"failing,omitempty"`
	// Status is the quality gate status.
	Status string `json:"status,omitempty"`
	// StillFailing indicates if still failing.
	StillFailing bool `json:"stillFailing,omitempty"`
}

ProjectAnalysesQualityGate represents quality gate details in an event.

type ProjectAnalysesSearch

type ProjectAnalysesSearch struct {
	// Analyses is the list of analyses.
	Analyses []ProjectAnalysis `json:"analyses,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

ProjectAnalysesSearch represents the response from searching analyses.

type ProjectAnalysesSearchOptions

type ProjectAnalysesSearchOptions struct {
	// PaginationArgs embeds pagination parameters.
	PaginationArgs

	// Branch is the branch key.
	Branch string `url:"branch,omitempty"`
	// Category filters events by category.
	// Possible values: VERSION, OTHER, QUALITY_PROFILE, QUALITY_GATE, DEFINITION_CHANGE, SQ_UPGRADE.
	Category string `url:"category,omitempty"`
	// From is the filter by date (inclusive).
	// Format: date or datetime (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ).
	From string `url:"from,omitempty"`
	// Project is the project key (required).
	Project string `url:"project,omitempty"`
	// PullRequest is the pull request key.
	PullRequest string `url:"pullRequest,omitempty"`
	// To is the filter by date (inclusive).
	// Format: date or datetime (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ssZ).
	To string `url:"to,omitempty"`
}

ProjectAnalysesSearchOptions represents options for searching analyses.

type ProjectAnalysesService

type ProjectAnalysesService struct {
	// contains filtered or unexported fields
}

ProjectAnalysesService handles communication with the project analyses related methods of the SonarQube API. This service provides management of project analyses, including events.

Since: 6.3.

func (*ProjectAnalysesService) CreateEvent

CreateEvent creates an event on a project analysis. Only events of category 'VERSION' and 'OTHER' can be created. Requires 'Administer' permission on the project.

API endpoint: POST /api/project_analyses/create_event. Since: 6.3.

func (*ProjectAnalysesService) Delete

Delete deletes a project analysis. Requires 'Administer' permission on the project.

API endpoint: POST /api/project_analyses/delete. Since: 6.3.

func (*ProjectAnalysesService) DeleteEvent

DeleteEvent deletes a project analysis event. Only events of category 'VERSION' and 'OTHER' can be deleted. Requires 'Administer' permission on the project.

API endpoint: POST /api/project_analyses/delete_event. Since: 6.3.

func (*ProjectAnalysesService) Search

Search searches project analyses and attached events. Requires 'Browse' permission on the project.

API endpoint: GET /api/project_analyses/search. Since: 6.3.

func (*ProjectAnalysesService) SearchAll

SearchAll is a convenience method to iterate over all analyses. It handles pagination automatically.

func (*ProjectAnalysesService) UpdateEvent

UpdateEvent updates an event name. Only events of category 'VERSION' and 'OTHER' can be updated. Requires 'Administer' permission on the project.

API endpoint: POST /api/project_analyses/update_event. Since: 6.3.

func (*ProjectAnalysesService) ValidateCreateEventOpt

func (s *ProjectAnalysesService) ValidateCreateEventOpt(opt *ProjectAnalysesCreateEventOptions) error

ValidateCreateEventOpt validates the options for the CreateEvent method.

func (*ProjectAnalysesService) ValidateDeleteEventOpt

func (s *ProjectAnalysesService) ValidateDeleteEventOpt(opt *ProjectAnalysesDeleteEventOptions) error

ValidateDeleteEventOpt validates the options for the DeleteEvent method.

func (*ProjectAnalysesService) ValidateDeleteOpt

func (s *ProjectAnalysesService) ValidateDeleteOpt(opt *ProjectAnalysesDeleteOptions) error

ValidateDeleteOpt validates the options for the Delete method.

func (*ProjectAnalysesService) ValidateSearchOpt

func (s *ProjectAnalysesService) ValidateSearchOpt(opt *ProjectAnalysesSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

func (*ProjectAnalysesService) ValidateUpdateEventOpt

func (s *ProjectAnalysesService) ValidateUpdateEventOpt(opt *ProjectAnalysesUpdateEventOptions) error

ValidateUpdateEventOpt validates the options for the UpdateEvent method.

type ProjectAnalysesUpdateEventOptions

type ProjectAnalysesUpdateEventOptions struct {
	// Event is the event key (required).
	Event string `url:"event,omitempty"`
	// Name is the new event name (required).
	Name string `url:"name,omitempty"`
}

ProjectAnalysesUpdateEventOptions represents options for updating an event.

type ProjectAnalysis

type ProjectAnalysis struct {
	// BuildString is the build string.
	BuildString string `json:"buildString,omitempty"`
	// Date is the analysis date.
	Date string `json:"date,omitempty"`
	// DetectedCI is the detected CI.
	DetectedCI string `json:"detectedCI,omitempty"`
	// Events is the list of events.
	Events []ProjectAnalysesEvent `json:"events,omitempty"`
	// Key is the analysis key.
	Key string `json:"key,omitempty"`
	// ManualNewCodePeriodBaseline indicates if it's a manual baseline.
	ManualNewCodePeriodBaseline bool `json:"manualNewCodePeriodBaseline,omitempty"`
	// ProjectVersion is the project version.
	ProjectVersion string `json:"projectVersion,omitempty"`
	// Revision is the revision.
	Revision string `json:"revision,omitempty"`
}

ProjectAnalysis represents a project analysis.

type ProjectBadgesMeasureOptions

type ProjectBadgesMeasureOptions struct {
	// Branch is the branch key.
	Branch string `url:"branch,omitempty"`
	// Metric is the metric key.
	// This field is required.
	// Allowed values: coverage, duplicated_lines_density, ncloc, alert_status, security_hotspots,
	// bugs, code_smells, vulnerabilities, sqale_rating, reliability_rating, security_rating,
	// sqale_index, software_quality_reliability_issues, software_quality_maintainability_issues,
	// software_quality_security_issues, software_quality_maintainability_rating,
	// software_quality_reliability_rating, software_quality_security_rating,
	// software_quality_maintainability_remediation_effort.
	Metric string `url:"metric"`
	// Project is the project or application key.
	// This field is required.
	Project string `url:"project"`
	// Token is the project badge token.
	Token string `url:"token,omitempty"`
}

ProjectBadgesMeasureOptions contains parameters for the Measure method.

type ProjectBadgesQualityGateOptions

type ProjectBadgesQualityGateOptions struct {
	// Branch is the branch key.
	Branch string `url:"branch,omitempty"`
	// Project is the project or application key.
	// This field is required.
	Project string `url:"project"`
	// Token is the project badge token.
	Token string `url:"token,omitempty"`
}

ProjectBadgesQualityGateOptions contains parameters for the QualityGate method.

type ProjectBadgesRenewTokenOptions

type ProjectBadgesRenewTokenOptions struct {
	// Project is the project or application key.
	// This field is required.
	Project string `url:"project"`
}

ProjectBadgesRenewTokenOptions contains parameters for the RenewToken method.

type ProjectBadgesService

type ProjectBadgesService struct {
	// contains filtered or unexported fields
}

ProjectBadgesService handles communication with the project badges related methods of the SonarQube API. This service generates badges based on quality gates or measures.

func (*ProjectBadgesService) Measure

Measure generates a badge for project's measure as an SVG. Requires 'Browse' permission on the specified project.

API endpoint: GET /api/project_badges/measure. Since: 7.1.

func (*ProjectBadgesService) QualityGate

QualityGate generates a badge for project's quality gate as an SVG. Requires 'Browse' permission on the specified project.

API endpoint: GET /api/project_badges/quality_gate. Since: 7.1.

func (*ProjectBadgesService) RenewToken

RenewToken creates a new token replacing any existing token for project or application badge access. This token can be used to authenticate with api/project_badges/quality_gate and api/project_badges/measure endpoints. Requires 'Administer' permission on the specified project or application.

API endpoint: POST /api/project_badges/renew_token. Since: 9.2.

func (*ProjectBadgesService) Token

Token retrieves a token to use for project or application badge access. This token can be used to authenticate with api/project_badges/quality_gate and api/project_badges/measure endpoints. Requires 'Browse' permission on the specified project or application.

API endpoint: GET /api/project_badges/token. Since: 9.2.

func (*ProjectBadgesService) ValidateMeasureOpt

func (s *ProjectBadgesService) ValidateMeasureOpt(opt *ProjectBadgesMeasureOptions) error

ValidateMeasureOpt validates the options for the Measure method.

func (*ProjectBadgesService) ValidateQualityGateOpt

func (s *ProjectBadgesService) ValidateQualityGateOpt(opt *ProjectBadgesQualityGateOptions) error

ValidateQualityGateOpt validates the options for the QualityGate method.

func (*ProjectBadgesService) ValidateRenewTokenOpt

func (s *ProjectBadgesService) ValidateRenewTokenOpt(opt *ProjectBadgesRenewTokenOptions) error

ValidateRenewTokenOpt validates the options for the RenewToken method.

func (*ProjectBadgesService) ValidateTokenOpt

func (s *ProjectBadgesService) ValidateTokenOpt(opt *ProjectBadgesTokenOptions) error

ValidateTokenOpt validates the options for the Token method.

type ProjectBadgesToken

type ProjectBadgesToken struct {
	// Token is the badge access token.
	Token string `json:"token,omitempty"`
}

ProjectBadgesToken represents the response from retrieving a badge token.

type ProjectBadgesTokenOptions

type ProjectBadgesTokenOptions struct {
	// Project is the project or application key.
	// This field is required.
	Project string `url:"project"`
}

ProjectBadgesTokenOptions contains parameters for the Token method.

type ProjectBranch

type ProjectBranch struct {
	// AnalysisDate is the date of the last analysis.
	AnalysisDate string `json:"analysisDate,omitempty"`
	// BranchID is the unique identifier of the branch.
	BranchID string `json:"branchId,omitempty"`
	// ExcludedFromPurge indicates whether the branch is excluded from automatic purge.
	ExcludedFromPurge bool `json:"excludedFromPurge,omitempty"`
	// IsMain indicates whether this is the main branch.
	IsMain bool `json:"isMain,omitempty"`
	// Name is the name of the branch.
	Name string `json:"name,omitempty"`
	// Status is the status of the branch.
	Status ProjectBranchStatus `json:"status,omitzero"`
	// Type is the type of the branch.
	Type string `json:"type,omitempty"`
}

ProjectBranch represents a project branch.

type ProjectBranchStatus

type ProjectBranchStatus struct {
	// QualityGateStatus is the quality gate status of the branch.
	QualityGateStatus string `json:"qualityGateStatus,omitempty"`
}

ProjectBranchStatus represents the status of a branch.

type ProjectBranchesDeleteOptions

type ProjectBranchesDeleteOptions struct {
	// Branch is the branch key.
	// This field is required.
	Branch string `url:"branch"`
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
}

ProjectBranchesDeleteOptions contains parameters for the Delete method.

type ProjectBranchesList

type ProjectBranchesList struct {
	// Branches is the list of branches.
	Branches []ProjectBranch `json:"branches,omitempty"`
}

ProjectBranchesList represents the response from listing branches.

type ProjectBranchesListOptions

type ProjectBranchesListOptions struct {
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
}

ProjectBranchesListOptions contains parameters for the List method.

type ProjectBranchesRenameOptions

type ProjectBranchesRenameOptions struct {
	// Name is the new name of the main branch.
	// This field is required. Maximum length is 255 characters.
	Name string `url:"name"`
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
}

ProjectBranchesRenameOptions contains parameters for the Rename method.

type ProjectBranchesService

type ProjectBranchesService struct {
	// contains filtered or unexported fields
}

ProjectBranchesService handles communication with the project branches related methods of the SonarQube API. This service manages project branches.

func (*ProjectBranchesService) Delete

Delete deletes a non-main branch of a project or application. Requires 'Administer' rights on the specified project or application.

API endpoint: POST /api/project_branches/delete. Since: 6.6.

func (*ProjectBranchesService) List

List lists the branches of a project or application. Requires 'Browse' or 'Execute analysis' rights on the specified project or application.

API endpoint: GET /api/project_branches/list. Since: 6.6.

func (*ProjectBranchesService) Rename

Rename renames the main branch of a project or application. Requires 'Administer' permission on the specified project or application.

API endpoint: POST /api/project_branches/rename. Since: 6.6.

func (*ProjectBranchesService) SetAutomaticDeletionProtection

SetAutomaticDeletionProtection protects a specific branch from automatic deletion. Protection can't be disabled for the main branch. Requires 'Administer' permission on the specified project or application.

API endpoint: POST /api/project_branches/set_automatic_deletion_protection. Since: 8.1.

func (*ProjectBranchesService) SetMain

SetMain allows setting a new main branch. Caution: only applicable on projects. Requires 'Administer' rights on the specified project or application.

API endpoint: POST /api/project_branches/set_main. Since: 10.2.

func (*ProjectBranchesService) ValidateDeleteOpt

func (s *ProjectBranchesService) ValidateDeleteOpt(opt *ProjectBranchesDeleteOptions) error

ValidateDeleteOpt validates the options for the Delete method.

func (*ProjectBranchesService) ValidateListOpt

func (s *ProjectBranchesService) ValidateListOpt(opt *ProjectBranchesListOptions) error

ValidateListOpt validates the options for the List method.

func (*ProjectBranchesService) ValidateRenameOpt

func (s *ProjectBranchesService) ValidateRenameOpt(opt *ProjectBranchesRenameOptions) error

ValidateRenameOpt validates the options for the Rename method.

func (*ProjectBranchesService) ValidateSetAutomaticDeletionProtectionOpt

func (s *ProjectBranchesService) ValidateSetAutomaticDeletionProtectionOpt(opt *ProjectBranchesSetAutomaticDeletionProtectionOptions) error

ValidateSetAutomaticDeletionProtectionOpt validates the options for the SetAutomaticDeletionProtection method.

func (*ProjectBranchesService) ValidateSetMainOpt

func (s *ProjectBranchesService) ValidateSetMainOpt(opt *ProjectBranchesSetMainOptions) error

ValidateSetMainOpt validates the options for the SetMain method.

type ProjectBranchesSetAutomaticDeletionProtectionOptions

type ProjectBranchesSetAutomaticDeletionProtectionOptions struct {
	// Branch is the branch key.
	// This field is required.
	Branch string `url:"branch"`
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
	// Value sets whether the branch should be protected from automatic deletion.
	// This field is required.
	Value bool `url:"value"`
}

ProjectBranchesSetAutomaticDeletionProtectionOptions contains parameters for the SetAutomaticDeletionProtection method.

type ProjectBranchesSetMainOptions

type ProjectBranchesSetMainOptions struct {
	// Branch is the branch key.
	// This field is required.
	Branch string `url:"branch"`
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
}

ProjectBranchesSetMainOptions contains parameters for the SetMain method.

type ProjectDumpExport

type ProjectDumpExport struct {
	// ProjectID is the project identifier.
	ProjectID string `json:"projectId,omitempty"`
	// ProjectKey is the project key.
	ProjectKey string `json:"projectKey,omitempty"`
	// ProjectName is the project name.
	ProjectName string `json:"projectName,omitempty"`
	// TaskID is the ID of the export task.
	TaskID string `json:"taskId,omitempty"`
}

ProjectDumpExport represents the response from triggering a project export.

type ProjectDumpExportOptions

type ProjectDumpExportOptions struct {
	// Key is the project key.
	// This field is required.
	Key string `url:"key"`
}

ProjectDumpExportOptions contains parameters for the Export method.

type ProjectDumpService

type ProjectDumpService struct {
	// contains filtered or unexported fields
}

ProjectDumpService handles communication with the project dump related methods of the SonarQube API. This service provides project export/import functionality.

func (*ProjectDumpService) Export

Export triggers project dump so that the project can be imported to another SonarQube server. Requires the 'Administer' permission.

API endpoint: POST /api/project_dump/export. Since: 1.0.

func (*ProjectDumpService) Status

Status provides the import and export status of a project. Permission 'Administer' is required. The project id or project key must be provided.

API endpoint: GET /api/project_dump/status. Since: 1.0.

func (*ProjectDumpService) ValidateExportOpt

func (s *ProjectDumpService) ValidateExportOpt(opt *ProjectDumpExportOptions) error

ValidateExportOpt validates the options for the Export method.

func (*ProjectDumpService) ValidateStatusOpt

func (s *ProjectDumpService) ValidateStatusOpt(opt *ProjectDumpStatusOptions) error

ValidateStatusOpt validates the options for the Status method. Either ID or Key must be provided.

type ProjectDumpStatus

type ProjectDumpStatus struct {
	// CanBeExported indicates whether the project can be exported.
	CanBeExported bool `json:"canBeExported,omitempty"`
	// CanBeImported indicates whether a dump can be imported for this project.
	CanBeImported bool `json:"canBeImported,omitempty"`
	// DumpToImport is the path to the dump file that can be imported.
	DumpToImport string `json:"dumpToImport,omitempty"`
	// ExportedDump is the path to the exported dump file.
	ExportedDump string `json:"exportedDump,omitempty"`
}

ProjectDumpStatus represents the response from getting the project dump status.

type ProjectDumpStatusOptions

type ProjectDumpStatusOptions struct {
	// ID is the project id.
	ID string `url:"id,omitempty"`
	// Key is the project key.
	Key string `url:"key,omitempty"`
}

ProjectDumpStatusOptions contains parameters for the Status method.

type ProjectLink struct {
	// ID is the unique identifier of the link.
	ID string `json:"id,omitempty"`
	// Name is the display name of the link.
	Name string `json:"name,omitempty"`
	// Type is the type of the link (e.g., "homepage", "ci", "issue", "scm").
	Type string `json:"type,omitempty"`
	// URL is the target URL of the link.
	URL string `json:"url,omitempty"`
}

ProjectLink represents a link associated with a project.

type ProjectLinksCreate

type ProjectLinksCreate struct {
	// Link is the created link.
	Link ProjectLink `json:"link,omitzero"`
}

ProjectLinksCreate represents the response from creating a project link.

type ProjectLinksCreateOptions

type ProjectLinksCreateOptions struct {
	// Name is the display name of the link.
	// This field is required. Maximum length is 128 characters.
	Name string `url:"name"`
	// ProjectID is the project id.
	// Either ProjectID or ProjectKey must be provided.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key.
	// Either ProjectID or ProjectKey must be provided.
	ProjectKey string `url:"projectKey,omitempty"`
	// URL is the target URL of the link.
	// This field is required. Maximum length is 2048 characters.
	URL string `url:"url"`
}

ProjectLinksCreateOptions contains parameters for the Create method.

type ProjectLinksDeleteOptions

type ProjectLinksDeleteOptions struct {
	// ID is the unique identifier of the link to delete.
	// This field is required.
	ID string `url:"id"`
}

ProjectLinksDeleteOptions contains parameters for the Delete method.

type ProjectLinksSearch

type ProjectLinksSearch struct {
	// Links is the list of links found.
	Links []ProjectLink `json:"links,omitempty"`
}

ProjectLinksSearch represents the response from searching project links.

type ProjectLinksSearchOptions

type ProjectLinksSearchOptions struct {
	// ProjectID is the project id.
	// Either ProjectID or ProjectKey must be provided.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key.
	// Either ProjectID or ProjectKey must be provided.
	ProjectKey string `url:"projectKey,omitempty"`
}

ProjectLinksSearchOptions contains parameters for the Search method.

type ProjectLinksService

type ProjectLinksService struct {
	// contains filtered or unexported fields
}

ProjectLinksService handles communication with the project links related methods of the SonarQube API. This service manages project links (custom URLs associated with projects).

func (*ProjectLinksService) Create

Create creates a new project link. Requires 'Administer' permission on the specified project, or global 'Administer' permission.

API endpoint: POST /api/project_links/create. Since: 6.1.

func (*ProjectLinksService) Delete

Delete deletes an existing project link. Requires 'Administer' permission on the specified project, or global 'Administer' permission.

API endpoint: POST /api/project_links/delete. Since: 6.1.

func (*ProjectLinksService) Search

Search lists links of a project. The 'projectId' or 'projectKey' must be provided. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project
  • 'Browse' on the specified project

API endpoint: GET /api/project_links/search. Since: 6.1.

func (*ProjectLinksService) ValidateCreateOpt

func (s *ProjectLinksService) ValidateCreateOpt(opt *ProjectLinksCreateOptions) error

ValidateCreateOpt validates the options for the Create method.

func (*ProjectLinksService) ValidateDeleteOpt

func (s *ProjectLinksService) ValidateDeleteOpt(opt *ProjectLinksDeleteOptions) error

ValidateDeleteOpt validates the options for the Delete method.

func (*ProjectLinksService) ValidateSearchOpt

func (s *ProjectLinksService) ValidateSearchOpt(opt *ProjectLinksSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

type ProjectPullRequest

type ProjectPullRequest struct {
	// Key is the pull request key/identifier.
	Key string `json:"key,omitempty"`
	// Title is the pull request title.
	Title string `json:"title,omitempty"`
	// Branch is the source branch of the pull request.
	Branch string `json:"branch,omitempty"`
	// Base is the target branch of the pull request.
	Base string `json:"base,omitempty"`
	// URL is the URL of the pull request in the source code manager.
	URL string `json:"url,omitempty"`
	// Status contains the quality gate status and issue counts for the pull request.
	Status ProjectPullRequestStatus `json:"status,omitzero"`
	// IsOrphan indicates whether the pull request is orphaned (target branch no longer exists).
	IsOrphan bool `json:"isOrphan,omitempty"`
	// AnalysisDate is the date and time when the pull request was last analyzed, in ISO 8601 format.
	AnalysisDate string `json:"analysisDate,omitempty"`
}

ProjectPullRequest represents a pull request analysis in SonarQube.

type ProjectPullRequestStatus

type ProjectPullRequestStatus struct {
	// QualityGateStatus is the quality gate status (e.g. "OK", "ERROR").
	QualityGateStatus string `json:"qualityGateStatus,omitempty"`
	// Bugs is the number of bugs found.
	Bugs int `json:"bugs,omitempty"`
	// Vulnerabilities is the number of vulnerabilities found.
	Vulnerabilities int `json:"vulnerabilities,omitempty"`
	// CodeSmells is the number of code smells found.
	CodeSmells int `json:"codeSmells,omitempty"`
}

ProjectPullRequestStatus represents the status of a pull request analysis, including quality gate status and issue counts.

type ProjectPullRequestsDeleteOptions

type ProjectPullRequestsDeleteOptions struct {
	// Project is the project key. This field is required.
	Project string `url:"project"`
	// PullRequest is the pull request key. This field is required.
	PullRequest string `url:"pullRequest"`
}

ProjectPullRequestsDeleteOptions contains parameters for the Delete method.

type ProjectPullRequestsList

type ProjectPullRequestsList struct {
	// PullRequests is the list of pull requests for the project.
	PullRequests []ProjectPullRequest `json:"pullRequests,omitempty"`
}

ProjectPullRequestsList represents the response from the list endpoint.

type ProjectPullRequestsListOptions

type ProjectPullRequestsListOptions struct {
	// Project is the project key. This field is required.
	Project string `url:"project"`
}

ProjectPullRequestsListOptions contains parameters for the List method.

type ProjectPullRequestsService

type ProjectPullRequestsService struct {
	// contains filtered or unexported fields
}

ProjectPullRequestsService handles communication with the project pull requests related methods of the SonarQube API.

func (*ProjectPullRequestsService) Delete

Delete deletes a pull request analysis. Requires Administer permission on the project.

API endpoint: POST /api/project_pull_requests/delete. Since: 7.1.

func (*ProjectPullRequestsService) List

List lists the pull request analyses of a project. Requires Browse or Execute Analysis permission on the project.

API endpoint: GET /api/project_pull_requests/list. Since: 7.1.

func (*ProjectPullRequestsService) ValidateDeleteOpt

ValidateDeleteOpt validates the options for the Delete method.

func (*ProjectPullRequestsService) ValidateListOpt

ValidateListOpt validates the options for the List method.

type ProjectQualityGate

type ProjectQualityGate struct {
	// Name is the name of the quality gate.
	Name string `json:"name,omitempty"`
	// Default indicates if this is the default quality gate.
	Default bool `json:"default,omitempty"`
}

ProjectQualityGate represents the quality gate associated with a project.

type ProjectSearchComponent

type ProjectSearchComponent struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
	// Qualifier is the project qualifier.
	Qualifier string `json:"qualifier,omitempty"`
	// Visibility is the project visibility.
	Visibility string `json:"visibility,omitempty"`
	// LastAnalysisDate is the date of the last analysis.
	LastAnalysisDate string `json:"lastAnalysisDate,omitempty"`
	// Revision is the last analysis revision.
	Revision string `json:"revision,omitempty"`
	// ProjectUuid is the project UUID.
	ProjectUuid string `json:"projectUuid,omitempty"`
	// Managed indicates if the project is managed.
	Managed bool `json:"managed,omitempty"`
}

ProjectSearchComponent represents a project component.

type ProjectTagsSearch

type ProjectTagsSearch struct {
	// Tags is the list of tags found.
	Tags []string `json:"tags,omitempty"`
}

ProjectTagsSearch represents the response from searching project tags.

type ProjectTagsSearchOptions

type ProjectTagsSearchOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	Query string `url:"q,omitempty"`
}

ProjectTagsSearchOptions contains parameters for the Search method.

type ProjectTagsService

type ProjectTagsService struct {
	// contains filtered or unexported fields
}

ProjectTagsService handles communication with the project tags related methods of the SonarQube API. This service manages project tags.

func (*ProjectTagsService) Search

Search searches for project tags.

API endpoint: GET /api/project_tags/search. Since: 6.4.

func (*ProjectTagsService) Set

Set sets tags on a project. Requires the 'Administer' rights on the specified project.

API endpoint: POST /api/project_tags/set. Since: 6.4.

func (*ProjectTagsService) ValidateSearchOpt

func (s *ProjectTagsService) ValidateSearchOpt(opt *ProjectTagsSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

func (*ProjectTagsService) ValidateSetOpt

func (s *ProjectTagsService) ValidateSetOpt(opt *ProjectTagsSetOptions) error

ValidateSetOpt validates the options for the Set method.

type ProjectTagsSetOptions

type ProjectTagsSetOptions struct {
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
	// Tags is the list of tags to set on the project.
	Tags []string `url:"tags,comma"`
}

ProjectTagsSetOptions contains parameters for the Set method.

type ProjectsBulkDeleteOptions

type ProjectsBulkDeleteOptions struct {
	// OnProvisionedOnly filters only provisioned projects (optional).
	OnProvisionedOnly bool `url:"onProvisionedOnly,omitempty"`
	// AnalyzedBefore filters projects analyzed before the given date (optional).
	// Format: YYYY-MM-DD.
	AnalyzedBefore string `url:"analyzedBefore,omitempty"`
	// Query is used to filter projects by name (optional).
	Query string `url:"q,omitempty"`
	// Visibility filters by project visibility (optional).
	// Possible values: private, public.
	Visibility string `url:"visibility,omitempty"`
	// Projects is the list of project keys to delete (optional).
	Projects []string `url:"projects,omitempty,comma"`
	// Qualifiers filters by project qualifiers (optional).
	// Possible values: TRK, VW, APP.
	Qualifiers []string `url:"qualifiers,omitempty,comma"`
}

ProjectsBulkDeleteOptions represents options for bulk deleting projects.

type ProjectsCreate

type ProjectsCreate struct {
	// Project is the created project.
	Project Project `json:"project,omitzero"`
}

ProjectsCreate represents the response from creating a project.

type ProjectsCreateOptions

type ProjectsCreateOptions struct {
	// Name is the project name (required).
	// Maximum length: 500 characters.
	Name string `url:"name,omitempty"`
	// Project is the project key (required).
	// Maximum length: 400 characters.
	Project string `url:"project,omitempty"`
	// MainBranch is the name of the main branch (optional).
	// If not provided, the default main branch name will be used.
	MainBranch string `url:"mainBranch,omitempty"`
	// NewCodeDefinitionType is the type of new code definition (optional).
	// Possible values: PREVIOUS_VERSION, NUMBER_OF_DAYS, REFERENCE_BRANCH.
	NewCodeDefinitionType string `url:"newCodeDefinitionType,omitempty"`
	// NewCodeDefinitionValue is the value of new code definition (optional).
	// Required if newCodeDefinitionType is NUMBER_OF_DAYS or REFERENCE_BRANCH.
	NewCodeDefinitionValue string `url:"newCodeDefinitionValue,omitempty"`
	// Visibility is the project visibility (optional).
	// If no visibility is specified, the default visibility will be used.
	// Possible values: private, public.
	Visibility string `url:"visibility,omitempty"`
}

ProjectsCreateOptions represents options for creating a project.

type ProjectsDeleteOptions

type ProjectsDeleteOptions struct {
	// Project is the project key (required).
	Project string `url:"project,omitempty"`
}

ProjectsDeleteOptions represents options for deleting a project.

type ProjectsSearch

type ProjectsSearch struct {
	// Components is the list of projects.
	Components []ProjectSearchComponent `json:"components,omitempty"`
	// Paging is the pagination info.
	Paging Paging `json:"paging,omitzero"`
}

ProjectsSearch represents the response from searching projects.

type ProjectsSearchMyProjects

type ProjectsSearchMyProjects struct {
	// Projects is the list of projects.
	Projects []MyProject `json:"projects,omitempty"`
	// Paging is the pagination info.
	Paging Paging `json:"paging,omitzero"`
}

ProjectsSearchMyProjects represents the response from searching my projects.

type ProjectsSearchMyProjectsOptions

type ProjectsSearchMyProjectsOptions struct {
	PaginationArgs
}

ProjectsSearchMyProjectsOptions represents options for searching my projects.

type ProjectsSearchMyScannableProjects

type ProjectsSearchMyScannableProjects struct {
	// Projects is the list of scannable projects.
	Projects []ScannableProject `json:"projects,omitempty"`
}

ProjectsSearchMyScannableProjects represents the response from searching my scannable projects.

type ProjectsSearchMyScannableProjectsOptions

type ProjectsSearchMyScannableProjectsOptions struct {
	// Query is used to filter projects by name.
	Query string `url:"q,omitempty"`
}

ProjectsSearchMyScannableProjectsOptions contains optional parameters for SearchMyScannableProjects.

type ProjectsSearchOptions

type ProjectsSearchOptions struct {
	PaginationArgs

	// AnalyzedBefore filters projects analyzed before the given date (optional).
	// Format: YYYY-MM-DD.
	AnalyzedBefore string `url:"analyzedBefore,omitempty"`
	// OnProvisionedOnly filters only provisioned projects (optional).
	OnProvisionedOnly bool `url:"onProvisionedOnly,omitempty"`
	// Projects is the list of project keys to return (optional).
	Projects []string `url:"projects,omitempty,comma"`
	// Query is used to filter projects by name or key (optional).
	Query string `url:"q,omitempty"`
	// Qualifiers filters by project qualifiers (optional).
	// Possible values: TRK, VW, APP.
	Qualifiers []string `url:"qualifiers,omitempty,comma"`
	// Visibility filters by project visibility (optional).
	// Possible values: private, public.
	Visibility string `url:"visibility,omitempty"`
}

ProjectsSearchOptions represents options for searching projects.

type ProjectsService

type ProjectsService struct {
	// contains filtered or unexported fields
}

ProjectsService handles communication with the Projects related methods of the SonarQube API. Manage project existence.

Since: 2.10.

func (*ProjectsService) BulkDelete

BulkDelete deletes one or several projects. At least one parameter is required among 'analyzedBefore', 'projects', and 'q'. Requires 'Administer System' permission.

Since: 5.2.

func (*ProjectsService) Create

Create provisions a new project. Requires 'Create Projects' permission.

Since: 4.0.

func (*ProjectsService) Delete

Delete deletes a project. Requires 'Administer System' permission or 'Administer' permission on the project.

Since: 5.2.

func (*ProjectsService) Search

Search searches for projects. Requires 'Browse' permission on the returned projects.

Since: 6.3.

func (*ProjectsService) SearchAll

SearchAll fetches all pages from Search and returns a flat slice of components.

Example

Fetch every page of a paginated endpoint with the SearchAll helper.

package main

import (
	"context"
	"fmt"

	"github.com/boxboxjason/sonarqube-client-go/v2/sonar"
)

func main() {
	client, err := sonar.NewClient(nil,
		sonar.WithBaseURL("https://sonarqube.example.com/api/"),
		sonar.WithToken("my-token"),
	)
	if err != nil {
		panic(err)
	}

	//nolint:exhaustruct // only the filter we care about is set
	projects, _, err := client.Projects.SearchAll(context.Background(), &sonar.ProjectsSearchOptions{})
	if err != nil {
		panic(err)
	}

	fmt.Printf("found %d projects\n", len(projects))
}

func (*ProjectsService) SearchMyProjects

SearchMyProjects returns the list of projects the current user can scan. Only the favorite and recently analyzed projects will be returned.

Since: 6.4.

func (*ProjectsService) SearchMyProjectsAll

SearchMyProjectsAll fetches all pages from SearchMyProjects and returns a flat slice of projects.

func (*ProjectsService) SearchMyScannableProjects

SearchMyScannableProjects returns the list of projects the current user can analyze. Requires authentication.

Since: 9.5.

func (*ProjectsService) UpdateDefaultVisibility

func (s *ProjectsService) UpdateDefaultVisibility(ctx context.Context, opt *ProjectsUpdateDefaultVisibilityOptions) (*http.Response, error)

UpdateDefaultVisibility updates the default visibility of new projects. Requires 'Administer System' permission.

Since: 6.4.

func (*ProjectsService) UpdateKey

UpdateKey updates a project key. Requires 'Administer' permission on the project.

Since: 6.1.

func (*ProjectsService) UpdateVisibility

UpdateVisibility updates a project visibility. Requires 'Project administer' permission on the project.

Since: 6.4.

func (*ProjectsService) ValidateBulkDeleteOpt

func (s *ProjectsService) ValidateBulkDeleteOpt(opt *ProjectsBulkDeleteOptions) error

ValidateBulkDeleteOpt validates the options for BulkDelete.

func (*ProjectsService) ValidateCreateOpt

func (s *ProjectsService) ValidateCreateOpt(opt *ProjectsCreateOptions) error

ValidateCreateOpt validates the options for Create.

func (*ProjectsService) ValidateDeleteOpt

func (s *ProjectsService) ValidateDeleteOpt(opt *ProjectsDeleteOptions) error

ValidateDeleteOpt validates the options for Delete.

func (*ProjectsService) ValidateSearchMyProjectsOpt

func (s *ProjectsService) ValidateSearchMyProjectsOpt(opt *ProjectsSearchMyProjectsOptions) error

ValidateSearchMyProjectsOpt validates the options for SearchMyProjects.

func (*ProjectsService) ValidateSearchOpt

func (s *ProjectsService) ValidateSearchOpt(opt *ProjectsSearchOptions) error

ValidateSearchOpt validates the options for Search.

func (*ProjectsService) ValidateUpdateDefaultVisibilityOpt

func (s *ProjectsService) ValidateUpdateDefaultVisibilityOpt(opt *ProjectsUpdateDefaultVisibilityOptions) error

ValidateUpdateDefaultVisibilityOpt validates the options for UpdateDefaultVisibility.

func (*ProjectsService) ValidateUpdateKeyOpt

func (s *ProjectsService) ValidateUpdateKeyOpt(opt *ProjectsUpdateKeyOptions) error

ValidateUpdateKeyOpt validates the options for UpdateKey.

func (*ProjectsService) ValidateUpdateVisibilityOpt

func (s *ProjectsService) ValidateUpdateVisibilityOpt(opt *ProjectsUpdateVisibilityOptions) error

ValidateUpdateVisibilityOpt validates the options for UpdateVisibility.

type ProjectsUpdateDefaultVisibilityOptions

type ProjectsUpdateDefaultVisibilityOptions struct {
	// ProjectVisibility is the new default visibility (required).
	// Possible values: private, public.
	ProjectVisibility string `url:"projectVisibility,omitempty"`
}

ProjectsUpdateDefaultVisibilityOptions represents options for updating default visibility.

type ProjectsUpdateKeyOptions

type ProjectsUpdateKeyOptions struct {
	// From is the current project key (required).
	From string `url:"from,omitempty"`
	// To is the new project key (required).
	To string `url:"to,omitempty"`
}

ProjectsUpdateKeyOptions represents options for updating a project key.

type ProjectsUpdateVisibilityOptions

type ProjectsUpdateVisibilityOptions struct {
	// Project is the project key (required).
	Project string `url:"project,omitempty"`
	// Visibility is the new visibility (required).
	// Possible values: private, public.
	Visibility string `url:"visibility,omitempty"`
}

ProjectsUpdateVisibilityOptions represents options for updating project visibility.

type PurchasableFeatureV2 added in v2.2.0

type PurchasableFeatureV2 struct {
	FeatureKey  string `json:"featureKey,omitempty"`
	Parent      string `json:"parent,omitempty"`
	URL         string `json:"url,omitempty"`
	IsEnabled   bool   `json:"isEnabled,omitempty"`
	IsAvailable bool   `json:"isAvailable,omitempty"`
}

PurchasableFeatureV2 represents a feature that can be purchased for the current SonarQube edition.

type PushService

type PushService struct {
	// contains filtered or unexported fields
}

PushService handles communication with the server-side events related methods of the SonarQube API. This service provides endpoints for listening to server-side events.

func (*PushService) SonarlintEvents

func (s *PushService) SonarlintEvents(ctx context.Context, opt *PushSonarlintEventsOptions) (*http.Response, error)

SonarlintEvents provides an endpoint for listening to server-side events. Currently, it notifies listeners about changes to the activation of a rule. The response body is left open for streaming events. The caller is responsible for reading from resp.Body (e.g., using an event stream parser) and closing the response body when finished.

API endpoint: GET /api/push/sonarlint_events. WARNING: This is an internal API and may change without notice.

func (*PushService) ValidateSonarlintEventsOpt

func (s *PushService) ValidateSonarlintEventsOpt(opt *PushSonarlintEventsOptions) error

ValidateSonarlintEventsOpt validates the options for the SonarlintEvents method.

type PushSonarlintEventsOptions

type PushSonarlintEventsOptions struct {
	// Languages is a list of languages for which events will be delivered.
	// This field is required.
	Languages []string `url:"languages,comma"`
	// ProjectKeys is a list of project keys for which events will be delivered.
	// This field is required.
	ProjectKeys []string `url:"projectKeys,comma"`
}

PushSonarlintEventsOptions contains parameters for the SonarlintEvents method.

type QualityGate

type QualityGate struct {
	// Actions contains the actions available for this quality gate.
	Actions QualityGateActions `json:"actions,omitzero"`
	// CaycStatus is the Clean As You Code status.
	// Possible values: compliant, non-compliant, over-compliant.
	CaycStatus string `json:"caycStatus,omitempty"`
	// Name is the name of the quality gate.
	Name string `json:"name,omitempty"`
	// HasMQRConditions indicates if the gate has MQR (Multi-Quality Rule) conditions.
	HasMQRConditions bool `json:"hasMQRConditions,omitempty"`
	// HasStandardConditions indicates if the gate has standard conditions.
	HasStandardConditions bool `json:"hasStandardConditions,omitempty"`
	// IsAiCodeSupported indicates if the gate supports AI-generated code.
	IsAiCodeSupported bool `json:"isAiCodeSupported,omitempty"`
	// IsBuiltIn indicates if this is a built-in quality gate.
	IsBuiltIn bool `json:"isBuiltIn,omitempty"`
	// IsDefault indicates if this is the default quality gate.
	IsDefault bool `json:"isDefault,omitempty"`
}

QualityGate represents a quality gate with its properties and available actions.

type QualityGateActions

type QualityGateActions struct {
	// AssociateProjects indicates if projects can be associated with this gate.
	AssociateProjects bool `json:"associateProjects,omitempty"`
	// Copy indicates if the gate can be copied.
	Copy bool `json:"copy,omitempty"`
	// Delegate indicates if permissions can be delegated for this gate.
	Delegate bool `json:"delegate,omitempty"`
	// Delete indicates if the gate can be deleted.
	Delete bool `json:"delete,omitempty"`
	// ManageAiCodeAssurance indicates if AI code assurance can be managed.
	ManageAiCodeAssurance bool `json:"manageAiCodeAssurance,omitempty"`
	// ManageConditions indicates if conditions can be managed.
	ManageConditions bool `json:"manageConditions,omitempty"`
	// Rename indicates if the gate can be renamed.
	Rename bool `json:"rename,omitempty"`
	// SetAsDefault indicates if the gate can be set as default.
	SetAsDefault bool `json:"setAsDefault,omitempty"`
}

QualityGateActions represents actions available for a specific quality gate.

type QualityGateAnalysisPeriod

type QualityGateAnalysisPeriod struct {
	// Date is the date of the period.
	Date string `json:"date,omitempty"`
	// Mode is the period mode.
	Mode string `json:"mode,omitempty"`
	// Parameter is an optional parameter for the period.
	Parameter string `json:"parameter,omitempty"`
}

QualityGateAnalysisPeriod represents information about the analysis period.

type QualityGateCondition

type QualityGateCondition struct {
	// Error is the error threshold value.
	Error string `json:"error,omitempty"`
	// ID is the unique identifier of the condition.
	ID string `json:"id,omitempty"`
	// Metric is the metric key for the condition.
	Metric string `json:"metric,omitempty"`
	// Op is the comparison operator (LT, GT).
	Op string `json:"op,omitempty"`
	// IsCaycCondition indicates if this condition is part of the Clean As You Code standard conditions.
	IsCaycCondition bool `json:"isCaycCondition,omitempty"`
}

QualityGateCondition represents a condition in a quality gate.

type QualityGateConditionStatus

type QualityGateConditionStatus struct {
	// ActualValue is the actual measured value.
	ActualValue string `json:"actualValue,omitempty"`
	// Comparator is the comparison operator used.
	Comparator string `json:"comparator,omitempty"`
	// ErrorThreshold is the threshold that triggers an error.
	ErrorThreshold string `json:"errorThreshold,omitempty"`
	// MetricKey is the key of the evaluated metric.
	MetricKey string `json:"metricKey,omitempty"`
	// Status is the status of this condition (OK, WARN, ERROR).
	Status string `json:"status,omitempty"`
}

QualityGateConditionStatus represents the evaluation result of a single condition.

type QualityGateGroup

type QualityGateGroup struct {
	// Description is the description of the group.
	Description string `json:"description,omitempty"`
	// Name is the name of the group.
	Name string `json:"name,omitempty"`
	// Selected indicates if the group is allowed to edit the quality gate.
	Selected bool `json:"selected,omitempty"`
}

QualityGateGroup represents a group that can edit a quality gate.

type QualityGateProject

type QualityGateProject struct {
	// Key is the unique key of the project.
	Key string `json:"key,omitempty"`
	// Name is the name of the project.
	Name string `json:"name,omitempty"`
	// ContainsAiCode indicates if the project contains AI-generated code.
	ContainsAiCode bool `json:"containsAiCode,omitempty"`
	// Selected indicates if the project is associated with the quality gate.
	Selected bool `json:"selected,omitempty"`
}

QualityGateProject represents a project in quality gate search results.

type QualityGateProjectStatus

type QualityGateProjectStatus struct {
	// Status is the overall quality gate status (OK, WARN, ERROR, NONE).
	Status string `json:"status,omitempty"`
	// CaycStatus is the Clean As You Code status.
	CaycStatus string `json:"caycStatus,omitempty"`
	// Conditions is the list of condition evaluations.
	Conditions []QualityGateConditionStatus `json:"conditions,omitempty"`
	// Period contains information about the analysis period.
	Period QualityGateAnalysisPeriod `json:"period,omitzero"`
	// IgnoredConditions indicates if some conditions were ignored.
	IgnoredConditions bool `json:"ignoredConditions,omitempty"`
}

QualityGateProjectStatus represents the detailed status of a project's quality gate.

type QualityGateUser

type QualityGateUser struct {
	// Avatar is the avatar URL of the user.
	Avatar string `json:"avatar,omitempty"`
	// Login is the login name of the user.
	Login string `json:"login,omitempty"`
	// Name is the display name of the user.
	Name string `json:"name,omitempty"`
	// Selected indicates if the user is allowed to edit the quality gate.
	Selected bool `json:"selected,omitempty"`
}

QualityGateUser represents a user that can edit a quality gate.

type QualityProfile

type QualityProfile struct {
	// Actions contains the actions available for this profile.
	Actions QualityProfileActions `json:"actions,omitzero"`
	// Key is the unique key of the profile.
	Key string `json:"key,omitempty"`
	// Name is the name of the profile.
	Name string `json:"name,omitempty"`
	// Language is the language code of the profile.
	Language string `json:"language,omitempty"`
	// LanguageName is the display name of the language.
	LanguageName string `json:"languageName,omitempty"`
	// ParentKey is the key of the parent profile (for inherited profiles).
	ParentKey string `json:"parentKey,omitempty"`
	// ParentName is the name of the parent profile.
	ParentName string `json:"parentName,omitempty"`
	// LastUsed is the timestamp when the profile was last used.
	LastUsed string `json:"lastUsed,omitempty"`
	// RuleUpdatedAt is the timestamp when rules were last updated.
	RuleUpdatedAt string `json:"rulesUpdatedAt,omitempty"`
	// UserUpdatedAt is the timestamp when the profile was last updated by a user.
	UserUpdatedAt string `json:"userUpdatedAt,omitempty"`
	// ActiveDeprecatedRuleCount is the count of active deprecated rules.
	ActiveDeprecatedRuleCount int64 `json:"activeDeprecatedRuleCount,omitempty"`
	// ActiveRuleCount is the count of active rules.
	ActiveRuleCount int64 `json:"activeRuleCount,omitempty"`
	// ProjectCount is the number of projects using this profile.
	ProjectCount int64 `json:"projectCount,omitempty"`
	// IsBuiltIn indicates if this is a built-in profile.
	IsBuiltIn bool `json:"isBuiltIn,omitempty"`
	// IsDefault indicates if this is the default profile for the language.
	IsDefault bool `json:"isDefault,omitempty"`
	// IsInherited indicates if this profile inherits from another.
	IsInherited bool `json:"isInherited,omitempty"`
}

QualityProfile represents a quality profile with its properties.

type QualityProfileActions

type QualityProfileActions struct {
	// AssociateProjects indicates if projects can be associated with this profile.
	AssociateProjects bool `json:"associateProjects,omitempty"`
	// Copy indicates if the profile can be copied.
	Copy bool `json:"copy,omitempty"`
	// Delete indicates if the profile can be deleted.
	Delete bool `json:"delete,omitempty"`
	// Edit indicates if the profile can be edited.
	Edit bool `json:"edit,omitempty"`
	// SetAsDefault indicates if the profile can be set as default.
	SetAsDefault bool `json:"setAsDefault,omitempty"`
}

QualityProfileActions represents actions available for a specific quality profile.

type QualitygatesActions

type QualitygatesActions struct {
	// Create indicates if the current user can create quality gates.
	Create bool `json:"create,omitempty"`
}

QualitygatesActions represents global actions available for quality gates.

type QualitygatesAddGroupOptions

type QualitygatesAddGroupOptions struct {
	// GateName is the name of the quality gate (required).
	// Maximum length: 100 characters
	GateName string `url:"gateName,omitempty"`
	// GroupName is the group name or 'anyone' (case insensitive) (required).
	GroupName string `url:"groupName,omitempty"`
}

QualitygatesAddGroupOptions contains options for allowing a group to edit a quality gate.

type QualitygatesAddUserOptions

type QualitygatesAddUserOptions struct {
	// GateName is the name of the quality gate (required).
	// Maximum length: 100 characters
	GateName string `url:"gateName,omitempty"`
	// Login is the user login (required).
	Login string `url:"login,omitempty"`
}

QualitygatesAddUserOptions contains options for allowing a user to edit a quality gate.

type QualitygatesAssignOptions

type QualitygatesAssignOptions struct {
	// GateName is the name of the quality gate (required).
	// Maximum length: 100 characters
	GateName string `url:"gateName,omitempty"`
	// ProjectKey is the project key (required).
	ProjectKey string `url:"projectKey,omitempty"`
}

QualitygatesAssignOptions contains options for associating a project.

type QualitygatesCopyOptions

type QualitygatesCopyOptions struct {
	// Name is the name of the new quality gate to create (required).
	Name string `url:"name,omitempty"`
	// SourceName is the name of the quality gate to copy (required).
	// Maximum length: 100 characters
	SourceName string `url:"sourceName,omitempty"`
}

QualitygatesCopyOptions contains options for copying a quality gate.

type QualitygatesCreate

type QualitygatesCreate struct {
	// ID is the deprecated unique identifier of the quality gate.
	//
	// Deprecated: Since SonarQube 10.0 - use Name instead.
	ID string `json:"id,omitempty"`
	// Name is the name of the created quality gate.
	Name string `json:"name,omitempty"`
}

QualitygatesCreate represents the response from creating a quality gate.

type QualitygatesCreateCondition

type QualitygatesCreateCondition struct {
	// Error is the error threshold value.
	Error string `json:"error,omitempty"`
	// ID is the unique identifier of the condition.
	ID string `json:"id,omitempty"`
	// Metric is the metric key for the condition.
	Metric string `json:"metric,omitempty"`
	// Op is the comparison operator (LT, GT).
	Op string `json:"op,omitempty"`
	// Warning is the deprecated warning threshold value.
	//
	// Deprecated: Warning thresholds are no longer supported.
	Warning string `json:"warning,omitempty"`
}

QualitygatesCreateCondition represents the response from creating a condition.

type QualitygatesCreateConditionOptions

type QualitygatesCreateConditionOptions struct {
	// Error is the condition error threshold (required).
	// Maximum length: 64 characters
	Error string `url:"error,omitempty"`
	// GateName is the name of the quality gate (required).
	GateName string `url:"gateName,omitempty"`
	// Metric is the condition metric (required).
	// Only metrics of the following types are allowed: INT, MILLISEC, RATING, WORK_DUR, FLOAT, PERCENT, LEVEL.
	// Forbidden metrics: alert_status, security_hotspots, new_security_hotspots.
	Metric string `url:"metric,omitempty"`
	// Op is the condition operator (optional).
	// Allowed values: LT (is lower than), GT (is greater than)
	Op string `url:"op,omitempty"`
}

QualitygatesCreateConditionOptions contains options for creating a condition.

type QualitygatesCreateOptions

type QualitygatesCreateOptions struct {
	// Name is the name of the quality gate to create (required).
	// Maximum length: 100 characters
	Name string `url:"name,omitempty"`
}

QualitygatesCreateOptions contains options for creating a quality gate.

type QualitygatesDeleteConditionOptions

type QualitygatesDeleteConditionOptions struct {
	// ID is the condition UUID (required).
	ID string `url:"id,omitempty"`
}

QualitygatesDeleteConditionOptions contains options for deleting a condition.

type QualitygatesDeleteOptions

type QualitygatesDeleteOptions struct {
	// Name is the name of the quality gate to delete (required).
	// Maximum length: 100 characters
	Name string `url:"name,omitempty"`
}

QualitygatesDeleteOptions contains options for deleting a quality gate.

type QualitygatesGetByProject

type QualitygatesGetByProject struct {
	// QualityGate contains the quality gate details for the project.
	QualityGate ProjectQualityGate `json:"qualityGate,omitzero"`
}

QualitygatesGetByProject represents the response from getting a project's quality gate.

type QualitygatesGetByProjectOptions

type QualitygatesGetByProjectOptions struct {
	// Project is the project key (required).
	Project string `url:"project,omitempty"`
}

QualitygatesGetByProjectOptions contains options for getting a project's quality gate.

type QualitygatesList

type QualitygatesList struct {
	// Actions contains the global actions available to the current user.
	Actions QualitygatesActions `json:"actions,omitzero"`
	// Qualitygates is the list of quality gates.
	Qualitygates []QualityGate `json:"qualitygates,omitempty"`
}

QualitygatesList represents the response from listing quality gates.

type QualitygatesProjectStatus

type QualitygatesProjectStatus struct {
	// QualityGateProjectStatus contains the detailed project status information.
	ProjectStatus QualityGateProjectStatus `json:"projectStatus,omitzero"`
}

QualitygatesProjectStatus represents the quality gate status of a project.

type QualitygatesProjectStatusOptions

type QualitygatesProjectStatusOptions struct {
	// AnalysisID is the analysis id (optional).
	// Either AnalysisID, ProjectID, or ProjectKey must be provided.
	AnalysisID string `url:"analysisId,omitempty"`
	// Branch is the branch key (optional).
	Branch string `url:"branch,omitempty"`
	// ProjectID is the project UUID (optional).
	// Doesn't work with branches or pull requests.
	ProjectID string `url:"projectId,omitempty"`
	// ProjectKey is the project key (optional).
	ProjectKey string `url:"projectKey,omitempty"`
	// PullRequest is the pull request id (optional).
	PullRequest string `url:"pullRequest,omitempty"`
}

QualitygatesProjectStatusOptions contains options for getting project status.

type QualitygatesRemoveGroupOptions

type QualitygatesRemoveGroupOptions struct {
	// GateName is the name of the quality gate (required).
	// Maximum length: 100 characters
	GateName string `url:"gateName,omitempty"`
	// GroupName is the group name or 'anyone' (case insensitive) (required).
	GroupName string `url:"groupName,omitempty"`
}

QualitygatesRemoveGroupOptions contains options for removing group permissions.

type QualitygatesRemoveUserOptions

type QualitygatesRemoveUserOptions struct {
	// GateName is the name of the quality gate (required).
	// Maximum length: 100 characters
	GateName string `url:"gateName,omitempty"`
	// Login is the user login (required).
	Login string `url:"login,omitempty"`
}

QualitygatesRemoveUserOptions contains options for removing user permissions.

type QualitygatesRenameOptions

type QualitygatesRenameOptions struct {
	// CurrentName is the current name of the quality gate (required).
	// Maximum length: 100 characters
	CurrentName string `url:"currentName,omitempty"`
	// Name is the new name of the quality gate (required).
	// Maximum length: 100 characters
	Name string `url:"name,omitempty"`
}

QualitygatesRenameOptions contains options for renaming a quality gate.

type QualitygatesSearch

type QualitygatesSearch struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Results is the list of projects.
	Results []QualityGateProject `json:"results,omitempty"`
}

QualitygatesSearch represents the response from searching for projects.

type QualitygatesSearchGroups

type QualitygatesSearchGroups struct {
	// Groups is the list of groups.
	Groups []QualityGateGroup `json:"groups,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

QualitygatesSearchGroups represents the response from searching for groups.

type QualitygatesSearchGroupsOptions

type QualitygatesSearchGroupsOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// GateName is the name of the quality gate (required).
	GateName string `url:"gateName,omitempty"`
	// Query limits search to group names containing this string (optional).
	Query string `url:"q,omitempty"`
	// Selected filters by selection status (optional, default: selected).
	// Allowed values: all, deselected, selected
	Selected string `url:"selected,omitempty"`
}

QualitygatesSearchGroupsOptions contains options for searching groups.

type QualitygatesSearchOptions

type QualitygatesSearchOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// GateName is the name of the quality gate (required).
	// Maximum length: 100 characters
	GateName string `url:"gateName,omitempty"`
	// Query is the search query for projects (optional).
	// If set, "selected" is set to "all".
	Query string `url:"query,omitempty"`
	// Selected filters by selection status (optional, default: selected).
	// Allowed values: all, deselected, selected
	Selected string `url:"selected,omitempty"`
}

QualitygatesSearchOptions contains options for searching projects.

type QualitygatesSearchUsers

type QualitygatesSearchUsers struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Users is the list of users.
	Users []QualityGateUser `json:"users,omitempty"`
}

QualitygatesSearchUsers represents the response from searching for users.

type QualitygatesSearchUsersOptions

type QualitygatesSearchUsersOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// GateName is the name of the quality gate (required).
	GateName string `url:"gateName,omitempty"`
	// Query limits search to names or logins containing this string (optional).
	Query string `url:"q,omitempty"`
	// Selected filters by selection status (optional, default: selected).
	// Allowed values: all, deselected, selected
	Selected string `url:"selected,omitempty"`
}

QualitygatesSearchUsersOptions contains options for searching users.

type QualitygatesService

type QualitygatesService struct {
	// contains filtered or unexported fields
}

QualitygatesService handles communication with the Quality Gates related methods of the SonarQube API. Quality gates define conditions that projects must meet to pass analysis.

func (*QualitygatesService) AddGroup

AddGroup allows a group of users to edit a quality gate. Requires one of the following permissions:

  • 'Administer Quality Gates'
  • Edit right on the specified quality gate

func (*QualitygatesService) AddUser

AddUser allows a user to edit a quality gate. Requires one of the following permissions:

  • 'Administer Quality Gates'
  • Edit right on the specified quality gate

func (*QualitygatesService) Assign

Assign associates a project to a quality gate. Requires one of the following permissions:

  • 'Administer Quality Gates'
  • 'Administer' right on the specified project

func (*QualitygatesService) Copy

Copy copies a quality gate. Requires the 'Administer Quality Gates' permission.

func (*QualitygatesService) Create

Create creates a quality gate. Requires the 'Administer Quality Gates' permission.

func (*QualitygatesService) CreateCondition

CreateCondition adds a new condition to a quality gate. Requires the 'Administer Quality Gates' permission.

func (*QualitygatesService) Delete

Delete deletes a quality gate. Requires the 'Administer Quality Gates' permission.

func (*QualitygatesService) DeleteCondition

func (s *QualitygatesService) DeleteCondition(ctx context.Context, opt *QualitygatesDeleteConditionOptions) (resp *http.Response, err error)

DeleteCondition deletes a condition from a quality gate. Requires the 'Administer Quality Gates' permission.

func (*QualitygatesService) GetByProject

GetByProject gets the quality gate of a project. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project
  • 'Browse' on the specified project

func (*QualitygatesService) List

func (s *QualitygatesService) List(ctx context.Context) (v *QualitygatesList, resp *http.Response, err error)

List gets a list of quality gates.

func (*QualitygatesService) ProjectStatus

ProjectStatus gets the quality gate status of a project or a Compute Engine task. Either AnalysisID, ProjectID, or ProjectKey must be provided. Returns status: OK, WARN, ERROR, NONE. NONE is returned when there is no quality gate associated with the analysis. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified project
  • 'Browse' on the specified project
  • 'Execute Analysis' on the specified project

func (*QualitygatesService) RemoveGroup

func (s *QualitygatesService) RemoveGroup(ctx context.Context, opt *QualitygatesRemoveGroupOptions) (resp *http.Response, err error)

RemoveGroup removes the ability from a group to edit a quality gate. Requires one of the following permissions:

  • 'Administer Quality Gates'
  • Edit right on the specified quality gate

func (*QualitygatesService) RemoveUser

func (s *QualitygatesService) RemoveUser(ctx context.Context, opt *QualitygatesRemoveUserOptions) (resp *http.Response, err error)

RemoveUser removes the ability from a user to edit a quality gate. Requires one of the following permissions:

  • 'Administer Quality Gates'
  • Edit right on the specified quality gate

func (*QualitygatesService) Rename

Rename renames a quality gate. Requires the 'Administer Quality Gates' permission.

func (*QualitygatesService) Search

Search searches for projects associated (or not) to a quality gate. Only authorized projects for the current user will be returned.

func (*QualitygatesService) SearchAll

SearchAll fetches all pages from Search and returns a flat slice of projects.

func (*QualitygatesService) SearchGroups

SearchGroups lists the groups that are allowed to edit a quality gate. Requires one of the following permissions:

  • 'Administer Quality Gates'
  • Edit right on the specified quality gate

func (*QualitygatesService) SearchGroupsAll

SearchGroupsAll fetches all pages from SearchGroups and returns a flat slice of groups.

func (*QualitygatesService) SearchUsers

SearchUsers lists the users that are allowed to edit a quality gate. Requires one of the following permissions:

  • 'Administer Quality Gates'
  • Edit right on the specified quality gate

func (*QualitygatesService) SearchUsersAll

SearchUsersAll fetches all pages from SearchUsers and returns a flat slice of users.

func (*QualitygatesService) SetDefault

func (s *QualitygatesService) SetDefault(ctx context.Context, opt *QualitygatesSetDefaultOptions) (resp *http.Response, err error)

SetDefault sets a quality gate as the default quality gate. Requires the 'Administer Quality Gates' permission.

func (*QualitygatesService) Show

Show displays the details of a quality gate.

func (*QualitygatesService) Unassign

Unassign removes the association of a project from a quality gate. Requires one of the following permissions:

  • 'Administer Quality Gates'
  • 'Administer' rights on the project

func (*QualitygatesService) UpdateCondition

func (s *QualitygatesService) UpdateCondition(ctx context.Context, opt *QualitygatesUpdateConditionOptions) (resp *http.Response, err error)

UpdateCondition updates a condition attached to a quality gate. Requires the 'Administer Quality Gates' permission.

func (*QualitygatesService) ValidateAddGroupOpt

func (s *QualitygatesService) ValidateAddGroupOpt(opt *QualitygatesAddGroupOptions) error

ValidateAddGroupOpt validates the options for adding a group to a quality gate.

func (*QualitygatesService) ValidateAddUserOpt

func (s *QualitygatesService) ValidateAddUserOpt(opt *QualitygatesAddUserOptions) error

ValidateAddUserOpt validates the options for adding a user to a quality gate.

func (*QualitygatesService) ValidateAssignOpt

func (s *QualitygatesService) ValidateAssignOpt(opt *QualitygatesAssignOptions) error

ValidateAssignOpt validates the options for assigning a project to a quality gate.

func (*QualitygatesService) ValidateCopyOpt

func (s *QualitygatesService) ValidateCopyOpt(opt *QualitygatesCopyOptions) error

ValidateCopyOpt validates the options for copying a quality gate.

func (*QualitygatesService) ValidateCreateConditionOpt

func (s *QualitygatesService) ValidateCreateConditionOpt(opt *QualitygatesCreateConditionOptions) error

ValidateCreateConditionOpt validates the options for creating a condition.

func (*QualitygatesService) ValidateCreateOpt

func (s *QualitygatesService) ValidateCreateOpt(opt *QualitygatesCreateOptions) error

ValidateCreateOpt validates the options for creating a quality gate.

func (*QualitygatesService) ValidateDeleteConditionOpt

func (s *QualitygatesService) ValidateDeleteConditionOpt(opt *QualitygatesDeleteConditionOptions) error

ValidateDeleteConditionOpt validates the options for deleting a condition.

func (*QualitygatesService) ValidateDeleteOpt

func (s *QualitygatesService) ValidateDeleteOpt(opt *QualitygatesDeleteOptions) error

ValidateDeleteOpt validates the options for deleting a quality gate.

func (*QualitygatesService) ValidateGetByProjectOpt

func (s *QualitygatesService) ValidateGetByProjectOpt(opt *QualitygatesGetByProjectOptions) error

ValidateGetByProjectOpt validates the options for getting a project's quality gate.

func (*QualitygatesService) ValidateProjectStatusOpt

func (s *QualitygatesService) ValidateProjectStatusOpt(opt *QualitygatesProjectStatusOptions) error

ValidateProjectStatusOpt validates the options for getting project status.

func (*QualitygatesService) ValidateRemoveGroupOpt

func (s *QualitygatesService) ValidateRemoveGroupOpt(opt *QualitygatesRemoveGroupOptions) error

ValidateRemoveGroupOpt validates the options for removing a group from a quality gate.

func (*QualitygatesService) ValidateRemoveUserOpt

func (s *QualitygatesService) ValidateRemoveUserOpt(opt *QualitygatesRemoveUserOptions) error

ValidateRemoveUserOpt validates the options for removing a user from a quality gate.

func (*QualitygatesService) ValidateRenameOpt

func (s *QualitygatesService) ValidateRenameOpt(opt *QualitygatesRenameOptions) error

ValidateRenameOpt validates the options for renaming a quality gate.

func (*QualitygatesService) ValidateSearchGroupsOpt

func (s *QualitygatesService) ValidateSearchGroupsOpt(opt *QualitygatesSearchGroupsOptions) error

ValidateSearchGroupsOpt validates the options for searching groups.

func (*QualitygatesService) ValidateSearchOpt

func (s *QualitygatesService) ValidateSearchOpt(opt *QualitygatesSearchOptions) error

ValidateSearchOpt validates the options for searching projects.

func (*QualitygatesService) ValidateSearchUsersOpt

func (s *QualitygatesService) ValidateSearchUsersOpt(opt *QualitygatesSearchUsersOptions) error

ValidateSearchUsersOpt validates the options for searching users.

func (*QualitygatesService) ValidateSetDefaultOpt

func (s *QualitygatesService) ValidateSetDefaultOpt(opt *QualitygatesSetDefaultOptions) error

ValidateSetDefaultOpt validates the options for setting a default quality gate.

func (*QualitygatesService) ValidateShowOpt

func (s *QualitygatesService) ValidateShowOpt(opt *QualitygatesShowOptions) error

ValidateShowOpt validates the options for showing a quality gate.

func (*QualitygatesService) ValidateUnassignOpt

func (s *QualitygatesService) ValidateUnassignOpt(opt *QualitygatesUnassignOptions) error

ValidateUnassignOpt validates the options for unassigning a project.

func (*QualitygatesService) ValidateUpdateConditionOpt

func (s *QualitygatesService) ValidateUpdateConditionOpt(opt *QualitygatesUpdateConditionOptions) error

ValidateUpdateConditionOpt validates the options for updating a condition.

type QualitygatesSetDefaultOptions

type QualitygatesSetDefaultOptions struct {
	// Name is the name of the quality gate to set as default (required).
	// Maximum length: 100 characters
	Name string `url:"name,omitempty"`
}

QualitygatesSetDefaultOptions contains options for setting the default gate.

type QualitygatesShow

type QualitygatesShow struct {
	// Actions contains the actions available for this quality gate.
	Actions QualityGateActions `json:"actions,omitzero"`
	// Name is the name of the quality gate.
	Name string `json:"name,omitempty"`
	// CaycStatus is the Clean As You Code status.
	CaycStatus string `json:"caycStatus,omitempty"`
	// Conditions is the list of conditions defined for this quality gate.
	Conditions []QualityGateCondition `json:"conditions,omitempty"`
	// IsAiCodeSupported indicates if the gate supports AI-generated code.
	IsAiCodeSupported bool `json:"isAiCodeSupported,omitempty"`
	// IsBuiltIn indicates if this is a built-in quality gate.
	IsBuiltIn bool `json:"isBuiltIn,omitempty"`
	// IsDefault indicates if this is the default quality gate.
	IsDefault bool `json:"isDefault,omitempty"`
	// HasMQRConditions indicates if the gate has conditions based on the Mode Quality Rating (MQR) metrics.
	HasMQRConditions bool `json:"hasMQRConditions,omitempty"`
	// HasStandardConditions indicates if the gate has conditions based on standard metrics.
	HasStandardConditions bool `json:"hasStandardConditions,omitempty"`
}

QualitygatesShow represents the response from showing a quality gate.

type QualitygatesShowOptions

type QualitygatesShowOptions struct {
	// Name is the name of the quality gate (required).
	Name string `url:"name,omitempty"`
}

QualitygatesShowOptions contains options for showing a quality gate.

type QualitygatesUnassignOptions

type QualitygatesUnassignOptions struct {
	// ProjectKey is the project key (required).
	ProjectKey string `url:"projectKey,omitempty"`
}

QualitygatesUnassignOptions contains options for removing a project association.

type QualitygatesUpdateConditionOptions

type QualitygatesUpdateConditionOptions struct {
	// Error is the condition error threshold (required).
	// Maximum length: 64 characters
	Error string `url:"error,omitempty"`
	// ID is the condition ID (required).
	ID string `url:"id,omitempty"`
	// Metric is the condition metric (required).
	// Only metrics of the following types are allowed: INT, MILLISEC, RATING, WORK_DUR, FLOAT, PERCENT, LEVEL.
	// Forbidden metrics: alert_status, security_hotspots, new_security_hotspots.
	Metric string `url:"metric,omitempty"`
	// Op is the condition operator (optional).
	// Allowed values: LT (is lower than), GT (is greater than)
	Op string `url:"op,omitempty"`
}

QualitygatesUpdateConditionOptions contains options for updating a condition.

type QualityprofilesActions

type QualityprofilesActions struct {
	// Create indicates if the current user can create quality profiles.
	Create bool `json:"create,omitempty"`
}

QualityprofilesActions represents global actions for quality profiles.

type QualityprofilesActivateRuleOptions

type QualityprofilesActivateRuleOptions struct {
	// Key is the quality profile key (required).
	Key string `url:"key,omitempty"`
	// Rule is the rule key (required).
	Rule string `url:"rule,omitempty"`
	// Impacts is the override of impact severities (e.g., "MAINTAINABILITY=HIGH;SECURITY=MEDIUM").
	// Cannot be used at the same time as Severity.
	Impacts map[string]string `url:"impacts,omitempty"`
	// Params is the parameters as semi-colon separated key=value pairs.
	// Ignored if Reset is true.
	Params map[string]string `url:"params,omitempty"`
	// PrioritizedRule marks the activated rule as prioritized.
	PrioritizedRule bool `url:"prioritizedRule,omitempty"`
	// Reset resets severity and parameters to parent profile or rule defaults.
	Reset bool `url:"reset,omitempty"`
	// Severity is the severity level.
	// Cannot be used at the same time as Impacts.
	// Possible values: INFO, MINOR, MAJOR, CRITICAL, BLOCKER
	Severity string `url:"severity,omitempty"`
}

QualityprofilesActivateRuleOptions contains options for activating a rule.

type QualityprofilesActivateRulesOptions

type QualityprofilesActivateRulesOptions struct {
	// TargetKey is the quality profile key on which rules are activated (required).
	TargetKey string `url:"targetKey,omitempty"`
	// Activation filters rules that are activated or deactivated on the selected quality profile.
	Activation bool `url:"activation,omitempty"`
	// ActiveImpactSeverities filters by activation software quality severities.
	// Allowed values: 'INFO', 'LOW', 'MEDIUM', 'HIGH', 'BLOCKER'
	ActiveImpactSeverities []string `url:"active_impactSeverities,omitempty,comma"`
	// ActiveSeverities filters by activation severities.
	// Allowed values: 'INFO', 'MINOR', 'MAJOR', 'CRITICAL', 'BLOCKER'
	ActiveSeverities []string `url:"active_severities,omitempty,comma"`
	// Asc indicates ascending sort.
	Asc bool `url:"asc,omitempty"`
	// AvailableSince filters rules added since date (format: yyyy-MM-dd).
	AvailableSince string `url:"available_since,omitempty"`
	// CleanCodeAttributeCategories filters by clean code attribute categories.
	// Allowed values: 'ADAPTABLE', 'CONSISTENT', 'INTENTIONAL', 'RESPONSIBLE'
	CleanCodeAttributeCategories []string `url:"cleanCodeAttributeCategories,omitempty,comma"`
	// CompareToProfile is a quality profile key to filter rules that are activated.
	// WARNING: This parameter is internal and may change without notice.
	CompareToProfile string `url:"compareToProfile,omitempty"`
	// Cwe filters by CWE identifiers.
	Cwe []string `url:"cwe,omitempty,comma"`
	// ImpactSeverities filters by software quality severities.
	// Allowed values: 'INFO', 'LOW', 'MEDIUM', 'HIGH', 'BLOCKER'
	ImpactSeverities []string `url:"impactSeverities,omitempty,comma"`
	// ImpactSoftwareQualities filters by software qualities.
	// Allowed values: 'MAINTAINABILITY', 'RELIABILITY', 'SECURITY',
	ImpactSoftwareQualities []string `url:"impactSoftwareQualities,omitempty,comma"`
	// Inheritance filters by inheritance for a rule within a quality profile.
	// Allowed values: 'NONE', 'INHERITED', 'OVERIDDES'
	Inheritance []string `url:"inheritance,omitempty,comma"`
	// IsTemplate filters template rules.
	IsTemplate bool `url:"is_template,omitempty"`
	// Languages filters by languages.
	Languages []string `url:"languages,omitempty,comma"`
	// OwaspMobileTop102024 filters by OWASP Mobile Top 10 2024 categories.
	// Allowed values: 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'
	OwaspMobileTop102024 []string `url:"owaspMobileTop10-2024,omitempty,comma"`
	// OwaspTop10 filters by OWASP Top 10 2017 categories.
	// Allowed values: 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10'
	OwaspTop10 []string `url:"owaspTop10,omitempty,comma"`
	// OwaspTop102021 filters by OWASP Top 10 2021 categories.
	// Allowed values: 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10'
	OwaspTop102021 []string `url:"owaspTop10-2021,omitempty,comma"`
	// PrioritizedRule marks activated rules as prioritized.
	PrioritizedRule bool `url:"prioritizedRule,omitempty"`
	// Query is the UTF-8 search query.
	Query string `url:"q,omitempty"`
	// Qprofile is the quality profile key to filter on.
	Qprofile string `url:"qprofile,omitempty"`
	// Repositories filters by repositories.
	Repositories []string `url:"repositories,omitempty,comma"`
	// RuleKey filters by rule key.
	RuleKey string `url:"rule_key,omitempty"`
	// Sort is the sort field.
	// Allowed values: 'updatedAt', 'key', 'name', 'createdAt'
	Sort string `url:"s,omitempty"`
	// SansTop25 filters by SANS Top 25 categories.
	//
	// Deprecated: Since SonarQube 10.0.
	// Allowed values: 'insecure-interaction', 'risky-resource', 'porous-defenses'
	SansTop25 []string `url:"sansTop25,omitempty,comma"`
	// Severities filters by default severities.
	// Allowed values: 'INFO', 'MINOR', 'MAJOR', 'CRITICAL', 'BLOCKER'
	Severities []string `url:"severities,omitempty,comma"`
	// SonarsourceSecurity filters by SonarSource security categories.
	// Allowed values: 'buffer-overflow', 'sql-injection', 'rce', 'object-injection',
	// 'command-injection', 'path-traversal-injection', 'ldap-injection', 'xpath-injection',
	// 'log-injection', 'xxe', 'xss', 'dos', 'ssrf', 'csrf', 'http-response-splitting',
	// 'open-redirect', 'weak-cryptography', 'auth', 'insecure-conf', 'file-manipulation',
	// 'encrypt-data', 'traceability', 'permission', 'others'
	SonarsourceSecurity []string `url:"sonarsourceSecurity,omitempty,comma"`
	// Statuses filters by status codes.
	// Allowed values: 'READY', 'DEPRECATED', 'REMOVED', 'BETA'
	Statuses []string `url:"statuses,omitempty,comma"`
	// Tags filters by tags.
	Tags []string `url:"tags,omitempty,comma"`
	// TargetSeverity is the severity to set on the activated rules.
	// Allowed values: 'INFO', 'MINOR', 'MAJOR', 'CRITICAL', 'BLOCKER'
	TargetSeverity string `url:"targetSeverity,omitempty"`
	// TemplateKey is the template rule key to filter on.
	TemplateKey string `url:"template_key,omitempty"`
	// Types filters by types.
	// Allowed values: 'CODE_SMELL', 'BUG', 'VULNERABILITY', 'SECURITY_HOTSPOT'
	Types []string `url:"types,omitempty,comma"`
}

QualityprofilesActivateRulesOptions contains options for bulk activating rules.

type QualityprofilesAddGroupOptions

type QualityprofilesAddGroupOptions struct {
	// Group is the group name (required).
	Group string `url:"group,omitempty"`
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesAddGroupOptions contains options for allowing a group to edit a profile.

type QualityprofilesAddProjectOptions

type QualityprofilesAddProjectOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// Project is the project key (required).
	Project string `url:"project,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesAddProjectOptions contains options for associating a project.

type QualityprofilesAddUserOptions

type QualityprofilesAddUserOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// Login is the user login (required).
	Login string `url:"login,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesAddUserOptions contains options for allowing a user to edit a profile.

type QualityprofilesBackupOptions

type QualityprofilesBackupOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesBackupOptions contains options for backing up a profile.

type QualityprofilesChangeParentOptions

type QualityprofilesChangeParentOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
	// ParentQualityProfile is the new parent profile name.
	// If not provided, breaks the inheritance link with the current parent.
	ParentQualityProfile string `url:"parentQualityProfile,omitempty"`
}

QualityprofilesChangeParentOptions contains options for changing a profile's parent.

type QualityprofilesChangelog

type QualityprofilesChangelog struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Events is the list of changelog events.
	Events []ChangelogEvent `json:"events,omitempty"`
	// Page is the current page number (legacy duplicate of Paging.PageIndex).
	Page int64 `json:"p,omitempty"`
	// PageSize is the page size (legacy duplicate of Paging.PageSize).
	PageSize int64 `json:"ps,omitempty"`
	// Total is the total number of events (legacy duplicate of Paging.Total).
	Total int64 `json:"total,omitempty"`
}

QualityprofilesChangelog represents the response from getting a quality profile's changelog.

type QualityprofilesChangelogOptions

type QualityprofilesChangelogOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
	// FilterMode filters events by mode
	// Allowed values: 'MQR', 'STANDARD'
	FilterMode string `url:"filterMode,omitempty"`
	// Since is the start date for the changelog (inclusive).
	Since string `url:"since,omitempty"`
	// To is the end date for the changelog (exclusive).
	To string `url:"to,omitempty"`
}

QualityprofilesChangelogOptions contains options for getting a profile's changelog.

type QualityprofilesCompare

type QualityprofilesCompare struct {
	// Left contains information about the left profile.
	Left QualityprofilesCompareProfile `json:"left,omitzero"`
	// Right contains information about the right profile.
	Right QualityprofilesCompareProfile `json:"right,omitzero"`
	// InLeft contains rules only in the left profile.
	InLeft []QualityprofilesCompareRule `json:"inLeft,omitempty"`
	// InRight contains rules only in the right profile.
	InRight []QualityprofilesCompareRule `json:"inRight,omitempty"`
	// Modified contains rules that differ between profiles.
	Modified []QualityprofilesCompareModifiedRule `json:"modified,omitempty"`
	// Same contains rules that are the same in both profiles.
	Same []QualityprofilesCompareRule `json:"same,omitempty"`
}

QualityprofilesCompare represents the response from comparing two quality profiles.

type QualityprofilesCompareModifiedRule

type QualityprofilesCompareModifiedRule struct {
	// Key is the rule key.
	Key string `json:"key,omitempty"`
	// Name is the rule name.
	Name string `json:"name,omitempty"`
	// PluginKey is the plugin key.
	PluginKey string `json:"pluginKey,omitempty"`
	// PluginName is the plugin name.
	PluginName string `json:"pluginName,omitempty"`
	// LanguageKey is the language key.
	LanguageKey string `json:"languageKey,omitempty"`
	// LanguageName is the language name.
	LanguageName string `json:"languageName,omitempty"`
	// Left contains the left profile's settings for this rule.
	Left QualityprofilesRuleSetting `json:"left,omitzero"`
	// Right contains the right profile's settings for this rule.
	Right QualityprofilesRuleSetting `json:"right,omitzero"`
}

QualityprofilesCompareModifiedRule represents a modified rule in a comparison response.

type QualityprofilesCompareOptions

type QualityprofilesCompareOptions struct {
	// LeftKey is the left profile key (required).
	LeftKey string `url:"leftKey,omitempty"`
	// RightKey is the right profile key (required).
	RightKey string `url:"rightKey,omitempty"`
}

QualityprofilesCompareOptions contains options for comparing two profiles. WARNING: This endpoint is internal and may change without notice.

type QualityprofilesCompareProfile

type QualityprofilesCompareProfile struct {
	// Key is the unique key of the profile.
	Key string `json:"key,omitempty"`
	// Name is the name of the profile.
	Name string `json:"name,omitempty"`
}

QualityprofilesCompareProfile represents a profile in a comparison response.

type QualityprofilesCompareRule

type QualityprofilesCompareRule struct {
	// Key is the rule key.
	Key string `json:"key,omitempty"`
	// Name is the rule name.
	Name string `json:"name,omitempty"`
	// PluginKey is the plugin key.
	PluginKey string `json:"pluginKey,omitempty"`
	// PluginName is the plugin name.
	PluginName string `json:"pluginName,omitempty"`
	// LanguageKey is the language key.
	LanguageKey string `json:"languageKey,omitempty"`
	// LanguageName is the language name.
	LanguageName string `json:"languageName,omitempty"`
}

QualityprofilesCompareRule represents a rule in a comparison response.

type QualityprofilesCopy

type QualityprofilesCopy struct {
	// Key is the unique key of the new profile.
	Key string `json:"key,omitempty"`
	// Name is the name of the new profile.
	Name string `json:"name,omitempty"`
	// Language is the language of the new profile.
	Language string `json:"language,omitempty"`
	// LanguageName is the display name of the language.
	LanguageName string `json:"languageName,omitempty"`
	// ParentKey is the key of the parent profile.
	ParentKey string `json:"parentKey,omitempty"`
	// IsDefault indicates if this is the default profile.
	IsDefault bool `json:"isDefault,omitempty"`
	// IsInherited indicates if this profile inherits from another.
	IsInherited bool `json:"isInherited,omitempty"`
}

QualityprofilesCopy represents the response from copying a quality profile.

type QualityprofilesCopyOptions

type QualityprofilesCopyOptions struct {
	// FromKey is the source quality profile key (required).
	FromKey string `url:"fromKey,omitempty"`
	// ToName is the name for the new quality profile (required).
	// Maximum length: 100 characters
	ToName string `url:"toName,omitempty"`
}

QualityprofilesCopyOptions contains options for copying a profile.

type QualityprofilesCreate

type QualityprofilesCreate struct {
	// Profile contains the created profile details.
	Profile QualityprofilesCreatedProfile `json:"profile,omitzero"`
}

QualityprofilesCreate represents the response from creating a quality profile.

type QualityprofilesCreateOptions

type QualityprofilesCreateOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// Name is the quality profile name (required).
	// Maximum length: 100 characters
	Name string `url:"name,omitempty"`
}

QualityprofilesCreateOptions contains options for creating a profile.

type QualityprofilesCreatedProfile

type QualityprofilesCreatedProfile struct {
	// Key is the unique key of the profile.
	Key string `json:"key,omitempty"`
	// Name is the name of the profile.
	Name string `json:"name,omitempty"`
	// Language is the language of the profile.
	Language string `json:"language,omitempty"`
	// LanguageName is the display name of the language.
	LanguageName string `json:"languageName,omitempty"`
	// IsDefault indicates if this is the default profile.
	IsDefault bool `json:"isDefault,omitempty"`
	// IsInherited indicates if this profile inherits from another.
	IsInherited bool `json:"isInherited,omitempty"`
}

QualityprofilesCreatedProfile represents a newly created quality profile.

type QualityprofilesDeactivateRuleOptions

type QualityprofilesDeactivateRuleOptions struct {
	// Key is the quality profile key (required).
	Key string `url:"key,omitempty"`
	// Rule is the rule key (required).
	Rule string `url:"rule,omitempty"`
}

QualityprofilesDeactivateRuleOptions contains options for deactivating a rule.

type QualityprofilesDeactivateRulesOptions

type QualityprofilesDeactivateRulesOptions struct {
	// TargetKey is the quality profile key on which rules are deactivated (required).
	TargetKey string `url:"targetKey,omitempty"`
	// Activation filters rules that are activated or deactivated on the selected quality profile.
	Activation bool `url:"activation,omitempty"`
	// ActiveImpactSeverities filters by activation software quality severities.
	ActiveImpactSeverities string `url:"active_impactSeverities,omitempty"`
	// ActiveSeverities filters by activation severities.
	ActiveSeverities string `url:"active_severities,omitempty"`
	// Asc indicates ascending sort.
	Asc bool `url:"asc,omitempty"`
	// AvailableSince filters rules added since date (format: yyyy-MM-dd).
	AvailableSince string `url:"available_since,omitempty"`
	// CleanCodeAttributeCategories filters by clean code attribute categories.
	// Allowed values: 'ADAPTABLE', 'CONSISTENT', 'INTENTIONAL', 'RESPONSIBLE'
	CleanCodeAttributeCategories []string `url:"cleanCodeAttributeCategories,omitempty,comma"`
	// CompareToProfile is a quality profile key to filter rules that are activated.
	// WARNING: This parameter is internal and may change without notice.
	CompareToProfile string `url:"compareToProfile,omitempty"`
	// Cwe filters by CWE identifiers.
	Cwe []string `url:"cwe,omitempty,comma"`
	// ImpactSeverities filters by software quality severities.
	// Allowed values: 'INFO', 'LOW', 'MEDIUM', 'HIGH', 'BLOCKER'
	ImpactSeverities []string `url:"impactSeverities,omitempty,comma"`
	// ImpactSoftwareQualities filters by software qualities.
	// Allowed values: 'MAINTAINABILITY', 'RELIABILITY', 'SECURITY',
	ImpactSoftwareQualities []string `url:"impactSoftwareQualities,omitempty,comma"`
	// Inheritance filters by inheritance for a rule within a quality profile.
	// Allowed values: 'NONE', 'INHERITED', 'OVERIDDES'
	Inheritance []string `url:"inheritance,omitempty,comma"`
	// IsTemplate filters template rules.
	IsTemplate bool `url:"is_template,omitempty"`
	// Languages filters by languages.
	Languages []string `url:"languages,omitempty,comma"`
	// OwaspMobileTop102024 filters by OWASP Mobile Top 10 2024 categories.
	// Allowed values: 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 'm7', 'm8', 'm9', 'm10'
	OwaspMobileTop102024 []string `url:"owaspMobileTop10-2024,omitempty,comma"`
	// OwaspTop10 filters by OWASP Top 10 2017 categories.
	// Allowed values: 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10'
	OwaspTop10 []string `url:"owaspTop10,omitempty,comma"`
	// OwaspTop102021 filters by OWASP Top 10 2021 categories.
	// Allowed values: 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'a7', 'a8', 'a9', 'a10'
	OwaspTop102021 []string `url:"owaspTop10-2021,omitempty,comma"`
	// Query is the UTF-8 search query.
	Query string `url:"q,omitempty"`
	// Qprofile is the quality profile key to filter on.
	Qprofile string `url:"qprofile,omitempty"`
	// Repositories filters by repositories.
	Repositories []string `url:"repositories,omitempty,comma"`
	// RuleKey filters by rule key.
	RuleKey string `url:"rule_key,omitempty"`
	// Sort is the sort field.
	// Allowed values: 'updatedAt', 'key', 'name', 'createdAt'
	Sort string `url:"s,omitempty"`
	// SansTop25 filters by SANS Top 25 categories.
	//
	// Deprecated: Since SonarQube 10.0.
	// Allowed values: 'insecure-interaction', 'risky-resource', 'porous-defenses'
	SansTop25 []string `url:"sansTop25,omitempty,comma"`
	// Severities filters by default severities.
	// Allowed values: 'INFO', 'MINOR', 'MAJOR', 'CRITICAL', 'BLOCKER'
	Severities []string `url:"severities,omitempty,comma"`
	// SonarsourceSecurity filters by SonarSource security categories.
	// Allowed values: 'buffer-overflow', 'sql-injection', 'rce', 'object-injection',
	// 'command-injection', 'path-traversal-injection', 'ldap-injection', 'xpath-injection',
	// 'log-injection', 'xxe', 'xss', 'dos', 'ssrf', 'csrf', 'http-response-splitting',
	// 'open-redirect', 'weak-cryptography', 'auth', 'insecure-conf', 'file-manipulation',
	// 'encrypt-data', 'traceability', 'permission', 'others'
	SonarsourceSecurity []string `url:"sonarsourceSecurity,omitempty,comma"`
	// Statuses filters by status codes.
	// Allowed values: 'READY', 'DEPRECATED', 'REMOVED', 'BETA'
	Statuses []string `url:"statuses,omitempty,comma"`
	// Tags filters by tags.
	Tags []string `url:"tags,omitempty,comma"`
	// TemplateKey is the template rule key to filter on.
	TemplateKey string `url:"template_key,omitempty"`
	// Types filters by types.
	// Allowed values: 'CODE_SMELL', 'BUG', 'VULNERABILITY', 'SECURITY_HOTSPOT'
	Types []string `url:"types,omitempty,comma"`
}

QualityprofilesDeactivateRulesOptions contains options for bulk deactivating rules. Uses the same filter parameters as QualityprofilesActivateRulesOption.

type QualityprofilesDeleteOptions

type QualityprofilesDeleteOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesDeleteOptions contains options for deleting a profile.

type QualityprofilesExportOptions deprecated

type QualityprofilesExportOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name.
	// If empty, the default profile for the language is exported.
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesExportOptions contains options for exporting a profile.

Deprecated: Since SonarQube 25.4. Use Backup instead.

type QualityprofilesExporter

type QualityprofilesExporter struct {
	// Key is the unique key of the exporter.
	Key string `json:"key,omitempty"`
	// Name is the name of the exporter.
	Name string `json:"name,omitempty"`
	// Languages is the list of supported languages.
	Languages []string `json:"languages,omitempty"`
}

QualityprofilesExporter represents a quality profile exporter.

type QualityprofilesExporters deprecated

type QualityprofilesExporters struct {
	// Exporters is the list of available exporters.
	Exporters []QualityprofilesExporter `json:"exporters,omitempty"`
}

QualityprofilesExporters represents the response from listing exporters.

Deprecated: No more custom profile exporters since SonarQube 25.4.

type QualityprofilesImporter

type QualityprofilesImporter struct {
	// Key is the unique key of the importer.
	Key string `json:"key,omitempty"`
	// Name is the name of the importer.
	Name string `json:"name,omitempty"`
	// Languages is the list of supported languages.
	Languages []string `json:"languages,omitempty"`
}

QualityprofilesImporter represents a quality profile importer.

type QualityprofilesImporters deprecated

type QualityprofilesImporters struct {
	// Importers is the list of available importers.
	Importers []QualityprofilesImporter `json:"importers,omitempty"`
}

QualityprofilesImporters represents the response from listing importers.

Deprecated: Since SonarQube 25.4.

type QualityprofilesInheritance

type QualityprofilesInheritance struct {
	// Profile contains the current profile information.
	Profile QualityprofilesInheritanceProfile `json:"profile,omitzero"`
	// Ancestors contains the ancestor profiles.
	Ancestors []QualityprofilesInheritanceProfile `json:"ancestors,omitempty"`
	// Children contains the child profiles.
	Children []QualityprofilesInheritanceProfile `json:"children,omitempty"`
}

QualityprofilesInheritance represents the response from getting inheritance info.

type QualityprofilesInheritanceOptions

type QualityprofilesInheritanceOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesInheritanceOptions contains options for getting inheritance info.

type QualityprofilesInheritanceProfile

type QualityprofilesInheritanceProfile struct {
	// Key is the unique key of the profile.
	Key string `json:"key,omitempty"`
	// Name is the name of the profile.
	Name string `json:"name,omitempty"`
	// ActiveRuleCount is the number of active rules.
	ActiveRuleCount int64 `json:"activeRuleCount,omitempty"`
	// InactiveRuleCount is the number of inactive rules.
	InactiveRuleCount int64 `json:"inactiveRuleCount,omitempty"`
	// OverridingRuleCount is the number of overriding rules.
	OverridingRuleCount int64 `json:"overridingRuleCount,omitempty"`
	// IsBuiltIn indicates if this is a built-in profile.
	IsBuiltIn bool `json:"isBuiltIn,omitempty"`
	// Parent is the key of the parent profile, present on the current profile entry.
	Parent string `json:"parent,omitempty"`
}

QualityprofilesInheritanceProfile represents a profile in an inheritance hierarchy.

type QualityprofilesProfileGroup

type QualityprofilesProfileGroup struct {
	// Name is the name of the group.
	Name string `json:"name,omitempty"`
	// Description is the description of the group.
	Description string `json:"description,omitempty"`
	// Selected indicates if the group is allowed to edit the profile.
	Selected bool `json:"selected,omitempty"`
}

QualityprofilesProfileGroup represents a group that can edit a quality profile.

type QualityprofilesProfileProject

type QualityprofilesProfileProject struct {
	// Key is the unique key of the project.
	Key string `json:"key,omitempty"`
	// Name is the name of the project.
	Name string `json:"name,omitempty"`
	// Selected indicates if the project is explicitly bound to the profile.
	Selected bool `json:"selected,omitempty"`
}

QualityprofilesProfileProject represents a project associated with a quality profile.

type QualityprofilesProfileUser

type QualityprofilesProfileUser struct {
	// Login is the login name of the user.
	Login string `json:"login,omitempty"`
	// Name is the display name of the user.
	Name string `json:"name,omitempty"`
	// Avatar is the avatar URL of the user.
	Avatar string `json:"avatar,omitempty"`
	// Selected indicates if the user is allowed to edit the profile.
	Selected bool `json:"selected,omitempty"`
}

QualityprofilesProfileUser represents a user that can edit a quality profile.

type QualityprofilesProjects

type QualityprofilesProjects struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Results contains the list of projects.
	Results []QualityprofilesProfileProject `json:"results,omitempty"`
}

QualityprofilesProjects represents the response from listing associated projects.

type QualityprofilesProjectsOptions

type QualityprofilesProjectsOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// Key is the quality profile key (required).
	Key string `url:"key,omitempty"`
	// Query limits search to projects containing this string.
	Query string `url:"q,omitempty"`
	// Selected filters by selection status.
	// Allowed values: all, deselected, selected
	Selected string `url:"selected,omitempty"`
}

QualityprofilesProjectsOptions contains options for listing associated projects.

type QualityprofilesRemoveGroupOptions

type QualityprofilesRemoveGroupOptions struct {
	// Group is the group name (required).
	Group string `url:"group,omitempty"`
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesRemoveGroupOptions contains options for removing group permissions.

type QualityprofilesRemoveProjectOptions

type QualityprofilesRemoveProjectOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// Project is the project key (required).
	Project string `url:"project,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesRemoveProjectOptions contains options for removing a project association.

type QualityprofilesRemoveUserOptions

type QualityprofilesRemoveUserOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// Login is the user login (required).
	Login string `url:"login,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesRemoveUserOptions contains options for removing user permissions.

type QualityprofilesRenameOptions

type QualityprofilesRenameOptions struct {
	// Key is the quality profile key (required).
	Key string `url:"key,omitempty"`
	// Name is the new quality profile name (required).
	// Maximum length: 100 characters
	Name string `url:"name,omitempty"`
}

QualityprofilesRenameOptions contains options for renaming a profile.

type QualityprofilesRestoreOptions

type QualityprofilesRestoreOptions struct {
	// Backup is the profile backup file content in XML format (required).
	Backup string `url:"backup,omitempty"`
}

QualityprofilesRestoreOptions contains options for restoring a profile from backup.

type QualityprofilesRuleSetting

type QualityprofilesRuleSetting struct {
	// Params contains the rule parameters.
	Params map[string]string `json:"params,omitempty"`
}

QualityprofilesRuleSetting represents the settings for a rule in a profile.

type QualityprofilesSearch

type QualityprofilesSearch struct {
	// Actions contains global actions available.
	Actions QualityprofilesActions `json:"actions,omitzero"`
	// Profiles is the list of quality profiles.
	Profiles []QualityProfile `json:"profiles,omitempty"`
}

QualityprofilesSearch represents the response from searching quality profiles.

type QualityprofilesSearchGroups

type QualityprofilesSearchGroups struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Groups is the list of groups.
	Groups []QualityprofilesProfileGroup `json:"groups,omitempty"`
}

QualityprofilesSearchGroups represents the response from searching groups.

type QualityprofilesSearchGroupsOptions

type QualityprofilesSearchGroupsOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
	// Query limits search to group names containing this string.
	Query string `url:"q,omitempty"`
	// Selected filters by selection status.
	// Allowed values: all, deselected, selected
	Selected string `url:"selected,omitempty"`
}

QualityprofilesSearchGroupsOptions contains options for searching groups. WARNING: This endpoint is internal and may change without notice.

type QualityprofilesSearchOptions

type QualityprofilesSearchOptions struct {
	// Defaults returns only default profiles if true.
	Defaults bool `url:"defaults,omitempty"`
	// Language is the quality profile language.
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// Project is the project key.
	Project string `url:"project,omitempty"`
	// QualityProfile is the quality profile name.
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesSearchOptions contains options for searching profiles.

type QualityprofilesSearchUsers

type QualityprofilesSearchUsers struct {
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Users is the list of users.
	Users []QualityprofilesProfileUser `json:"users,omitempty"`
}

QualityprofilesSearchUsers represents the response from searching users.

type QualityprofilesSearchUsersOptions

type QualityprofilesSearchUsersOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// Language is the quality profile language (required).
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
	// Query limits search to names or logins containing this string.
	Query string `url:"q,omitempty"`
	// Selected filters by selection status.
	// Allowed values: all, deselected, selected
	Selected string `url:"selected,omitempty"`
}

QualityprofilesSearchUsersOptions contains options for searching users.

type QualityprofilesService

type QualityprofilesService struct {
	// contains filtered or unexported fields
}

QualityprofilesService handles communication with the Quality Profiles related methods of the SonarQube API. Quality profiles define sets of rules that are applied to projects during analysis.

func (*QualityprofilesService) ActivateRule

ActivateRule activates a rule on a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) ActivateRules

ActivateRules bulk-activates rules on one quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) AddGroup

AddGroup allows a group to edit a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) AddProject

AddProject associates a project with a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Administer right on the specified project

func (*QualityprofilesService) AddUser

AddUser allows a user to edit a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) Backup

Backup backs up a quality profile in XML form. The exported profile can be restored through Restore.

func (*QualityprofilesService) ChangeParent

ChangeParent changes a quality profile's parent. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) Changelog

Changelog gets the history of changes on a quality profile. Events are ordered by date in descending order (most recent first).

func (*QualityprofilesService) ChangelogAll

ChangelogAll fetches all pages from Changelog and returns a flat slice of events.

func (*QualityprofilesService) Compare

Compare compares two quality profiles.

func (*QualityprofilesService) Copy

Copy copies a quality profile. Requires the 'Administer Quality Profiles' permission.

func (*QualityprofilesService) Create

Create creates a quality profile. Requires the 'Administer Quality Profiles' permission.

func (*QualityprofilesService) DeactivateRule

DeactivateRule deactivates a rule on a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) DeactivateRules

DeactivateRules bulk-deactivates rules on quality profiles. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) Delete

Delete deletes a quality profile and all its descendants. The default quality profile cannot be deleted. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) Export deprecated

Export exports a quality profile.

Deprecated: Since SonarQube 25.4. Use Backup instead.

func (*QualityprofilesService) Exporters deprecated

Exporters lists quality profile exporters.

Deprecated: No more custom profile exporters since SonarQube 25.4.

func (*QualityprofilesService) Importers deprecated

Importers lists supported quality profile importers.

Deprecated: Since SonarQube 25.4.

func (*QualityprofilesService) Inheritance

Inheritance shows a quality profile's ancestors and children.

func (*QualityprofilesService) Projects

Projects lists projects with their association status regarding a quality profile. Only projects explicitly bound to the profile are returned.

func (*QualityprofilesService) ProjectsAll

ProjectsAll fetches all pages from Projects and returns a flat slice of projects.

func (*QualityprofilesService) RemoveGroup

RemoveGroup removes the ability from a group to edit a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) RemoveProject

RemoveProject removes a project's association with a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile
  • Administer right on the specified project

func (*QualityprofilesService) RemoveUser

RemoveUser removes the ability from a user to edit a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) Rename

Rename renames a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) Restore

Restore restores a quality profile using an XML file. The restored profile name is taken from the backup file. If a profile with the same name and language exists, it will be overwritten. Requires the 'Administer Quality Profiles' permission.

func (*QualityprofilesService) Search

Search searches for quality profiles.

func (*QualityprofilesService) SearchGroups

SearchGroups lists the groups that are allowed to edit a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) SearchGroupsAll

SearchGroupsAll fetches all pages from SearchGroups and returns a flat slice of groups.

func (*QualityprofilesService) SearchUsers

SearchUsers lists the users that are allowed to edit a quality profile. Requires one of the following permissions:

  • 'Administer Quality Profiles'
  • Edit right on the specified quality profile

func (*QualityprofilesService) SearchUsersAll

SearchUsersAll fetches all pages from SearchUsers and returns a flat slice of users.

func (*QualityprofilesService) SetDefault

SetDefault selects the default profile for a given language. Requires the 'Administer Quality Profiles' permission.

func (*QualityprofilesService) Show

Show shows a quality profile.

func (*QualityprofilesService) ValidateActivateRuleOpt

func (s *QualityprofilesService) ValidateActivateRuleOpt(opt *QualityprofilesActivateRuleOptions) error

ValidateActivateRuleOpt validates the options for activating a rule.

func (*QualityprofilesService) ValidateActivateRulesOpt

func (s *QualityprofilesService) ValidateActivateRulesOpt(opt *QualityprofilesActivateRulesOptions) error

ValidateActivateRulesOpt validates the options for bulk activating rules.

func (*QualityprofilesService) ValidateAddGroupOpt

func (s *QualityprofilesService) ValidateAddGroupOpt(opt *QualityprofilesAddGroupOptions) error

ValidateAddGroupOpt validates the options for adding a group to a quality profile.

func (*QualityprofilesService) ValidateAddProjectOpt

func (s *QualityprofilesService) ValidateAddProjectOpt(opt *QualityprofilesAddProjectOptions) error

ValidateAddProjectOpt validates the options for associating a project.

func (*QualityprofilesService) ValidateAddUserOpt

func (s *QualityprofilesService) ValidateAddUserOpt(opt *QualityprofilesAddUserOptions) error

ValidateAddUserOpt validates the options for adding a user to a quality profile.

func (*QualityprofilesService) ValidateBackupOpt

func (s *QualityprofilesService) ValidateBackupOpt(opt *QualityprofilesBackupOptions) error

ValidateBackupOpt validates the options for backing up a profile.

func (*QualityprofilesService) ValidateChangeParentOpt

func (s *QualityprofilesService) ValidateChangeParentOpt(opt *QualityprofilesChangeParentOptions) error

ValidateChangeParentOpt validates the options for changing a profile's parent.

func (*QualityprofilesService) ValidateChangelogOpt

func (s *QualityprofilesService) ValidateChangelogOpt(opt *QualityprofilesChangelogOptions) error

ValidateChangelogOpt validates the options for getting a profile's changelog.

func (*QualityprofilesService) ValidateCompareOpt

func (s *QualityprofilesService) ValidateCompareOpt(opt *QualityprofilesCompareOptions) error

ValidateCompareOpt validates the options for comparing two profiles.

func (*QualityprofilesService) ValidateCopyOpt

func (s *QualityprofilesService) ValidateCopyOpt(opt *QualityprofilesCopyOptions) error

ValidateCopyOpt validates the options for copying a profile.

func (*QualityprofilesService) ValidateCreateOpt

func (s *QualityprofilesService) ValidateCreateOpt(opt *QualityprofilesCreateOptions) error

ValidateCreateOpt validates the options for creating a profile.

func (*QualityprofilesService) ValidateDeactivateRuleOpt

func (s *QualityprofilesService) ValidateDeactivateRuleOpt(opt *QualityprofilesDeactivateRuleOptions) error

ValidateDeactivateRuleOpt validates the options for deactivating a rule.

func (*QualityprofilesService) ValidateDeactivateRulesOpt

func (s *QualityprofilesService) ValidateDeactivateRulesOpt(opt *QualityprofilesDeactivateRulesOptions) error

ValidateDeactivateRulesOpt validates the options for bulk deactivating rules.

func (*QualityprofilesService) ValidateDeleteOpt

func (s *QualityprofilesService) ValidateDeleteOpt(opt *QualityprofilesDeleteOptions) error

ValidateDeleteOpt validates the options for deleting a profile.

func (*QualityprofilesService) ValidateExportOpt

func (s *QualityprofilesService) ValidateExportOpt(opt *QualityprofilesExportOptions) error

ValidateExportOpt validates the options for exporting a profile.

func (*QualityprofilesService) ValidateInheritanceOpt

func (s *QualityprofilesService) ValidateInheritanceOpt(opt *QualityprofilesInheritanceOptions) error

ValidateInheritanceOpt validates the options for getting inheritance info.

func (*QualityprofilesService) ValidateProjectsOpt

func (s *QualityprofilesService) ValidateProjectsOpt(opt *QualityprofilesProjectsOptions) error

ValidateProjectsOpt validates the options for listing associated projects.

func (*QualityprofilesService) ValidateRemoveGroupOpt

func (s *QualityprofilesService) ValidateRemoveGroupOpt(opt *QualityprofilesRemoveGroupOptions) error

ValidateRemoveGroupOpt validates the options for removing group permissions.

func (*QualityprofilesService) ValidateRemoveProjectOpt

func (s *QualityprofilesService) ValidateRemoveProjectOpt(opt *QualityprofilesRemoveProjectOptions) error

ValidateRemoveProjectOpt validates the options for removing a project association.

func (*QualityprofilesService) ValidateRemoveUserOpt

func (s *QualityprofilesService) ValidateRemoveUserOpt(opt *QualityprofilesRemoveUserOptions) error

ValidateRemoveUserOpt validates the options for removing user permissions.

func (*QualityprofilesService) ValidateRenameOpt

func (s *QualityprofilesService) ValidateRenameOpt(opt *QualityprofilesRenameOptions) error

ValidateRenameOpt validates the options for renaming a profile.

func (*QualityprofilesService) ValidateRestoreOpt

func (s *QualityprofilesService) ValidateRestoreOpt(opt *QualityprofilesRestoreOptions) error

ValidateRestoreOpt validates the options for restoring a profile.

func (*QualityprofilesService) ValidateSearchGroupsOpt

func (s *QualityprofilesService) ValidateSearchGroupsOpt(opt *QualityprofilesSearchGroupsOptions) error

ValidateSearchGroupsOpt validates the options for searching groups.

func (*QualityprofilesService) ValidateSearchOpt

func (s *QualityprofilesService) ValidateSearchOpt(opt *QualityprofilesSearchOptions) error

ValidateSearchOpt validates the options for searching profiles.

func (*QualityprofilesService) ValidateSearchUsersOpt

func (s *QualityprofilesService) ValidateSearchUsersOpt(opt *QualityprofilesSearchUsersOptions) error

ValidateSearchUsersOpt validates the options for searching users.

func (*QualityprofilesService) ValidateSetDefaultOpt

func (s *QualityprofilesService) ValidateSetDefaultOpt(opt *QualityprofilesSetDefaultOptions) error

ValidateSetDefaultOpt validates the options for setting the default profile.

func (*QualityprofilesService) ValidateShowOpt

func (s *QualityprofilesService) ValidateShowOpt(opt *QualityprofilesShowOptions) error

ValidateShowOpt validates the options for showing a profile.

type QualityprofilesSetDefaultOptions

type QualityprofilesSetDefaultOptions struct {
	// Language is the quality profile language (required).
	// Allowed values: 'kubernetes', 'css', 'scala', 'jsp', 'py', 'js', 'docker', 'rust',
	// 'java', 'web', 'flex', 'xml', 'json', 'ipynb', 'text', 'vbnet', 'cloudformation',
	// 'yaml', 'go', 'kotlin', 'secrets', 'ruby', 'cs', 'php', 'terraform', 'azureresourcemanager', 'ts'
	Language string `url:"language,omitempty"`
	// QualityProfile is the quality profile name (required).
	QualityProfile string `url:"qualityProfile,omitempty"`
}

QualityprofilesSetDefaultOptions contains options for setting the default profile.

type QualityprofilesShow

type QualityprofilesShow struct {
	// Profile contains the profile details.
	Profile QualityprofilesShownProfile `json:"profile,omitzero"`
}

QualityprofilesShow represents the response from showing a quality profile.

type QualityprofilesShowOptions

type QualityprofilesShowOptions struct {
	// Key is the quality profile key (required).
	Key string `url:"key,omitempty"`
	// CompareToSonarWay adds the number of missing rules from related Sonar way profile.
	CompareToSonarWay bool `url:"compareToSonarWay,omitempty"`
}

QualityprofilesShowOptions contains options for showing a profile.

type QualityprofilesShownProfile

type QualityprofilesShownProfile struct {
	// Key is the unique key of the profile.
	Key string `json:"key,omitempty"`
	// Name is the name of the profile.
	Name string `json:"name,omitempty"`
	// Language is the language code of the profile.
	Language string `json:"language,omitempty"`
	// LanguageName is the display name of the language.
	LanguageName string `json:"languageName,omitempty"`
	// LastUsed is the timestamp when the profile was last used.
	LastUsed string `json:"lastUsed,omitempty"`
	// RulesUpdatedAt is the timestamp when rules were last updated.
	RulesUpdatedAt string `json:"rulesUpdatedAt,omitempty"`
	// ActiveDeprecatedRuleCount is the count of active deprecated rules.
	ActiveDeprecatedRuleCount int64 `json:"activeDeprecatedRuleCount,omitempty"`
	// ActiveRuleCount is the count of active rules.
	ActiveRuleCount int64 `json:"activeRuleCount,omitempty"`
	// ProjectCount is the number of projects using this profile.
	ProjectCount int64 `json:"projectCount,omitempty"`
	// IsBuiltIn indicates if this is a built-in profile.
	IsBuiltIn bool `json:"isBuiltIn,omitempty"`
	// IsDefault indicates if this is the default profile for the language.
	IsDefault bool `json:"isDefault,omitempty"`
	// IsInherited indicates if this profile inherits from another.
	IsInherited bool `json:"isInherited,omitempty"`
}

QualityprofilesShownProfile represents a quality profile in a show response.

type RegulatoryReportsDownloadOptions

type RegulatoryReportsDownloadOptions struct {
	// Branch is the branch key. Optional.
	Branch string `url:"branch,omitempty"`
	// Project is the project key. This field is required.
	Project string `url:"project"`
}

RegulatoryReportsDownloadOptions contains parameters for the Download method.

type RegulatoryReportsService

type RegulatoryReportsService struct {
	// contains filtered or unexported fields
}

RegulatoryReportsService handles communication with the regulatory reports related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*RegulatoryReportsService) Download

Download downloads the regulatory report for a project as a zip file. Requires 'Browse' permission on the project.

API endpoint: GET /api/regulatory_reports/download. Since: 9.5. Enterprise Edition only.

func (*RegulatoryReportsService) ValidateDownloadOpt

ValidateDownloadOpt validates the options for the Download method.

type ResponseError

type ResponseError struct {
	Body       []byte
	Response   *http.Response
	Message    string
	StatusCode int
}

ResponseError represents an error response from the SonarQube API.

func (*ResponseError) Error

func (e *ResponseError) Error() string

Error returns the error message.

type RetryOptions

type RetryOptions struct {
	// MaxAttempts is the total number of attempts including the first.
	// Values of 0 or 1 disable retries.
	MaxAttempts int
	// InitialDelay is the base delay used in the exponential backoff calculation.
	InitialDelay time.Duration
	// MaxDelay caps the computed backoff delay.
	MaxDelay time.Duration
	// RetryableStatusCodes lists HTTP status codes that should trigger a retry.
	RetryableStatusCodes []int
	// RetryNonIdempotent enables automatic retries for non-idempotent methods
	// (POST, PATCH). It is disabled by default: only idempotent methods (GET,
	// HEAD, PUT, DELETE, OPTIONS, TRACE) are retried, because resending a
	// non-idempotent request after a network error or 5xx can duplicate a
	// server-side side effect (for example creating a resource twice). Enable
	// this only for endpoints you know are safe to repeat.
	RetryNonIdempotent bool
}

RetryOptions configures opt-in retry with exponential backoff and full jitter. The zero value disables retrying (default behaviour).

type RuleParameterV2

type RuleParameterV2 struct {
	// Key is the parameter key.
	Key string `json:"key,omitempty"`
	// HtmlDescription is the HTML description of the parameter (read-only).
	HtmlDescription string `json:"htmlDescription,omitempty"`
	// DefaultValue is the default value for the parameter.
	DefaultValue string `json:"defaultValue,omitempty"`
	// Type is the parameter type (read-only).
	Type string `json:"type,omitempty"`
}

RuleParameterV2 represents a parameter for a custom rule.

type RuleV2

type RuleV2 struct {
	// Id is the rule's unique identifier.
	Id string `json:"id,omitempty"`
	// Key is the rule key.
	Key string `json:"key,omitempty"`
	// RepositoryKey is the repository key.
	RepositoryKey string `json:"repositoryKey,omitempty"`
	// Name is the rule name.
	Name string `json:"name,omitempty"`
	// Severity is the rule severity.
	Severity string `json:"severity,omitempty"`
	// Type is the rule type.
	Type string `json:"type,omitempty"`
	// Impacts is the list of software quality impacts.
	Impacts []RulesImpact `json:"impacts,omitempty"`
	// CleanCodeAttribute is the clean code attribute for the rule.
	CleanCodeAttribute string `json:"cleanCodeAttribute,omitempty"`
	// CleanCodeAttributeCategory is the clean code attribute category.
	CleanCodeAttributeCategory string `json:"cleanCodeAttributeCategory,omitempty"`
	// Status is the rule status.
	Status string `json:"status,omitempty"`
	// External indicates whether the rule is external.
	External bool `json:"external,omitempty"`
	// CreatedAt is the rule creation timestamp.
	CreatedAt string `json:"createdAt,omitempty"`
	// DescriptionSections contains the rule description sections.
	DescriptionSections []RulesDescriptionSection `json:"descriptionSections,omitempty"`
	// MarkdownDescription is the rule description in markdown format.
	MarkdownDescription string `json:"markdownDescription,omitempty"`
	// GapDescription is the gap description for the rule.
	GapDescription string `json:"gapDescription,omitempty"`
	// HtmlNote is the HTML note for the rule.
	HtmlNote string `json:"htmlNote,omitempty"`
	// MarkdownNote is the markdown note for the rule.
	MarkdownNote string `json:"markdownNote,omitempty"`
	// EducationPrinciples is the list of education principles.
	EducationPrinciples []string `json:"educationPrinciples,omitempty"`
	// Template indicates whether this rule is a template.
	Template bool `json:"template,omitempty"`
	// TemplateId is the ID of the template this rule is based on.
	TemplateId string `json:"templateId,omitempty"`
	// Tags is the list of user-defined tags.
	Tags []string `json:"tags,omitempty"`
	// SystemTags is the list of system tags.
	SystemTags []string `json:"systemTags,omitempty"`
	// LanguageKey is the language key.
	LanguageKey string `json:"languageKey,omitempty"`
	// LanguageName is the language display name.
	LanguageName string `json:"languageName,omitempty"`
	// Parameters is the list of rule parameters.
	Parameters []RuleParameterV2 `json:"parameters,omitempty"`
	// RemediationFunctionType is the remediation function type.
	RemediationFunctionType string `json:"remediationFunctionType,omitempty"`
	// RemediationFunctionGapMultiplier is the gap multiplier for remediation.
	RemediationFunctionGapMultiplier string `json:"remediationFunctionGapMultiplier,omitempty"`
	// RemediationFunctionBaseEffort is the base effort for remediation.
	RemediationFunctionBaseEffort string `json:"remediationFunctionBaseEffort,omitempty"`
}

RuleV2 represents a rule returned by V2 API endpoints.

type RulesActivation

type RulesActivation struct {
	// Inherit indicates how the rule is inherited (NONE, INHERITED, OVERRIDES).
	Inherit string `json:"inherit,omitempty"`
	// QProfile is the key of the quality profile where the rule is activated.
	QProfile string `json:"qProfile,omitempty"`
	// Severity is the severity level of the activated rule.
	Severity string `json:"severity,omitempty"`
	// Params is the list of parameter values for the activated rule.
	Params []RulesParamKV `json:"params,omitempty"`
	// CreatedAt is the timestamp when the rule was activated in the profile.
	CreatedAt string `json:"createdAt,omitempty"`
	// UpdatedAt is the timestamp when the rule activation was last updated in the profile.
	UpdatedAt string `json:"updatedAt,omitempty"`
	// Impacts is the list of impacts on software quality for this activated rule.
	Impacts []RulesImpact `json:"impacts,omitempty"`
	// PrioritizedRule indicates if the rule is prioritized in this profile.
	PrioritizedRule bool `json:"prioritizedRule,omitempty"`
}

RulesActivation represents how a rule is activated in a quality profile.

type RulesActivationDetailed

type RulesActivationDetailed struct {
	// CreatedAt is the date and time the rule was activated.
	CreatedAt string `json:"createdAt,omitempty"`
	// Impacts is the list of software quality impacts of the activated rule.
	Impacts []RulesImpact `json:"impacts,omitempty"`
	// Inherit indicates how the rule is inherited (NONE, INHERITED, OVERRIDES).
	Inherit string `json:"inherit,omitempty"`
	// QProfile is the key of the quality profile where the rule is activated.
	QProfile string `json:"qProfile,omitempty"`
	// Severity is the severity level of the activated rule.
	Severity string `json:"severity,omitempty"`
	// Params is the list of parameter values for the activated rule.
	Params []RulesParamKV `json:"params,omitempty"`
	// PrioritizedRule indicates if the rule is prioritized in this profile.
	PrioritizedRule bool `json:"prioritizedRule,omitempty"`
	// UpdatedAt is the date and time the rule activation was last updated.
	UpdatedAt string `json:"updatedAt,omitempty"`
}

RulesActivationDetailed contains detailed information about a rule activation.

type RulesApp

type RulesApp struct {
	// Languages is a map listing languages keys and their associated display names.
	Languages map[string]string `json:"languages,omitempty"`
	// Statuses is a map of statuses keys and their associated display names.
	Statuses map[string]string `json:"statuses,omitempty"`
	// Characteristics is the list of available rule characteristics.
	Characteristics []RulesCharacteristic `json:"characteristics,omitempty"`
	// Repositories is the list of available rule repositories.
	Repositories []RulesRepository `json:"repositories,omitempty"`
	// CanWrite indicates if the current user has permission to modify rules.
	CanWrite bool `json:"canWrite,omitempty"`
}

RulesApp contains metadata for rendering the 'Coding Rules' page.

type RulesCharacteristic

type RulesCharacteristic struct {
	// Key is the unique identifier of the characteristic.
	Key string `json:"key,omitempty"`
	// Name is the display name of the characteristic.
	Name string `json:"name,omitempty"`
	// Parent is the key of the parent characteristic, if any.
	Parent string `json:"parent,omitempty"`
}

RulesCharacteristic represents a characteristic that can be associated with rules.

type RulesCreate

type RulesCreate struct {
	Rule RulesDefinition `json:"rule,omitzero"`
}

RulesCreate represents the response from creating a custom rule.

type RulesCreateOptions

type RulesCreateOptions struct {
	// CleanCodeAttribute represents the Clean Code Attribute associated with the rule.
	// Allowed values: CONVENTIONAL, FORMATTED, IDENTIFIABLE, CLEAR, COMPLETE, EFFICIENT,
	// LOGICAL, DISTINCT, FOCUSED, MODULAR, TESTED, LAWFUL, RESPECTFUL, TRUSTWORTHY
	CleanCodeAttribute string `url:"cleanCodeAttribute,omitempty"`
	// CustomKey is the unique identifier for the custom rule (required).
	// Maximum length: 200 characters
	CustomKey string `url:"customKey,omitempty"`
	// Impacts is a map of software quality to severity (e.g., MAINTAINABILITY: HIGH, SECURITY: LOW).
	// Allowed keys: MAINTAINABILITY, RELIABILITY, SECURITY
	// Allowed values: INFO, LOW, MEDIUM, HIGH, BLOCKER
	Impacts map[string]string `url:"impacts,omitempty"`
	// MarkdownDescription is the Markdown-formatted description of the rule (required).
	MarkdownDescription string `url:"markdownDescription,omitempty"`
	// Name is the display name of the rule (required).
	// Maximum length: 200 characters
	Name string `url:"name,omitempty"`
	// Params is a map of parameter names to values (e.g., key1: v1, key2: v2).
	Params map[string]string `url:"params,omitempty"`
	// PreventReactivation prevents reactivation in profiles where the rule was deactivated.
	//
	// Deprecated: Since SonarQube 10.4
	PreventReactivation string `url:"preventReactivation,omitempty"`
	// Severity is the rule severity.
	// Allowed values: INFO, MINOR, MAJOR, CRITICAL, BLOCKER
	Severity string `url:"severity,omitempty"`
	// Status is the status of the rule.
	// Allowed values: READY, DEPRECATED, BETA
	Status string `url:"status,omitempty"`
	// TemplateKey is the key of the template rule from which to create the custom rule (required).
	TemplateKey string `url:"templateKey,omitempty"`
	// Type is the rule type.
	// Allowed values: CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
	Type string `url:"type,omitempty"`
}

RulesCreateOptions contains options for creating a custom rule.

type RulesDefinition

type RulesDefinition struct {
	// Key is the unique identifier of the rule.
	Key string `json:"key,omitempty"`
	// Severity indicates the severity level of the rule.
	Severity string `json:"severity,omitempty"`
	// CreatedAt is the timestamp when the rule was created.
	CreatedAt string `json:"createdAt,omitempty"`
	// UpdatedAt is the timestamp when the rule was last updated.
	UpdatedAt string `json:"updatedAt,omitempty"`
	// HTMLDesc is the HTML-formatted description of the rule.
	HTMLDesc string `json:"htmlDesc,omitempty"`
	// MdDesc is the Markdown-formatted description of the rule.
	MdDesc string `json:"mdDesc,omitempty"`
	// HTMLNote is the HTML-formatted note for the rule.
	HTMLNote string `json:"htmlNote,omitempty"`
	// MdNote is the Markdown-formatted note for the rule.
	MdNote string `json:"mdNote,omitempty"`
	// NoteLogin is the login of the user who created the note.
	NoteLogin string `json:"noteLogin,omitempty"`
	// InternalKey is the internal key used by the rule engine.
	InternalKey string `json:"internalKey,omitempty"`
	// Type is the rule type (CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT).
	Type string `json:"type,omitempty"`
	// TemplateKey is the key of the template rule, if this is a custom rule.
	TemplateKey string `json:"templateKey,omitempty"`
	// CleanCodeAttributeCategory is the category of the clean code attribute.
	CleanCodeAttributeCategory string `json:"cleanCodeAttributeCategory,omitempty"`
	// Lang is the language key of the rule.
	Lang string `json:"lang,omitempty"`
	// Scope is the scope of the rule (MAIN, TEST, ALL).
	Scope string `json:"scope,omitempty"`
	// Name is the display name of the rule.
	Name string `json:"name,omitempty"`
	// Status is the status of the rule (READY, DEPRECATED, BETA, REMOVED).
	Status string `json:"status,omitempty"`
	// Repo is the repository key of the rule.
	Repo string `json:"repo,omitempty"`
	// LangName is the display name of the language.
	LangName string `json:"langName,omitempty"`
	// CleanCodeAttribute is the clean code attribute of the rule.
	CleanCodeAttribute string `json:"cleanCodeAttribute,omitempty"`
	// Params is the list of parameters that can be configured for the rule.
	Params []RulesParam `json:"params,omitempty"`
	// SysTags is the list of system-defined tags.
	SysTags []string `json:"sysTags,omitempty"`
	// Tags is the list of user-defined tags.
	Tags []any `json:"tags,omitempty"`
	// Impacts is the list of impacts on software quality.
	Impacts []RulesImpact `json:"impacts,omitempty"`
	// DescriptionSections is the list of structured description sections of the rule.
	DescriptionSections []RulesDescriptionSection `json:"descriptionSections,omitempty"`
	// EducationPrinciples is the list of education principle keys associated with the rule.
	EducationPrinciples []string `json:"educationPrinciples,omitempty"`
	// RemFnType is the remediation function type.
	RemFnType string `json:"remFnType,omitempty"`
	// RemFnBaseEffort is the base effort of the remediation function.
	RemFnBaseEffort string `json:"remFnBaseEffort,omitempty"`
	// DefaultRemFnType is the default remediation function type.
	DefaultRemFnType string `json:"defaultRemFnType,omitempty"`
	// DefaultRemFnBaseEffort is the default base effort of the remediation function.
	DefaultRemFnBaseEffort string `json:"defaultRemFnBaseEffort,omitempty"`
	// DebtRemFnType is the deprecated remediation function type (legacy debt terminology).
	//
	// Deprecated: use RemFnType instead.
	DebtRemFnType string `json:"debtRemFnType,omitempty"`
	// DefaultDebtRemFnType is the deprecated default remediation function type (legacy debt terminology).
	//
	// Deprecated: use DefaultRemFnType instead.
	DefaultDebtRemFnType string `json:"defaultDebtRemFnType,omitempty"`
	// RemFnOverloaded indicates if the remediation function overrides the template's default.
	RemFnOverloaded bool `json:"remFnOverloaded,omitempty"`
	// IsTemplate indicates if this is a template rule that can be used to create custom rules.
	IsTemplate bool `json:"isTemplate,omitempty"`
	// IsExternal indicates if this is an external rule.
	IsExternal bool `json:"isExternal,omitempty"`
}

RulesDefinition represents a SonarQube rule.

type RulesDeleteOptions

type RulesDeleteOptions struct {
	// Key is the unique identifier of the rule to be deleted (required).
	Key string `url:"key,omitempty"`
}

RulesDeleteOptions contains options for deleting a custom rule.

type RulesDeprecatedKeys added in v2.2.1

type RulesDeprecatedKeys struct {
	// DeprecatedKey is the list of deprecated rule keys.
	DeprecatedKey []string `json:"deprecatedKey,omitempty"`
}

RulesDeprecatedKeys represents the deprecated keys of a rule that was renamed or moved.

type RulesDescriptionSection

type RulesDescriptionSection struct {
	// Content is the HTML content of the section.
	Content string `json:"content,omitempty"`
	// Context provides additional context for the section.
	Context RulesDescriptionSectionContext `json:"context,omitzero"`
	// Key is the unique identifier of the section.
	Key string `json:"key,omitempty"`
}

RulesDescriptionSection represents a section of a rule's description.

type RulesDescriptionSectionContext

type RulesDescriptionSectionContext struct {
	// DisplayName is the human-readable name of the context.
	DisplayName string `json:"displayName,omitempty"`
	// Key is the unique identifier of the context.
	Key string `json:"key,omitempty"`
}

RulesDescriptionSectionContext provides context for a description section.

type RulesDetails

type RulesDetails struct {
	Name                   string `json:"name,omitempty"`
	Key                    string `json:"key,omitempty"`
	CreatedAt              string `json:"createdAt,omitempty"`
	UpdatedAt              string `json:"updatedAt,omitempty"`
	RemFnType              string `json:"remFnType,omitempty"`
	HTMLDesc               string `json:"htmlDesc,omitempty"`
	MdDesc                 string `json:"mdDesc,omitempty"`
	HTMLNote               string `json:"htmlNote,omitempty"`
	MdNote                 string `json:"mdNote,omitempty"`
	NoteLogin              string `json:"noteLogin,omitempty"`
	CleanCodeAttribute     string `json:"cleanCodeAttribute,omitempty"`
	InternalKey            string `json:"internalKey,omitempty"`
	RemFnGapMultiplier     string `json:"remFnGapMultiplier,omitempty"`
	RemFnBaseEffort        string `json:"remFnBaseEffort,omitempty"`
	DefaultRemFnBaseEffort string `json:"defaultRemFnBaseEffort,omitempty"`
	// DebtRemFnType is the deprecated remediation function type (legacy debt terminology).
	//
	// Deprecated: use RemFnType instead.
	DebtRemFnType string `json:"debtRemFnType,omitempty"`
	// DefaultDebtRemFnType is the deprecated default remediation function type (legacy debt terminology).
	//
	// Deprecated: use DefaultRemFnType instead.
	DefaultDebtRemFnType       string        `json:"defaultDebtRemFnType,omitempty"`
	Lang                       string        `json:"lang,omitempty"`
	LangName                   string        `json:"langName,omitempty"`
	CleanCodeAttributeCategory string        `json:"cleanCodeAttributeCategory,omitempty"`
	GapDescription             string        `json:"gapDescription,omitempty"`
	Repo                       string        `json:"repo,omitempty"`
	Scope                      string        `json:"scope,omitempty"`
	Severity                   string        `json:"severity,omitempty"`
	Status                     string        `json:"status,omitempty"`
	DefaultRemFnType           string        `json:"defaultRemFnType,omitempty"`
	DefaultRemFnGapMultiplier  string        `json:"defaultRemFnGapMultiplier,omitempty"`
	TemplateKey                string        `json:"templateKey,omitempty"`
	Type                       string        `json:"type,omitempty"`
	Impacts                    []RulesImpact `json:"impacts,omitempty"`
	Tags                       []any         `json:"tags,omitempty"`
	SysTags                    []string      `json:"sysTags,omitempty"`
	// DeprecatedKeys contains the deprecated rule keys, for rules that were renamed or moved.
	DeprecatedKeys RulesDeprecatedKeys `json:"deprecatedKeys,omitzero"`
	// EducationPrinciples is the list of education principle keys associated with the rule.
	EducationPrinciples []string                  `json:"educationPrinciples,omitempty"`
	Params              []RulesParam              `json:"params,omitempty"`
	DescriptionSections []RulesDescriptionSection `json:"descriptionSections,omitempty"`
	IsTemplate          bool                      `json:"isTemplate,omitempty"`
	IsExternal          bool                      `json:"isExternal,omitempty"`
	RemFnOverloaded     bool                      `json:"remFnOverloaded,omitempty"`
	Template            bool                      `json:"template,omitempty"`
}

RulesDetails contains comprehensive information about a rule.

type RulesFacetItem

type RulesFacetItem struct {
	// Val is the facet value.
	Val string `json:"val,omitempty"`
	// Count is the number of items matching this facet value.
	Count int64 `json:"count,omitempty"`
}

RulesFacetItem represents a single facet value with its count.

type RulesImpact

type RulesImpact struct {
	// Severity is the severity of the impact (HIGH, MEDIUM, LOW).
	Severity string `json:"severity,omitempty"`
	// SoftwareQuality is the software quality characteristic affected (MAINTAINABILITY, RELIABILITY, SECURITY).
	SoftwareQuality string `json:"softwareQuality,omitempty"`
}

RulesImpact represents the impact of a rule on software quality.

type RulesListOptions

type RulesListOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// AvailableSince filters rules added since the specified date (format: yyyy-MM-dd).
	// If not set, all rules are returned.
	AvailableSince string `url:"available_since,omitempty"`
	// Qprofile is the key of the quality profile to filter by activated rules.
	Qprofile string `url:"qprofile,omitempty"`
	// Sort is the sort field.
	// Allowed values: createdAt
	Sort string `url:"s,omitempty"`
	// Asc indicates whether to sort results in ascending order.
	Asc bool `url:"asc,omitempty"`
}

RulesListOptions contains options for listing rules. WARNING: Internal endpoint, may change without notice.

type RulesParam

type RulesParam struct {
	// DefaultValue is the default value of the parameter.
	DefaultValue string `json:"defaultValue,omitempty"`
	// HTMLDesc is the HTML-formatted description of the parameter.
	HTMLDesc string `json:"htmlDesc,omitempty"`
	// Desc is the plain text description of the parameter.
	Desc string `json:"desc,omitempty"`
	// Key is the unique identifier of the parameter.
	Key string `json:"key,omitempty"`
	// Type is the data type of the parameter (STRING, TEXT, BOOLEAN, INTEGER, FLOAT).
	Type string `json:"type,omitempty"`
}

RulesParam represents a parameter that can be configured for a rule.

type RulesParamKV

type RulesParamKV struct {
	// Key is the parameter name.
	Key string `json:"key,omitempty"`
	// Value is the parameter value.
	Value string `json:"value,omitempty"`
}

RulesParamKV represents a key-value pair for rule parameters.

type RulesRepositories

type RulesRepositories struct {
	Repositories []RulesRepository `json:"repositories,omitempty"`
}

RulesRepositories contains the list of available rule repositories.

type RulesRepositoriesOptions

type RulesRepositoriesOptions struct {
	// Language filters repositories by programming language.
	// If provided, only repositories for the given language will be returned.
	Language string `url:"language,omitempty"`
	// Query is a pattern to match repository keys/names against.
	Query string `url:"q,omitempty"`
}

RulesRepositoriesOptions contains options for listing rule repositories.

type RulesRepository

type RulesRepository struct {
	// Key is the unique identifier of the repository.
	Key string `json:"key,omitempty"`
	// Language is the programming language of the repository.
	Language string `json:"language,omitempty"`
	// Name is the display name of the repository.
	Name string `json:"name,omitempty"`
}

RulesRepository represents a rules repository.

type RulesSearch

type RulesSearch struct {
	Actives map[string][]RulesActivation `json:"actives,omitempty"`
	Facets  []RulesSearchFacet           `json:"facets,omitempty"`
	Rules   []RulesDetails               `json:"rules,omitempty"`
	Paging  Paging                       `json:"paging,omitzero"`
	// Page is the current page number (legacy duplicate of Paging.PageIndex).
	Page int64 `json:"p,omitempty"`
	// PageSize is the page size (legacy duplicate of Paging.PageSize).
	PageSize int64 `json:"ps,omitempty"`
	// Total is the total number of rules (legacy duplicate of Paging.Total).
	Total int64 `json:"total,omitempty"`
}

RulesSearch represents the response from searching for rules. The Actives field is a map because rule keys are dynamic.

type RulesSearchFacet

type RulesSearchFacet struct {
	// Name is the facet name (e.g., languages, repositories, tags).
	Name string `json:"name,omitempty"`
	// Property is the property key the facet was computed on.
	Property string `json:"property,omitempty"`
	// Values is the list of facet values with their counts.
	Values []RulesFacetItem `json:"values,omitempty"`
}

RulesSearchFacet represents a facet in search results.

type RulesSearchOptions

type RulesSearchOptions struct {
	// PaginationArgs contains pagination parameters.
	PaginationArgs `url:",inline"`

	// Activation filters rules by their activation status on the selected quality profile.
	// If Qprofile is not set, this parameter is ignored.
	Activation bool `url:"activation,omitempty"`
	// ActiveImpactSeverities filters by impact severity of rules in quality profiles.
	// Allowed values: INFO, LOW, MEDIUM, HIGH, BLOCKER
	ActiveImpactSeverities []string `url:"active_impactSeverities,omitempty,comma"`
	// ActiveSeverities filters by severity of rules in quality profiles.
	// Allowed values: INFO, MINOR, MAJOR, CRITICAL, BLOCKER
	ActiveSeverities []string `url:"active_severities,omitempty,comma"`
	// Asc indicates whether to sort results in ascending order.
	Asc bool `url:"asc,omitempty"`
	// AvailableSince filters rules added since the specified date (format: yyyy-MM-dd).
	AvailableSince string `url:"available_since,omitempty"`
	// CleanCodeAttributeCategories filters by clean code attribute categories.
	// Allowed values: ADAPTABLE, CONSISTENT, INTENTIONAL, RESPONSIBLE
	CleanCodeAttributeCategories []string `url:"cleanCodeAttributeCategories,omitempty,comma"`
	// CompareToProfile is the key of the quality profile to compare against (internal parameter).
	CompareToProfile string `url:"compareToProfile,omitempty"`
	// ComplianceStandards filters by compliance standards.
	ComplianceStandards []string `url:"complianceStandards,omitempty,comma"`
	// Cwe filters by CWE identifiers. Use 'unknown' to select rules not associated with any CWE.
	Cwe []string `url:"cwe,omitempty,comma"`
	// Fields specifies which fields to return in the response.
	// Allowed values: actives, cleanCodeAttributeCategory, cleanCodeAttribute, createdAt, debtRemFn,
	// defaultDebtRemFn, defaultRemFn, deprecatedKeys, descriptionSections, educationPrinciples,
	// gapDescription, htmlDesc, htmlNote, internalKey, isExternal, isTemplate, lang, langName,
	// mdDesc, mdNote, name, noteLogin, params, remFn, remFnOverloaded, repo, scope, severity,
	// status, sysTags, tags, templateKey, updatedAt
	Fields []string `url:"f,omitempty,comma"`
	// Facets specifies which facets to compute and return.
	// Allowed values: languages, repositories, tags, severities, active_severities, statuses, types,
	// true, cwe, owaspTop10, owaspTop10-2021, owaspMobileTop10-2024, sansTop25, sonarsourceSecurity,
	// cleanCodeAttributeCategories, impactSeverities, impactSoftwareQualities, active_impactSeverities,
	// complianceStandards
	Facets []string `url:"facets,omitempty,comma"`
	// ImpactSeverities filters by impact severity of rules.
	// Allowed values: INFO, LOW, MEDIUM, HIGH, BLOCKER
	ImpactSeverities []string `url:"impactSeverities,omitempty,comma"`
	// ImpactSoftwareQualities filters by impact software quality of rules.
	// Allowed values: MAINTAINABILITY, RELIABILITY, SECURITY
	ImpactSoftwareQualities []string `url:"impactSoftwareQualities,omitempty,comma"`
	// IncludeExternal determines whether to include external rules in the results.
	IncludeExternal bool `url:"include_external,omitempty"`
	// Inheritance filters by inheritance status within a quality profile.
	// Used only if Activation parameter is set.
	// Allowed values: NONE, INHERITED, OVERRIDES
	Inheritance []string `url:"inheritance,omitempty,comma"`
	// IsTemplate filters rules based on whether they are templates.
	IsTemplate bool `url:"is_template,omitempty"`
	// Languages filters by programming languages.
	Languages []string `url:"languages,omitempty,comma"`
	// OwaspMobileTop102024 filters by OWASP Mobile Top 10 - 2024 categories.
	// Allowed values: m1, m2, m3, m4, m5, m6, m7, m8, m9, m10
	OwaspMobileTop102024 []string `url:"owaspMobileTop10-2024,omitempty,comma"`
	// OwaspTop10 filters by OWASP Top 10 2017 categories.
	// Allowed values: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
	OwaspTop10 []string `url:"owaspTop10,omitempty,comma"`
	// OwaspTop102021 filters by OWASP Top 10 2021 categories.
	// Allowed values: a1, a2, a3, a4, a5, a6, a7, a8, a9, a10
	OwaspTop102021 []string `url:"owaspTop10-2021,omitempty,comma"`
	// PrioritizedRule filters rules based on whether they are prioritized in the selected quality profile.
	// If Qprofile is not set, this parameter is ignored.
	PrioritizedRule bool `url:"prioritizedRule,omitempty"`
	// Query is a free text search query to filter rules (must be at least 2 characters).
	// Searches in rule name, description, note, tags, and key.
	Query string `url:"q,omitempty"`
	// Qprofile is the key of the quality profile to filter by activation status.
	// Only rules of the same language as this profile are returned.
	Qprofile string `url:"qprofile,omitempty"`
	// Repositories filters by rule repositories.
	Repositories []string `url:"repositories,omitempty,comma"`
	// RuleKey is the unique identifier of a specific rule to search for.
	RuleKey string `url:"rule_key,omitempty"`
	// Sort specifies the sort field.
	// Allowed values: key, name, createdAt, updatedAt
	Sort string `url:"s,omitempty"`
	// SansTop25 filters by SANS Top 25 categories.
	// Allowed values: insecure-interaction, risky-resource, porous-defenses
	//
	// Deprecated: Since SonarQube 10.0
	SansTop25 []string `url:"sansTop25,omitempty,comma"`
	// Severities filters by rule severities.
	// Allowed values: INFO, MINOR, MAJOR, CRITICAL, BLOCKER
	Severities []string `url:"severities,omitempty,comma"`
	// SonarsourceSecurity filters by SonarSource security categories.
	// Use 'others' to select rules not associated with any category.
	// Allowed values: buffer-overflow, sql-injection, rce, object-injection, command-injection,
	// path-traversal-injection, ldap-injection, xpath-injection, log-injection, xxe, xss, dos,
	// ssrf, csrf, http-response-splitting, open-redirect, weak-cryptography, auth, insecure-conf,
	// file-manipulation, encrypt-data, traceability, permission, others
	SonarsourceSecurity []string `url:"sonarsourceSecurity,omitempty,comma"`
	// Statuses filters by rule statuses.
	// Allowed values: READY, DEPRECATED, REMOVED, BETA
	Statuses []string `url:"statuses,omitempty,comma"`
	// Tags filters by rule tags (OR filter - rules having at least one of the tags will be returned).
	Tags []string `url:"tags,omitempty,comma"`
	// TemplateKey filters custom rules based on the specified template key.
	TemplateKey string `url:"template_key,omitempty"`
	// Types filters by rule types (OR filter - rules matching at least one type will be returned).
	// Allowed values: CODE_SMELL, BUG, VULNERABILITY, SECURITY_HOTSPOT
	Types []string `url:"types,omitempty,comma"`
}

RulesSearchOptions contains options for searching rules.

type RulesService

type RulesService struct {
	// contains filtered or unexported fields
}

RulesService handles communication with the Rules related methods of the SonarQube API.

func (*RulesService) App

func (s *RulesService) App(ctx context.Context) (v *RulesApp, resp *http.Response, err error)

App retrieves data required for rendering the 'Coding Rules' page. WARNING: This is an internal endpoint, may change without notice.

func (*RulesService) Create

func (s *RulesService) Create(ctx context.Context, opt *RulesCreateOptions) (v *RulesCreate, resp *http.Response, err error)

Create creates a custom rule. Requires the 'Administer Quality Profiles' permission.

func (*RulesService) Delete

func (s *RulesService) Delete(ctx context.Context, opt *RulesDeleteOptions) (resp *http.Response, err error)

Delete deletes a custom rule. Requires the 'Administer Quality Profiles' permission.

func (*RulesService) List

func (s *RulesService) List(ctx context.Context, opt *RulesListOptions) (v *string, resp *http.Response, err error)

List lists rules, excluding external rules and rules with status REMOVED.

func (*RulesService) Repositories

func (s *RulesService) Repositories(ctx context.Context, opt *RulesRepositoriesOptions) (v *RulesRepositories, resp *http.Response, err error)

Repositories lists available rule repositories.

func (*RulesService) Search

func (s *RulesService) Search(ctx context.Context, opt *RulesSearchOptions) (v *RulesSearch, resp *http.Response, err error)

Search searches for a collection of relevant rules matching a specified query.

func (*RulesService) SearchAll

SearchAll fetches all pages from Search and returns a flat slice of rules.

func (*RulesService) Show

func (s *RulesService) Show(ctx context.Context, opt *RulesShowOptions) (v *RulesShow, resp *http.Response, err error)

Show retrieves detailed information about a specific rule.

func (*RulesService) Tags

func (s *RulesService) Tags(ctx context.Context, opt *RulesTagsOptions) (v *RulesTags, resp *http.Response, err error)

Tags lists all available rule tags.

func (*RulesService) Update

func (s *RulesService) Update(ctx context.Context, opt *RulesUpdateOptions) (v *RulesUpdate, resp *http.Response, err error)

Update updates an existing rule. Requires the 'Administer Quality Profiles' permission.

func (*RulesService) ValidateCreateOpt

func (s *RulesService) ValidateCreateOpt(opt *RulesCreateOptions) error

ValidateCreateOpt validates the options for creating a custom rule.

func (*RulesService) ValidateDeleteOpt

func (s *RulesService) ValidateDeleteOpt(opt *RulesDeleteOptions) error

ValidateDeleteOpt validates the options for deleting a custom rule.

func (*RulesService) ValidateListOpt

func (s *RulesService) ValidateListOpt(opt *RulesListOptions) error

ValidateListOpt validates the options for listing rules.

func (*RulesService) ValidateRepositoriesOpt

func (s *RulesService) ValidateRepositoriesOpt(opt *RulesRepositoriesOptions) error

ValidateRepositoriesOpt validates the options for listing rule repositories.

func (*RulesService) ValidateSearchOpt

func (s *RulesService) ValidateSearchOpt(opt *RulesSearchOptions) error

ValidateSearchOpt validates the options for searching rules.

func (*RulesService) ValidateShowOpt

func (s *RulesService) ValidateShowOpt(opt *RulesShowOptions) error

ValidateShowOpt validates the options for showing a specific rule.

func (*RulesService) ValidateTagsOpt

func (s *RulesService) ValidateTagsOpt(opt *RulesTagsOptions) error

ValidateTagsOpt validates the options for listing rule tags.

func (*RulesService) ValidateUpdateOpt

func (s *RulesService) ValidateUpdateOpt(opt *RulesUpdateOptions) error

ValidateUpdateOpt validates the options for updating a rule.

type RulesShow

type RulesShow struct {
	Actives []RulesActivationDetailed `json:"actives,omitempty"`
	Rule    RulesDetails              `json:"rule,omitzero"`
}

RulesShow represents the response from showing a specific rule.

type RulesShowOptions

type RulesShowOptions struct {
	// Key is the unique identifier of the rule to be retrieved (required).
	Key string `url:"key,omitempty"`
	// Actives determines whether to include the list of quality profiles where the rule is active.
	Actives bool `url:"actives,omitempty"`
}

RulesShowOptions contains options for showing a specific rule.

type RulesTags

type RulesTags struct {
	Tags []string `json:"tags,omitempty"`
}

RulesTags contains the list of available rule tags.

type RulesTagsOptions

type RulesTagsOptions struct {
	// Query limits the search to tags containing the supplied string.
	Query string `url:"q,omitempty"`
	// PageSize is the response page size (must be greater than 0 and less than or equal to 500).
	PageSize int64 `url:"ps,omitempty"`
}

RulesTagsOptions contains options for listing rule tags.

type RulesUpdate

type RulesUpdate struct {
	Rule RulesDefinition `json:"rule,omitzero"`
}

RulesUpdate represents the response from updating a rule.

type RulesUpdateOptions

type RulesUpdateOptions struct {
	// Impacts is a map of software quality to severity (e.g., MAINTAINABILITY: HIGH, SECURITY: LOW).
	// Allowed keys: MAINTAINABILITY, RELIABILITY, SECURITY
	// Allowed values: INFO, LOW, MEDIUM, HIGH, BLOCKER
	Impacts map[string]string `url:"impacts,omitempty"`
	// Key is the unique identifier of the rule to be updated (required).
	// Maximum length: 200 characters
	Key string `url:"key,omitempty"`
	// MarkdownDescription is the Markdown-formatted description of the rule.
	// Mandatory for custom and manual rules.
	MarkdownDescription string `url:"markdownDescription,omitempty"`
	// MarkdownNote is the optional note in Markdown format.
	// Use empty value to remove current note. Note is not changed if parameter is not set.
	MarkdownNote string `url:"markdown_note,omitempty"`
	// Name is the name of the rule (mandatory for custom rules).
	// Maximum length: 200 characters
	Name string `url:"name,omitempty"`
	// Params is a map of parameter names to values.
	// Only applicable when updating a custom rule.
	Params map[string]string `url:"params,omitempty"`
	// RemediationFnBaseEffort is the base effort of the remediation function (e.g., '1d').
	RemediationFnBaseEffort string `url:"remediation_fn_base_effort,omitempty"`
	// RemediationFnType is the type of the remediation function.
	// Allowed values: CONSTANT_ISSUE, LINEAR, LINEAR_OFFSET
	RemediationFnType string `url:"remediation_fn_type,omitempty"`
	// RemediationFyGapMultiplier is the gap multiplier of the remediation function (e.g., '2min').
	RemediationFyGapMultiplier string `url:"remediation_fy_gap_multiplier,omitempty"`
	// Severity is the rule severity (only when updating a custom rule).
	// Allowed values: INFO, MINOR, MAJOR, CRITICAL, BLOCKER
	Severity string `url:"severity,omitempty"`
	// Status is the status of the rule.
	// Allowed values: READY, DEPRECATED, REMOVED, BETA
	Status string `url:"status,omitempty"`
	// Tags is a list of tags to associate with the rule.
	// Use empty slice to remove current tags. Tags are not changed if parameter is not set.
	Tags []string `url:"tags,omitempty,comma"`
}

RulesUpdateOptions contains options for updating a rule.

type SamlService

type SamlService struct {
	// contains filtered or unexported fields
}

SamlService handles communication with the SAML related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*SamlService) ValidateValidationOpt

func (s *SamlService) ValidateValidationOpt(opt *SamlValidationOptions) error

ValidateValidationOpt validates the options for the Validation method.

func (*SamlService) Validation

func (s *SamlService) Validation(ctx context.Context, opt *SamlValidationOptions) ([]byte, *http.Response, error)

Validation validates a SAML response and returns the resulting HTML page. No authentication is required: this endpoint is the SAML assertion consumer service (ACS) that the identity provider posts to as part of the SSO callback, so the caller cannot be authenticated yet.

The SAMLResponse value is sent as a form-urlencoded POST body rather than a URL query parameter, since real SAML assertions are too large to fit reliably within URL length limits.

Unlike the rest of the SonarQube API, this endpoint is mounted on the server root rather than under "api/" (live-verified against a SonarQube Enterprise instance: "api/saml/validation" 404s with "Unknown url", while "saml/validation" reaches the real handler), so the request bypasses the client's API base path.

API endpoint: POST saml/validation. Since: 9.7. Internal endpoint.

func (*SamlService) ValidationInit

func (s *SamlService) ValidationInit(ctx context.Context) (*http.Response, error)

ValidationInit initiates the SAML validation flow. No authentication is required: this endpoint kicks off the SSO redirect to the identity provider so that an administrator can validate the SAML configuration before it is enforced.

Like Validation, this endpoint is mounted on the server root rather than under "api/", so the request bypasses the client's API base path.

API endpoint: GET saml/validation_init. Since: 9.7. Internal endpoint.

type SamlValidationOptions

type SamlValidationOptions struct {
	// SAMLResponse is the base64-encoded SAML assertion returned by the
	// identity provider. This field is required.
	//
	// This value is sent in the POST request body (application/x-www-form-urlencoded),
	// not as a URL query parameter: real-world SAML assertions are typically
	// 2-10 KB once base64-encoded, which comfortably exceeds the URL length
	// limits enforced by most HTTP servers and proxies (commonly 2-8 KB).
	SAMLResponse string
}

SamlValidationOptions contains parameters for the Validation method.

type ScaAddCommentRequest added in v2.2.0

type ScaAddCommentRequest struct {
	// IssueReleaseKey is the issue-release key. This field is required.
	IssueReleaseKey string `json:"issueReleaseKey"`
	// Comment is the comment text. Optional.
	Comment string `json:"comment,omitempty"`
}

ScaAddCommentRequest contains the request body for the AddComment method.

type ScaAllAssigneesOptions added in v2.2.0

type ScaAllAssigneesOptions struct {
	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
	// BranchKey filters by branch. Optional; if not provided, the default branch is used unless
	// PullRequestKey is provided.
	BranchKey string `json:"branchKey,omitempty"`
	// PullRequestKey filters by pull request. Optional.
	PullRequestKey string `json:"pullRequestKey,omitempty"`
}

ScaAllAssigneesOptions contains parameters for the GetAllAssignees method.

type ScaAnalysisError added in v2.2.0

type ScaAnalysisError struct {
	// Id is the error identifier.
	Id string `json:"id,omitempty"`
	// Code is the error code.
	Code string `json:"code,omitempty"`
	// Path is the path of the file that caused the error.
	Path string `json:"path,omitempty"`
	// Message is a human-readable description of the error.
	Message string `json:"message,omitempty"`
}

ScaAnalysisError represents an error encountered while parsing dependency files during analysis.

type ScaAnalysisGetOptions added in v2.2.0

type ScaAnalysisGetOptions struct {
	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
	// BranchKey filters by branch. Optional; if not provided, the default branch is used unless
	// PullRequestKey is provided.
	BranchKey string `json:"branchKey,omitempty"`
	// PullRequestKey filters by pull request. Optional.
	PullRequestKey string `json:"pullRequestKey,omitempty"`
}

ScaAnalysisGetOptions contains parameters for the GetAnalysis method.

type ScaAnalysisResource added in v2.2.0

type ScaAnalysisResource struct {
	Status       string             `json:"status,omitempty"`
	FailedReason string             `json:"failedReason,omitempty"`
	UpdatedAt    string             `json:"updatedAt,omitempty"`
	Errors       []ScaAnalysisError `json:"errors,omitempty"`
	ParsedFiles  []string           `json:"parsedFiles,omitempty"`
}

ScaAnalysisResource represents the SCA analysis status of a project branch or pull request.

type ScaBulkIssueReleaseChangeRequest added in v2.2.2

type ScaBulkIssueReleaseChangeRequest struct {
	// IssueReleaseKeys is the list of issue-release keys to update. This field is required.
	IssueReleaseKeys []string `json:"issueReleaseKeys"`
	// Severity is the manual severity to set on every listed issue-release. Optional.
	// One of "BLOCKER", "HIGH", "MEDIUM", "LOW", "INFO".
	Severity string `json:"severity,omitempty"`
	// TransitionKey is the workflow transition to apply. Optional.
	// One of "ACCEPT", "CONFIRM", "REOPEN", "SAFE".
	TransitionKey string `json:"transitionKey,omitempty"`
	// Comment is an optional comment recorded with the change.
	Comment string `json:"comment,omitempty"`
	// Assignee is the login of the user to assign the issue-releases to. Optional.
	Assignee string `json:"assignee,omitempty"`
	// ShouldUnsetAssignee, when true, clears the assignee on every listed issue-release.
	ShouldUnsetAssignee bool `json:"shouldUnsetAssignee,omitempty"`
}

ScaBulkIssueReleaseChangeRequest is the request body for the BulkChangeIssueReleases method.

type ScaChangeStatusRequest added in v2.2.0

type ScaChangeStatusRequest struct {
	// IssueReleaseKey is the issue-release key. This field is required.
	IssueReleaseKey string `json:"issueReleaseKey"`
	// TransitionKey is the transition to apply. This field is required.
	// Allowed values: ScaTransitionConfirm, ScaTransitionReopen, ScaTransitionSafe,
	// ScaTransitionFixed, ScaTransitionAccept.
	TransitionKey string `json:"transitionKey"`
	// Comment explains why the status is changing. Optional.
	Comment string `json:"comment,omitempty"`
}

ScaChangeStatusRequest contains the request body for the ChangeStatus method.

type ScaChangelogDeleteOptions added in v2.2.0

type ScaChangelogDeleteOptions struct {
	// Key is the issue-release key. This field is required. Sent as a path parameter.
	Key string `json:"-"`
	// IssueReleaseChangeKey is the changelog entry key to delete. This field is required.
	IssueReleaseChangeKey string `json:"issueReleaseChangeKey"`
}

ScaChangelogDeleteOptions contains parameters for the DeleteChangelogEntry method.

type ScaChangelogGetOptions added in v2.2.0

type ScaChangelogGetOptions struct {
	// Key is the issue-release key. This field is required.
	Key string `json:"key"`
}

ScaChangelogGetOptions contains parameters for the GetChangelog method.

type ScaChangelogUpdateOptions added in v2.2.0

type ScaChangelogUpdateOptions struct {
	// Key is the issue-release key. This field is required.
	Key string `json:"key"`
}

ScaChangelogUpdateOptions contains parameters for the UpdateChangelogComment method.

type ScaChangelogUpdateRequest added in v2.2.0

type ScaChangelogUpdateRequest struct {
	// IssueReleaseChangeKey is the changelog entry key to update. This field is required.
	IssueReleaseChangeKey string `json:"issueReleaseChangeKey"`
	// Comment is the new comment text. This field is required.
	Comment string `json:"comment"`
}

ScaChangelogUpdateRequest contains the request body for the UpdateChangelogComment method.

type ScaCliGetOptions

type ScaCliGetOptions struct {
	// Id is the CLI download identifier. This field is required.
	Id string `json:"id"`
}

ScaCliGetOptions contains parameters for the GetCli method.

type ScaCliInfo

type ScaCliInfo struct {
	// Id is the unique identifier of this CLI release.
	Id string `json:"id,omitempty"`
	// Filename is the filename of the CLI binary.
	Filename string `json:"filename,omitempty"`
	// Sha256 is the SHA-256 hash of the binary.
	Sha256 string `json:"sha256,omitempty"`
	// Os is the operating system target.
	Os string `json:"os,omitempty"`
	// Arch is the CPU architecture target.
	Arch string `json:"arch,omitempty"`
}

ScaCliInfo represents metadata about a downloadable SCA CLI binary.

type ScaCliListOptions

type ScaCliListOptions struct {
	// Os filters by operating system. Optional.
	Os string `json:"os,omitempty"`
	// Arch filters by CPU architecture. Optional.
	Arch string `json:"arch,omitempty"`
}

ScaCliListOptions contains parameters for the ListClis method.

type ScaDependencyFile added in v2.2.2

type ScaDependencyFile struct {
	// Content provides the raw bytes of the dependency file. This field is required.
	Content io.Reader
	// Filename is the name of the dependency file (e.g. "package-lock.json"). This field is required.
	Filename string
}

ScaDependencyFile is a single dependency or lock file submitted to ParseDependencyFiles.

type ScaDependencyFileError added in v2.2.2

type ScaDependencyFileError struct {
	// Id is the identifier of the errored input.
	Id string `json:"id,omitempty"`
	// Code is the machine-readable error code (e.g. "MISSING_LOCKFILE").
	Code string `json:"code,omitempty"`
	// Path is the path of the file the error relates to.
	Path string `json:"path,omitempty"`
	// Message is the human-readable error message.
	Message string `json:"message,omitempty"`
}

ScaDependencyFileError describes a problem encountered while parsing dependency files.

type ScaDependencyFilePackage added in v2.2.2

type ScaDependencyFilePackage struct {
	// PackageUrl is the package URL (purl) of the discovered package.
	PackageUrl string `json:"packageUrl,omitempty"`
	// DependencyFilePaths lists the dependency files that declare this package.
	DependencyFilePaths []string `json:"dependencyFilePaths,omitempty"`
	// DependencyChains lists the dependency chains that lead to this package.
	DependencyChains [][]string `json:"dependencyChains,omitempty"`
}

ScaDependencyFilePackage is a single package discovered while parsing dependency files.

type ScaDependencyFilesParseResult added in v2.2.2

type ScaDependencyFilesParseResult struct {
	// Packages is the list of packages discovered in the submitted files.
	Packages []ScaDependencyFilePackage `json:"packages,omitempty"`
	// ParsedFiles lists the submitted files that were successfully parsed.
	ParsedFiles []string `json:"parsedFiles,omitempty"`
	// Errors lists the problems encountered while parsing.
	Errors []ScaDependencyFileError `json:"errors,omitempty"`
}

ScaDependencyFilesParseResult is the response returned by ParseDependencyFiles.

type ScaDependencyRisk

type ScaDependencyRisk struct {
	// Key is the unique identifier for this issue-release pair.
	Key string `json:"key,omitempty"`
	// Severity is the severity level.
	Severity string `json:"severity,omitempty"`
	// Type is the risk type (e.g., VULNERABILITY, LICENSE).
	Type string `json:"type,omitempty"`
	// CreatedAt is the creation timestamp.
	CreatedAt string `json:"createdAt,omitempty"`
	// SpdxLicenseId is the SPDX license identifier for license risks.
	SpdxLicenseId string `json:"spdxLicenseId,omitempty"`
	// Release is the release this risk is associated with.
	Release ScaReleaseSearchResource `json:"release,omitzero"`
	// Vulnerability contains vulnerability details for CVE-type risks.
	Vulnerability ScaVulnerabilityResource `json:"vulnerability,omitzero"`
}

ScaDependencyRisk represents an issue-release pair (a vulnerability in a dependency).

type ScaDependencyRiskGetOptions

type ScaDependencyRiskGetOptions struct {
	// Key is the issue-release key. This field is required.
	Key string `json:"key"`
}

ScaDependencyRiskGetOptions contains parameters for the GetDependencyRisk method.

type ScaDependencyRisksSearch

type ScaDependencyRisksSearch struct {
	// IssuesReleases is the list of issue-release pairs.
	IssuesReleases []ScaDependencyRisk `json:"issuesReleases,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

ScaDependencyRisksSearch represents the response from the issues-releases search endpoint.

type ScaDependencyRisksSearchOptions

type ScaDependencyRisksSearchOptions struct {
	PaginationParamsV2

	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
	// BranchKey filters by branch. Optional.
	BranchKey string `json:"branchKey,omitempty"`
	// PullRequestKey filters by pull request. Optional.
	PullRequestKey string `json:"pullRequestKey,omitempty"`
	// PackageManagers filters by package managers (comma-separated). Optional.
	PackageManagers string `json:"packageManagers,omitempty"`
	// Types filters by risk type. Optional.
	Types string `json:"types,omitempty"`
	// Severities filters by severity. Optional.
	Severities string `json:"severities,omitempty"`
	// PackageName filters by package name. Optional.
	PackageName string `json:"packageName,omitempty"`
	// VulnerabilityId filters by CVE/vulnerability ID. Optional.
	VulnerabilityId string `json:"vulnerabilityId,omitempty"`
	// Sort specifies the sort order. Optional.
	Sort string `json:"sort,omitempty"`
	// NewlyIntroduced filters for risks newly introduced vs. the target branch. Optional.
	NewlyIntroduced *bool `json:"newlyIntroduced,omitempty"`
	// Direct filters for direct dependencies only. Optional.
	Direct *bool `json:"direct,omitempty"`
	// ProductionScope filters by production scope. Optional.
	ProductionScope *bool `json:"productionScope,omitempty"`
	// Assigned filters for assigned (or unassigned, when false) issues. Optional.
	Assigned *bool `json:"assigned,omitempty"`
	// OnlyShowConfirmedReachable filters for issues confirmed as reachable. Optional.
	OnlyShowConfirmedReachable *bool `json:"onlyShowConfirmedReachable,omitempty"`
	// SecurityStandard filters by security standard. Optional.
	SecurityStandard string `json:"securityStandard,omitempty"`
	// SecurityStandardCategory filters by security standard category. Optional.
	SecurityStandardCategory string `json:"securityStandardCategory,omitempty"`
	// SecurityStandardVersion filters by security standard version. Optional.
	SecurityStandardVersion string `json:"securityStandardVersion,omitempty"`
	// FixedInPullRequestKey filters for issues fixed in the given pull request. Optional.
	FixedInPullRequestKey string `json:"fixedInPullRequestKey,omitempty"`
	// Qualities filters by component qualifier. Optional.
	Qualities []string `json:"qualities,omitempty"`
	// Statuses filters by issue status. Optional.
	Statuses []string `json:"statuses,omitempty"`
	// Assignees filters by assignee logins. Optional.
	Assignees []string `json:"assignees,omitempty"`
	// Projects filters by project keys. Optional.
	Projects []string `json:"projects,omitempty"`
}

ScaDependencyRisksSearchOptions contains parameters for the SearchDependencyRisks method.

type ScaFeatureEnabledResult added in v2.2.0

type ScaFeatureEnabledResult struct {
	// Enabled indicates whether SCA is licensed and set up.
	Enabled bool `json:"enabled"`
}

ScaFeatureEnabledResult represents whether SCA is licensed and set up for the resource's organization or enterprise.

type ScaFeatureEnablement

type ScaFeatureEnablement struct {
	// Enablement indicates whether SCA is enabled.
	Enablement bool `json:"enablement"`
}

ScaFeatureEnablement represents the SCA enablement state.

type ScaIssueReleaseBranch added in v2.2.0

type ScaIssueReleaseBranch struct {
	// Uuid is the branch UUID.
	Uuid string `json:"uuid,omitempty"`
	// Key is the branch key.
	Key string `json:"key,omitempty"`
	// ProjectKey is the key of the project the branch belongs to.
	ProjectKey string `json:"projectKey,omitempty"`
	// ProjectName is the name of the project the branch belongs to.
	ProjectName string `json:"projectName,omitempty"`
	// PullRequest indicates whether this branch is a pull request.
	PullRequest bool `json:"pullRequest"`
}

ScaIssueReleaseBranch describes the branch an issue-release pair belongs to.

type ScaIssueReleaseChange added in v2.2.0

type ScaIssueReleaseChange struct {
	// Key is the unique identifier of this changelog entry.
	Key string `json:"key,omitempty"`
	// CreatedAt is the creation timestamp.
	CreatedAt string `json:"createdAt,omitempty"`
	// User is the user who made the change.
	User ScaUserResource `json:"user,omitzero"`
	// MarkdownComment is the comment text in Markdown format, if any.
	MarkdownComment string `json:"markdownComment,omitempty"`
	// HtmlComment is the comment text rendered as HTML, if any.
	HtmlComment string `json:"htmlComment,omitempty"`
	// ChangeData lists the field-level changes recorded by this entry.
	ChangeData []ScaIssueReleaseChangeDiff `json:"changeData,omitempty"`
	// Actions lists the actions available to the current user for this entry (e.g. EDIT_COMMENT,
	// DELETE_COMMENT).
	Actions []string `json:"actions,omitempty"`
}

ScaIssueReleaseChange represents a single changelog entry for an issue-release pair.

type ScaIssueReleaseChangeDiff added in v2.2.0

type ScaIssueReleaseChangeDiff struct {
	// FieldName is the name of the field that changed.
	FieldName string `json:"fieldName,omitempty"`
	// OldValue is the value before the change.
	OldValue string `json:"oldValue,omitempty"`
	// NewValue is the value after the change.
	NewValue string `json:"newValue,omitempty"`
}

ScaIssueReleaseChangeDiff represents a single field change recorded in an issue-release changelog entry.

type ScaIssueReleaseChangelog added in v2.2.0

type ScaIssueReleaseChangelog struct {
	// Changelog is the list of changelog entries.
	Changelog []ScaIssueReleaseChange `json:"changelog,omitempty"`
}

ScaIssueReleaseChangelog represents the response from the GetChangelog method.

type ScaIssueReleaseDetails added in v2.2.0

type ScaIssueReleaseDetails struct {
	Type                         string                   `json:"type,omitempty"`
	CreatedAt                    string                   `json:"createdAt,omitempty"`
	OriginalSeverity             string                   `json:"originalSeverity,omitempty"`
	ManualSeverity               string                   `json:"manualSeverity,omitempty"`
	SpdxLicenseId                string                   `json:"spdxLicenseId,omitempty"`
	Quality                      string                   `json:"quality,omitempty"`
	Status                       string                   `json:"status,omitempty"`
	Key                          string                   `json:"key,omitempty"`
	Severity                     string                   `json:"severity,omitempty"`
	Branch                       ScaIssueReleaseBranch    `json:"branch,omitzero"`
	Assignee                     ScaUserResource          `json:"assignee,omitzero"`
	Actions                      []string                 `json:"actions,omitempty"`
	Transitions                  []string                 `json:"transitions,omitempty"`
	Release                      ScaReleaseSearchResource `json:"release,omitzero"`
	Vulnerability                ScaVulnerabilityResource `json:"vulnerability,omitzero"`
	CommentCount                 int32                    `json:"commentCount"`
	ShowIncreasedSeverityWarning bool                     `json:"showIncreasedSeverityWarning"`
}

ScaIssueReleaseDetails represents detailed information about an issue-release pair (dependency risk).

type ScaLicenseInfo added in v2.2.0

type ScaLicenseInfo struct {
	// Expression is the SPDX license expression.
	Expression string `json:"expression,omitempty"`
	// Allowed indicates whether the license is allowed under the applicable license policy.
	Allowed bool `json:"allowed"`
}

ScaLicenseInfo represents license information about a package, as returned by GetPackageInfo.

type ScaLicensePolicyLicense added in v2.2.0

type ScaLicensePolicyLicense struct {
	// Id is the license policy's unique identifier.
	Id string `json:"id,omitempty"`
	// SpdxLicenseId is the SPDX license identifier.
	SpdxLicenseId string `json:"spdxLicenseId,omitempty"`
	// Name is the license's display name.
	Name string `json:"name,omitempty"`
	// Category is the license category key.
	// Allowed values: ScaLicenseCategoryUnknown, ScaLicenseCategoryCopyleftWeak,
	// ScaLicenseCategoryCopyleftStrong, ScaLicenseCategoryCopyleftNetwork,
	// ScaLicenseCategoryCopyleftMaximal, ScaLicenseCategoryPermissiveStandard,
	// ScaLicenseCategoryPermissiveAmateur.
	Category string `json:"category,omitempty"`
	// Policy is the policy configured for this license.
	// Allowed values: ScaLicensePolicyDeny, ScaLicensePolicyAllow.
	Policy string `json:"policy,omitempty"`
}

ScaLicensePolicyLicense represents the policy configured for a single license within a license profile.

type ScaLicensePolicyLicenseUpdateRequest added in v2.2.0

type ScaLicensePolicyLicenseUpdateRequest struct {
	// Policy is the policy to apply to the license. This field is required.
	// Allowed values: ScaLicensePolicyDeny, ScaLicensePolicyAllow.
	Policy string `json:"policy"`
}

ScaLicensePolicyLicenseUpdateRequest contains the parameters for the UpdateLicenseProfileLicense method.

type ScaLicenseProfile added in v2.2.0

type ScaLicenseProfile struct {
	// Id is the license profile's unique identifier.
	Id string `json:"id,omitempty"`
	// Name is the license profile's display name.
	Name string `json:"name,omitempty"`
	// UpdatedAt is the timestamp of the license profile's last update.
	UpdatedAt string `json:"updatedAt,omitempty"`
	// Actions describes the actions available to the current user on this license profile.
	Actions ScaLicenseProfileActions `json:"actions,omitzero"`
	// Default is true if this is the default license profile.
	Default bool `json:"default"`
}

ScaLicenseProfile represents a license profile used to evaluate license issues.

type ScaLicenseProfileActions added in v2.2.0

type ScaLicenseProfileActions struct {
	// Edit is true if the current user can edit the license profile.
	Edit bool `json:"edit"`
	// SetAsDefault is true if the current user can set the license profile as the default.
	SetAsDefault bool `json:"setAsDefault"`
	// AssociateProjects is true if the current user can associate projects with the license
	// profile.
	AssociateProjects bool `json:"associateProjects"`
	// Delete is true if the current user can delete the license profile.
	Delete bool `json:"delete"`
}

ScaLicenseProfileActions describes the actions available to the current user on a license profile.

type ScaLicenseProfileAssignableProject added in v2.2.0

type ScaLicenseProfileAssignableProject struct {
	// Id is the project's unique identifier.
	Id string `json:"id,omitempty"`
	// ProjectKey is the project's key.
	ProjectKey string `json:"projectKey,omitempty"`
	// ProjectName is the project's display name.
	ProjectName string `json:"projectName,omitempty"`
	// AssignedToLicenseProfile is true if the project is already assigned to the license profile.
	AssignedToLicenseProfile bool `json:"assignedToLicenseProfile"`
}

ScaLicenseProfileAssignableProject represents a project that can be assigned to a license profile.

type ScaLicenseProfileAssignableProjectsOptions added in v2.2.0

type ScaLicenseProfileAssignableProjectsOptions struct {
	PaginationParamsV2

	AssignedToLicenseProfile *bool  `json:"assignedToLicenseProfile,omitempty"`
	LicenseProfileUuid       string `json:"licenseProfileUuid,omitempty"`
	LicenseProfileId         string `json:"licenseProfileId,omitempty"`
	Q                        string `json:"q,omitempty"`
}

ScaLicenseProfileAssignableProjectsOptions contains parameters for the ListLicenseProfileAssignableProjects method.

type ScaLicenseProfileAssignableProjectsResponse added in v2.2.0

type ScaLicenseProfileAssignableProjectsResponse struct {
	// AssignableProjects is the list of projects that can be assigned to the license profile.
	AssignableProjects []ScaLicenseProfileAssignableProject `json:"assignableProjects,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

ScaLicenseProfileAssignableProjectsResponse represents the response from the license profile assignable projects endpoint.

type ScaLicenseProfileAssignmentDeleteOptions added in v2.2.0

type ScaLicenseProfileAssignmentDeleteOptions struct {
	// ProjectKey is the key of the project whose license profile assignment should be removed. This
	// field is required.
	ProjectKey string `json:"projectKey"`
}

ScaLicenseProfileAssignmentDeleteOptions contains parameters for the DeleteLicenseProfileAssignment method.

type ScaLicenseProfileAssignmentRequest added in v2.2.0

type ScaLicenseProfileAssignmentRequest struct {
	// LicenseProfileUuid is the key of the license profile to assign the project to. Optional.
	//
	// Deprecated: use LicenseProfileId instead.
	LicenseProfileUuid string `json:"licenseProfileUuid,omitempty"`
	// LicenseProfileId is the key of the license profile to assign the project to. Optional.
	LicenseProfileId string `json:"licenseProfileId,omitempty"`
	// ProjectKey is the key of the project to assign to the license profile. This field is
	// required.
	ProjectKey string `json:"projectKey"`
}

ScaLicenseProfileAssignmentRequest contains the parameters for the AssignLicenseProfileProject method.

type ScaLicenseProfileCategory added in v2.2.0

type ScaLicenseProfileCategory struct {
	// Id is the category's unique identifier.
	Id string `json:"id,omitempty"`
	// Key is the license category key.
	// Allowed values: ScaLicenseCategoryUnknown, ScaLicenseCategoryCopyleftWeak,
	// ScaLicenseCategoryCopyleftStrong, ScaLicenseCategoryCopyleftNetwork,
	// ScaLicenseCategoryCopyleftMaximal, ScaLicenseCategoryPermissiveStandard,
	// ScaLicenseCategoryPermissiveAmateur.
	Key string `json:"key,omitempty"`
	// Policy is the policy configured for this category.
	// Allowed values: ScaLicensePolicyDeny, ScaLicensePolicyAllow.
	Policy string `json:"policy,omitempty"`
}

ScaLicenseProfileCategory represents the policy configured for an entire license category within a license profile.

type ScaLicenseProfileCategoryOptions added in v2.2.0

type ScaLicenseProfileCategoryOptions struct {
	// LicenseProfileKey is the license profile key. This field is required.
	LicenseProfileKey string `json:"licenseProfileKey"`
	// CategoryKey is the license category key. This field is required.
	// Allowed values: ScaLicenseCategoryUnknown, ScaLicenseCategoryCopyleftWeak,
	// ScaLicenseCategoryCopyleftStrong, ScaLicenseCategoryCopyleftNetwork,
	// ScaLicenseCategoryCopyleftMaximal, ScaLicenseCategoryPermissiveStandard,
	// ScaLicenseCategoryPermissiveAmateur.
	CategoryKey string `json:"categoryKey"`
}

ScaLicenseProfileCategoryOptions contains parameters for the UpdateLicenseProfileCategory method.

type ScaLicenseProfileCategoryUpdateRequest added in v2.2.0

type ScaLicenseProfileCategoryUpdateRequest struct {
	// Policy is the policy to apply to the category. This field is required.
	// Allowed values: ScaLicensePolicyDeny, ScaLicensePolicyAllow.
	Policy string `json:"policy"`
}

ScaLicenseProfileCategoryUpdateRequest contains the parameters for the UpdateLicenseProfileCategory method.

type ScaLicenseProfileCollectionActions added in v2.2.0

type ScaLicenseProfileCollectionActions struct {
	// Create is true if the current user can create a new license profile.
	Create bool `json:"create"`
}

ScaLicenseProfileCollectionActions describes the actions available to the current user on the collection of license profiles.

type ScaLicenseProfileCreateRequest added in v2.2.0

type ScaLicenseProfileCreateRequest struct {
	// Name is the name of the license profile to create. This field is required.
	Name string `json:"name"`
	// Organization is the key of the organization the license profile belongs to. This field is
	// required.
	Organization string `json:"organization"`
	// Default, if true, sets the license profile as the default. Optional.
	Default bool `json:"default,omitempty"`
}

ScaLicenseProfileCreateRequest contains the parameters for the CreateLicenseProfile method.

type ScaLicenseProfileDetails added in v2.2.0

type ScaLicenseProfileDetails struct {
	// Profile is the license profile.
	Profile ScaLicenseProfile `json:"profile,omitzero"`
	// Categories is the list of category policies configured for the license profile.
	Categories []ScaLicenseProfileCategory `json:"categories,omitempty"`
	// Licenses is the list of individual license policies configured for the license profile.
	Licenses []ScaLicensePolicyLicense `json:"licenses,omitempty"`
}

ScaLicenseProfileDetails represents the response from the get license profile endpoint, containing the profile itself plus its category and license policies.

type ScaLicenseProfileGetOptions added in v2.2.0

type ScaLicenseProfileGetOptions struct {
	// Key is the license profile key. This field is required.
	Key string `json:"key"`
}

ScaLicenseProfileGetOptions contains parameters for the GetLicenseProfile and DeleteLicenseProfile methods.

type ScaLicenseProfileIndex added in v2.2.0

type ScaLicenseProfileIndex struct {
	// LicenseProfiles is the list of configured license profiles.
	LicenseProfiles []ScaLicenseProfile `json:"licenseProfiles,omitempty"`
	// Actions describes the actions available to the current user on the license profiles
	// collection.
	Actions ScaLicenseProfileCollectionActions `json:"actions,omitzero"`
}

ScaLicenseProfileIndex represents the response from the license profiles list endpoint.

type ScaLicenseProfileLicenseOptions added in v2.2.0

type ScaLicenseProfileLicenseOptions struct {
	// LicenseProfileKey is the license profile key. This field is required.
	LicenseProfileKey string `json:"licenseProfileKey"`
	// LicensePolicyId is the license ID. This field is required.
	LicensePolicyId string `json:"licensePolicyId"`
}

ScaLicenseProfileLicenseOptions contains parameters for the UpdateLicenseProfileLicense method.

type ScaLicenseProfileListOptions added in v2.2.0

type ScaLicenseProfileListOptions struct {
	// ProjectKey, if provided, filters to the license profile that is used to analyze the project
	// (if one exists). Optional.
	ProjectKey string `json:"projectKey,omitempty"`
}

ScaLicenseProfileListOptions contains parameters for the ListLicenseProfiles method.

type ScaLicenseProfileUpdateRequest added in v2.2.0

type ScaLicenseProfileUpdateRequest struct {
	// Default, if set, changes whether the license profile is the default. Optional.
	Default *bool `json:"default,omitempty"`
	// Name is the new name of the license profile. Optional.
	Name string `json:"name,omitempty"`
}

ScaLicenseProfileUpdateRequest contains the parameters for the UpdateLicenseProfile method.

type ScaPackageInfo added in v2.2.0

type ScaPackageInfo struct {
	// Packages is the list of analyzed packages.
	Packages []ScaPackageInfoEntry `json:"packages,omitempty"`
}

ScaPackageInfo represents the response from the GetPackageInfo method when analyzing one or more packages by their purls.

type ScaPackageInfoEntry added in v2.2.0

type ScaPackageInfoEntry struct {
	// PackageUrl is the package URL (purl) that was analyzed.
	PackageUrl string `json:"purl,omitempty"`
	// License contains license information about the package.
	License ScaLicenseInfo `json:"license,omitzero"`
	// Vulnerabilities lists the vulnerabilities affecting this package.
	Vulnerabilities []ScaPackageVulnerability `json:"vulnerabilities,omitempty"`
	// Malicious indicates whether the package is known to be malicious.
	Malicious bool `json:"malicious"`
	// KnownPackage indicates whether the package (regardless of version) is known.
	KnownPackage bool `json:"knownPackage"`
	// KnownRelease indicates whether this specific package version is known.
	KnownRelease bool `json:"knownRelease"`
}

ScaPackageInfoEntry represents analyzed information about a single package, as returned by GetPackageInfo.

type ScaPackageInfoOptions added in v2.2.0

type ScaPackageInfoOptions struct {
	IncludeVulnerabilityDetails *bool    `json:"includeVulnerabilityDetails,omitempty"`
	ProjectKey                  string   `json:"projectKey"`
	Purls                       []string `json:"purls"`
}

ScaPackageInfoOptions contains the request body for the GetPackageInfo method.

type ScaPackageVulnerability added in v2.2.0

type ScaPackageVulnerability struct {
	Id                 string          `json:"id,omitempty"`
	RiskSeverity       string          `json:"riskSeverity,omitempty"`
	PublishedOn        string          `json:"publishedOn,omitempty"`
	UnaffectedVersions string          `json:"unaffectedVersions,omitempty"`
	CweIds             []string        `json:"cweIds,omitempty"`
	FixedVersions      []ScaVersionFix `json:"fixedVersions,omitempty"`
	CvssScore          float64         `json:"cvssScore"`
	Withdrawn          bool            `json:"withdrawn"`
}

ScaPackageVulnerability represents a vulnerability affecting a package, as returned by GetPackageInfo.

type ScaParseDependencyFilesOptions added in v2.2.2

type ScaParseDependencyFilesOptions struct {
	// ProjectKey is the key of the project the files belong to. This field is required.
	ProjectKey string
	// Files is the set of dependency files to parse. At least one file is required.
	Files []ScaDependencyFile
}

ScaParseDependencyFilesOptions contains parameters for the ParseDependencyFiles method.

type ScaReachabilityDefinitionsOptions added in v2.2.2

type ScaReachabilityDefinitionsOptions struct {
	// LanguageKey is the language to return reachability definitions for. This field is required.
	LanguageKey string `json:"languageKey"`
	// ProjectKey scopes the definitions to a project. Optional.
	ProjectKey string `json:"projectKey,omitempty"`
	// Organization scopes the definitions to an organization. Optional.
	// Deprecated by SonarQube in favour of ProjectKey.
	Organization string `json:"organization,omitempty"`
}

ScaReachabilityDefinitionsOptions contains parameters for the ListReachabilityDefinitions method.

type ScaReanalysisOptions added in v2.2.0

type ScaReanalysisOptions struct {
	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
	// BranchKey is the branch to re-analyze. Optional; if omitted, all branches matching the
	// organization's rescan branch type setting will be queued.
	BranchKey string `json:"branchKey,omitempty"`
}

ScaReanalysisOptions contains the request body for the TriggerReanalysis method.

type ScaReanalysisResult added in v2.2.0

type ScaReanalysisResult struct {
	// BranchesQueued is the number of branches that were queued for re-analysis.
	BranchesQueued int32 `json:"branchesQueued"`
}

ScaReanalysisResult represents the response from the TriggerReanalysis method.

type ScaReleaseDetail

type ScaReleaseDetail struct {
	// Key is the unique release key.
	Key string `json:"key,omitempty"`
	// PackageUrl is the package URL (purl).
	PackageUrl string `json:"packageUrl,omitempty"`
	// PackageManager is the package manager.
	PackageManager string `json:"packageManager,omitempty"`
	// PackageName is the package name.
	PackageName string `json:"packageName,omitempty"`
	// Version is the package version.
	Version string `json:"version,omitempty"`
	// LicenseExpression is the SPDX license expression.
	LicenseExpression string `json:"licenseExpression,omitempty"`
	// ScopeSummary is a summary of dependency scopes.
	ScopeSummary string `json:"scopeSummary,omitempty"`
	// Known indicates whether the package is known.
	Known bool `json:"known"`
	// NewlyIntroduced indicates whether this release was newly introduced vs. the target branch.
	NewlyIntroduced bool `json:"newlyIntroduced"`
	// DirectSummary indicates whether this is a direct dependency.
	DirectSummary bool `json:"directSummary"`
	// ProductionScopeSummary indicates whether this is in production scope.
	ProductionScopeSummary bool `json:"productionScopeSummary"`
}

ScaReleaseDetail represents detailed information about a release.

type ScaReleaseGetOptions

type ScaReleaseGetOptions struct {
	// Key is the release key. This field is required.
	Key string `json:"key"`
}

ScaReleaseGetOptions contains parameters for the GetRelease method.

type ScaReleasePackageManagerCount

type ScaReleasePackageManagerCount struct {
	// PackageManager is the package manager (e.g., npm, maven).
	PackageManager string `json:"packageManager,omitempty"`
	// ReleaseCount is the number of releases for this package manager.
	ReleaseCount int32 `json:"releaseCount"`
}

ScaReleasePackageManagerCount represents the number of releases for a given package manager.

type ScaReleaseResearch added in v2.2.0

type ScaReleaseResearch struct {
	// Releases is the list of researched releases.
	Releases []ScaReleaseResearchEntry `json:"releases,omitempty"`
}

ScaReleaseResearch represents the response from the ResearchReleases method.

type ScaReleaseResearchEntry added in v2.2.0

type ScaReleaseResearchEntry struct {
	Key               string                    `json:"key,omitempty"`
	PackageUrl        string                    `json:"packageUrl,omitempty"`
	PackageManager    string                    `json:"packageManager,omitempty"`
	PackageName       string                    `json:"packageName,omitempty"`
	Version           string                    `json:"version,omitempty"`
	LicenseExpression string                    `json:"licenseExpression,omitempty"`
	Issues            []ScaReleaseResearchIssue `json:"issues,omitempty"`
	Known             bool                      `json:"known"`
	KnownPackage      bool                      `json:"knownPackage"`
	NewlyIntroduced   bool                      `json:"newlyIntroduced"`
}

ScaReleaseResearchEntry represents a single researched release.

type ScaReleaseResearchIssue added in v2.2.0

type ScaReleaseResearchIssue struct {
	Key                          string   `json:"key,omitempty"`
	Severity                     string   `json:"severity,omitempty"`
	Type                         string   `json:"type,omitempty"`
	Quality                      string   `json:"quality,omitempty"`
	Status                       string   `json:"status,omitempty"`
	VulnerabilityId              string   `json:"vulnerabilityId,omitempty"`
	CvssScore                    string   `json:"cvssScore,omitempty"`
	SpdxLicenseId                string   `json:"spdxLicenseId,omitempty"`
	CweIds                       []string `json:"cweIds,omitempty"`
	ShowIncreasedSeverityWarning bool     `json:"showIncreasedSeverityWarning"`
}

ScaReleaseResearchIssue represents a potential issue identified for a researched release.

type ScaReleaseResearchOptions added in v2.2.0

type ScaReleaseResearchOptions struct {
	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
	// Purls is the list of versioned package URLs to research. This field is required. Maximum
	// 100 per request.
	Purls []string `json:"purls"`
}

ScaReleaseResearchOptions contains the request body for the ResearchReleases method.

type ScaReleaseSearchBranch added in v2.2.0

type ScaReleaseSearchBranch struct {
	Id                  string   `json:"id,omitempty"`
	Key                 string   `json:"key,omitempty"`
	ProjectKey          string   `json:"projectKey,omitempty"`
	ProjectName         string   `json:"projectName,omitempty"`
	PackageUrl          string   `json:"packageUrl,omitempty"`
	DependencyFilePaths []string `json:"dependencyFilePaths,omitempty"`
	PullRequest         bool     `json:"pullRequest"`
	Direct              bool     `json:"direct"`
	ProductionScope     bool     `json:"productionScope"`
}

ScaReleaseSearchBranch represents a branch on which a matching release was found, as returned by SearchReleasesByPurl.

type ScaReleaseSearchByPurl added in v2.2.0

type ScaReleaseSearchByPurl struct {
	// Branches is the list of branches on which a matching release was found.
	Branches []ScaReleaseSearchBranch `json:"branches,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

ScaReleaseSearchByPurl represents the response from the SearchReleasesByPurl method.

type ScaReleaseSearchByPurlOptions added in v2.2.0

type ScaReleaseSearchByPurlOptions struct {
	PaginationParamsV2

	Purl string `json:"purl"`
}

ScaReleaseSearchByPurlOptions contains parameters for the SearchReleasesByPurl method.

type ScaReleaseSearchResource

type ScaReleaseSearchResource struct {
	// Key is the unique release key.
	Key string `json:"key,omitempty"`
	// PackageUrl is the package URL (purl).
	PackageUrl string `json:"packageUrl,omitempty"`
	// PackageManager is the package manager (e.g., npm, maven).
	PackageManager string `json:"packageManager,omitempty"`
	// PackageName is the package name.
	PackageName string `json:"packageName,omitempty"`
	// Version is the package version.
	Version string `json:"version,omitempty"`
	// LicenseExpression is the SPDX license expression.
	LicenseExpression string `json:"licenseExpression,omitempty"`
	// ScopeSummary is a summary of dependency scopes.
	ScopeSummary string `json:"scopeSummary,omitempty"`
	// DependencyFilePaths lists the dependency files that reference this release.
	DependencyFilePaths []string `json:"dependencyFilePaths,omitempty"`
	// Known indicates whether the package is known to SonarQube SCA.
	Known bool `json:"known"`
	// NewlyIntroduced indicates whether this release was newly introduced vs. the target branch.
	NewlyIntroduced bool `json:"newlyIntroduced"`
	// DirectSummary indicates whether this is a direct dependency.
	DirectSummary bool `json:"directSummary"`
}

ScaReleaseSearchResource represents a release in the SCA search results.

type ScaReleasesSearch

type ScaReleasesSearch struct {
	// Releases is the list of releases.
	Releases []ScaReleaseSearchResource `json:"releases,omitempty"`
	// PackageManagerCounts summarizes the number of releases per package manager.
	PackageManagerCounts []ScaReleasePackageManagerCount `json:"packageManagerCounts,omitempty"`
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
}

ScaReleasesSearch represents the response from the releases search endpoint.

type ScaReleasesSearchOptions

type ScaReleasesSearchOptions struct {
	PaginationParamsV2

	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
	// BranchKey filters by branch. Optional.
	BranchKey string `json:"branchKey,omitempty"`
	// PullRequestKey filters by pull request. Optional.
	PullRequestKey string `json:"pullRequestKey,omitempty"`
	// PackageManagers filters by package managers. Optional.
	PackageManagers string `json:"packageManagers,omitempty"`
	// Q filters by package name query. Optional.
	Q string `json:"q,omitempty"`
	// NewlyIntroduced filters for releases newly introduced vs. the target branch. Optional.
	NewlyIntroduced *bool `json:"newlyIntroduced,omitempty"`
	// Direct filters for direct dependencies. Optional.
	Direct *bool `json:"direct,omitempty"`
	// ProductionScope filters by production scope. Optional.
	ProductionScope *bool `json:"productionScope,omitempty"`
}

ScaReleasesSearchOptions contains parameters for the SearchReleases method.

type ScaRiskReportItem added in v2.2.0

type ScaRiskReportItem struct {
	CreatedAt          string                      `json:"createdAt,omitempty"`
	PackageUrl         string                      `json:"packageUrl,omitempty"`
	BranchKey          string                      `json:"branchKey,omitempty"`
	RiskTitle          string                      `json:"riskTitle,omitempty"`
	RiskType           string                      `json:"riskType,omitempty"`
	RiskSeverity       string                      `json:"riskSeverity,omitempty"`
	RiskStatus         string                      `json:"riskStatus,omitempty"`
	Scope              string                      `json:"scope,omitempty"`
	VulnerabilityId    string                      `json:"vulnerabilityId,omitempty"`
	RiskUrl            string                      `json:"riskUrl,omitempty"`
	ProjectName        string                      `json:"projectName,omitempty"`
	ProjectKey         string                      `json:"projectKey,omitempty"`
	PublishedOn        string                      `json:"publishedOn,omitempty"`
	CweIds             []string                    `json:"cweIds,omitempty"`
	DependencyChains   [][]string                  `json:"dependencyChains,omitempty"`
	StatusChanges      []ScaRiskReportStatusChange `json:"statusChanges,omitempty"`
	CvssScore          float64                     `json:"cvssScore"`
	EpssPercentile     float64                     `json:"epssPercentile"`
	EpssScore          float64                     `json:"epssScore"`
	KnownExploited     bool                        `json:"knownExploited"`
	ProductionScope    bool                        `json:"productionScope"`
	ConfirmedReachable bool                        `json:"confirmedReachable"`
}

ScaRiskReportItem represents a single SCA dependency risk in a risk report.

type ScaRiskReportOptions added in v2.2.0

type ScaRiskReportOptions struct {
	// Component is the key of the component (project, application, portfolio) to build the
	// report for. This field is required.
	Component string `json:"component"`
	// Branch filters by branch. Optional.
	Branch string `json:"branch,omitempty"`
	// RiskType filters by risk type. Optional; if not provided, all risk types are included.
	RiskType []string `json:"riskType,omitempty"`
}

ScaRiskReportOptions contains parameters for the GetRiskReport method.

type ScaRiskReportStatusChange added in v2.2.0

type ScaRiskReportStatusChange struct {
	// Comment explains why the status changed.
	Comment string `json:"comment,omitempty"`
	// NewStatus is the status the risk transitioned to.
	NewStatus string `json:"newStatus,omitempty"`
	// CreatedAt is the timestamp of the change.
	CreatedAt string `json:"createdAt,omitempty"`
}

ScaRiskReportStatusChange represents a status change recorded in a risk report item's history.

type ScaSbomReportOptions

type ScaSbomReportOptions struct {
	// Component is the key of the component (project, application, portfolio) to build the
	// report for. This field is required.
	Component string `json:"component"`
	// Branch filters by branch. Optional.
	Branch string `json:"branch,omitempty"`
	// Type is the SBOM report type, one of ScaSbomReportTypeCycloneDX, ScaSbomReportTypeSpdx23 or
	// ScaSbomReportTypeSpdx30. This field is required.
	Type string `json:"type"`
	// OnlyProductionScope filters to production dependencies only when true. If false, all
	// dependencies are included. Optional; defaults to true server-side when absent.
	OnlyProductionScope *bool `json:"onlyProductionScope,omitempty"`
	// Format is the desired report serialization, one of ScaSbomReportFormatJSON or
	// ScaSbomReportFormatXML. It is sent as the request's Accept header rather than a query
	// parameter, since the SonarQube API selects the report's MIME type via content negotiation.
	// This field is required.
	Format string `json:"-"`
}

ScaSbomReportOptions contains parameters for the GetSbomReport method.

type ScaSelfTestHTTPCall added in v2.2.0

type ScaSelfTestHTTPCall struct {
	AttemptedUrl             string     `json:"attemptedUrl,omitempty"`
	AttemptedMethod          string     `json:"attemptedMethod,omitempty"`
	ResponseBody             string     `json:"responseBody,omitempty"`
	ResponseHeaders          [][]string `json:"responseHeaders,omitempty"`
	ResponseCode             int32      `json:"responseCode"`
	ResponseBodyAppearsValid bool       `json:"responseBodyAppearsValid"`
}

ScaSelfTestHTTPCall represents the result of a single diagnostic HTTP call performed by SelfTest.

type ScaSelfTestResult added in v2.2.0

type ScaSelfTestResult struct {
	// CliVersionCheck is the result of the CLI version check.
	CliVersionCheck ScaSelfTestHTTPCall `json:"cliVersionCheck,omitzero"`
	// VulnerabilityDetailsCheck is the result of the vulnerability details check.
	VulnerabilityDetailsCheck ScaSelfTestHTTPCall `json:"vulnerabilityDetailsCheck,omitzero"`
	// FeatureEnabled indicates whether SCA is enabled.
	FeatureEnabled bool `json:"featureEnabled"`
	// SelfTestPassed indicates whether the overall self-test passed.
	SelfTestPassed bool `json:"selfTestPassed"`
}

ScaSelfTestResult represents the response from the SelfTest method.

type ScaService

type ScaService struct {
	// contains filtered or unexported fields
}

ScaService handles communication with the Software Composition Analysis (SCA) V2 API endpoints. This service is only available in Enterprise Edition with SCA enabled.

func (*ScaService) AddComment added in v2.2.0

func (s *ScaService) AddComment(ctx context.Context, body *ScaAddCommentRequest) (*http.Response, error)

AddComment adds a comment to an issue-release pair. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: POST /api/v2/sca/issues-releases/comments. Enterprise Edition only.

func (*ScaService) AssignLicenseProfileProject added in v2.2.0

func (s *ScaService) AssignLicenseProfileProject(ctx context.Context, body *ScaLicenseProfileAssignmentRequest) (*ScaLicenseProfile, *http.Response, error)

AssignLicenseProfileProject configures which license profile should be used when analyzing a project for license issues. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: PATCH /api/v2/sca/license-profiles/assigned-projects. Enterprise Edition only.

func (*ScaService) BulkChangeIssueReleases added in v2.2.2

BulkChangeIssueReleases applies a status transition, severity change and/or assignee change to a collection of issue-release pairs in one call, returning the updated issue-release details.

API endpoint: POST /api/v2/sca/issues-releases/bulk-change. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ScaService) ChangeStatus added in v2.2.0

ChangeStatus transitions a single issue-release pair (dependency risk) to a new status, with an optional comment explaining why. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: PATCH /api/v2/sca/issues-releases/change-status. Enterprise Edition only.

func (*ScaService) CreateLicenseProfile added in v2.2.0

CreateLicenseProfile creates a new license profile for projects to use when evaluating license issues. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: POST /api/v2/sca/license-profiles. Enterprise Edition only.

func (*ScaService) DeleteChangelogEntry added in v2.2.0

func (s *ScaService) DeleteChangelogEntry(ctx context.Context, opt *ScaChangelogDeleteOptions) (*http.Response, error)

DeleteChangelogEntry deletes a comment from an issue-release pair's changelog. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: DELETE /api/v2/sca/issues-releases/{key}/changelog. Enterprise Edition only.

func (*ScaService) DeleteLicenseProfile added in v2.2.0

func (s *ScaService) DeleteLicenseProfile(ctx context.Context, opt *ScaLicenseProfileGetOptions) (*http.Response, error)

DeleteLicenseProfile deletes the license profile. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: DELETE /api/v2/sca/license-profiles/{license-profile-key}. Enterprise Edition only.

func (*ScaService) DeleteLicenseProfileAssignment added in v2.2.0

func (s *ScaService) DeleteLicenseProfileAssignment(ctx context.Context, opt *ScaLicenseProfileAssignmentDeleteOptions) (*http.Response, error)

DeleteLicenseProfileAssignment removes the project's assignment to the license profile. If there is a default license profile, it will be used to analyze license issues for this project. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: DELETE /api/v2/sca/license-profiles/assigned-projects/{project-key}. Enterprise Edition only.

func (*ScaService) GetAllAssignees added in v2.2.0

func (s *ScaService) GetAllAssignees(ctx context.Context, opt *ScaAllAssigneesOptions) ([]ScaUserResource, *http.Response, error)

GetAllAssignees returns the list of users assigned to at least one issue in the given branch. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: GET /api/v2/sca/issues-releases/all-assignees. Enterprise Edition only.

func (*ScaService) GetAnalysis added in v2.2.0

GetAnalysis fetches the analysis status for a project branch or pull request. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: GET /api/v2/sca/analyses. Enterprise Edition only.

func (*ScaService) GetChangelog added in v2.2.0

GetChangelog returns the changelog for a single issue-release pair. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: GET /api/v2/sca/issues-releases/{key}/changelogs. Enterprise Edition only.

func (*ScaService) GetCli

GetCli returns metadata for a specific SCA CLI download. Requires 'Browse' permission.

API endpoint: GET /api/v2/sca/clis/{id}. Enterprise Edition only.

func (*ScaService) GetDependencyRisk

GetDependencyRisk returns details for a single issue-release pair. Requires 'Browse' permission on the project.

API endpoint: GET /api/v2/sca/issues-releases/{key}. Enterprise Edition only.

func (*ScaService) GetEnablement

func (s *ScaService) GetEnablement(ctx context.Context) (*ScaFeatureEnablement, *http.Response, error)

GetEnablement returns the SCA feature enablement status. Requires 'Administer System' permission.

API endpoint: GET /api/v2/sca/feature-enablements. Enterprise Edition only.

func (*ScaService) GetFeatureEnabled added in v2.2.0

func (s *ScaService) GetFeatureEnabled(ctx context.Context) (*ScaFeatureEnabledResult, *http.Response, error)

GetFeatureEnabled returns whether SCA is licensed and set up for the resource's organization or enterprise.

API endpoint: GET /api/v2/sca/feature-enabled. Enterprise Edition only.

func (*ScaService) GetLicenseProfile added in v2.2.0

GetLicenseProfile returns the license policy for a given profile. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: GET /api/v2/sca/license-profiles/{license-profile-key}. Enterprise Edition only.

func (*ScaService) GetPackageInfo added in v2.2.0

func (s *ScaService) GetPackageInfo(ctx context.Context, body *ScaPackageInfoOptions) (*ScaPackageInfo, *http.Response, error)

GetPackageInfo analyzes one or more packages by their package URLs (purls), returning license, vulnerability and malware information. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: POST /api/v2/sca/package-info. Enterprise Edition only.

func (*ScaService) GetRelease

GetRelease returns details for a single dependency release. Requires 'Browse' permission on the project.

API endpoint: GET /api/v2/sca/releases/{key}. Enterprise Edition only.

func (*ScaService) GetRiskReport added in v2.2.0

GetRiskReport returns a report of all current SCA dependency risks for a given component and branch.

API endpoint: GET /api/v2/sca/risk-reports. Enterprise Edition only.

func (*ScaService) GetSbomReport

func (s *ScaService) GetSbomReport(ctx context.Context, opt *ScaSbomReportOptions) ([]byte, *http.Response, error)

GetSbomReport returns a Software Bill of Materials (SBOM) report for a project. The report's MIME type is selected via content negotiation: opt.Type picks the report standard (ScaSbomReportTypeCycloneDX or ScaSbomReportTypeSpdx23) and opt.Format picks the serialization (ScaSbomReportFormatJSON or ScaSbomReportFormatXML); together they set the request's Accept header, which the server requires to disambiguate the response format. Requires 'Browse' permission on the project.

API endpoint: GET /api/v2/sca/sbom-reports. Enterprise Edition only.

func (*ScaService) IsScaEnabled deprecated added in v2.2.0

IsScaEnabled returns whether SCA is licensed and set up for the resource's organization or enterprise.

Deprecated: prefer GetFeatureEnabled in new code.

API endpoint: GET /api/v2/sca/enabled. Enterprise Edition only.

func (*ScaService) ListClis

func (s *ScaService) ListClis(ctx context.Context, opt *ScaCliListOptions) ([]ScaCliInfo, *http.Response, error)

ListClis returns available SCA CLI downloads. Requires 'Browse' permission.

API endpoint: GET /api/v2/sca/clis. Enterprise Edition only.

func (*ScaService) ListLicenseProfileAssignableProjects added in v2.2.0

ListLicenseProfileAssignableProjects lists the projects that can be assigned to a license profile. Assigning a project to a license profile will cause that license profile to be used when analyzing the project for license issues. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: GET /api/v2/sca/license-profiles/assignable-projects. Enterprise Edition only.

func (*ScaService) ListLicenseProfiles added in v2.2.0

ListLicenseProfiles lists the license profiles that have been configured for use when evaluating license issues. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: GET /api/v2/sca/license-profiles. Enterprise Edition only.

func (*ScaService) ListReachabilityDefinitions added in v2.2.2

func (s *ScaService) ListReachabilityDefinitions(ctx context.Context, opt *ScaReachabilityDefinitionsOptions) ([]byte, *http.Response, error)

ListReachabilityDefinitions returns the raw reachability-definition bundle for a language as an opaque byte stream (content type application/octet-stream); its internal format is not published, so the bytes are returned as-is.

API endpoint: GET /api/v2/sca/reachability/list-definitions. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ScaService) ParseDependencyFiles added in v2.2.2

ParseDependencyFiles parses one or more dependency or lock files and returns the packages and dependency chains discovered in them, without persisting an analysis.

API endpoint: POST /api/v2/sca/analyses/parse. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*ScaService) ResearchReleases added in v2.2.0

ResearchReleases researches release information for a set of versioned package URLs, without requiring them to already be present in a project's dependency graph. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: POST /api/v2/sca/release-research/releases. Enterprise Edition only.

func (*ScaService) SearchDependencyRisks

SearchDependencyRisks searches for issue-release pairs (dependency risks). Requires 'Browse' permission on the project.

API endpoint: GET /api/v2/sca/issues-releases. Enterprise Edition only.

func (*ScaService) SearchReleases

SearchReleases searches for dependency releases in a project. Requires 'Browse' permission on the project.

API endpoint: GET /api/v2/sca/releases. Enterprise Edition only.

func (*ScaService) SearchReleasesByPurl added in v2.2.0

SearchReleasesByPurl searches, across all projects visible to the current user, for releases matching the given package URL (purl). Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: GET /api/v2/sca/releases/search. Enterprise Edition only.

func (*ScaService) SelfTest added in v2.2.0

SelfTest runs an SCA self-test, checking connectivity to backing services. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: GET /api/v2/sca/self-test. Enterprise Edition only.

func (*ScaService) SetEnablement

SetEnablement updates the SCA feature enablement settings. Requires 'Administer System' permission.

API endpoint: PATCH /api/v2/sca/feature-enablements. Enterprise Edition only.

func (*ScaService) SetSeverity added in v2.2.0

SetSeverity manually changes the severity of an issue-release pair. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: POST /api/v2/sca/issues-releases/set-severity. Enterprise Edition only.

func (*ScaService) TriggerReanalysis added in v2.2.0

func (s *ScaService) TriggerReanalysis(ctx context.Context, body *ScaReanalysisOptions) (*ScaReanalysisResult, *http.Response, error)

TriggerReanalysis triggers an immediate re-analysis of a project or branch. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: POST /api/v2/sca/reanalysis. Enterprise Edition only.

func (*ScaService) UpdateAssignee added in v2.2.0

UpdateAssignee updates the assignee of an issue-release pair (dependency risk). Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: PATCH /api/v2/sca/issues-releases/update-assignee. Enterprise Edition only.

func (*ScaService) UpdateChangelogComment added in v2.2.0

func (s *ScaService) UpdateChangelogComment(ctx context.Context, opt *ScaChangelogUpdateOptions, body *ScaChangelogUpdateRequest) (*http.Response, error)

UpdateChangelogComment updates a comment on an issue-release pair's changelog. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: PATCH /api/v2/sca/issues-releases/{key}/changelog. Enterprise Edition only.

func (*ScaService) UpdateIssueReleaseSeverity added in v2.2.0

func (s *ScaService) UpdateIssueReleaseSeverity(ctx context.Context, key string, body *ScaSetSeverityRequest) (*ScaIssueReleaseDetails, *http.Response, error)

UpdateIssueReleaseSeverity updates an issue-release pair's information, specifically its severity, identifying the pair via the given id rather than a request body field. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: PATCH /api/v2/sca/issues-releases/{id}. Enterprise Edition only.

func (*ScaService) UpdateLicenseProfile added in v2.2.0

func (s *ScaService) UpdateLicenseProfile(ctx context.Context, key string, body *ScaLicenseProfileUpdateRequest) (*ScaLicenseProfile, *http.Response, error)

UpdateLicenseProfile updates the license profile for projects to use when evaluating license issues. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: PATCH /api/v2/sca/license-profiles/{license-profile-key}. Enterprise Edition only.

func (*ScaService) UpdateLicenseProfileCategory added in v2.2.0

UpdateLicenseProfileCategory updates the policy for an entire category in the license profile. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: PATCH /api/v2/sca/license-profiles/{license-profile-key}/categories/{category-key}. Enterprise Edition only.

func (*ScaService) UpdateLicenseProfileLicense added in v2.2.0

UpdateLicenseProfileLicense updates the policy for a single license in the license profile. Accepts only authenticated requests. This is an internal API and subject to change without notice.

API endpoint: PATCH /api/v2/sca/license-profiles/{license-profile-key}/licenses/{license-policy-id}. Enterprise Edition only.

func (*ScaService) ValidateAddCommentOpt added in v2.2.0

func (s *ScaService) ValidateAddCommentOpt(body *ScaAddCommentRequest) error

ValidateAddCommentOpt validates the request body for the AddComment method.

func (*ScaService) ValidateAllAssigneesOpt added in v2.2.0

func (s *ScaService) ValidateAllAssigneesOpt(opt *ScaAllAssigneesOptions) error

ValidateAllAssigneesOpt validates the options for the GetAllAssignees method.

func (*ScaService) ValidateAnalysisGetOpt added in v2.2.0

func (s *ScaService) ValidateAnalysisGetOpt(opt *ScaAnalysisGetOptions) error

ValidateAnalysisGetOpt validates the options for the GetAnalysis method.

func (*ScaService) ValidateBulkIssueReleaseChangeOpt added in v2.2.2

func (s *ScaService) ValidateBulkIssueReleaseChangeOpt(body *ScaBulkIssueReleaseChangeRequest) error

ValidateBulkIssueReleaseChangeOpt validates the request body for the BulkChangeIssueReleases method.

func (*ScaService) ValidateChangeStatusOpt added in v2.2.0

func (s *ScaService) ValidateChangeStatusOpt(body *ScaChangeStatusRequest) error

ValidateChangeStatusOpt validates the request body for the ChangeStatus method.

func (*ScaService) ValidateChangelogDeleteOpt added in v2.2.0

func (s *ScaService) ValidateChangelogDeleteOpt(opt *ScaChangelogDeleteOptions) error

ValidateChangelogDeleteOpt validates the options for the DeleteChangelogEntry method.

func (*ScaService) ValidateChangelogGetOpt added in v2.2.0

func (s *ScaService) ValidateChangelogGetOpt(opt *ScaChangelogGetOptions) error

ValidateChangelogGetOpt validates the options for the GetChangelog method.

func (*ScaService) ValidateChangelogUpdateOpt added in v2.2.0

func (s *ScaService) ValidateChangelogUpdateOpt(opt *ScaChangelogUpdateOptions, body *ScaChangelogUpdateRequest) error

ValidateChangelogUpdateOpt validates the options and request body for the UpdateChangelogComment method.

func (*ScaService) ValidateCliGetOpt

func (s *ScaService) ValidateCliGetOpt(opt *ScaCliGetOptions) error

ValidateCliGetOpt validates the options for the GetCli method.

func (*ScaService) ValidateGetDependencyRiskOpt

func (s *ScaService) ValidateGetDependencyRiskOpt(opt *ScaDependencyRiskGetOptions) error

ValidateGetDependencyRiskOpt validates the options for the GetDependencyRisk method.

func (*ScaService) ValidateGetReleaseOpt

func (s *ScaService) ValidateGetReleaseOpt(opt *ScaReleaseGetOptions) error

ValidateGetReleaseOpt validates the options for the GetRelease method.

func (*ScaService) ValidateLicenseProfileAssignmentDeleteOpt added in v2.2.0

func (s *ScaService) ValidateLicenseProfileAssignmentDeleteOpt(opt *ScaLicenseProfileAssignmentDeleteOptions) error

ValidateLicenseProfileAssignmentDeleteOpt validates the options for the DeleteLicenseProfileAssignment method.

func (*ScaService) ValidateLicenseProfileAssignmentOpt added in v2.2.0

func (s *ScaService) ValidateLicenseProfileAssignmentOpt(body *ScaLicenseProfileAssignmentRequest) error

ValidateLicenseProfileAssignmentOpt validates the request body for the AssignLicenseProfileProject method.

func (*ScaService) ValidateLicenseProfileCategoryOpt added in v2.2.0

func (s *ScaService) ValidateLicenseProfileCategoryOpt(opt *ScaLicenseProfileCategoryOptions) error

ValidateLicenseProfileCategoryOpt validates the options for the UpdateLicenseProfileCategory method.

func (*ScaService) ValidateLicenseProfileCategoryUpdateOpt added in v2.2.0

func (s *ScaService) ValidateLicenseProfileCategoryUpdateOpt(
	opt *ScaLicenseProfileCategoryOptions, body *ScaLicenseProfileCategoryUpdateRequest,
) error

ValidateLicenseProfileCategoryUpdateOpt validates the options and request body for the UpdateLicenseProfileCategory method.

func (*ScaService) ValidateLicenseProfileCreateOpt added in v2.2.0

func (s *ScaService) ValidateLicenseProfileCreateOpt(body *ScaLicenseProfileCreateRequest) error

ValidateLicenseProfileCreateOpt validates the request body for the CreateLicenseProfile method.

func (*ScaService) ValidateLicenseProfileGetOpt added in v2.2.0

func (s *ScaService) ValidateLicenseProfileGetOpt(opt *ScaLicenseProfileGetOptions) error

ValidateLicenseProfileGetOpt validates the options for the GetLicenseProfile and DeleteLicenseProfile methods.

func (*ScaService) ValidateLicenseProfileLicenseOpt added in v2.2.0

func (s *ScaService) ValidateLicenseProfileLicenseOpt(opt *ScaLicenseProfileLicenseOptions) error

ValidateLicenseProfileLicenseOpt validates the options for the UpdateLicenseProfileLicense method.

func (*ScaService) ValidateLicenseProfileLicenseUpdateOpt added in v2.2.0

func (s *ScaService) ValidateLicenseProfileLicenseUpdateOpt(
	opt *ScaLicenseProfileLicenseOptions, body *ScaLicensePolicyLicenseUpdateRequest,
) error

ValidateLicenseProfileLicenseUpdateOpt validates the options and request body for the UpdateLicenseProfileLicense method.

func (*ScaService) ValidatePackageInfoOpt added in v2.2.0

func (s *ScaService) ValidatePackageInfoOpt(body *ScaPackageInfoOptions) error

ValidatePackageInfoOpt validates the request body for the GetPackageInfo method.

func (*ScaService) ValidateParseDependencyFilesOpt added in v2.2.2

func (s *ScaService) ValidateParseDependencyFilesOpt(opt *ScaParseDependencyFilesOptions) error

ValidateParseDependencyFilesOpt validates the options for the ParseDependencyFiles method.

func (*ScaService) ValidateReachabilityDefinitionsOpt added in v2.2.2

func (s *ScaService) ValidateReachabilityDefinitionsOpt(opt *ScaReachabilityDefinitionsOptions) error

ValidateReachabilityDefinitionsOpt validates the options for the ListReachabilityDefinitions method.

func (*ScaService) ValidateReanalysisOpt added in v2.2.0

func (s *ScaService) ValidateReanalysisOpt(body *ScaReanalysisOptions) error

ValidateReanalysisOpt validates the request body for the TriggerReanalysis method.

func (*ScaService) ValidateReleaseResearchOpt added in v2.2.0

func (s *ScaService) ValidateReleaseResearchOpt(body *ScaReleaseResearchOptions) error

ValidateReleaseResearchOpt validates the request body for the ResearchReleases method.

func (*ScaService) ValidateReleaseSearchByPurlOpt added in v2.2.0

func (s *ScaService) ValidateReleaseSearchByPurlOpt(opt *ScaReleaseSearchByPurlOptions) error

ValidateReleaseSearchByPurlOpt validates the options for the SearchReleasesByPurl method.

func (*ScaService) ValidateRiskReportOpt added in v2.2.0

func (s *ScaService) ValidateRiskReportOpt(opt *ScaRiskReportOptions) error

ValidateRiskReportOpt validates the options for the GetRiskReport method.

func (*ScaService) ValidateSbomReportOpt

func (s *ScaService) ValidateSbomReportOpt(opt *ScaSbomReportOptions) error

ValidateSbomReportOpt validates the options for the GetSbomReport method.

func (*ScaService) ValidateSearchDependencyRisksOpt

func (s *ScaService) ValidateSearchDependencyRisksOpt(opt *ScaDependencyRisksSearchOptions) error

ValidateSearchDependencyRisksOpt validates the options for the SearchDependencyRisks method.

func (*ScaService) ValidateSearchReleasesOpt

func (s *ScaService) ValidateSearchReleasesOpt(opt *ScaReleasesSearchOptions) error

ValidateSearchReleasesOpt validates the options for the SearchReleases method.

func (*ScaService) ValidateSetEnablementOpt

func (s *ScaService) ValidateSetEnablementOpt(opt *ScaSetEnablementOptions) error

ValidateSetEnablementOpt validates the options for the SetEnablement method.

func (*ScaService) ValidateSetSeverityOpt added in v2.2.0

func (s *ScaService) ValidateSetSeverityOpt(body *ScaSetSeverityRequest) error

ValidateSetSeverityOpt validates the request body for the SetSeverity method.

func (*ScaService) ValidateUpdateAssigneeOpt added in v2.2.0

func (s *ScaService) ValidateUpdateAssigneeOpt(body *ScaUpdateAssigneeRequest) error

ValidateUpdateAssigneeOpt validates the request body for the UpdateAssignee method.

func (*ScaService) ValidateUpdateIssueReleaseSeverityOpt added in v2.2.0

func (s *ScaService) ValidateUpdateIssueReleaseSeverityOpt(key string, body *ScaSetSeverityRequest) error

ValidateUpdateIssueReleaseSeverityOpt validates the key and request body for the UpdateIssueReleaseSeverity method.

type ScaSetEnablementOptions

type ScaSetEnablementOptions struct {
	// Enablement indicates whether to enable SCA. This field is required.
	Enablement bool `json:"enablement"`
}

ScaSetEnablementOptions contains parameters for the SetEnablement method.

type ScaSetSeverityRequest added in v2.2.0

type ScaSetSeverityRequest struct {
	// IssueReleaseKey is the issue-release key. Required for SetSeverity; ignored by
	// UpdateIssueReleaseSeverity, which identifies the issue-release pair via its "id" parameter
	// instead.
	IssueReleaseKey string `json:"issueReleaseKey,omitempty"`
	// Quality is the software quality to set the severity for. Optional.
	// Allowed values: SoftwareQualityMaintainability, SoftwareQualityReliability,
	// SoftwareQualitySecurity.
	Quality string `json:"quality,omitempty"`
	// Severity is the manual severity to set. Optional.
	// Allowed values: RuleImpactSeverityInfo, RuleImpactSeverityLow, RuleImpactSeverityMedium,
	// RuleImpactSeverityHigh, RuleImpactSeverityBlocker.
	Severity string `json:"severity,omitempty"`
}

ScaSetSeverityRequest contains the request body for the SetSeverity and UpdateIssueReleaseSeverity methods.

type ScaUpdateAssigneeRequest added in v2.2.0

type ScaUpdateAssigneeRequest struct {
	// IssueReleaseKey is the issue-release key. This field is required.
	IssueReleaseKey string `json:"issueReleaseKey"`
	// AssigneeLogin is the login of the user to assign. Optional; omit to unassign.
	AssigneeLogin string `json:"assigneeLogin,omitempty"`
}

ScaUpdateAssigneeRequest contains the request body for the UpdateAssignee method.

type ScaUserResource added in v2.2.0

type ScaUserResource struct {
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// Avatar is the URL of the user's avatar.
	Avatar string `json:"avatar,omitempty"`
	// Active indicates whether the user account is active.
	Active bool `json:"active"`
}

ScaUserResource represents a SonarQube user referenced by SCA issues-releases endpoints.

type ScaVersionFix added in v2.2.0

type ScaVersionFix struct {
	// Version is the fixed version.
	Version string `json:"version,omitempty"`
	// FixLevel describes the level of fix (e.g. direct, transitive).
	FixLevel string `json:"fixLevel,omitempty"`
	// DescriptionCode is a code identifying the fix description.
	DescriptionCode string `json:"descriptionCode,omitempty"`
}

ScaVersionFix represents a package version that fixes a known vulnerability.

type ScaVulnerabilityResource

type ScaVulnerabilityResource struct {
	// VulnerabilityId is the CVE or other vulnerability identifier.
	VulnerabilityId string `json:"vulnerabilityId,omitempty"`
	// Description is the vulnerability description.
	Description string `json:"description,omitempty"`
	// EpssPercentile is the EPSS percentile score.
	EpssPercentile string `json:"epssPercentile,omitempty"`
	// EpssProbability is the EPSS probability score.
	EpssProbability string `json:"epssProbability,omitempty"`
	// CweIds lists the associated CWE identifiers.
	CweIds []string `json:"cweIds,omitempty"`
	// KnownExploited indicates whether this vulnerability is known to be exploited.
	KnownExploited bool `json:"knownExploited"`
}

ScaVulnerabilityResource represents a vulnerability associated with a release.

type ScannableProject

type ScannableProject struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
}

ScannableProject represents a scannable project.

type SchemaMismatch added in v2.2.1

type SchemaMismatch struct {
	// Endpoint identifies the request the mismatch was observed on, formatted
	// as "METHOD scheme://host/path".
	Endpoint string
	// GoType is the name of the struct type being validated.
	GoType string
	// Path is the dotted/bracketed path to the unmapped field, e.g.
	// "components[].measures[].bestValue".
	Path string
}

SchemaMismatch describes a JSON object field observed in a decoded API response that has no corresponding field on the destination Go struct. It signals that a modeled response type has drifted from what the SonarQube API actually returns: either a field is missing from the struct, or the struct models it under the wrong name.

func CheckSchema added in v2.2.1

func CheckSchema(endpoint string, data []byte, dest any) ([]SchemaMismatch, error)

CheckSchema compares a raw JSON response body against the exported, JSON-tagged fields declared on the type of dest and returns one SchemaMismatch per JSON object key that has no corresponding struct field. Object keys are only checked where the JSON value lines up against a Go struct; JSON matched against a Go map is left unchecked since maps intentionally accept arbitrary keys.

CheckSchema returns an error only if data is not valid JSON. A nil dest, or a dest whose underlying type is never a struct anywhere in its shape, simply yields no mismatches.

func (SchemaMismatch) String added in v2.2.1

func (m SchemaMismatch) String() string

String formats the mismatch as a single human-readable line.

type SchemaObserver added in v2.2.1

type SchemaObserver func(endpoint string, mismatches []SchemaMismatch)

SchemaObserver is invoked by Client.Do, when configured via WithSchemaObserver, after every successfully decoded API response. It receives any SchemaMismatch found between the raw response body and the destination struct for that call. mismatches is empty when the response matched its destination type exactly.

type ScimManagementService

type ScimManagementService struct {
	// contains filtered or unexported fields
}

ScimManagementService handles communication with the SCIM management related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*ScimManagementService) Disable

Disable disables SCIM provisioning. Requires 'Administer System' permission.

API endpoint: POST /api/scim_management/disable. Since: 10.0. Internal endpoint.

func (*ScimManagementService) Enable

Enable enables SCIM provisioning. Requires 'Administer System' permission.

API endpoint: POST /api/scim_management/enable. Since: 10.0. Internal endpoint.

func (*ScimManagementService) Status

Status returns the SCIM provisioning status. Requires 'Administer System' permission.

API endpoint: GET /api/scim_management/status. Since: 10.0. Internal endpoint.

type ScimManagementStatus

type ScimManagementStatus struct {
	// Enabled indicates whether SCIM provisioning is enabled.
	Enabled bool `json:"enabled"`
}

ScimManagementStatus represents the SCIM provisioning status.

type SearchIndexes

type SearchIndexes struct {
	// IndexComponentsDocs is the number of documents in the components index.
	IndexComponentsDocs int64 `json:"Index components - Docs,omitempty"`
	// IndexComponentsShards is the number of shards in the components index.
	IndexComponentsShards int64 `json:"Index components - Shards,omitempty"`
	// IndexComponentsStoreSize is the store size of the components index.
	IndexComponentsStoreSize string `json:"Index components - Store Size,omitempty"`
	// IndexIssuesDocs is the number of documents in the issues index.
	IndexIssuesDocs int64 `json:"Index issues - Docs,omitempty"`
	// IndexIssuesShards is the number of shards in the issues index.
	IndexIssuesShards int64 `json:"Index issues - Shards,omitempty"`
	// IndexIssuesStoreSize is the store size of the issues index.
	IndexIssuesStoreSize string `json:"Index issues - Store Size,omitempty"`
	// IndexMetadatasDocs is the number of documents in the metadatas index.
	IndexMetadatasDocs int64 `json:"Index metadatas - Docs,omitempty"`
	// IndexMetadatasShards is the number of shards in the metadatas index.
	IndexMetadatasShards int64 `json:"Index metadatas - Shards,omitempty"`
	// IndexMetadatasStoreSize is the store size of the metadatas index.
	IndexMetadatasStoreSize string `json:"Index metadatas - Store Size,omitempty"`
	// IndexProjectmeasuresDocs is the number of documents in the projectmeasures index.
	IndexProjectmeasuresDocs int64 `json:"Index projectmeasures - Docs,omitempty"`
	// IndexProjectmeasuresShards is the number of shards in the projectmeasures index.
	IndexProjectmeasuresShards int64 `json:"Index projectmeasures - Shards,omitempty"`
	// IndexProjectmeasuresStoreSize is the store size of the projectmeasures index.
	IndexProjectmeasuresStoreSize string `json:"Index projectmeasures - Store Size,omitempty"`
	// IndexRulesDocs is the number of documents in the rules index.
	IndexRulesDocs int64 `json:"Index rules - Docs,omitempty"`
	// IndexRulesShards is the number of shards in the rules index.
	IndexRulesShards int64 `json:"Index rules - Shards,omitempty"`
	// IndexRulesStoreSize is the store size of the rules index.
	IndexRulesStoreSize string `json:"Index rules - Store Size,omitempty"`
	// IndexUsersDocs is the number of documents in the users index.
	IndexUsersDocs int64 `json:"Index users - Docs,omitempty"`
	// IndexUsersShards is the number of shards in the users index.
	IndexUsersShards int64 `json:"Index users - Shards,omitempty"`
	// IndexUsersStoreSize is the store size of the users index.
	IndexUsersStoreSize string `json:"Index users - Store Size,omitempty"`
	// IndexViewsDocs is the number of documents in the views index.
	IndexViewsDocs int64 `json:"Index views - Docs,omitempty"`
	// IndexViewsShards is the number of shards in the views index.
	IndexViewsShards int64 `json:"Index views - Shards,omitempty"`
	// IndexViewsStoreSize is the store size of the views index.
	IndexViewsStoreSize string `json:"Index views - Store Size,omitempty"`
}

SearchIndexes contains search index statistics.

type SearchState

type SearchState struct {
	// CPUUsage is the CPU usage percentage.
	CPUUsage int64 `json:"CPU Usage (%),omitempty"`
	// DiskAvailable is the available disk space.
	DiskAvailable string `json:"Disk Available,omitempty"`
	// FieldDataCircuitBreakerEstimation is the field data circuit breaker estimation.
	FieldDataCircuitBreakerEstimation string `json:"Field Data Circuit Breaker Estimation,omitempty"`
	// FieldDataCircuitBreakerLimit is the field data circuit breaker limit.
	FieldDataCircuitBreakerLimit string `json:"Field Data Circuit Breaker Limit,omitempty"`
	// FieldDataMemory is the field data memory usage.
	FieldDataMemory string `json:"Field Data Memory,omitempty"`
	// JVMHeapMax is the maximum JVM heap size.
	JVMHeapMax string `json:"JVM Heap Max,omitempty"`
	// JVMHeapUsage is the JVM heap usage percentage.
	JVMHeapUsage string `json:"JVM Heap Usage,omitempty"`
	// JVMHeapUsed is the used JVM heap size.
	JVMHeapUsed string `json:"JVM Heap Used,omitempty"`
	// JVMNonHeapUsed is the used JVM non-heap size.
	JVMNonHeapUsed string `json:"JVM Non Heap Used,omitempty"`
	// JVMThreads is the number of JVM threads.
	JVMThreads int64 `json:"JVM Threads,omitempty"`
	// MaxFileDescriptors is the maximum number of file descriptors.
	MaxFileDescriptors int64 `json:"Max File Descriptors,omitempty"`
	// OpenFileDescriptors is the number of open file descriptors.
	OpenFileDescriptors int64 `json:"Open File Descriptors,omitempty"`
	// QueryCacheMemory is the query cache memory usage.
	QueryCacheMemory string `json:"Query Cache Memory,omitempty"`
	// RequestCacheMemory is the request cache memory usage.
	RequestCacheMemory string `json:"Request Cache Memory,omitempty"`
	// RequestCircuitBreakerEstimation is the request circuit breaker estimation.
	RequestCircuitBreakerEstimation string `json:"Request Circuit Breaker Estimation,omitempty"`
	// RequestCircuitBreakerLimit is the request circuit breaker limit.
	RequestCircuitBreakerLimit string `json:"Request Circuit Breaker Limit,omitempty"`
	// State is the search node state (GREEN, YELLOW, RED).
	State string `json:"State,omitempty"`
	// StoreSize is the total store size.
	StoreSize string `json:"Store Size,omitempty"`
	// TranslogSize is the translog size.
	TranslogSize string `json:"Translog Size,omitempty"`
}

SearchState contains search node state information.

type SecurityReportCWEDistribution

type SecurityReportCWEDistribution struct {
	// CWE is the CWE identifier (e.g. "89").
	CWE string `json:"cwe,omitempty"`
	// Vulnerabilities is the number of vulnerabilities for this CWE.
	Vulnerabilities int `json:"vulnerabilities,omitempty"`
	// VulnerabilityRating is the vulnerability rating (1-5, A-E) for this CWE.
	VulnerabilityRating int `json:"vulnerabilityRating,omitempty"`
	// SecurityReviewRating is the security review rating (1-5, A-E) for this CWE.
	SecurityReviewRating int `json:"securityReviewRating,omitempty"`
	// ActiveRules is the number of active rules for this CWE.
	ActiveRules int `json:"activeRules,omitempty"`
	// TotalRules is the total number of rules (active or not) for this CWE.
	TotalRules int `json:"totalRules,omitempty"`
	// ToReviewSecurityHotspots is the number of security hotspots to review.
	ToReviewSecurityHotspots int `json:"toReviewSecurityHotspots,omitempty"`
	// ReviewedSecurityHotspots is the number of reviewed security hotspots.
	ReviewedSecurityHotspots int `json:"reviewedSecurityHotspots,omitempty"`
	// HasMoreRules indicates whether more rules exist beyond TotalRules.
	HasMoreRules bool `json:"hasMoreRules,omitempty"`
}

SecurityReportCWEDistribution represents the per-CWE breakdown within a security report category, returned when includeDistribution is set.

type SecurityReportCategory

type SecurityReportCategory struct {
	// Category is the category name.
	Category string `json:"category,omitempty"`
	// Version is the standard revision this category belongs to (e.g. "2017", "2021"
	// for owaspTop10, "3.2", "4.0" for pciDss). Empty for standards without revisions.
	Version string `json:"version,omitempty"`
	// Distribution is the CWE breakdown for this category. Only populated when
	// includeDistribution is requested (and non-empty for CWE-oriented standards).
	Distribution []SecurityReportCWEDistribution `json:"distribution,omitempty"`
	// Vulnerabilities is the number of vulnerabilities in this category.
	Vulnerabilities int `json:"vulnerabilities,omitempty"`
	// SecurityReviewRating is the security review rating (1-5, A-E) for this category.
	SecurityReviewRating int `json:"securityReviewRating,omitempty"`
	// ActiveRules is the number of active rules for this category.
	ActiveRules int `json:"activeRules,omitempty"`
	// TotalRules is the total number of rules (active or not) for this category.
	TotalRules int `json:"totalRules,omitempty"`
	// ToReviewSecurityHotspots is the number of security hotspots to review.
	ToReviewSecurityHotspots int `json:"toReviewSecurityHotspots,omitempty"`
	// ReviewedSecurityHotspots is the number of reviewed security hotspots.
	ReviewedSecurityHotspots int `json:"reviewedSecurityHotspots,omitempty"`
	// HasMoreRules indicates whether more rules exist beyond TotalRules.
	HasMoreRules bool `json:"hasMoreRules,omitempty"`
}

SecurityReportCategory represents a category in a security report.

type SecurityReportsDownloadOptions

type SecurityReportsDownloadOptions struct {
	// Branch filters the results by branch. Optional.
	Branch string `url:"branch,omitempty"`
	// Project is the project key. This field is required.
	Project string `url:"project"`

	// Standards is the list of standards to include in the report. If
	// omitted, all standards are included. Optional.
	//
	// Unlike Show, this endpoint only supports a subset of the standards
	// accepted by allowedSecurityStandards: live-verified, only
	// "sonarsourceSecurity", "casa", and "owaspMasvs-v2" are accepted here -
	// every other standard (including "owaspTop10") fails with 400
	// {"errors":[{"msg":"Standard '<standard>' is not supported"}]}.
	Standards []string `url:"standards,omitempty,comma"`
}

SecurityReportsDownloadOptions contains parameters for the Download method.

type SecurityReportsService

type SecurityReportsService struct {
	// contains filtered or unexported fields
}

SecurityReportsService handles communication with the security reports related methods of the SonarQube API. This service is internal and enterprise-only.

func (*SecurityReportsService) Download

Download downloads a security report as a PDF document. Requires Browse permission on the project.

API endpoint: GET /api/security_reports/download. Since: 8.8. Internal endpoint.

func (*SecurityReportsService) Show

Show returns the security report for a project. Requires Browse permission on the project.

API endpoint: GET /api/security_reports/show. Since: 7.3. Internal endpoint.

func (*SecurityReportsService) ValidateDownloadOpt

func (s *SecurityReportsService) ValidateDownloadOpt(opt *SecurityReportsDownloadOptions) error

ValidateDownloadOpt validates the options for the Download method.

func (*SecurityReportsService) ValidateShowOpt

func (s *SecurityReportsService) ValidateShowOpt(opt *SecurityReportsShowOptions) error

ValidateShowOpt validates the options for the Show method.

type SecurityReportsShow

type SecurityReportsShow struct {
	// Categories is the list of security report categories.
	Categories []SecurityReportCategory `json:"categories,omitempty"`
}

SecurityReportsShow represents the response from the show endpoint.

type SecurityReportsShowOptions

type SecurityReportsShowOptions struct {
	// Branch filters the results by branch. Optional.
	Branch string `url:"branch,omitempty"`
	// Project is the project key. This field is required.
	Project string `url:"project"`
	// Standard is the security standard to report on. This field is required.
	Standard string `url:"standard"`
	// IncludeDistribution includes distribution information when set. Optional.
	IncludeDistribution bool `url:"includeDistribution,omitempty"`
}

SecurityReportsShowOptions contains parameters for the Show method.

type SemicolonSeparatedMap

type SemicolonSeparatedMap map[string]string

SemicolonSeparatedMap is a custom type for URL encoding maps as semicolon-separated key=value pairs.

func (SemicolonSeparatedMap) EncodeValues

func (m SemicolonSeparatedMap) EncodeValues(key string, v *url.Values) error

EncodeValues implements the query.Encoder interface for custom URL encoding.

type ServerPushConnections

type ServerPushConnections struct {
	// SonarLintConnectedClients is the number of connected SonarLint clients.
	SonarLintConnectedClients int64 `json:"SonarLint Connected Clients,omitempty"`
}

ServerPushConnections contains server push connection information.

type ServerService

type ServerService struct {
	// contains filtered or unexported fields
}

ServerService handles communication with the Server related methods of the SonarQube API.

func (*ServerService) Version

func (s *ServerService) Version(ctx context.Context) (v *string, resp *http.Response, err error)

Version returns the SonarQube server version.

type ServicesV2

type ServicesV2 struct {
	// Analysis provides methods for the Analysis V2 API.
	Analysis *AnalysisService
	// Architecture provides methods for the Architecture V2 API.
	Architecture *ArchitectureService
	// Authorizations provides methods for the Authorizations V2 API.
	Authorizations *AuthorizationsService
	// CleanCodePolicy provides methods for the Clean Code Policy V2 API.
	CleanCodePolicy *CleanCodePolicyService
	// DopTranslation provides methods for the Dop Translation V2 API.
	DopTranslation *DopTranslationService
	// FixSuggestions provides methods for the Fix Suggestions V2 API.
	FixSuggestions *FixSuggestionsService
	// History provides methods for the History V2 API.
	History *HistoryService
	// Marketplace provides methods for the Marketplace V2 API.
	Marketplace *MarketplaceService
	// Sca provides methods for the SCA V2 API.
	Sca *ScaService
	// System provides methods for the System V2 API.
	System *SystemServiceV2
	// UsersManagement provides methods for the Users Management V2 API.
	UsersManagement *UsersManagementService

	// Atlassian provides methods for the Atlassian V2 API.
	Atlassian *AtlassianService

	// Entitlements provides methods for the Entitlements V2 API.
	Entitlements *EntitlementsService

	// Integrations provides methods for the Integrations V2 API.
	Integrations *IntegrationsService

	// Issues provides methods for the Issues V2 API.
	Issues *IssuesV2Service

	// Jira provides methods for the Jira V2 API.
	Jira *JiraService

	// Monitoring provides methods for the Monitoring V2 API.
	Monitoring *MonitoringServiceV2

	// SoftwareQualityReports provides methods for the Software Quality Reports V2 API.
	SoftwareQualityReports *SoftwareQualityReportsService
}

ServicesV2 groups all SonarQube V2 API services.

type SettingDefinition

type SettingDefinition struct {
	// Category is the category of the setting.
	Category string `json:"category,omitempty"`
	// DefaultValue is the default value of the setting.
	DefaultValue string `json:"defaultValue,omitempty"`
	// Description is the description of the setting.
	Description string `json:"description,omitempty"`
	// DeprecatedKey is the previous key of the setting, kept for backward compatibility.
	DeprecatedKey string `json:"deprecatedKey,omitempty"`
	// Key is the unique key of the setting.
	Key string `json:"key,omitempty"`
	// Name is the display name of the setting.
	Name string `json:"name,omitempty"`
	// SubCategory is the sub-category of the setting.
	SubCategory string `json:"subCategory,omitempty"`
	// Type is the type of the setting (STRING, TEXT, BOOLEAN, etc.).
	Type string `json:"type,omitempty"`
	// Options is the list of possible values for the setting.
	Options []string `json:"options,omitempty"`
	// Fields is the list of field definitions for property set types.
	Fields []SettingField `json:"fields,omitempty"`
	// MultiValues indicates if the setting accepts multiple values.
	MultiValues bool `json:"multiValues,omitempty"`
}

SettingDefinition represents a setting definition.

type SettingField

type SettingField struct {
	// Description is the description of the field.
	Description string `json:"description,omitempty"`
	// Key is the unique key of the field.
	Key string `json:"key,omitempty"`
	// Name is the display name of the field.
	Name string `json:"name,omitempty"`
	// Type is the type of the field.
	Type string `json:"type,omitempty"`
	// Options is the list of possible values for the field.
	Options []string `json:"options,omitempty"`
}

SettingField represents a field within a property set setting.

type SettingValue

type SettingValue struct {
	// Key is the unique key of the setting.
	Key string `json:"key,omitempty"`
	// Value is the value of the setting (for single-value settings).
	Value string `json:"value,omitempty"`
	// Values is the values of the setting (for multi-value settings).
	Values []string `json:"values,omitempty"`
	// FieldValues is the values of the setting (for property set types).
	FieldValues []map[string]string `json:"fieldValues,omitempty"`
	// Inherited indicates if the value is inherited from a parent component.
	Inherited bool `json:"inherited,omitempty"`
	// ParentValue is the value inherited from the parent component (for single-value settings).
	ParentValue string `json:"parentValue,omitempty"`
}

SettingValue represents a setting value.

type SettingsCheckSecretKey

type SettingsCheckSecretKey struct {
	// SecretKeyAvailable indicates if a secret key is available.
	SecretKeyAvailable bool `json:"secretKeyAvailable,omitempty"`
}

SettingsCheckSecretKey represents the response from checking if a secret key is available.

type SettingsEncrypt

type SettingsEncrypt struct {
	// EncryptedValue is the encrypted setting value.
	EncryptedValue string `json:"encryptedValue,omitempty"`
}

SettingsEncrypt represents the response from encrypting a value.

type SettingsEncryptOptions

type SettingsEncryptOptions struct {
	// Value is the setting value to encrypt (required).
	Value string `url:"value,omitempty"`
}

SettingsEncryptOptions represents options for encrypting a value.

type SettingsGenerateSecretKey

type SettingsGenerateSecretKey struct {
	// SecretKey is the generated secret key.
	SecretKey string `json:"secretKey,omitempty"`
}

SettingsGenerateSecretKey represents the response from generating a secret key.

type SettingsListDefinitions

type SettingsListDefinitions struct {
	// Definitions is the list of setting definitions.
	Definitions []SettingDefinition `json:"definitions,omitempty"`
}

SettingsListDefinitions represents the response from listing setting definitions.

type SettingsListDefinitionsOptions

type SettingsListDefinitionsOptions struct {
	// Component is the component key to get definitions for (optional).
	Component string `url:"component,omitempty"`
}

SettingsListDefinitionsOptions represents options for listing setting definitions.

type SettingsLoginMessage

type SettingsLoginMessage struct {
	// Message is the formatted login message.
	Message string `json:"message,omitempty"`
}

SettingsLoginMessage represents the response from getting the login message.

type SettingsResetOptions

type SettingsResetOptions struct {
	// Component is the component key (optional).
	// Only keys for projects, applications, portfolios or subportfolios are accepted.
	Component string `url:"component,omitempty"`
	// Keys is the list of setting keys to reset (required).
	Keys []string `url:"keys,omitempty,comma"`
}

SettingsResetOptions represents options for resetting settings.

type SettingsService

type SettingsService struct {
	// contains filtered or unexported fields
}

SettingsService handles communication with the Settings related methods of the SonarQube API. Manage settings.

Since: 6.1.

func (*SettingsService) CheckSecretKey

CheckSecretKey checks if a secret key is available. Requires the 'Administer System' permission.

Since: 6.1.

func (*SettingsService) Encrypt

Encrypt encrypts a setting value. Requires 'Administer System' permission.

Since: 6.1.

func (*SettingsService) GenerateSecretKey

GenerateSecretKey generates a secret key. Requires the 'Administer System' permission.

Since: 6.1.

func (*SettingsService) ListDefinitions

ListDefinitions lists settings definitions. Requires 'Browse' permission when a component is specified. To access licensed settings, authentication is required. To access secured settings, one of the following permissions is required:

  • 'Execute Analysis'
  • 'Administer System'
  • 'Administer' rights on the specified component

Since: 6.3.

func (*SettingsService) LoginMessage

LoginMessage returns the formatted login message, set to the 'sonar.login.message' property.

Since: 9.8.

func (*SettingsService) Reset

Reset removes a setting value. The settings defined in conf/sonar.properties are read-only and can't be changed. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified component

Since: 6.1.

func (*SettingsService) Set

Set updates a setting value. Either 'value', 'values' or 'fieldValues' must be provided. The settings defined in conf/sonar.properties are read-only and can't be changed. Requires one of the following permissions:

  • 'Administer System'
  • 'Administer' rights on the specified component

Since: 6.1.

func (*SettingsService) ValidateEncryptOpt

func (s *SettingsService) ValidateEncryptOpt(opt *SettingsEncryptOptions) error

ValidateEncryptOpt validates the options for Encrypt.

func (*SettingsService) ValidateListDefinitionsOpt

func (s *SettingsService) ValidateListDefinitionsOpt(opt *SettingsListDefinitionsOptions) error

ValidateListDefinitionsOpt validates the options for ListDefinitions.

func (*SettingsService) ValidateResetOpt

func (s *SettingsService) ValidateResetOpt(opt *SettingsResetOptions) error

ValidateResetOpt validates the options for Reset.

func (*SettingsService) ValidateSetOpt

func (s *SettingsService) ValidateSetOpt(opt *SettingsSetOptions) error

ValidateSetOpt validates the options for Set.

func (*SettingsService) ValidateValuesOpt

func (s *SettingsService) ValidateValuesOpt(opt *SettingsValuesOptions) error

ValidateValuesOpt validates the options for Values.

func (*SettingsService) Values

Values lists settings values. If no value has been set for a setting, then the default value is returned. The settings from conf/sonar.properties are excluded from results. Requires 'Browse' or 'Execute Analysis' permission when a component is specified. Secured settings values are not returned by the endpoint.

Since: 6.3.

type SettingsSetOptions

type SettingsSetOptions struct {
	// Component is the component key (optional).
	// Only keys for projects, applications, portfolios or subportfolios are accepted.
	Component string `url:"component,omitempty"`
	// Key is the setting key (required).
	Key string `url:"key,omitempty"`
	// Value is the setting value (optional).
	// To reset a value, please use the reset web service.
	// Maximum length: 4000 characters.
	Value string `url:"value,omitempty"`
	// Values is the setting multi-value (optional).
	// To set several values, the parameter must be called once for each value.
	Values []string `url:"values,omitempty"`
	// FieldValues is the setting field values for property set types (optional).
	// This input is stringified and passed as a single parameter.
	FieldValues JSONEncodedMap `url:"fieldValues,omitempty"`
}

SettingsSetOptions represents options for setting a value.

type SettingsValues

type SettingsValues struct {
	// Settings is the list of settings.
	Settings []SettingValue `json:"settings,omitempty"`
	// SetSecuredSettings is the list of secured settings that have a value set.
	SetSecuredSettings []string `json:"setSecuredSettings,omitempty"`
}

SettingsValues represents the response from listing setting values.

type SettingsValuesOptions

type SettingsValuesOptions struct {
	// Component is the component key (optional).
	Component string `url:"component,omitempty"`
	// Keys is the list of setting keys (optional).
	Keys []string `url:"keys,omitempty,comma"`
}

SettingsValuesOptions represents options for listing setting values.

type SoftwareQualityReportsAccessibilityReport added in v2.2.0

type SoftwareQualityReportsAccessibilityReport struct {
	// Categories is the list of accessibility report categories.
	Categories []SoftwareQualityReportsCategory `json:"categories,omitempty"`
}

SoftwareQualityReportsAccessibilityReport represents the accessibility report for a project branch.

type SoftwareQualityReportsCategory added in v2.2.0

type SoftwareQualityReportsCategory struct {
	// Key is the category key.
	Key string `json:"key,omitempty"`
	// ActiveRules is the number of active rules for this category.
	ActiveRules int32 `json:"activeRules,omitempty"`
	// Issues is the number of issues found for this category.
	Issues int32 `json:"issues,omitempty"`
}

SoftwareQualityReportsCategory represents a single accessibility report category.

type SoftwareQualityReportsGetAccessibilityReportOptions added in v2.2.0

type SoftwareQualityReportsGetAccessibilityReportOptions struct {
	// ProjectKey is the project key. This field is required.
	ProjectKey string `json:"projectKey"`
	// Standard is the accessibility standard. This field is required.
	// Allowed values: wcag.
	Standard string `json:"standard"`
	// Version is the accessibility standard version. This field is required.
	// Allowed values: 2.0, 2.1, 2.2.
	Version string `json:"version"`
	// BranchKey is the branch key. If not provided, the main branch is used.
	BranchKey string `json:"branchKey,omitempty"`
}

SoftwareQualityReportsGetAccessibilityReportOptions contains parameters for the GetAccessibilityReport method.

type SoftwareQualityReportsService added in v2.2.0

type SoftwareQualityReportsService struct {
	// contains filtered or unexported fields
}

SoftwareQualityReportsService handles communication with the software quality reports V2 API endpoints. This service is only available in Enterprise Edition. The underlying endpoint is marked internal by SonarQube (x-sonar-internal) and its request/response contract may change without notice between SonarQube versions.

func (*SoftwareQualityReportsService) GetAccessibilityReport added in v2.2.0

GetAccessibilityReport returns the accessibility report for a project branch.

API endpoint: GET /api/v2/software-quality-reports/accessibility-reports. Enterprise Edition only. Marked internal by SonarQube and subject to change without notice.

func (*SoftwareQualityReportsService) ValidateGetAccessibilityReportOpt added in v2.2.0

ValidateGetAccessibilityReportOpt validates the options for the GetAccessibilityReport method.

type SonarAPIRequestParameters

type SonarAPIRequestParameters struct {
	// Method is the HTTP method to use for the request (e.g. http.MethodGet, http.MethodPost, http.MethodPatch, http.MethodDelete).
	// Defaults to http.MethodGet if empty.
	Method string
	// Path is the URL path for the API endpoint, relative to the base URL
	// (e.g. "components/search" for V1 or "v2/system/health" for V2).
	// This field is required.
	Path string
	// RawQuery contains pre-encoded URL query parameters to include in the
	// request URL. Use the version-specific helpers which encode query structs
	// automatically based on the appropriate struct tag convention.
	RawQuery url.Values
	// Headers is a map of additional HTTP headers to include in the request.
	// Default is no additional headers beyond the standard Accept, Content-Type,
	// authentication and User-Agent headers.
	Headers map[string]string
	// Body is the request body to include in the API request. It will be
	// JSON-encoded if not nil.
	Body any
	// RootPath resolves Path against the server root instead of the client's
	// API base path (which always ends in "api/"). A handful of legacy
	// endpoints (e.g. the SAML assertion consumer service) are mounted
	// directly on the server root rather than under "api/"; this flag lets
	// those requests reach the correct URL.
	RootPath bool
}

SonarAPIRequestParameters contains parameters for making a SonarQube API request. This struct is the unified way to provide parameters to NewSonarQubeAPIRequest. For most use cases, prefer the version-specific helpers NewSonarQubeV1APIRequest and NewSonarQubeV2APIRequest which handle query encoding and path prefixing automatically.

type SonarlintEvents

type SonarlintEvents struct{}

SonarlintEvents represents the response from the SonarLint events endpoint. The structure of events is dynamic and depends on the event type. Currently, it notifies listeners about changes to activation of a rule.

type SourcesComponent

type SourcesComponent struct {
	// Key is the component key.
	Key string `json:"key,omitempty"`
	// LongName is the long name of the component.
	LongName string `json:"longName,omitempty"`
	// Name is the short name of the component.
	Name string `json:"name,omitempty"`
	// Path is the path to the component.
	Path string `json:"path,omitempty"`
	// Qualifier is the component qualifier.
	Qualifier string `json:"qualifier,omitempty"`
	// UUID is the component UUID.
	UUID string `json:"uuid,omitempty"`
}

SourcesComponent represents source component information.

type SourcesIndex

type SourcesIndex struct {
	Sources map[string]string `json:"sources,omitempty"`
}

SourcesIndex represents the response from getting source file lines. The key is the line number as a string, and the value is the source code.

type SourcesIndexOptions

type SourcesIndexOptions struct {
	// Resource is the file key (API parameter: "resource", required).
	Resource string `url:"resource,omitempty"`
	// From is the starting line number (optional, default: 1).
	From int64 `url:"from,omitempty"`
	// To is the ending line number (optional, default: end of file).
	To int64 `url:"to,omitempty"`
}

SourcesIndexOptions represents options for getting source file lines.

type SourcesIssueSnippet

type SourcesIssueSnippet struct {
	// Component is the component information.
	Component SourcesComponent `json:"component,omitzero"`
	// Sources is the source lines for the issue snippet.
	Sources []SourcesLine `json:"sources,omitempty"`
}

SourcesIssueSnippet represents a single issue snippet.

type SourcesIssueSnippets

type SourcesIssueSnippets map[string]SourcesIssueSnippet

SourcesIssueSnippets represents the response from getting issue snippets.

type SourcesIssueSnippetsOptions

type SourcesIssueSnippetsOptions struct {
	// IssueKey is the issue key (required).
	IssueKey string `url:"issueKey,omitempty"`
}

SourcesIssueSnippetsOptions represents options for getting issue snippets.

type SourcesLine

type SourcesLine struct {
	// Line is the line number.
	Line int64 `json:"line,omitempty"`
	// Code is the HTML-formatted source code.
	Code string `json:"code,omitempty"`
	// SCMAuthor is the author who last modified this line.
	SCMAuthor string `json:"scmAuthor,omitempty"`
	// SCMDate is the date when the line was last modified.
	SCMDate string `json:"scmDate,omitempty"`
	// SCMRevision is the SCM revision for this line.
	SCMRevision string `json:"scmRevision,omitempty"`
	// LineHits is the number of times this line was executed by tests.
	LineHits int64 `json:"lineHits,omitempty"`
	// Conditions is the number of conditions on this line.
	Conditions int64 `json:"conditions,omitempty"`
	// CoveredConditions is the number of covered conditions on this line.
	CoveredConditions int64 `json:"coveredConditions,omitempty"`
	// Duplicated indicates if the line is duplicated.
	Duplicated bool `json:"duplicated,omitempty"`
	// IsNew indicates if this is a new line.
	IsNew bool `json:"isNew,omitempty"`
}

SourcesLine represents a single source line.

type SourcesLines

type SourcesLines struct {
	// Sources is the list of source lines.
	Sources []SourcesLine `json:"sources,omitempty"`
}

SourcesLines represents the response from getting source file lines.

type SourcesLinesOptions

type SourcesLinesOptions struct {
	// Key is the file key (required).
	Key string `url:"key,omitempty"`
	// Branch is the branch key (optional).
	Branch string `url:"branch,omitempty"`
	// PullRequest is the pull request identifier (optional).
	PullRequest string `url:"pullRequest,omitempty"`
	// From is the starting line number (optional, default: 1).
	From int64 `url:"from,omitempty"`
	// To is the ending line number (optional, default: end of file).
	To int64 `url:"to,omitempty"`
}

SourcesLinesOptions represents options for getting source file lines.

type SourcesRawOptions

type SourcesRawOptions struct {
	// Key is the file key (required).
	Key string `url:"key,omitempty"`
	// Branch is the branch key (optional).
	Branch string `url:"branch,omitempty"`
	// PullRequest is the pull request identifier (optional).
	PullRequest string `url:"pullRequest,omitempty"`
}

SourcesRawOptions represents options for getting raw source file content.

type SourcesScm

type SourcesScm struct {
	// Scm is the SCM information by line number.
	// Each entry contains: [line number, author, commit date, revision]
	Scm [][]any `json:"scm,omitempty"`
}

SourcesScm represents the response from getting SCM data.

type SourcesScmOptions

type SourcesScmOptions struct {
	// Key is the file key (required).
	Key string `url:"key,omitempty"`
	// CommitsByLine indicates whether to group commits by line (optional, default: false).
	CommitsByLine bool `url:"commits_by_line,omitempty"`
	// From is the starting line number (optional, default: 1).
	From int64 `url:"from,omitempty"`
	// To is the ending line number (optional, default: end of file).
	To int64 `url:"to,omitempty"`
}

SourcesScmOptions represents options for getting SCM data.

type SourcesService

type SourcesService struct {
	// contains filtered or unexported fields
}

SourcesService handles communication with the Sources related methods of the SonarQube API. Get source code.

Since: 4.4.

func (*SourcesService) Index deprecated

Index gets source code. Requires 'See Source Code' permission on file's project. Each element is a key/value pair where the key is the line number and the value is the content of the line.

Since: 5.0.

Deprecated: This web service is deprecated since 5.1. Use api/sources/lines instead.

func (*SourcesService) IssueSnippets

IssueSnippets gets source code snippets for issues. Requires 'Browse' permission on the file's project. Returns source code snippets relevant to the given issue.

Since: 7.8.

func (*SourcesService) Lines

Lines shows source code with line-oriented info. Requires 'See Source Code' permission on file's project. Returns source code with additional info like SCM data, coverage, and duplications.

Since: 5.0.

func (*SourcesService) Raw

Raw gets the raw source code. Returns the raw source code as plain text. Requires 'See Source Code' permission on file's project.

Since: 5.0.

func (*SourcesService) Scm

Scm gets SCM information of source files. Requires 'See Source Code' permission on file's project. Returns source code modification information.

Since: 4.4.

func (*SourcesService) Show

Show gets source code as line number / text pairs. Requires 'See Source Code' permission on file's project.

Since: 4.4.

func (*SourcesService) ValidateIndexOpt

func (s *SourcesService) ValidateIndexOpt(opt *SourcesIndexOptions) error

ValidateIndexOpt validates the options for Index.

func (*SourcesService) ValidateIssueSnippetsOpt

func (s *SourcesService) ValidateIssueSnippetsOpt(opt *SourcesIssueSnippetsOptions) error

ValidateIssueSnippetsOpt validates the options for IssueSnippets.

func (*SourcesService) ValidateLinesOpt

func (s *SourcesService) ValidateLinesOpt(opt *SourcesLinesOptions) error

ValidateLinesOpt validates the options for Lines.

func (*SourcesService) ValidateRawOpt

func (s *SourcesService) ValidateRawOpt(opt *SourcesRawOptions) error

ValidateRawOpt validates the options for Raw.

func (*SourcesService) ValidateScmOpt

func (s *SourcesService) ValidateScmOpt(opt *SourcesScmOptions) error

ValidateScmOpt validates the options for Scm.

func (*SourcesService) ValidateShowOpt

func (s *SourcesService) ValidateShowOpt(opt *SourcesShowOptions) error

ValidateShowOpt validates the options for Show.

type SourcesShow

type SourcesShow struct {
	// Sources is the list of source lines (index and code pairs).
	Sources [][]any `json:"sources,omitempty"`
}

SourcesShow represents the response from getting raw source file content.

type SourcesShowOptions

type SourcesShowOptions struct {
	// Key is the file key (required).
	Key string `url:"key,omitempty"`
	// From is the starting line number (optional, default: 1).
	From int64 `url:"from,omitempty"`
	// To is the ending line number (optional, default: end of file).
	To int64 `url:"to,omitempty"`
}

SourcesShowOptions represents options for showing source file content.

type SupportInfo

type SupportInfo struct {
	// Database contains database-related support information.
	Database map[string]any `json:"Database,omitempty"`
	// SonarQube contains SonarQube application-level support information.
	SonarQube map[string]any `json:"SonarQube,omitempty"`
	// Statistics contains usage statistics information.
	Statistics map[string]any `json:"Statistics,omitempty"`
	// System contains system-level support information.
	System map[string]any `json:"System,omitempty"`
}

SupportInfo contains system support information returned by the Info endpoint.

type SupportService

type SupportService struct {
	// contains filtered or unexported fields
}

SupportService handles communication with the support related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*SupportService) Info

Info returns support information about the system and the currently installed license. Requires 'Administer System' permission.

API endpoint: GET /api/support/info. Since: 3.1. Enterprise Edition only. WARNING: This is an internal API and may change without notice. WARNING: Live-verified against SonarQube 2025.2 Enterprise: this endpoint requires an actual installed commercial license to succeed, independent of Enterprise Edition + 'Administer System' permission. Without one it fails with HTTP 400 and body {"errors":[{"msg":"License not found"}]}, so the success-path JSON shape of SupportInfo below could not be confirmed against a live server and remains a best-effort guess (see .github/reviews/pr-265.md).

type SystemChangeLogLevelOptions

type SystemChangeLogLevelOptions struct {
	// Level is the new log level.
	// Possible values: TRACE, DEBUG, INFO.
	// Be cautious: DEBUG, and even more TRACE, may have performance impacts.
	Level string `url:"level,omitempty"`
}

SystemChangeLogLevelOptions contains options for the ChangeLogLevel method.

type SystemDbMigrationStatus

type SystemDbMigrationStatus struct {
	// Message contains additional information about the migration status.
	Message string `json:"message,omitempty"`
	// StartedAt is the timestamp when the migration started.
	StartedAt string `json:"startedAt,omitempty"`
	// State is the current migration state.
	// Possible values: NO_MIGRATION, NOT_SUPPORTED, MIGRATION_RUNNING, MIGRATION_SUCCEEDED, MIGRATION_FAILED, MIGRATION_REQUIRED.
	State string `json:"state,omitempty"`
}

SystemDbMigrationStatus represents the response from getting the database migration status. State values indicate the current status of the database migration process.

type SystemDbMigrationsStatusV2

type SystemDbMigrationsStatusV2 struct {
	// CompletedSteps is the number of migration steps completed.
	CompletedSteps int32 `json:"completedSteps,omitempty"`
	// ExpectedFinishTimestamp is the estimated finish time for the migration.
	ExpectedFinishTimestamp string `json:"expectedFinishTimestamp,omitempty"`
	// Message is a descriptive message about the migration status.
	Message string `json:"message,omitempty"`
	// StartedAt is the datetime when the migration started.
	StartedAt string `json:"startedAt,omitempty"`
	// Status is the current status of the migration.
	Status string `json:"status,omitempty"`
	// TotalSteps is the total number of migration steps.
	TotalSteps int32 `json:"totalSteps,omitempty"`
}

SystemDbMigrationsStatusV2 represents the response from getting database migration status.

type SystemHealth

type SystemHealth struct {
	// Causes contains the reasons for any health issues.
	Causes []SystemHealthCause `json:"causes,omitempty"`
	// Health is the overall health status: GREEN, YELLOW, or RED.
	Health string `json:"health,omitempty"`
	// Nodes contains health information for each node in a cluster.
	Nodes []SystemHealthNode `json:"nodes,omitempty"`
}

SystemHealth represents the response from checking the health status of SonarQube.

type SystemHealthCause

type SystemHealthCause struct {
	// Message describes the cause of the health issue.
	Message string `json:"message,omitempty"`
}

SystemHealthCause represents a reason for a health issue.

type SystemHealthNode

type SystemHealthNode struct {
	// Causes contains the reasons for any health issues on this node.
	Causes []SystemHealthCause `json:"causes,omitempty"`
	// Health is the health status of this node: GREEN, YELLOW, or RED.
	Health string `json:"health,omitempty"`
	// Host is the hostname or IP address of this node.
	Host string `json:"host,omitempty"`
	// Name is the display name of this node.
	Name string `json:"name,omitempty"`
	// Port is the port number of this node.
	Port int64 `json:"port,omitempty"`
	// StartedAt is the timestamp when this node was started.
	StartedAt string `json:"startedAt,omitempty"`
	// Type is the type of this node (e.g., APPLICATION, SEARCH).
	Type string `json:"type,omitempty"`
}

SystemHealthNode represents health information for a single node in a cluster.

type SystemHealthV2

type SystemHealthV2 struct {
	// Causes lists the reasons for the current health status.
	Causes []string `json:"causes,omitempty"`
	// Status is the health status (GREEN, YELLOW, RED).
	Status string `json:"status,omitempty"`
}

SystemHealthV2 represents the response from getting system health.

type SystemIncompatiblePlugin

type SystemIncompatiblePlugin struct {
	// Category is the plugin category.
	Category string `json:"category,omitempty"`
	// Description is the plugin description.
	Description string `json:"description,omitempty"`
	// EditionBundled indicates if the plugin is bundled with an edition.
	EditionBundled bool `json:"editionBundled,omitempty"`
	// Key is the plugin key.
	Key string `json:"key,omitempty"`
	// License is the plugin license.
	License string `json:"license,omitempty"`
	// Name is the plugin name.
	Name string `json:"name,omitempty"`
	// OrganizationName is the organization name.
	OrganizationName string `json:"organizationName,omitempty"`
	// OrganizationURL is the organization URL.
	OrganizationURL string `json:"organizationUrl,omitempty"`
}

SystemIncompatiblePlugin represents a plugin that is incompatible with an upgrade.

type SystemInfo

type SystemInfo struct {
	// ALMs contains ALM integration configuration.
	ALMs SystemInfoALMs `json:"ALMs,omitzero"`
	// Bundled contains versions of bundled plugins.
	Bundled SystemInfoBundled `json:"Bundled,omitzero"`
	// ComputeEngineDatabaseConnection contains CE database connection pool info.
	ComputeEngineDatabaseConnection DatabaseConnectionPool `json:"Compute Engine Database Connection,omitzero"`
	// ComputeEngineJVMProperties contains CE JVM properties.
	ComputeEngineJVMProperties map[string]any `json:"Compute Engine JVM Properties,omitempty"`
	// ComputeEngineJVMState contains CE JVM state information.
	ComputeEngineJVMState JVMState `json:"Compute Engine JVM State,omitzero"`
	// ComputeEngineLogging contains CE logging configuration.
	ComputeEngineLogging LoggingConfig `json:"Compute Engine Logging,omitzero"`
	// ComputeEngineTasks contains CE task information.
	ComputeEngineTasks ComputeEngineTasks `json:"Compute Engine Tasks,omitzero"`
	// Database contains database information.
	Database DatabaseInfo `json:"Database,omitzero"`
	// Health is the overall health status.
	Health string `json:"Health,omitempty"`
	// HealthCauses contains reasons for any health issues.
	HealthCauses []any `json:"Health Causes,omitempty"`
	// MCP contains Model Context Protocol integration status.
	MCP SystemInfoMCP `json:"MCP,omitzero"`
	// Plugins contains installed plugin information.
	Plugins map[string]string `json:"Plugins,omitempty"`
	// SearchIndexes contains search index statistics.
	SearchIndexes SearchIndexes `json:"Search Indexes,omitzero"`
	// SearchState contains search node state information.
	SearchState SearchState `json:"Search State,omitzero"`
	// ServerPushConnections contains server push connection information.
	ServerPushConnections ServerPushConnections `json:"Server Push Connections,omitzero"`
	// Settings contains SonarQube settings.
	Settings map[string]any `json:"Settings,omitempty"`
	// System contains core system information.
	System SystemInfoSystem `json:"System,omitzero"`
	// WebDatabaseConnection contains Web database connection pool info.
	WebDatabaseConnection DatabaseConnectionPool `json:"Web Database Connection,omitzero"`
	// WebJVMProperties contains Web JVM properties.
	WebJVMProperties map[string]any `json:"Web JVM Properties,omitempty"`
	// WebJVMState contains Web JVM state information.
	WebJVMState JVMState `json:"Web JVM State,omitzero"`
	// WebLogging contains Web logging configuration.
	WebLogging LoggingConfig `json:"Web Logging,omitzero"`
}

SystemInfo represents the response from getting detailed system information. This contains extensive information about the SonarQube configuration and state.

type SystemInfoALMs

type SystemInfoALMs struct {
	// GithubConfig contains GitHub configuration.
	GithubConfig string `json:"Github Config,omitempty"`
	// GitlabConfig contains GitLab configuration.
	GitlabConfig string `json:"Gitlab Config,omitempty"`
}

SystemInfoALMs contains ALM integration configuration.

type SystemInfoBundled

type SystemInfoBundled struct {
	// Abap is the ABAP plugin version.
	Abap string `json:"abap,omitempty"`
	// Architecture is the architecture plugin version.
	Architecture string `json:"architecture,omitempty"`
	// Architecturecsharpfrontend is the architecture C# frontend plugin version.
	Architecturecsharpfrontend string `json:"architecturecsharpfrontend,omitempty"`
	// Architecturejavafrontend is the architecture Java frontend plugin version.
	Architecturejavafrontend string `json:"architecturejavafrontend,omitempty"`
	// Architecturejavascriptfrontend is the architecture JavaScript frontend plugin version.
	Architecturejavascriptfrontend string `json:"architecturejavascriptfrontend,omitempty"`
	// Architecturepythonfrontend is the architecture Python frontend plugin version.
	Architecturepythonfrontend string `json:"architecturepythonfrontend,omitempty"`
	// Cayc is the Clean-as-You-Code plugin version.
	Cayc string `json:"cayc,omitempty"`
	// Cfamilydependencies is the C-family dependencies plugin version.
	Cfamilydependencies string `json:"cfamilydependencies,omitempty"`
	// Cobol is the COBOL plugin version.
	Cobol string `json:"cobol,omitempty"`
	// Config is the config plugin version.
	Config string `json:"config,omitempty"`
	// Cpp is the C++ plugin version.
	Cpp string `json:"cpp,omitempty"`
	// Csharp is the C# plugin version.
	Csharp string `json:"csharp,omitempty"`
	// Csharpenterprise is the C# enterprise plugin version.
	Csharpenterprise string `json:"csharpenterprise,omitempty"`
	// Dart is the Dart plugin version.
	Dart string `json:"dart,omitempty"`
	// Dbd is the database design plugin version.
	Dbd string `json:"dbd,omitempty"`
	// Dbdjavafrontend is the database design Java frontend plugin version.
	Dbdjavafrontend string `json:"dbdjavafrontend,omitempty"`
	// Dbdpythonfrontend is the database design Python frontend plugin version.
	Dbdpythonfrontend string `json:"dbdpythonfrontend,omitempty"`
	// Dre is the DRE plugin version.
	Dre string `json:"dre,omitempty"`
	// Flex is the Flex plugin version.
	Flex string `json:"flex,omitempty"`
	// Go is the Go plugin version.
	Go string `json:"go,omitempty"`
	// Iac is the IaC plugin version.
	Iac string `json:"iac,omitempty"`
	// Jacoco is the JaCoCo plugin version.
	Jacoco string `json:"jacoco,omitempty"`
	// Jasmin is the Jasmin plugin version.
	Jasmin string `json:"jasmin,omitempty"`
	// Java is the Java plugin version.
	Java string `json:"java,omitempty"`
	// Javascript is the JavaScript plugin version.
	Javascript string `json:"javascript,omitempty"`
	// Javasymbolicexecution is the Java symbolic execution plugin version.
	Javasymbolicexecution string `json:"javasymbolicexecution,omitempty"`
	// Jcl is the JCL plugin version.
	Jcl string `json:"jcl,omitempty"`
	// Kotlin is the Kotlin plugin version.
	Kotlin string `json:"kotlin,omitempty"`
	// Php is the PHP plugin version.
	Php string `json:"php,omitempty"`
	// Pli is the PL/I plugin version.
	Pli string `json:"pli,omitempty"`
	// Plsql is the PL/SQL plugin version.
	Plsql string `json:"plsql,omitempty"`
	// Python is the Python plugin version.
	Python string `json:"python,omitempty"`
	// Rpg is the RPG plugin version.
	Rpg string `json:"rpg,omitempty"`
	// Ruby is the Ruby plugin version.
	Ruby string `json:"ruby,omitempty"`
	// Rust is the Rust plugin version.
	Rust string `json:"rust,omitempty"`
	// Security is the security plugin version.
	Security string `json:"security,omitempty"`
	// Securitycsharpfrontend is the security C# frontend plugin version.
	Securitycsharpfrontend string `json:"securitycsharpfrontend,omitempty"`
	// Securitygofrontend is the security Go frontend plugin version.
	Securitygofrontend string `json:"securitygofrontend,omitempty"`
	// Securityjavafrontend is the security Java frontend plugin version.
	Securityjavafrontend string `json:"securityjavafrontend,omitempty"`
	// Securitykotlinfrontend is the security Kotlin frontend plugin version.
	Securitykotlinfrontend string `json:"securitykotlinfrontend,omitempty"`
	// Securityphpfrontend is the security PHP frontend plugin version.
	Securityphpfrontend string `json:"securityphpfrontend,omitempty"`
	// Securitypythonfrontend is the security Python frontend plugin version.
	Securitypythonfrontend string `json:"securitypythonfrontend,omitempty"`
	// Securityvbnetfrontend is the security VB.NET frontend plugin version.
	Securityvbnetfrontend string `json:"securityvbnetfrontend,omitempty"`
	// Sonarapex is the Apex plugin version.
	Sonarapex string `json:"sonarapex,omitempty"`
	// Sonarscala is the Scala plugin version.
	Sonarscala string `json:"sonarscala,omitempty"`
	// Swift is the Swift plugin version.
	Swift string `json:"swift,omitempty"`
	// Text is the Text plugin version.
	Text string `json:"text,omitempty"`
	// Textenterprise is the text enterprise plugin version.
	Textenterprise string `json:"textenterprise,omitempty"`
	// Tsql is the T-SQL plugin version.
	Tsql string `json:"tsql,omitempty"`
	// Vb is the VB plugin version.
	Vb string `json:"vb,omitempty"`
	// Vbnet is the VB.NET plugin version.
	Vbnet string `json:"vbnet,omitempty"`
	// Vbnetenterprise is the VB.NET enterprise plugin version.
	Vbnetenterprise string `json:"vbnetenterprise,omitempty"`
	// Web is the Web plugin version.
	Web string `json:"web,omitempty"`
	// XML is the XML plugin version.
	XML string `json:"xml,omitempty"`
}

SystemInfoBundled contains versions of bundled plugins.

type SystemInfoMCP added in v2.2.1

type SystemInfoMCP struct {
	// Enabled indicates whether MCP integration is enabled.
	Enabled bool `json:"Enabled,omitempty"`
	// Healthy indicates whether MCP integration is healthy.
	Healthy bool `json:"Healthy,omitempty"`
}

SystemInfoMCP contains Model Context Protocol integration status.

type SystemInfoSystem

type SystemInfoSystem struct {
	// AcceptedExternalIdentityProviders lists accepted external identity providers.
	AcceptedExternalIdentityProviders string `json:"Accepted external identity providers,omitempty"`
	// Container indicates if running in a container.
	Container bool `json:"Container,omitempty"`
	// DataDir is the data directory path.
	DataDir string `json:"Data Dir,omitempty"`
	// Docker indicates if running in Docker.
	Docker bool `json:"Docker,omitempty"`
	// Edition is the SonarQube edition.
	Edition string `json:"Edition,omitempty"`
	// ExternalIdentityProvidersWhoseUsersAreAllowedToSignThemselvesUp describes which providers allow self-signup.
	ExternalIdentityProvidersWhoseUsersAreAllowedToSignThemselvesUp string `json:"External identity providers whose users are allowed to sign themselves up,omitempty"`
	// ForceAuthentication indicates if authentication is forced.
	ForceAuthentication bool `json:"Force authentication,omitempty"`
	// HighAvailability indicates if high availability mode is enabled.
	HighAvailability bool `json:"High Availability,omitempty"`
	// HomeDir is the home directory path.
	HomeDir string `json:"Home Dir,omitempty"`
	// LinesOfCode is the total number of lines of code analyzed by this instance.
	LinesOfCode int64 `json:"Lines of Code,omitempty"`
	// OfficialDistribution indicates if this is an official distribution.
	OfficialDistribution bool `json:"Official Distribution,omitempty"`
	// Processors is the number of available processors.
	Processors int64 `json:"Processors,omitempty"`
	// ServerID is the server identifier.
	ServerID string `json:"Server ID,omitempty"`
	// TempDir is the temp directory path.
	TempDir string `json:"Temp Dir,omitempty"`
	// Version is the SonarQube version.
	Version string `json:"Version,omitempty"`
}

SystemInfoSystem contains core system information.

type SystemLiveness

type SystemLiveness struct{}

SystemLiveness represents the response from the liveness check. Note: The API does not return a response body, liveness is indicated by HTTP status.

type SystemLogsOptions

type SystemLogsOptions struct {
	// Name is the name of the logs to retrieve.
	// Possible values: access, app, ce, deprecation, es, web.
	// Default: app.
	Name string `url:"name,omitempty"`
}

SystemLogsOptions contains options for the Logs method.

type SystemMigrateDb

type SystemMigrateDb struct {
	// Message contains additional information about the migration.
	Message string `json:"message,omitempty"`
	// StartedAt is the timestamp when the migration started.
	StartedAt string `json:"startedAt,omitempty"`
	// State is the current migration state.
	State string `json:"state,omitempty"`
}

SystemMigrateDb represents the response from initiating a database migration. State values indicate the current status of the database migration process.

type SystemPasscodeOptionV2

type SystemPasscodeOptionV2 struct {
	// Passcode is the value for the X-Sonar-Passcode header.
	// Can be provided instead of system admin credentials.
	Passcode string
}

SystemPasscodeOptionV2 contains the optional passcode header for system endpoints.

type SystemPluginUpdate

type SystemPluginUpdate struct {
	// Category is the plugin category.
	Category string `json:"category,omitempty"`
	// Description is the plugin description.
	Description string `json:"description,omitempty"`
	// EditionBundled indicates if the plugin is bundled with an edition.
	EditionBundled bool `json:"editionBundled,omitempty"`
	// Key is the plugin key.
	Key string `json:"key,omitempty"`
	// License is the plugin license.
	License string `json:"license,omitempty"`
	// Name is the plugin name.
	Name string `json:"name,omitempty"`
	// OrganizationName is the organization name.
	OrganizationName string `json:"organizationName,omitempty"`
	// OrganizationURL is the organization URL.
	OrganizationURL string `json:"organizationUrl,omitempty"`
	// TermsAndConditionsURL is the URL to terms and conditions.
	TermsAndConditionsURL string `json:"termsAndConditionsUrl,omitempty"`
	// Version is the required version.
	Version string `json:"version,omitempty"`
}

SystemPluginUpdate represents a plugin that requires updating for an upgrade.

type SystemService

type SystemService struct {
	// contains filtered or unexported fields
}

SystemService handles communication with the System related methods of the SonarQube API. This service provides endpoints for system management, health checks, and status monitoring.

func (*SystemService) ChangeLogLevel

func (s *SystemService) ChangeLogLevel(ctx context.Context, opt *SystemChangeLogLevelOptions) (*http.Response, error)

ChangeLogLevel temporarily changes the level of logs. The new level is not persistent and is lost when restarting the server. Requires system administration permission.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/change_log_level

func (*SystemService) DbMigrationStatus deprecated

func (s *SystemService) DbMigrationStatus(ctx context.Context) (*SystemDbMigrationStatus, *http.Response, error)

DbMigrationStatus displays the database migration status of SonarQube. State values are:

  • NO_MIGRATION: DB is up to date with current version of SonarQube.
  • NOT_SUPPORTED: Migration is not supported on embedded databases.
  • MIGRATION_RUNNING: DB migration is underway.
  • MIGRATION_SUCCEEDED: DB migration has run and has been successful.
  • MIGRATION_FAILED: DB migration has run and failed.
  • MIGRATION_REQUIRED: DB migration is required.

Deprecated: since 10.6. Use the API v2 version /api/v2/system/migrations-status instead.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/db_migration_status

func (*SystemService) Health

Health provides the health status of SonarQube. Although global health is calculated based on both application and search nodes, detailed information is returned only for application nodes.

Health status values:

  • GREEN: SonarQube is fully operational.
  • YELLOW: SonarQube is usable, but it needs attention.
  • RED: SonarQube is not operational.

Requires the 'Administer System' permission or system passcode. When SonarQube is in safe mode, only authentication with a system passcode is supported.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/health

func (*SystemService) Info

Info gets detailed information about system configuration. Requires 'Administer' permissions.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/info

func (*SystemService) Liveness

Liveness provides the liveness status of SonarQube, meant to be used for a liveness probe on Kubernetes. Requires 'Administer System' permission or authentication with passcode.

When SonarQube is fully started, liveness checks for database connectivity, Compute Engine status, and (except for DataCenter Edition) if ElasticSearch is Green or Yellow.

When SonarQube is on Safe Mode, liveness checks only for database connectivity.

Response codes:

  • HTTP 204: this SonarQube node is alive.
  • Any other HTTP code: this SonarQube node is not alive and should be rescheduled.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/liveness

func (*SystemService) Logs

Logs gets system logs in plain-text format. Requires system administration permission.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/logs

func (*SystemService) MigrateDb

MigrateDb migrates the database to match the current version of SonarQube. It is strongly advised to make a database backup before invoking this method.

State values are:

  • NO_MIGRATION: DB is up to date with current version of SonarQube.
  • NOT_SUPPORTED: Migration is not supported on embedded databases.
  • MIGRATION_RUNNING: DB migration is underway.
  • MIGRATION_SUCCEEDED: DB migration has run and has been successful.
  • MIGRATION_FAILED: DB migration has run and failed.
  • MIGRATION_REQUIRED: DB migration is required.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/migrate_db

func (*SystemService) Ping

func (s *SystemService) Ping(ctx context.Context) (*string, *http.Response, error)

Ping answers "pong" as plain-text. This can be used for health checks.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/ping

func (*SystemService) Restart

func (s *SystemService) Restart(ctx context.Context) (*http.Response, error)

Restart restarts the server. Requires 'Administer System' permission. Performs a full restart of the Web, Search and Compute Engine Servers processes. Does not reload sonar.properties.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/restart

func (*SystemService) Status

Status gets state information about SonarQube.

Status values:

  • STARTING: SonarQube Web Server is up and serving some Web Services but initialization is still ongoing.
  • UP: SonarQube instance is up and running.
  • DOWN: SonarQube instance is up but not running because migration has failed or some other reason.
  • RESTARTING: SonarQube instance is still up but a restart has been requested.
  • DB_MIGRATION_NEEDED: Database migration is required.
  • DB_MIGRATION_RUNNING: DB migration is running.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/status

func (*SystemService) Upgrades

Upgrades lists available upgrades for the SonarQube instance (if any). For each upgrade, it lists incompatible plugins and plugins requiring upgrade. Plugin information is retrieved from Update Center.

API Docs: https://next.sonarqube.com/sonarqube/web_api/api/system/upgrades

func (*SystemService) ValidateChangeLogLevelOpt

func (s *SystemService) ValidateChangeLogLevelOpt(opt *SystemChangeLogLevelOptions) error

ValidateChangeLogLevelOpt validates the options for ChangeLogLevel.

func (*SystemService) ValidateLogsOpt

func (s *SystemService) ValidateLogsOpt(opt *SystemLogsOptions) error

ValidateLogsOpt validates the options for Logs.

type SystemServiceV2

type SystemServiceV2 struct {
	// contains filtered or unexported fields
}

SystemServiceV2 handles communication with the System related methods of the SonarQube V2 API.

func (*SystemServiceV2) CheckLiveness

func (s *SystemServiceV2) CheckLiveness(ctx context.Context, opt *SystemPasscodeOptionV2) (*http.Response, error)

CheckLiveness provides liveness of SonarQube, meant to be used as a liveness probe on Kubernetes. Returns a 204 status when alive. Requires 'Administer System' permission or authentication with passcode.

func (*SystemServiceV2) GetHealth

GetHealth returns the health status of the SonarQube instance. Requires 'Administer System' permission or authentication with passcode.

func (*SystemServiceV2) GetMigrationsStatus

func (s *SystemServiceV2) GetMigrationsStatus(ctx context.Context) (*SystemDbMigrationsStatusV2, *http.Response, error)

GetMigrationsStatus returns the detailed status of ongoing database migrations. If no migration is ongoing or needed, it still returns appropriate information.

type SystemStatus

type SystemStatus struct {
	// ID is the server identifier.
	ID string `json:"id,omitempty"`
	// Status is the running status.
	// Possible values: STARTING, UP, DOWN, RESTARTING, DB_MIGRATION_NEEDED, DB_MIGRATION_RUNNING.
	Status string `json:"status,omitempty"`
	// Version is the SonarQube version.
	Version string `json:"version,omitempty"`
}

SystemStatus represents the response from getting the system status.

type SystemUpgrade

type SystemUpgrade struct {
	// ChangeLogURL is the URL to the release changelog.
	ChangeLogURL string `json:"changeLogUrl,omitempty"`
	// Description describes the upgrade.
	Description string `json:"description,omitempty"`
	// DocumentationURL is the URL to the upgrade documentation.
	DocumentationURL string `json:"documentationUrl,omitempty"`
	// DownloadURL is the URL to download the upgrade (Community edition).
	DownloadURL string `json:"downloadUrl,omitempty"`
	// DownloadDeveloperURL is the URL to download the Developer edition of the upgrade.
	DownloadDeveloperURL string `json:"downloadDeveloperUrl,omitempty"`
	// DownloadEnterpriseURL is the URL to download the Enterprise edition of the upgrade.
	DownloadEnterpriseURL string `json:"downloadEnterpriseUrl,omitempty"`
	// DownloadDatacenterURL is the URL to download the Data Center edition of the upgrade.
	DownloadDatacenterURL string `json:"downloadDatacenterUrl,omitempty"`
	// Product is the product name for the upgrade.
	Product string `json:"product,omitempty"`
	// Plugins contains plugin compatibility information.
	Plugins SystemUpgradePlugins `json:"plugins,omitzero"`
	// ReleaseDate is the release date of the upgrade.
	ReleaseDate string `json:"releaseDate,omitempty"`
	// Version is the version of the upgrade.
	Version string `json:"version,omitempty"`
}

SystemUpgrade represents an available upgrade.

type SystemUpgradePlugins

type SystemUpgradePlugins struct {
	// Incompatible lists plugins that are incompatible with the upgrade.
	Incompatible []SystemIncompatiblePlugin `json:"incompatible,omitempty"`
	// RequireUpdate lists plugins that require updating.
	RequireUpdate []SystemPluginUpdate `json:"requireUpdate,omitempty"`
}

SystemUpgradePlugins contains plugin compatibility information for an upgrade.

type SystemUpgrades

type SystemUpgrades struct {
	// InstalledVersionActive indicates if the installed version is still active.
	InstalledVersionActive bool `json:"installedVersionActive,omitempty"`
	// LatestLTA is the latest Long-Term Active version.
	LatestLTA string `json:"latestLTA,omitempty"`
	// LatestLTS is the latest Long-Term Support version (deprecated, use LatestLTA).
	LatestLTS string `json:"latestLTS,omitempty"`
	// UpdateCenterRefresh is the timestamp when Update Center was last refreshed.
	UpdateCenterRefresh string `json:"updateCenterRefresh,omitempty"`
	// Upgrades is the list of available upgrades.
	Upgrades []SystemUpgrade `json:"upgrades,omitempty"`
}

SystemUpgrades represents the response from checking for available upgrades.

type TextRange

type TextRange struct {
	// StartLine is the starting line number (1-based).
	StartLine int64 `json:"startLine,omitempty"`
	// EndLine is the ending line number (1-based).
	EndLine int64 `json:"endLine,omitempty"`
	// StartOffset is the starting offset within the line (0-based).
	StartOffset int64 `json:"startOffset,omitempty"`
	// EndOffset is the ending offset within the line (0-based).
	EndOffset int64 `json:"endOffset,omitempty"`
}

TextRange represents a range of text in a source file.

type TransportConfig

type TransportConfig struct {
	// TLSClientConfig customizes the TLS settings used for HTTPS connections.
	//
	// Security warning: setting TLSClientConfig.InsecureSkipVerify to true
	// disables server certificate verification, which exposes the connection to
	// man-in-the-middle attacks and can leak the auth token and source-code
	// metadata exchanged with SonarQube. Only use it against a trusted local or
	// development instance, never in production.
	TLSClientConfig *tls.Config
	// MaxIdleConns controls the maximum number of idle (keep-alive) connections
	// across all hosts. Zero means no limit.
	MaxIdleConns int
	// IdleConnTimeout is the maximum time an idle connection is kept before
	// closing. Zero means no limit.
	IdleConnTimeout time.Duration
	// TLSHandshakeTimeout is the maximum time to wait for a TLS handshake.
	// Zero means no timeout.
	TLSHandshakeTimeout time.Duration
	// DisableCompression disables transparent gzip request/response compression.
	DisableCompression bool
}

TransportConfig holds configuration for the SDK-managed HTTP transport. It is ignored when WithHTTPClient is also used.

type UpdateFieldListStringV2

type UpdateFieldListStringV2 struct {
	// Value is the list of string values.
	Value []string
	// Defined indicates whether this field has been explicitly set.
	Defined bool
}

UpdateFieldListStringV2 represents a field that can be explicitly set or cleared in a V2 PATCH request. When used as a pointer field with omitempty, a nil pointer means the field is not included in the request (no change). A non-nil pointer serializes the Value slice directly as a JSON array (or null if Value is nil).

func (UpdateFieldListStringV2) MarshalJSON

func (u UpdateFieldListStringV2) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface. It serializes the UpdateFieldListStringV2 as the bare Value slice so that merge-patch+json requests send `"field":["a","b"]` instead of `"field":{"value":...,"defined":...}`.

type User

type User struct {
	// Active indicates whether the user is active.
	Active bool `json:"active,omitempty"`
	// Email is the user's email address.
	Email string `json:"email,omitempty"`
	// ExternalIdentity is the user's external identity.
	ExternalIdentity string `json:"externalIdentity,omitempty"`
	// ExternalProvider is the user's external identity provider.
	ExternalProvider string `json:"externalProvider,omitempty"`
	// Groups is the list of groups the user belongs to.
	Groups []string `json:"groups,omitempty"`
	// Local indicates whether the user is authenticated locally.
	Local bool `json:"local,omitempty"`
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// ScmAccounts is the list of SCM accounts associated with the user.
	ScmAccounts []string `json:"scmAccounts,omitempty"`
}

User represents a user in the system.

type UserGroupsAddUserOptions

type UserGroupsAddUserOptions struct {
	// Login is the user login (optional - for internal accounts).
	Login string `url:"login,omitempty"`
	// Name is the group name (required).
	Name string `url:"name,omitempty"`
}

UserGroupsAddUserOptions represents options for adding a user to a group.

type UserGroupsCreate

type UserGroupsCreate struct {
	// Group contains the created group details.
	Group UserGroupsDetail `json:"group,omitzero"`
}

UserGroupsCreate represents the response from creating a group.

type UserGroupsCreateOptions

type UserGroupsCreateOptions struct {
	// Description is the description for the new group.
	// Maximum length: 200 characters.
	Description string `url:"description,omitempty"`
	// Name is the name for the new group (required).
	// Must be unique and cannot be 'anyone'.
	// Maximum length: 255 characters.
	Name string `url:"name,omitempty"`
}

UserGroupsCreateOptions represents options for creating a group.

type UserGroupsDeleteOptions

type UserGroupsDeleteOptions struct {
	// Name is the group name (required).
	Name string `url:"name,omitempty"`
}

UserGroupsDeleteOptions represents options for deleting a group.

type UserGroupsDetail

type UserGroupsDetail struct {
	// Description is the description of the group.
	Description string `json:"description,omitempty"`
	// ID is the unique identifier of the group.
	ID string `json:"id,omitempty"`
	// Name is the name of the group.
	Name string `json:"name,omitempty"`
	// Organization is the organization the group belongs to.
	Organization string `json:"organization,omitempty"`
	// MembersCount is the number of members in the group.
	MembersCount int64 `json:"membersCount,omitempty"`
	// Default indicates if this is a default group.
	Default bool `json:"default,omitempty"`
	// Managed indicates if the group is managed externally.
	Managed bool `json:"managed,omitempty"`
}

UserGroupsDetail represents a user group with its properties from user_groups API.

type UserGroupsRemoveUserOptions

type UserGroupsRemoveUserOptions struct {
	// Login is the user login (optional - for internal accounts).
	Login string `url:"login,omitempty"`
	// Name is the group name (required).
	Name string `url:"name,omitempty"`
}

UserGroupsRemoveUserOptions represents options for removing a user from a group.

type UserGroupsSearch

type UserGroupsSearch struct {
	// Groups is the list of groups.
	Groups []UserGroupsDetail `json:"groups,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

UserGroupsSearch represents the response from searching groups.

type UserGroupsSearchOptions

type UserGroupsSearchOptions struct {
	PaginationArgs

	// Managed filters by managed status.
	// Only available for managed instances.
	Managed *bool `url:"managed,omitempty"`
	// Fields is the list of fields to return in response.
	// Possible values: name, description, membersCount, managed.
	Fields []string `url:"f,omitempty,comma"`
	// Query limits search to names that contain the supplied string.
	Query string `url:"q,omitempty"`
}

UserGroupsSearchOptions represents options for searching groups.

type UserGroupsService deprecated

type UserGroupsService struct {
	// contains filtered or unexported fields
}

UserGroupsService handles communication with the User Groups related methods of the SonarQube API. Manage user groups.

Deprecated: Since 10.4. Use v2 API endpoints instead.

Since: 5.2.

func (*UserGroupsService) AddUser deprecated

AddUser adds a user to a group. 'name' must be provided. Requires the following permission: 'Administer System'.

Deprecated: Since 10.4. Use POST /api/v2/authorizations/group-memberships instead.

Since: 5.2.

func (*UserGroupsService) Create deprecated

Create creates a group. Requires the following permission: 'Administer System'.

Deprecated: Since 10.4. Use POST /api/v2/authorizations/groups instead.

Since: 5.2.

func (*UserGroupsService) Delete deprecated

Delete deletes a group. The default groups cannot be deleted. 'name' must be provided. Requires the following permission: 'Administer System'.

Deprecated: Since 10.4. Use DELETE /api/v2/authorizations/groups instead.

Since: 5.2.

func (*UserGroupsService) RemoveUser deprecated

RemoveUser removes a user from a group. 'name' must be provided. Requires the following permission: 'Administer System'.

Deprecated: Since 10.4. Use DELETE /api/v2/authorizations/group-memberships instead.

Since: 5.2.

func (*UserGroupsService) Search deprecated

Search searches for user groups. Requires the following permission: 'Administer System'.

Deprecated: Since 10.4. Use GET /api/v2/authorizations/groups instead.

Since: 5.2.

func (*UserGroupsService) SearchAll

SearchAll fetches all pages from Search and returns a flat slice of groups.

func (*UserGroupsService) Update deprecated

Update updates a group. Requires the following permission: 'Administer System'.

Deprecated: Since 10.4. Use PATCH /api/v2/authorizations/groups instead.

Since: 5.2.

func (*UserGroupsService) Users deprecated

Users searches for users with membership information with respect to a group. Requires the following permission: 'Administer System'.

Deprecated: Since 10.4. Use GET /api/v2/authorizations/group-memberships instead.

Since: 5.2.

func (*UserGroupsService) UsersAll

UsersAll fetches all pages from Users and returns a flat slice of users.

func (*UserGroupsService) ValidateAddUserOpt

func (s *UserGroupsService) ValidateAddUserOpt(opt *UserGroupsAddUserOptions) error

ValidateAddUserOpt validates the options for AddUser.

func (*UserGroupsService) ValidateCreateOpt

func (s *UserGroupsService) ValidateCreateOpt(opt *UserGroupsCreateOptions) error

ValidateCreateOpt validates the options for Create.

func (*UserGroupsService) ValidateDeleteOpt

func (s *UserGroupsService) ValidateDeleteOpt(opt *UserGroupsDeleteOptions) error

ValidateDeleteOpt validates the options for Delete.

func (*UserGroupsService) ValidateRemoveUserOpt

func (s *UserGroupsService) ValidateRemoveUserOpt(opt *UserGroupsRemoveUserOptions) error

ValidateRemoveUserOpt validates the options for RemoveUser.

func (*UserGroupsService) ValidateSearchOpt

func (s *UserGroupsService) ValidateSearchOpt(opt *UserGroupsSearchOptions) error

ValidateSearchOpt validates the options for Search.

func (*UserGroupsService) ValidateUpdateOpt

func (s *UserGroupsService) ValidateUpdateOpt(opt *UserGroupsUpdateOptions) error

ValidateUpdateOpt validates the options for Update.

func (*UserGroupsService) ValidateUsersOpt

func (s *UserGroupsService) ValidateUsersOpt(opt *UserGroupsUsersOptions) error

ValidateUsersOpt validates the options for Users.

type UserGroupsUpdateOptions

type UserGroupsUpdateOptions struct {
	// CurrentName is the current name of the group to update (required).
	CurrentName string `url:"currentName,omitempty"`
	// Description is the new optional description for the group.
	// Maximum length: 200 characters.
	Description string `url:"description,omitempty"`
	// Name is the new optional name for the group.
	// Cannot be 'anyone'.
	// Maximum length: 255 characters.
	Name string `url:"name,omitempty"`
}

UserGroupsUpdateOptions represents options for updating a group.

type UserGroupsUser

type UserGroupsUser struct {
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// Managed indicates if the user is managed externally.
	Managed bool `json:"managed,omitempty"`
	// Selected indicates if the user is selected/member of the group.
	Selected bool `json:"selected,omitempty"`
}

UserGroupsUser represents a user within a group.

type UserGroupsUsers

type UserGroupsUsers struct {
	// Users is the list of users.
	Users []UserGroupsUser `json:"users,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
	// Page is the current page number (legacy duplicate of Paging.PageIndex).
	Page int64 `json:"p,omitempty"`
	// PageSize is the page size (legacy duplicate of Paging.PageSize).
	PageSize int64 `json:"ps,omitempty"`
	// Total is the total number of users (legacy duplicate of Paging.Total).
	Total int64 `json:"total,omitempty"`
}

UserGroupsUsers represents the response from listing users in a group.

type UserGroupsUsersOptions

type UserGroupsUsersOptions struct {
	PaginationArgs

	// Name is the group name (required).
	Name string `url:"name,omitempty"`
	// Query limits search to names or logins that contain the supplied string.
	Query string `url:"q,omitempty"`
	// Selected filters by selection status.
	// Possible values: all, deselected, selected.
	Selected string `url:"selected,omitempty"`
}

UserGroupsUsersOptions represents options for listing users in a group.

type UserToken

type UserToken struct {
	// CreatedAt is the creation date of the token.
	CreatedAt string `json:"createdAt,omitempty"`
	// ExpirationDate is the expiration date of the token.
	ExpirationDate string `json:"expirationDate,omitempty"`
	// IsExpired indicates whether the token has expired.
	IsExpired bool `json:"isExpired,omitempty"`
	// Name is the name of the token.
	Name string `json:"name,omitempty"`
	// Project is the project associated with a PROJECT_ANALYSIS_TOKEN.
	Project UserTokenProject `json:"project,omitzero"`
	// Type is the type of the token (USER_TOKEN, GLOBAL_ANALYSIS_TOKEN, PROJECT_ANALYSIS_TOKEN).
	Type string `json:"type,omitempty"`
}

UserToken represents a user access token.

type UserTokenProject

type UserTokenProject struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
}

UserTokenProject represents a project associated with a token.

type UserTokensGenerate

type UserTokensGenerate struct {
	// CreatedAt is the creation date of the token.
	CreatedAt string `json:"createdAt,omitempty"`
	// ExpirationDate is the expiration date of the token.
	ExpirationDate string `json:"expirationDate,omitempty"`
	// Login is the user login.
	Login string `json:"login,omitempty"`
	// Name is the name of the token.
	Name string `json:"name,omitempty"`
	// ProjectKey is the key of the project the token is scoped to.
	ProjectKey string `json:"projectKey,omitempty"`
	// Token is the generated token value (only returned once).
	Token string `json:"token,omitempty"`
	// Type is the type of the token.
	Type string `json:"type,omitempty"`
}

UserTokensGenerate represents the response from generating a token.

type UserTokensGenerateOptions

type UserTokensGenerateOptions struct {
	// ExpirationDate is the expiration date of the token in ISO 8601 format (YYYY-MM-DD).
	// If not set, defaults to no expiration.
	ExpirationDate string `url:"expirationDate,omitempty"`
	// Login is the user login. If not set, the token is generated for the authenticated user.
	Login string `url:"login,omitempty"`
	// Name is the token name.
	// This field is required. Maximum length is 100 characters.
	Name string `url:"name"`
	// ProjectKey is the key of the only project that can be analyzed by the PROJECT_ANALYSIS_TOKEN.
	// Required when Type is set to PROJECT_ANALYSIS_TOKEN.
	ProjectKey string `url:"projectKey,omitempty"`
	// Type is the token type.
	// Allowed values: USER_TOKEN, GLOBAL_ANALYSIS_TOKEN, PROJECT_ANALYSIS_TOKEN.
	// Default: USER_TOKEN.
	// If set to PROJECT_ANALYSIS_TOKEN, ProjectKey must be provided.
	Type string `url:"type,omitempty"`
}

UserTokensGenerateOptions contains parameters for the Generate method.

type UserTokensRevokeOptions

type UserTokensRevokeOptions struct {
	// Login is the user login.
	Login string `url:"login,omitempty"`
	// Name is the token name.
	// This field is required.
	Name string `url:"name"`
}

UserTokensRevokeOptions contains parameters for the Revoke method.

type UserTokensSearch

type UserTokensSearch struct {
	// Login is the user login.
	Login string `json:"login,omitempty"`
	// UserTokens is the list of tokens.
	UserTokens []UserToken `json:"userTokens,omitempty"`
}

UserTokensSearch represents the response from searching tokens.

type UserTokensSearchOptions

type UserTokensSearchOptions struct {
	// Login is the user login.
	Login string `url:"login,omitempty"`
}

UserTokensSearchOptions contains parameters for the Search method.

type UserTokensService

type UserTokensService struct {
	// contains filtered or unexported fields
}

UserTokensService handles communication with the user tokens related methods of the SonarQube API. This service lists, creates, and deletes a user's access tokens.

func (*UserTokensService) Generate

Generate generates a user access token. Please keep your tokens secret. They enable authentication and project analysis. It requires administration permissions to specify a 'login' and generate a token for another user. Otherwise, a token is generated for the current user.

API endpoint: POST /api/user_tokens/generate. Since: 5.3.

func (*UserTokensService) Revoke

Revoke revokes a user access token. It requires administration permissions to specify a 'login' and revoke a token for another user. Otherwise, the token for the current user is revoked.

API endpoint: POST /api/user_tokens/revoke. Since: 5.3.

func (*UserTokensService) Search

Search lists the access tokens of a user. The login must exist and be active. Field 'lastConnectionDate' is only updated every hour, so it may not be accurate. It requires administration permissions to specify a 'login' and list the tokens of another user. Otherwise, tokens for the current user are listed. Authentication is required for this API endpoint.

API endpoint: GET /api/user_tokens/search. Since: 5.3.

func (*UserTokensService) ValidateGenerateOpt

func (s *UserTokensService) ValidateGenerateOpt(opt *UserTokensGenerateOptions) error

ValidateGenerateOpt validates the options for the Generate method.

func (*UserTokensService) ValidateRevokeOpt

func (s *UserTokensService) ValidateRevokeOpt(opt *UserTokensRevokeOptions) error

ValidateRevokeOpt validates the options for the Revoke method.

func (*UserTokensService) ValidateSearchOpt

func (s *UserTokensService) ValidateSearchOpt(opt *UserTokensSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

type UserV2

type UserV2 struct {
	// Active indicates whether the user is active.
	Active bool `json:"active,omitempty"`
	// Avatar is the user's avatar URL.
	Avatar string `json:"avatar,omitempty"`
	// Email is the user's email address.
	Email string `json:"email,omitempty"`
	// ExternalId is the user's external ID in the authentication system.
	ExternalId string `json:"externalId,omitempty"`
	// ExternalLogin is the user's login in the external authentication system.
	ExternalLogin string `json:"externalLogin,omitempty"`
	// ExternalProvider is the user's external identity provider.
	ExternalProvider string `json:"externalProvider,omitempty"`
	// Id is the user's unique identifier.
	Id string `json:"id,omitempty"`
	// Local indicates whether the user is authenticated locally.
	Local bool `json:"local,omitempty"`
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Managed indicates whether the user is managed externally.
	Managed bool `json:"managed,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// ScmAccounts is the list of SCM accounts associated with the user.
	ScmAccounts []string `json:"scmAccounts,omitempty"`
	// SonarLintLastConnectionDate is the user's last SonarLint connection date.
	SonarLintLastConnectionDate string `json:"sonarLintLastConnectionDate,omitempty"`
	// SonarQubeLastConnectionDate is the user's last SonarQube connection date.
	SonarQubeLastConnectionDate string `json:"sonarQubeLastConnectionDate,omitempty"`
}

UserV2 represents a user returned by V2 API endpoints.

type UsersAnonymizeOptions

type UsersAnonymizeOptions struct {
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
}

UsersAnonymizeOptions contains parameters for the Anonymize method.

type UsersChangePasswordOptions

type UsersChangePasswordOptions struct {
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// Password is the new password.
	// This field is required. Must be at least 12 characters.
	Password string `url:"password"`
	// PreviousPassword is the previous password. Required when changing one's own password.
	PreviousPassword string `url:"previousPassword,omitempty"`
}

UsersChangePasswordOptions contains parameters for the ChangePassword method.

type UsersCreate

type UsersCreate struct {
	// User is the created user.
	User User `json:"user,omitzero"`
}

UsersCreate represents the response from creating a user.

type UsersCreateOptions

type UsersCreateOptions struct {
	// Email is the user email address.
	Email string `url:"email,omitempty"`
	// Local specifies if the user should be authenticated from SonarQube server.
	// When true, the user is authenticated locally. When false, user is external.
	// Password should not be set when Local is false.
	Local bool `url:"local,omitempty"`
	// Login is the user login.
	// This field is required. Must be between 2 and 255 characters.
	Login string `url:"login"`
	// Name is the user's display name.
	// This field is required.
	Name string `url:"name"`
	// Password is the user password.
	// Only required when creating a local user.
	Password string `url:"password,omitempty"`
	// ScmAccounts is the list of SCM accounts.
	ScmAccounts []string `url:"scmAccount,omitempty"`
}

UsersCreateOptions contains parameters for the Create method.

type UsersCreateOptionsV2

type UsersCreateOptionsV2 struct {
	// Email is the user's email address.
	Email string `json:"email,omitempty"`
	// Local specifies if the user should be authenticated locally.
	// When false, password should not be set. Default is true.
	Local *bool `json:"local,omitempty"`
	// Login is the user's login.
	// This field is required. Must be between 2 and 100 characters.
	Login string `json:"login"`
	// Name is the user's display name.
	// This field is required. Maximum 200 characters.
	Name string `json:"name"`
	// Password is the user's password. Only required when creating a local user.
	Password string `json:"password,omitempty"`
	// ScmAccounts is the list of SCM accounts.
	ScmAccounts []string `json:"scmAccounts,omitempty"`
}

UsersCreateOptionsV2 contains parameters for creating a user via the V2 API.

type UsersCurrent

type UsersCurrent = UsersCurrentProfile

UsersCurrent represents the response from getting the current user.

type UsersCurrentProfile

type UsersCurrentProfile struct {
	// Avatar is the user's avatar URL.
	Avatar string `json:"avatar,omitempty"`
	// DismissedNotices contains the notices dismissed by the user.
	DismissedNotices UsersDismissedNotices `json:"dismissedNotices,omitzero"`
	// Email is the user's email address.
	Email string `json:"email,omitempty"`
	// ExternalIdentity is the user's external identity.
	ExternalIdentity string `json:"externalIdentity,omitempty"`
	// ExternalProvider is the user's external identity provider.
	ExternalProvider string `json:"externalProvider,omitempty"`
	// Groups is the list of groups the user belongs to.
	Groups []string `json:"groups,omitempty"`
	// Homepage is the user's homepage configuration.
	Homepage UsersHomepage `json:"homepage,omitzero"`
	// ID is the user's unique identifier.
	ID string `json:"id,omitempty"`
	// IsLoggedIn indicates whether the user is currently logged in.
	IsLoggedIn bool `json:"isLoggedIn,omitempty"`
	// Local indicates whether the user is authenticated locally.
	Local bool `json:"local,omitempty"`
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// Permissions contains the user's global permissions.
	Permissions UsersPermissions `json:"permissions,omitzero"`
	// ScmAccounts is the list of SCM accounts associated with the user.
	ScmAccounts []string `json:"scmAccounts,omitempty"`
	// UsingSonarLintConnectedMode indicates whether the user is using SonarLint connected mode.
	UsingSonarLintConnectedMode bool `json:"usingSonarLintConnectedMode,omitempty"`
}

UsersCurrentProfile represents the currently authenticated user.

type UsersDeactivate

type UsersDeactivate struct {
	// User is the deactivated user.
	User UsersDeactivateResult `json:"user,omitzero"`
}

UsersDeactivate represents the response from deactivating a user.

type UsersDeactivateOptions

type UsersDeactivateOptions struct {
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// Anonymize specifies whether to anonymize the user in addition to deactivating.
	Anonymize bool `url:"anonymize,omitempty"`
}

UsersDeactivateOptions contains parameters for the Deactivate method.

type UsersDeactivateOptionsV2

type UsersDeactivateOptionsV2 struct {
	// Id is the user's unique identifier.
	// This field is required.
	Id string `json:"-"`
	// Anonymize specifies whether to anonymize the user in addition to deactivating.
	Anonymize bool `json:"anonymize,omitempty"`
}

UsersDeactivateOptionsV2 contains parameters for the Deactivate method.

type UsersDeactivateResult

type UsersDeactivateResult struct {
	// Active indicates whether the user is active (always false for deactivated users).
	Active bool `json:"active,omitempty"`
	// ExternalIdentity is the user's external identity.
	ExternalIdentity string `json:"externalIdentity,omitempty"`
	// ExternalProvider is the user's external identity provider.
	ExternalProvider string `json:"externalProvider,omitempty"`
	// Groups is the list of groups (empty for deactivated users).
	Groups []any `json:"groups,omitempty"`
	// Local indicates whether the user was authenticated locally.
	Local bool `json:"local,omitempty"`
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// ScmAccounts is the list of SCM accounts (empty for deactivated users).
	ScmAccounts []any `json:"scmAccounts,omitempty"`
}

UsersDeactivateResult represents a deactivated user.

type UsersDismissNoticeOptions

type UsersDismissNoticeOptions struct {
	// Notice is the notice key to dismiss.
	// This field is required.
	// Allowed values: educationPrinciples, sonarlintAd, showDesignAndArchitectureBanner,
	// showNewModesBanner, showSandboxedIssuesIntro, issueCleanCodeGuide,
	// issueNewIssueStatusAndTransitionGuide, showDesignAndArchitectureOptInBanner,
	// overviewZeroNewIssuesSimplification, showDesignAndArchitectureTour, showEnableSca.
	Notice string `url:"notice"`
}

UsersDismissNoticeOptions contains parameters for the DismissNotice method.

type UsersDismissedNotices

type UsersDismissedNotices struct {
	// EducationPrinciples indicates whether the education principles notice was dismissed.
	EducationPrinciples bool `json:"educationPrinciples,omitempty"`
	// IssueCleanCodeGuide indicates whether the issue clean code guide notice was dismissed.
	IssueCleanCodeGuide bool `json:"issueCleanCodeGuide,omitempty"`
	// IssueNewIssueStatusAndTransitionGuide indicates whether the issue new status and transition guide notice was dismissed.
	IssueNewIssueStatusAndTransitionGuide bool `json:"issueNewIssueStatusAndTransitionGuide,omitempty"`
	// OverviewZeroNewIssuesSimplification indicates whether the overview zero new issues simplification notice was dismissed.
	OverviewZeroNewIssuesSimplification bool `json:"overviewZeroNewIssuesSimplification,omitempty"`
	// ShowDesignAndArchitectureBanner indicates whether the design and architecture banner notice was dismissed.
	ShowDesignAndArchitectureBanner bool `json:"showDesignAndArchitectureBanner,omitempty"`
	// ShowDesignAndArchitectureOptInBanner indicates whether the design and architecture opt-in banner notice was dismissed.
	ShowDesignAndArchitectureOptInBanner bool `json:"showDesignAndArchitectureOptInBanner,omitempty"`
	// ShowDesignAndArchitectureTour indicates whether the design and architecture tour notice was dismissed.
	ShowDesignAndArchitectureTour bool `json:"showDesignAndArchitectureTour,omitempty"`
	// ShowEnableSca indicates whether the enable SCA notice was dismissed.
	ShowEnableSca bool `json:"showEnableSca,omitempty"`
	// ShowNewModesBanner indicates whether the new modes banner notice was dismissed.
	ShowNewModesBanner bool `json:"showNewModesBanner,omitempty"`
	// ShowSandboxedIssuesIntro indicates whether the sandboxed issues intro notice was dismissed.
	ShowSandboxedIssuesIntro bool `json:"showSandboxedIssuesIntro,omitempty"`
	// SonarlintAd indicates whether the SonarLint ad notice was dismissed.
	SonarlintAd bool `json:"sonarlintAd,omitempty"`
}

UsersDismissedNotices represents the notices dismissed by a user.

type UsersGroup

type UsersGroup struct {
	// Default indicates whether this is a default group.
	Default bool `json:"default,omitempty"`
	// Description is the group description.
	Description string `json:"description,omitempty"`
	// ID is the group's unique identifier.
	ID string `json:"id,omitempty"`
	// Name is the group name.
	Name string `json:"name,omitempty"`
	// Selected indicates whether the user is a member of this group.
	Selected bool `json:"selected,omitempty"`
}

UsersGroup represents a group that a user belongs to.

type UsersGroups

type UsersGroups struct {
	// Groups is the list of groups.
	Groups []UsersGroup `json:"groups,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

UsersGroups represents the response from listing a user's groups.

type UsersGroupsOptions

type UsersGroupsOptions struct {
	PaginationArgs

	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// Query is a limit search to group names that contain the supplied string.
	Query string `url:"q,omitempty"`
	// Selected filters the selection status.
	// Allowed values: all, selected, deselected.
	Selected string `url:"selected,omitempty"`
}

UsersGroupsOptions contains parameters for the Groups method.

type UsersHomepage

type UsersHomepage struct {
	// Component is the project key for project homepages.
	Component string `json:"component,omitempty"`
	// Type is the homepage type.
	Type string `json:"type,omitempty"`
}

UsersHomepage represents a user's homepage configuration.

type UsersIdentityProvider

type UsersIdentityProvider struct {
	// BackgroundColor is the background color for the provider icon.
	BackgroundColor string `json:"backgroundColor,omitempty"`
	// HelpMessage is a help message for the identity provider.
	HelpMessage string `json:"helpMessage,omitempty"`
	// IconPath is the path to the provider icon.
	IconPath string `json:"iconPath,omitempty"`
	// Key is the unique key of the identity provider.
	Key string `json:"key,omitempty"`
	// Name is the display name of the identity provider.
	Name string `json:"name,omitempty"`
}

UsersIdentityProvider represents an external identity provider.

type UsersIdentityProviders

type UsersIdentityProviders struct {
	// IdentityProviders is the list of identity providers.
	IdentityProviders []UsersIdentityProvider `json:"identityProviders,omitempty"`
}

UsersIdentityProviders represents the response from listing identity providers.

type UsersManagementService

type UsersManagementService struct {
	// contains filtered or unexported fields
}

UsersManagementService handles communication with the Users Management related methods of the SonarQube V2 API.

func (*UsersManagementService) Create

Create creates a new user. If a deactivated user account exists with the given login, it will be reactivated. Requires Administer System permission.

func (*UsersManagementService) Deactivate

Deactivate deactivates a user. Requires Administer System permission.

func (*UsersManagementService) Get

Get retrieves a single user by ID.

func (*UsersManagementService) Search

Search returns a list of users matching the search criteria. By default, only active users are returned.

func (*UsersManagementService) Update

Update updates a user's attributes.

func (*UsersManagementService) ValidateCreateRequest

func (s *UsersManagementService) ValidateCreateRequest(opt *UsersCreateOptionsV2) error

ValidateCreateRequest validates the UsersCreateOptionsV2.

func (*UsersManagementService) ValidateDeactivateOpt

func (s *UsersManagementService) ValidateDeactivateOpt(opt *UsersDeactivateOptionsV2) error

ValidateDeactivateOpt validates the UsersDeactivateOptionsV2.

func (*UsersManagementService) ValidateSearchOpt

func (s *UsersManagementService) ValidateSearchOpt(opt *UsersSearchOptionV2) error

ValidateSearchOpt validates the UsersSearchOptionV2.

func (*UsersManagementService) ValidateUpdateRequest

func (s *UsersManagementService) ValidateUpdateRequest(userID string, opt *UsersUpdateOptionsV2) error

ValidateUpdateRequest validates the UsersUpdateOptionsV2.

type UsersPermissions

type UsersPermissions struct {
	// Global is the list of global permissions.
	Global []string `json:"global,omitempty"`
}

UsersPermissions represents a user's global permissions.

type UsersSearch

type UsersSearch struct {
	// Users is the list of users.
	Users []UsersSearchResult `json:"users,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

UsersSearch represents the response from searching users.

type UsersSearchOptionV2

type UsersSearchOptionV2 struct {
	PaginationParamsV2

	// Active filters active/inactive users. Default is true.
	Active *bool `json:"active,omitempty"`
	// ExternalIdentity filters by external identity (case-sensitive exact match).
	ExternalIdentity string `json:"externalIdentity,omitempty"`
	// GroupId filters users belonging to a group. Only available for system administrators.
	// Internal: this parameter is marked as internal in the SonarQube API.
	GroupId string `json:"groupId,omitempty"`
	// Managed filters managed or non-managed users.
	Managed *bool `json:"managed,omitempty"`
	// Query filters on login, name and email (partial match, case insensitive).
	Query string `json:"q,omitempty"`
	// SonarLintLastConnectionDateFrom filters users who connected via SonarLint at or after this date (ISO 8601).
	SonarLintLastConnectionDateFrom string `json:"sonarLintLastConnectionDateFrom,omitempty"`
	// SonarLintLastConnectionDateTo filters users who connected via SonarLint at or before this date (ISO 8601).
	SonarLintLastConnectionDateTo string `json:"sonarLintLastConnectionDateTo,omitempty"`
	// SonarQubeLastConnectionDateFrom filters users who connected at or after this date (ISO 8601).
	SonarQubeLastConnectionDateFrom string `json:"sonarQubeLastConnectionDateFrom,omitempty"`
	// SonarQubeLastConnectionDateTo filters users who connected at or before this date (ISO 8601).
	SonarQubeLastConnectionDateTo string `json:"sonarQubeLastConnectionDateTo,omitempty"`
}

UsersSearchOptionV2 contains query parameters for the Search method.

type UsersSearchOptions

type UsersSearchOptions struct {
	PaginationArgs

	// Deactivated returns deactivated users instead of active users when true.
	Deactivated bool `url:"deactivated,omitempty"`
	// ExternalIdentity finds a user by their external identity (case-sensitive).
	// Only available with Administer System permission.
	ExternalIdentity string `url:"externalIdentity,omitempty"`
	// LastConnectedAfter filters users who connected at or after this date.
	// Format: ISO 8601 datetime (YYYY-MM-DDThh:mm:ss±hhmm).
	LastConnectedAfter string `url:"lastConnectedAfter,omitempty"`
	// LastConnectedBefore filters users who never connected or connected at or before this date.
	// Format: ISO 8601 datetime (YYYY-MM-DDThh:mm:ss±hhmm).
	LastConnectedBefore string `url:"lastConnectedBefore,omitempty"`
	// Managed returns managed or non-managed users.
	// Only available for managed instances.
	Managed bool `url:"managed,omitempty"`
	// Query filters on login, name and email (partial match, case insensitive).
	Query string `url:"q,omitempty"`
	// SlLastConnectedAfter filters users who connected via SonarLint at or after this date.
	// Format: ISO 8601 datetime (YYYY-MM-DDThh:mm:ss±hhmm).
	SlLastConnectedAfter string `url:"slLastConnectedAfter,omitempty"`
	// SlLastConnectedBefore filters users who never connected or connected via SonarLint at or before this date.
	// Format: ISO 8601 datetime (YYYY-MM-DDThh:mm:ss±hhmm).
	SlLastConnectedBefore string `url:"slLastConnectedBefore,omitempty"`
}

UsersSearchOptions contains parameters for the Search method.

type UsersSearchResult

type UsersSearchResult struct {
	// Active indicates whether the user is active.
	Active bool `json:"active,omitempty"`
	// Avatar is the user's avatar URL.
	Avatar string `json:"avatar,omitempty"`
	// Email is the user's email address.
	Email string `json:"email,omitempty"`
	// ExternalIdentity is the user's external identity.
	ExternalIdentity string `json:"externalIdentity,omitempty"`
	// ExternalProvider is the user's external identity provider.
	ExternalProvider string `json:"externalProvider,omitempty"`
	// Groups is the list of groups the user belongs to.
	Groups []string `json:"groups,omitempty"`
	// LastConnectionDate is the user's last connection date.
	LastConnectionDate string `json:"lastConnectionDate,omitempty"`
	// Local indicates whether the user is authenticated locally.
	Local bool `json:"local,omitempty"`
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Managed indicates whether the user is managed externally.
	Managed bool `json:"managed,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// ScmAccounts is the list of SCM accounts associated with the user.
	ScmAccounts []string `json:"scmAccounts,omitempty"`
	// SonarLintLastConnectionDate is the user's last SonarLint connection date.
	SonarLintLastConnectionDate string `json:"sonarLintLastConnectionDate,omitempty"`
	// TokensCount is the number of tokens owned by the user.
	TokensCount int64 `json:"tokensCount,omitempty"`
}

UsersSearchResult represents a user returned in search results.

type UsersSearchV2

type UsersSearchV2 struct {
	// Page contains pagination information.
	Page PageResponseV2 `json:"page,omitzero"`
	// Users is the list of users.
	Users []UserV2 `json:"users,omitempty"`
}

UsersSearchV2 represents the response from searching users via the V2 API.

type UsersService

type UsersService struct {
	// contains filtered or unexported fields
}

UsersService handles communication with the user management related methods of the SonarQube API. This service manages users, passwords, groups, and identity providers.

func (*UsersService) Anonymize deprecated

func (s *UsersService) Anonymize(ctx context.Context, opt *UsersAnonymizeOptions) (*http.Response, error)

Anonymize anonymizes a deactivated user. Requires Administer System permission.

Deprecated: Since SonarQube 10.4. API endpoint: POST /api/users/anonymize. Since: 9.7.

func (*UsersService) ChangePassword

func (s *UsersService) ChangePassword(ctx context.Context, opt *UsersChangePasswordOptions) (*http.Response, error)

ChangePassword updates a user's password. Authenticated users can change their own password, provided that the account is not linked to an external authentication system. Administer System permission is required to change another user's password.

API endpoint: POST /api/users/change_password. Since: 5.2.

func (*UsersService) Create deprecated

Create creates a user. If a deactivated user account exists with the given login, it will be reactivated. Requires Administer System permission.

Deprecated: Since SonarQube 10.4. API endpoint: POST /api/users/create. Since: 3.7.

func (*UsersService) Current

func (s *UsersService) Current(ctx context.Context) (*UsersCurrent, *http.Response, error)

Current gets the details of the current authenticated user.

API endpoint: GET /api/users/current. Since: 5.2.

func (*UsersService) Deactivate deprecated

Deactivate deactivates a user. Requires Administer System permission.

Deprecated: Since SonarQube 10.4. API endpoint: POST /api/users/deactivate. Since: 3.7.

func (*UsersService) DismissNotice

func (s *UsersService) DismissNotice(ctx context.Context, opt *UsersDismissNoticeOptions) (*http.Response, error)

DismissNotice dismisses a notice for the current user. Silently ignores if the notice is already dismissed.

API endpoint: POST /api/users/dismiss_notice. Since: 9.6.

func (*UsersService) Groups deprecated

Groups lists the groups a user belongs to. Requires Administer System permission.

Deprecated: Since SonarQube 10.4. API endpoint: GET /api/users/groups. Since: 5.2.

func (*UsersService) GroupsAll

GroupsAll fetches all pages from Groups and returns a flat slice of user groups.

func (*UsersService) IdentityProviders

func (s *UsersService) IdentityProviders(ctx context.Context) (*UsersIdentityProviders, *http.Response, error)

IdentityProviders lists the external identity providers.

API endpoint: GET /api/users/identity_providers. Since: 5.5.

func (*UsersService) Search deprecated

Search searches for users. By default, only active users are returned. The following fields are only returned when the user has Administer System permission or for the logged-in user: email, externalIdentity, externalProvider, groups, lastConnectionDate, sonarLintLastConnectionDate, tokensCount. Field 'lastConnectionDate' is only updated every hour, so it may not be accurate.

Deprecated: Since SonarQube 10.4. API endpoint: GET /api/users/search. Since: 3.6.

func (*UsersService) SearchAll

SearchAll fetches all pages from Search and returns a flat slice of users.

func (*UsersService) SetAiToolUsage deprecated added in v2.2.0

func (s *UsersService) SetAiToolUsage(ctx context.Context, opt *UsersSetAiToolUsageOptions) (*http.Response, error)

SetAiToolUsage indicates whether the current user utilizes any tool that generates AI code for a given project. Requires Browse permission on the specified project.

Deprecated: Since SonarQube 2026.1. API endpoint: POST /api/users/set_ai_tool_usage. Since: 2025.1. Enterprise Edition only.

func (*UsersService) SetHomepage

func (s *UsersService) SetHomepage(ctx context.Context, opt *UsersSetHomepageOptions) (*http.Response, error)

SetHomepage sets the homepage of the current user. Requires authentication.

API endpoint: POST /api/users/set_homepage. Since: 7.0.

func (*UsersService) Update deprecated

Update updates a user. Requires Administer System permission.

Deprecated: Since SonarQube 10.4. API endpoint: POST /api/users/update. Since: 3.7.

func (*UsersService) UpdateIdentityProvider deprecated

func (s *UsersService) UpdateIdentityProvider(ctx context.Context, opt *UsersUpdateIdentityProviderOptions) (*http.Response, error)

UpdateIdentityProvider updates the identity provider information for a user. It's only possible to migrate to an installed identity provider. Once updated, the user will only be able to authenticate on the new identity provider. It is not possible to migrate an external user to a local one. Requires Administer System permission.

Deprecated: Since SonarQube 10.4. API endpoint: POST /api/users/update_identity_provider. Since: 8.7.

func (*UsersService) UpdateLogin deprecated

func (s *UsersService) UpdateLogin(ctx context.Context, opt *UsersUpdateLoginOptions) (*http.Response, error)

UpdateLogin updates a user login. A login can be updated many times. Requires Administer System permission.

Deprecated: Since SonarQube 10.4. API endpoint: POST /api/users/update_login. Since: 7.6.

func (*UsersService) ValidateAnonymizeOpt

func (s *UsersService) ValidateAnonymizeOpt(opt *UsersAnonymizeOptions) error

ValidateAnonymizeOpt validates the options for the Anonymize method.

func (*UsersService) ValidateChangePasswordOpt

func (s *UsersService) ValidateChangePasswordOpt(opt *UsersChangePasswordOptions) error

ValidateChangePasswordOpt validates the options for the ChangePassword method.

func (*UsersService) ValidateCreateOpt

func (s *UsersService) ValidateCreateOpt(opt *UsersCreateOptions) error

ValidateCreateOpt validates the options for the Create method.

func (*UsersService) ValidateDeactivateOpt

func (s *UsersService) ValidateDeactivateOpt(opt *UsersDeactivateOptions) error

ValidateDeactivateOpt validates the options for the Deactivate method.

func (*UsersService) ValidateDismissNoticeOpt

func (s *UsersService) ValidateDismissNoticeOpt(opt *UsersDismissNoticeOptions) error

ValidateDismissNoticeOpt validates the options for the DismissNotice method.

func (*UsersService) ValidateGroupsOpt

func (s *UsersService) ValidateGroupsOpt(opt *UsersGroupsOptions) error

ValidateGroupsOpt validates the options for the Groups method.

func (*UsersService) ValidateSearchOpt

func (s *UsersService) ValidateSearchOpt(opt *UsersSearchOptions) error

ValidateSearchOpt validates the options for the Search method.

func (*UsersService) ValidateSetAiToolUsageOpt added in v2.2.0

func (s *UsersService) ValidateSetAiToolUsageOpt(opt *UsersSetAiToolUsageOptions) error

ValidateSetAiToolUsageOpt validates the options for the SetAiToolUsage method.

func (*UsersService) ValidateSetHomepageOpt

func (s *UsersService) ValidateSetHomepageOpt(opt *UsersSetHomepageOptions) error

ValidateSetHomepageOpt validates the options for the SetHomepage method.

func (*UsersService) ValidateUpdateIdentityProviderOpt

func (s *UsersService) ValidateUpdateIdentityProviderOpt(opt *UsersUpdateIdentityProviderOptions) error

ValidateUpdateIdentityProviderOpt validates the options for the UpdateIdentityProvider method.

func (*UsersService) ValidateUpdateLoginOpt

func (s *UsersService) ValidateUpdateLoginOpt(opt *UsersUpdateLoginOptions) error

ValidateUpdateLoginOpt validates the options for the UpdateLogin method.

func (*UsersService) ValidateUpdateOpt

func (s *UsersService) ValidateUpdateOpt(opt *UsersUpdateOptions) error

ValidateUpdateOpt validates the options for the Update method.

type UsersSetAiToolUsageOptions added in v2.2.0

type UsersSetAiToolUsageOptions struct {
	// Project is the project key.
	// This field is required.
	Project string `url:"project"`
}

UsersSetAiToolUsageOptions contains parameters for the SetAiToolUsage method.

type UsersSetHomepageOptions

type UsersSetHomepageOptions struct {
	// Branch is the branch key. Only used when Type is PROJECT.
	Branch string `url:"branch,omitempty"`
	// Component is the project key. Only used when Type is PROJECT.
	Component string `url:"component,omitempty"`
	// Type is the type of the requested homepage.
	// This field is required.
	// Allowed values: PROJECT, PROJECTS, ISSUES, PORTFOLIOS, PORTFOLIO, APPLICATION.
	Type string `url:"type"`
}

UsersSetHomepageOptions contains parameters for the SetHomepage method.

type UsersUpdate

type UsersUpdate struct {
	// User is the updated user.
	User User `json:"user,omitzero"`
}

UsersUpdate represents the response from updating a user.

type UsersUpdateIdentityProviderOptions

type UsersUpdateIdentityProviderOptions struct {
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// NewExternalIdentity is the new external identity.
	// If not provided, the previous identity will be used.
	NewExternalIdentity string `url:"newExternalIdentity,omitempty"`
	// NewExternalProvider is the new external provider key.
	// This field is required.
	NewExternalProvider string `url:"newExternalProvider"`
}

UsersUpdateIdentityProviderOptions contains parameters for the UpdateIdentityProvider method.

type UsersUpdateLoginOptions

type UsersUpdateLoginOptions struct {
	// Login is the current login (case-sensitive).
	// This field is required.
	Login string `url:"login"`
	// NewLogin is the new login.
	// This field is required. Must be between 2 and 255 characters.
	NewLogin string `url:"newLogin"`
}

UsersUpdateLoginOptions contains parameters for the UpdateLogin method.

type UsersUpdateOptions

type UsersUpdateOptions struct {
	// Email is the user's new email address.
	Email string `url:"email,omitempty"`
	// Login is the user login.
	// This field is required.
	Login string `url:"login"`
	// Name is the user's new display name.
	Name string `url:"name,omitempty"`
	// ScmAccounts is the list of SCM accounts.
	ScmAccounts []string `url:"scmAccount,omitempty"`
}

UsersUpdateOptions contains parameters for the Update method.

type UsersUpdateOptionsV2

type UsersUpdateOptionsV2 struct {
	// Email is the user's email address.
	Email string `json:"email,omitempty"`
	// ExternalId is the new external ID in the authentication system.
	ExternalId string `json:"externalId,omitempty"`
	// ExternalLogin is the new external login.
	ExternalLogin string `json:"externalLogin,omitempty"`
	// ExternalProvider is the new identity provider.
	ExternalProvider string `json:"externalProvider,omitempty"`
	// Login is the user's login.
	Login string `json:"login,omitempty"`
	// Name is the user's display name.
	Name string `json:"name,omitempty"`
	// ScmAccounts is the list of SCM accounts.
	ScmAccounts *UpdateFieldListStringV2 `json:"scmAccounts,omitempty"`
}

UsersUpdateOptionsV2 contains parameters for updating a user via the V2 API. All fields are optional (PATCH merge semantics).

type ValidationError

type ValidationError struct {
	Err     error
	Field   string
	Message string
}

ValidationError represents a validation error with context about which field failed.

func NewValidationError

func NewValidationError(field, message string, err error) *ValidationError

NewValidationError creates a new ValidationError.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error returns the formatted error message.

func (*ValidationError) Unwrap

func (e *ValidationError) Unwrap() error

Unwrap returns the wrapped error.

type View

type View struct {
	// Description is the portfolio description.
	//
	// Live-verified: the real API field is "desc", not "description".
	Description string `json:"desc,omitempty"`
	// IsFavorite indicates whether the portfolio is marked as favorite by the current user.
	IsFavorite bool `json:"isFavorite,omitempty"`
	// Key is the portfolio key. When this View represents a sub-portfolio
	// nested under a parent (e.g. within ViewDetails.SubViews), this is a
	// composite "<parent>:<child>" key, not the sub-portfolio's own key -
	// use OriginalKey for that.
	Key string `json:"key,omitempty"`
	// OriginalKey is the sub-portfolio's own key, without the parent-key
	// prefix that Key carries in a nested context. Only populated when this
	// View represents a sub-portfolio.
	OriginalKey string `json:"originalKey,omitempty"`
	// Name is the portfolio name.
	Name string `json:"name,omitempty"`
	// Qualifier is the qualifier of the component (VW for portfolio, SVW for sub-portfolio).
	Qualifier string `json:"qualifier,omitempty"`
	// Visibility is the visibility of the portfolio (public or private).
	Visibility string `json:"visibility,omitempty"`
}

View represents a SonarQube portfolio/view.

type ViewApplication

type ViewApplication struct {
	// Key is the application key.
	Key string `json:"key,omitempty"`
	// Name is the application name.
	Name string `json:"name,omitempty"`
}

ViewApplication represents an application entry in a portfolio.

type ViewDestination

type ViewDestination struct {
	// Key is the destination portfolio key.
	Key string `json:"key,omitempty"`
	// Name is the destination portfolio name.
	Name string `json:"name,omitempty"`
}

ViewDestination represents a possible destination for moving a portfolio.

type ViewDetails

type ViewDetails struct {
	// Description is the portfolio description.
	//
	// Live-verified: the real API field is "desc", not "description".
	Description string `json:"desc,omitempty"`
	// Key is the portfolio key.
	Key string `json:"key,omitempty"`
	// Name is the portfolio name.
	Name string `json:"name,omitempty"`
	// Qualifier is the qualifier (VW or SVW).
	Qualifier string `json:"qualifier,omitempty"`
	// Visibility is the visibility (public or private).
	Visibility string `json:"visibility,omitempty"`
	// SelectionMode describes how projects are selected for the portfolio.
	SelectionMode string `json:"selectionMode,omitempty"`
	// SubViews is the list of sub-portfolios.
	SubViews []View `json:"subViews,omitempty"`
}

ViewDetails is an extended portfolio with sub-portfolios and selection modes.

type ViewProject

type ViewProject struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
	// BranchKey lists the branch keys selected for the project, if any.
	BranchKey []string `json:"branchKey,omitempty"`
	// Selected indicates whether the project is selected in the portfolio.
	Selected bool `json:"selected,omitempty"`
	// Enabled indicates whether the project is enabled in the portfolio.
	Enabled bool `json:"enabled,omitempty"`
	// Accessible indicates whether the current user can access the project.
	Accessible bool `json:"accessible,omitempty"`
}

ViewProject represents a project entry in a portfolio.

type ViewProjectStatus

type ViewProjectStatus struct {
	// Key is the project key.
	Key string `json:"key,omitempty"`
	// Name is the project name.
	Name string `json:"name,omitempty"`
	// Status is the quality gate status of the project.
	Status string `json:"status,omitempty"`
	// BranchKey is the branch key used for the analysis.
	BranchKey string `json:"branchKey,omitempty"`
}

ViewProjectStatus represents a project with its quality gate status in a portfolio.

type ViewsAddApplicationBranchOptions

type ViewsAddApplicationBranchOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Branch is the branch key. This field is required.
	Branch string `url:"branch"`
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
}

ViewsAddApplicationBranchOptions contains parameters for the AddApplicationBranch method.

type ViewsAddApplicationOptions

type ViewsAddApplicationOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
}

ViewsAddApplicationOptions contains parameters for the AddApplication method.

type ViewsAddPortfolioOptions

type ViewsAddPortfolioOptions struct {
	// Portfolio is the parent portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
	// Reference is the key of the portfolio to add as a sub-portfolio. This field is required.
	Reference string `url:"reference"`
}

ViewsAddPortfolioOptions contains parameters for the AddPortfolio method (adding a reference portfolio as a sub-portfolio).

type ViewsAddProjectBranchOptions

type ViewsAddProjectBranchOptions struct {
	// Branch is the branch key. This field is required.
	Branch string `url:"branch"`
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
	// Project is the project key. This field is required.
	Project string `url:"project"`
}

ViewsAddProjectBranchOptions contains parameters for the AddProjectBranch method.

type ViewsAddProjectOptions

type ViewsAddProjectOptions struct {
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
	// Project is the project key. This field is required.
	Project string `url:"project"`
}

ViewsAddProjectOptions contains parameters for the AddProject method.

type ViewsApplications

type ViewsApplications struct {
	// Applications is the list of applications in the portfolio.
	Applications []ViewApplication `json:"applications,omitempty"`
}

ViewsApplications represents the response from the applications endpoint.

type ViewsApplicationsOptions

type ViewsApplicationsOptions struct {
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
}

ViewsApplicationsOptions contains parameters for the Applications method.

type ViewsCreateOptions

type ViewsCreateOptions struct {
	// Description is an optional portfolio description.
	Description string `url:"description,omitempty"`
	// Key is the portfolio key. If not provided, it will be generated from the name.
	Key string `url:"key,omitempty"`
	// Name is the portfolio name. This field is required.
	Name string `url:"name"`
	// Parent is the key of the parent portfolio, when creating a sub-portfolio.
	Parent string `url:"parent,omitempty"`
	// Visibility is the portfolio visibility (public or private).
	Visibility string `url:"visibility,omitempty"`
}

ViewsCreateOptions contains parameters for the Create method.

type ViewsDeleteOptions

type ViewsDeleteOptions struct {
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
}

ViewsDeleteOptions contains parameters for the Delete method.

type ViewsList

type ViewsList struct {
	// Views is the list of root portfolios.
	Views []View `json:"views,omitempty"`
}

ViewsList represents the response from the list endpoint.

type ViewsMoveDestinations

type ViewsMoveDestinations struct {
	// Views is the list of possible destination portfolios.
	Views []ViewDestination `json:"views,omitempty"`
}

ViewsMoveDestinations represents the response from the move_options endpoint.

type ViewsMoveOptions

type ViewsMoveOptions struct {
	// Destination is the key of the destination (new parent) portfolio. This field is required.
	Destination string `url:"destination"`
	// Key is the portfolio key to move. This field is required.
	Key string `url:"key"`
}

ViewsMoveOptions contains parameters for the Move method.

type ViewsMoveOptionsOptions

type ViewsMoveOptionsOptions struct {
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
}

ViewsMoveOptionsOptions contains parameters for the MoveOptions method.

type ViewsProjects

type ViewsProjects struct {
	// Projects is the list of projects in the portfolio.
	//
	// Live-verified: unlike most list endpoints in this SDK, the real
	// response wraps this list in a "results" field, not "projects".
	Projects []ViewProject `json:"results,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

ViewsProjects represents the response from the projects endpoint.

type ViewsProjectsOptions

type ViewsProjectsOptions struct {
	PaginationArgs

	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
	// Query limits results to projects whose key contains this value.
	Query string `url:"query,omitempty"`
	// Selected filters on selected, deselected or all projects.
	Selected string `url:"selected,omitempty"`
}

ViewsProjectsOptions contains parameters for the Projects method.

type ViewsProjectsStatus

type ViewsProjectsStatus struct {
	// Projects is the list of projects with their quality gate status.
	Projects []ViewProjectStatus `json:"projects,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

ViewsProjectsStatus represents the response from the projects_status endpoint.

type ViewsProjectsStatusOptions

type ViewsProjectsStatusOptions struct {
	PaginationArgs

	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
	// Status filters projects by quality gate status.
	Status string `url:"status,omitempty"`
}

ViewsProjectsStatusOptions contains parameters for the ProjectsStatus method.

type ViewsRefreshOptions

type ViewsRefreshOptions struct {
	// Key is the root portfolio key. If not specified, all portfolios are refreshed.
	Key string `url:"key,omitempty"`
}

ViewsRefreshOptions contains parameters for the Refresh method.

type ViewsRemoveApplicationBranchOptions

type ViewsRemoveApplicationBranchOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Branch is the branch key. This field is required.
	Branch string `url:"branch"`
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
}

ViewsRemoveApplicationBranchOptions contains parameters for the RemoveApplicationBranch method.

type ViewsRemoveApplicationOptions

type ViewsRemoveApplicationOptions struct {
	// Application is the application key. This field is required.
	Application string `url:"application"`
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
}

ViewsRemoveApplicationOptions contains parameters for the RemoveApplication method.

type ViewsRemovePortfolioOptions

type ViewsRemovePortfolioOptions struct {
	// Portfolio is the parent portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
	// Reference is the key of the sub-portfolio to remove. This field is required.
	Reference string `url:"reference"`
}

ViewsRemovePortfolioOptions contains parameters for the RemovePortfolio method.

type ViewsRemoveProjectBranchOptions

type ViewsRemoveProjectBranchOptions struct {
	// Branch is the branch key. This field is required.
	Branch string `url:"branch"`
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
	// Project is the project key. This field is required.
	Project string `url:"project"`
}

ViewsRemoveProjectBranchOptions contains parameters for the RemoveProjectBranch method.

type ViewsRemoveProjectOptions

type ViewsRemoveProjectOptions struct {
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
	// Project is the project key. This field is required.
	Project string `url:"project"`
}

ViewsRemoveProjectOptions contains parameters for the RemoveProject method.

type ViewsSearch

type ViewsSearch struct {
	// Components is the list of portfolios matching the search.
	Components []View `json:"components,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

ViewsSearch represents the response from the search endpoint.

type ViewsSearchOptions

type ViewsSearchOptions struct {
	PaginationArgs

	// Query limits search to portfolios whose name or key contains this value.
	Query string `url:"q,omitempty"`
	// Qualifiers filters by component qualifier (VW for portfolio, SVW for sub-portfolio).
	Qualifiers string `url:"qualifiers,omitempty"`
	// OnlyFavorites if true restricts results to favorite portfolios only.
	OnlyFavorites bool `url:"onlyFavorites,omitempty"`
}

ViewsSearchOptions contains parameters for the Search method.

type ViewsService

type ViewsService struct {
	// contains filtered or unexported fields
}

ViewsService handles communication with the portfolio related methods of the SonarQube API. This service is only available in Enterprise Edition.

func (*ViewsService) AddApplication

func (s *ViewsService) AddApplication(ctx context.Context, opt *ViewsAddApplicationOptions) (*http.Response, error)

AddApplication adds an application to a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/add_application. Since: 7.1. Enterprise Edition only.

func (*ViewsService) AddApplicationBranch

func (s *ViewsService) AddApplicationBranch(ctx context.Context, opt *ViewsAddApplicationBranchOptions) (*http.Response, error)

AddApplicationBranch adds a specific application branch to a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/add_application_branch. Since: 7.1. Enterprise Edition only.

func (*ViewsService) AddPortfolio

func (s *ViewsService) AddPortfolio(ctx context.Context, opt *ViewsAddPortfolioOptions) (*http.Response, error)

AddPortfolio adds an existing portfolio as a sub-portfolio (reference) to a parent portfolio. Requires 'Administer' permission on the parent portfolio.

API endpoint: POST /api/views/add_portfolio. Since: 6.6. Enterprise Edition only.

func (*ViewsService) AddProject

func (s *ViewsService) AddProject(ctx context.Context, opt *ViewsAddProjectOptions) (*http.Response, error)

AddProject adds a project to a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/add_project. Since: 6.6. Enterprise Edition only.

func (*ViewsService) AddProjectBranch

func (s *ViewsService) AddProjectBranch(ctx context.Context, opt *ViewsAddProjectBranchOptions) (*http.Response, error)

AddProjectBranch adds a specific project branch to a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/add_project_branch. Since: 7.1. Enterprise Edition only.

func (*ViewsService) Applications

Applications returns the applications in a portfolio. Requires 'Browse' permission on the portfolio.

API endpoint: GET /api/views/applications. Since: 7.1. Enterprise Edition only.

func (*ViewsService) Create

Create creates a new root portfolio or sub-portfolio. Requires 'Administer System' permission (root) or 'Administer' permission on the parent.

API endpoint: POST /api/views/create. Since: 6.6. Enterprise Edition only.

func (*ViewsService) Delete

Delete deletes a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/delete. Since: 6.6. Enterprise Edition only.

func (*ViewsService) List

List returns the list of root portfolios. Requires authentication.

API endpoint: GET /api/views/list. Since: 6.6. Enterprise Edition only.

func (*ViewsService) Move

Move moves a portfolio to a new parent portfolio. Requires 'Administer' permission on both portfolios.

API endpoint: POST /api/views/move. Since: 6.6. Enterprise Edition only.

func (*ViewsService) MoveOptions

MoveOptions returns the list of possible destination portfolios for a move operation. Requires 'Administer' permission on the portfolio.

API endpoint: GET /api/views/move_options. Since: 6.6. Enterprise Edition only.

func (*ViewsService) Projects

Projects lists the projects in a portfolio. Requires 'Browse' permission on the portfolio.

API endpoint: GET /api/views/projects. Since: 6.6. Enterprise Edition only.

func (*ViewsService) ProjectsStatus

ProjectsStatus returns the quality gate status of projects in a portfolio. Requires 'Browse' permission on the portfolio.

API endpoint: GET /api/views/projects_status. Since: 6.6. Enterprise Edition only.

func (*ViewsService) Refresh

Refresh triggers a computation of portfolio measures. If no key is provided, all portfolios are refreshed. Requires 'Administer System' permission.

API endpoint: POST /api/views/refresh. Since: 6.6. Enterprise Edition only.

func (*ViewsService) RemoveApplication

func (s *ViewsService) RemoveApplication(ctx context.Context, opt *ViewsRemoveApplicationOptions) (*http.Response, error)

RemoveApplication removes an application from a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/remove_application. Since: 7.1. Enterprise Edition only.

func (*ViewsService) RemoveApplicationBranch

func (s *ViewsService) RemoveApplicationBranch(ctx context.Context, opt *ViewsRemoveApplicationBranchOptions) (*http.Response, error)

RemoveApplicationBranch removes a specific application branch from a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/remove_application_branch. Since: 7.1. Enterprise Edition only.

func (*ViewsService) RemovePortfolio

func (s *ViewsService) RemovePortfolio(ctx context.Context, opt *ViewsRemovePortfolioOptions) (*http.Response, error)

RemovePortfolio removes a sub-portfolio from a parent portfolio. Requires 'Administer' permission on the parent portfolio.

API endpoint: POST /api/views/remove_portfolio. Since: 6.6. Enterprise Edition only.

func (*ViewsService) RemoveProject

func (s *ViewsService) RemoveProject(ctx context.Context, opt *ViewsRemoveProjectOptions) (*http.Response, error)

RemoveProject removes a project from a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/remove_project. Since: 6.6. Enterprise Edition only.

func (*ViewsService) RemoveProjectBranch

func (s *ViewsService) RemoveProjectBranch(ctx context.Context, opt *ViewsRemoveProjectBranchOptions) (*http.Response, error)

RemoveProjectBranch removes a specific project branch from a portfolio. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/remove_project_branch. Since: 7.1. Enterprise Edition only.

func (*ViewsService) Search

Search searches portfolios by name, key, or description. Requires authentication.

API endpoint: GET /api/views/search. Since: 6.6. Enterprise Edition only.

func (*ViewsService) SetManualMode

func (s *ViewsService) SetManualMode(ctx context.Context, opt *ViewsSetManualModeOptions) (*http.Response, error)

SetManualMode sets a portfolio to manual project selection mode. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/set_manual_mode. Since: 6.6. Enterprise Edition only.

func (*ViewsService) SetNoneMode

func (s *ViewsService) SetNoneMode(ctx context.Context, opt *ViewsSetNoneModeOptions) (*http.Response, error)

SetNoneMode sets a portfolio to no project selection (empty). Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/set_none_mode. Since: 6.6. Enterprise Edition only.

func (*ViewsService) SetRegexpMode

func (s *ViewsService) SetRegexpMode(ctx context.Context, opt *ViewsSetRegexpModeOptions) (*http.Response, error)

SetRegexpMode sets a portfolio to regexp-based project selection mode. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/set_regexp_mode. Since: 6.6. Enterprise Edition only.

func (*ViewsService) SetRemainingProjectsMode

func (s *ViewsService) SetRemainingProjectsMode(ctx context.Context, opt *ViewsSetRemainingProjectsModeOptions) (*http.Response, error)

SetRemainingProjectsMode sets a portfolio to include all remaining (unclassified) projects. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/set_remaining_projects_mode. Since: 6.6. Enterprise Edition only.

func (*ViewsService) SetTagsMode

func (s *ViewsService) SetTagsMode(ctx context.Context, opt *ViewsSetTagsModeOptions) (*http.Response, error)

SetTagsMode sets a portfolio to tag-based project selection mode. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/set_tags_mode. Since: 6.6. Enterprise Edition only.

func (*ViewsService) Show

Show returns the details of a portfolio, including sub-portfolios. Requires 'Browse' permission on the portfolio.

The response body is the portfolio object itself (live-verified: it is not wrapped in a "portfolio" field, despite what the endpoint's name might suggest).

API endpoint: GET /api/views/show. Since: 6.6. Enterprise Edition only.

func (*ViewsService) SubPortfolios

SubPortfolios returns the sub-portfolios of a portfolio. Requires 'Browse' permission on the portfolio.

API endpoint: GET /api/views/portfolios. Since: 6.6. Enterprise Edition only.

func (*ViewsService) Update

Update updates a portfolio's name and/or description. Requires 'Administer' permission on the portfolio.

API endpoint: POST /api/views/update. Since: 6.6. Enterprise Edition only.

func (*ViewsService) ValidateAddApplicationBranchOpt

func (s *ViewsService) ValidateAddApplicationBranchOpt(opt *ViewsAddApplicationBranchOptions) error

ValidateAddApplicationBranchOpt validates the options for the AddApplicationBranch method.

func (*ViewsService) ValidateAddApplicationOpt

func (s *ViewsService) ValidateAddApplicationOpt(opt *ViewsAddApplicationOptions) error

ValidateAddApplicationOpt validates the options for the AddApplication method.

func (*ViewsService) ValidateAddPortfolioOpt

func (s *ViewsService) ValidateAddPortfolioOpt(opt *ViewsAddPortfolioOptions) error

ValidateAddPortfolioOpt validates the options for the AddPortfolio method.

func (*ViewsService) ValidateAddProjectBranchOpt

func (s *ViewsService) ValidateAddProjectBranchOpt(opt *ViewsAddProjectBranchOptions) error

ValidateAddProjectBranchOpt validates the options for the AddProjectBranch method.

func (*ViewsService) ValidateAddProjectOpt

func (s *ViewsService) ValidateAddProjectOpt(opt *ViewsAddProjectOptions) error

ValidateAddProjectOpt validates the options for the AddProject method.

func (*ViewsService) ValidateApplicationsOpt

func (s *ViewsService) ValidateApplicationsOpt(opt *ViewsApplicationsOptions) error

ValidateApplicationsOpt validates the options for the Applications method.

func (*ViewsService) ValidateCreateOpt

func (s *ViewsService) ValidateCreateOpt(opt *ViewsCreateOptions) error

ValidateCreateOpt validates the options for the Create method.

func (*ViewsService) ValidateDeleteOpt

func (s *ViewsService) ValidateDeleteOpt(opt *ViewsDeleteOptions) error

ValidateDeleteOpt validates the options for the Delete method.

func (*ViewsService) ValidateMoveOpt

func (s *ViewsService) ValidateMoveOpt(opt *ViewsMoveOptions) error

ValidateMoveOpt validates the options for the Move method.

func (*ViewsService) ValidateMoveOptionsOpt

func (s *ViewsService) ValidateMoveOptionsOpt(opt *ViewsMoveOptionsOptions) error

ValidateMoveOptionsOpt validates the options for the MoveOptions method.

func (*ViewsService) ValidateProjectsOpt

func (s *ViewsService) ValidateProjectsOpt(opt *ViewsProjectsOptions) error

ValidateProjectsOpt validates the options for the Projects method.

func (*ViewsService) ValidateProjectsStatusOpt

func (s *ViewsService) ValidateProjectsStatusOpt(opt *ViewsProjectsStatusOptions) error

ValidateProjectsStatusOpt validates the options for the ProjectsStatus method.

func (*ViewsService) ValidateRemoveApplicationBranchOpt

func (s *ViewsService) ValidateRemoveApplicationBranchOpt(opt *ViewsRemoveApplicationBranchOptions) error

ValidateRemoveApplicationBranchOpt validates the options for the RemoveApplicationBranch method.

func (*ViewsService) ValidateRemoveApplicationOpt

func (s *ViewsService) ValidateRemoveApplicationOpt(opt *ViewsRemoveApplicationOptions) error

ValidateRemoveApplicationOpt validates the options for the RemoveApplication method.

func (*ViewsService) ValidateRemovePortfolioOpt

func (s *ViewsService) ValidateRemovePortfolioOpt(opt *ViewsRemovePortfolioOptions) error

ValidateRemovePortfolioOpt validates the options for the RemovePortfolio method.

func (*ViewsService) ValidateRemoveProjectBranchOpt

func (s *ViewsService) ValidateRemoveProjectBranchOpt(opt *ViewsRemoveProjectBranchOptions) error

ValidateRemoveProjectBranchOpt validates the options for the RemoveProjectBranch method.

func (*ViewsService) ValidateRemoveProjectOpt

func (s *ViewsService) ValidateRemoveProjectOpt(opt *ViewsRemoveProjectOptions) error

ValidateRemoveProjectOpt validates the options for the RemoveProject method.

func (*ViewsService) ValidateSetManualModeOpt

func (s *ViewsService) ValidateSetManualModeOpt(opt *ViewsSetManualModeOptions) error

ValidateSetManualModeOpt validates the options for the SetManualMode method.

func (*ViewsService) ValidateSetNoneModeOpt

func (s *ViewsService) ValidateSetNoneModeOpt(opt *ViewsSetNoneModeOptions) error

ValidateSetNoneModeOpt validates the options for the SetNoneMode method.

func (*ViewsService) ValidateSetRegexpModeOpt

func (s *ViewsService) ValidateSetRegexpModeOpt(opt *ViewsSetRegexpModeOptions) error

ValidateSetRegexpModeOpt validates the options for the SetRegexpMode method.

func (*ViewsService) ValidateSetRemainingProjectsModeOpt

func (s *ViewsService) ValidateSetRemainingProjectsModeOpt(opt *ViewsSetRemainingProjectsModeOptions) error

ValidateSetRemainingProjectsModeOpt validates the options for the SetRemainingProjectsMode method.

func (*ViewsService) ValidateSetTagsModeOpt

func (s *ViewsService) ValidateSetTagsModeOpt(opt *ViewsSetTagsModeOptions) error

ValidateSetTagsModeOpt validates the options for the SetTagsMode method.

func (*ViewsService) ValidateShowOpt

func (s *ViewsService) ValidateShowOpt(opt *ViewsShowOptions) error

ValidateShowOpt validates the options for the Show method.

func (*ViewsService) ValidateSubPortfoliosOpt

func (s *ViewsService) ValidateSubPortfoliosOpt(opt *ViewsSubViewsOptions) error

ValidateSubPortfoliosOpt validates the options for the SubPortfolios method.

func (*ViewsService) ValidateUpdateOpt

func (s *ViewsService) ValidateUpdateOpt(opt *ViewsUpdateOptions) error

ValidateUpdateOpt validates the options for the Update method.

type ViewsSetManualModeOptions

type ViewsSetManualModeOptions struct {
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
}

ViewsSetManualModeOptions contains parameters for the SetManualMode method.

type ViewsSetNoneModeOptions

type ViewsSetNoneModeOptions struct {
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
}

ViewsSetNoneModeOptions contains parameters for the SetNoneMode method.

type ViewsSetRegexpModeOptions

type ViewsSetRegexpModeOptions struct {
	// Branch selects a branch in all matched projects instead of using main branches.
	Branch string `url:"branch,omitempty"`
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
	// Regexp is a valid Java regular expression for project key matching. This field is required.
	Regexp string `url:"regexp"`
}

ViewsSetRegexpModeOptions contains parameters for the SetRegexpMode method.

type ViewsSetRemainingProjectsModeOptions

type ViewsSetRemainingProjectsModeOptions struct {
	// Branch selects a branch in all matched projects instead of using main branches.
	Branch string `url:"branch,omitempty"`
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
}

ViewsSetRemainingProjectsModeOptions contains parameters for the SetRemainingProjectsMode method.

type ViewsSetTagsModeOptions

type ViewsSetTagsModeOptions struct {
	// Branch selects a branch in all matched projects instead of using main branches.
	Branch string `url:"branch,omitempty"`
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
	// Tags is the list of project tags to match. This field is required.
	Tags []string `url:"tags,comma"`
}

ViewsSetTagsModeOptions contains parameters for the SetTagsMode method.

type ViewsShowOptions

type ViewsShowOptions struct {
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
}

ViewsShowOptions contains parameters for the Show method.

type ViewsSubViews

type ViewsSubViews struct {
	// SubViews is the list of sub-portfolios.
	SubViews []View `json:"subViews,omitempty"`
}

ViewsSubViews represents the response from the portfolios endpoint.

type ViewsSubViewsOptions

type ViewsSubViewsOptions struct {
	// Portfolio is the portfolio key. This field is required.
	Portfolio string `url:"portfolio"`
}

ViewsSubViewsOptions contains parameters for the SubPortfolios method.

type ViewsUpdateOptions

type ViewsUpdateOptions struct {
	// Description is the new description for the portfolio.
	Description string `url:"description,omitempty"`
	// Key is the portfolio key. This field is required.
	Key string `url:"key"`
	// Name is the new name for the portfolio. This field is required.
	Name string `url:"name"`
}

ViewsUpdateOptions contains parameters for the Update method.

type WebhookDelivery

type WebhookDelivery struct {
	// At is the timestamp of the delivery attempt.
	At string `json:"at,omitempty"`
	// CeTaskID is the Compute Engine task ID.
	//
	// Deprecated: Since 10.7.
	CeTaskID string `json:"ceTaskId,omitempty"`
	// ComponentKey is the project key.
	ComponentKey string `json:"componentKey,omitempty"`
	// ID is the unique identifier of the delivery.
	ID string `json:"id,omitempty"`
	// Name is the name of the webhook.
	Name string `json:"name,omitempty"`
	// Payload is the JSON payload sent (only in single delivery response).
	Payload string `json:"payload,omitempty"`
	// URL is the target URL.
	URL string `json:"url,omitempty"`
	// DurationMs is the duration of the request in milliseconds.
	DurationMs int64 `json:"durationMs,omitempty"`
	// HTTPStatus is the HTTP response status code.
	HTTPStatus int64 `json:"httpStatus,omitempty"`
	// Success indicates if the delivery was successful.
	Success bool `json:"success,omitempty"`
}

WebhookDelivery represents a webhook delivery attempt.

type WebhooksCreate

type WebhooksCreate struct {
	// Webhook contains the created webhook details.
	Webhook WebhooksDefinition `json:"webhook,omitzero"`
}

WebhooksCreate represents the response from creating a webhook.

type WebhooksCreateOptions

type WebhooksCreateOptions struct {
	// Name is the display name of the webhook (required).
	// Maximum length: 100 characters.
	Name string `url:"name,omitempty"`
	// Project is the key of the project that will own the webhook (optional).
	// If not provided, the webhook will be global.
	// Maximum length: 400 characters.
	Project string `url:"project,omitempty"`
	// Secret is the HMAC secret for signing payloads (optional).
	// If provided, the secret will be used to generate the HMAC hex digest
	// in the 'X-Sonar-Webhook-HMAC-SHA256' header.
	// Minimum length: 16 characters (since 10.6).
	// Maximum length: 200 characters.
	Secret string `url:"secret,omitempty"`
	// URL is the target endpoint for the webhook (required).
	// Maximum length: 512 characters.
	URL string `url:"url,omitempty"`
}

WebhooksCreateOptions represents options for creating a webhook.

type WebhooksDefinition

type WebhooksDefinition struct {
	// Key is the unique identifier of the webhook.
	Key string `json:"key,omitempty"`
	// Name is the display name of the webhook.
	Name string `json:"name,omitempty"`
	// URL is the target endpoint for the webhook.
	URL string `json:"url,omitempty"`
	// HasSecret indicates if a secret is configured for HMAC signature.
	HasSecret bool `json:"hasSecret,omitempty"`
}

WebhooksDefinition represents a webhook configuration.

type WebhooksDeleteOptions

type WebhooksDeleteOptions struct {
	// Webhook is the key of the webhook to delete (required).
	// Maximum length: 40 characters.
	Webhook string `url:"webhook,omitempty"`
}

WebhooksDeleteOptions represents options for deleting a webhook.

type WebhooksDeliveries

type WebhooksDeliveries struct {
	// Deliveries is the list of webhook deliveries.
	Deliveries []WebhookDelivery `json:"deliveries,omitempty"`
	// Paging contains pagination information.
	Paging Paging `json:"paging,omitzero"`
}

WebhooksDeliveries represents the response from listing webhook deliveries.

type WebhooksDeliveriesOptions

type WebhooksDeliveriesOptions struct {
	PaginationArgs

	// CeTaskID filters deliveries by Compute Engine task ID.
	//
	// Deprecated: Since 10.7.
	CeTaskID string `url:"ceTaskId,omitempty"`
	// ComponentKey filters deliveries by project key.
	//
	// Deprecated: Since 10.7.
	ComponentKey string `url:"componentKey,omitempty"`
	// Webhook filters deliveries by webhook key.
	Webhook string `url:"webhook,omitempty"`
}

WebhooksDeliveriesOptions represents options for listing webhook deliveries.

type WebhooksDelivery

type WebhooksDelivery struct {
	// Delivery contains the detailed delivery information.
	Delivery WebhookDelivery `json:"delivery,omitzero"`
}

WebhooksDelivery represents the response from getting a single delivery.

type WebhooksDeliveryOptions

type WebhooksDeliveryOptions struct {
	// DeliveryID is the unique identifier of the delivery (required).
	DeliveryID string `url:"deliveryId,omitempty"`
}

WebhooksDeliveryOptions represents options for getting a single delivery.

type WebhooksList

type WebhooksList struct {
	// Webhooks is the list of configured webhooks.
	Webhooks []WebhooksDefinition `json:"webhooks,omitempty"`
}

WebhooksList represents the response from listing webhooks.

type WebhooksListOptions

type WebhooksListOptions struct {
	// Project filters webhooks by project key (optional).
	// If not provided, returns global webhooks.
	Project string `url:"project,omitempty"`
}

WebhooksListOptions represents options for listing webhooks.

type WebhooksService

type WebhooksService struct {
	// contains filtered or unexported fields
}

WebhooksService handles communication with the Webhooks related methods of the SonarQube API. Webhooks allow to notify external services when a project analysis is done.

Since: 6.2.

func (*WebhooksService) Create

Create creates a webhook. Requires 'Administer' permission on the specified project, or global 'Administer' permission.

Since: 7.1.

func (*WebhooksService) Delete

Delete deletes a webhook. Requires 'Administer' permission on the specified project, or global 'Administer' permission.

Since: 7.1.

func (*WebhooksService) Deliveries

Deliveries gets the recent deliveries for a specified project or Compute Engine task. Requires 'Administer' permission on the related project. Note that additional information is returned by api/webhooks/delivery.

Since: 6.2.

func (*WebhooksService) Delivery

Delivery gets a webhook delivery by its ID. Requires 'Administer System' permission.

Since: 6.2.

func (*WebhooksService) List

List searches for global webhooks or project webhooks. Webhooks are ordered by name. Requires 'Administer' permission on the specified project, or global 'Administer' permission.

Since: 7.1.

func (*WebhooksService) Update

Update updates a webhook. Requires 'Administer' permission on the specified project, or global 'Administer' permission.

Since: 7.1.

func (*WebhooksService) ValidateCreateOpt

func (s *WebhooksService) ValidateCreateOpt(opt *WebhooksCreateOptions) error

ValidateCreateOpt validates the options for Create.

func (*WebhooksService) ValidateDeleteOpt

func (s *WebhooksService) ValidateDeleteOpt(opt *WebhooksDeleteOptions) error

ValidateDeleteOpt validates the options for Delete.

func (*WebhooksService) ValidateDeliveriesOpt

func (s *WebhooksService) ValidateDeliveriesOpt(opt *WebhooksDeliveriesOptions) error

ValidateDeliveriesOpt validates the options for Deliveries.

func (*WebhooksService) ValidateDeliveryOpt

func (s *WebhooksService) ValidateDeliveryOpt(opt *WebhooksDeliveryOptions) error

ValidateDeliveryOpt validates the options for Delivery.

func (*WebhooksService) ValidateListOpt

func (s *WebhooksService) ValidateListOpt(opt *WebhooksListOptions) error

ValidateListOpt validates the options for List.

func (*WebhooksService) ValidateUpdateOpt

func (s *WebhooksService) ValidateUpdateOpt(opt *WebhooksUpdateOptions) error

ValidateUpdateOpt validates the options for Update.

type WebhooksUpdateOptions

type WebhooksUpdateOptions struct {
	// Name is the new name for the webhook (required).
	// Maximum length: 100 characters.
	Name string `url:"name,omitempty"`
	// Secret is the new HMAC secret (optional).
	// If blank, any existing secret will be removed.
	// If not set, the secret will remain unchanged.
	// Maximum length: 200 characters.
	Secret string `url:"secret,omitempty"`
	// URL is the new target endpoint (required).
	// Maximum length: 512 characters.
	URL string `url:"url,omitempty"`
	// Webhook is the key of the webhook to update (required).
	// Maximum length: 40 characters.
	Webhook string `url:"webhook,omitempty"`
}

WebhooksUpdateOptions represents options for updating a webhook.

type WebservicesAction

type WebservicesAction struct {
	// Changelog is the list of changes.
	Changelog []WebservicesChangelog `json:"changelog,omitempty"`
	// DeprecatedSince indicates when the action was deprecated.
	DeprecatedSince string `json:"deprecatedSince,omitempty"`
	// Description is the action description.
	Description string `json:"description,omitempty"`
	// HasResponseExample indicates if a response example exists.
	HasResponseExample bool `json:"hasResponseExample,omitempty"`
	// Internal indicates if the action is internal.
	Internal bool `json:"internal,omitempty"`
	// Key is the action key.
	Key string `json:"key,omitempty"`
	// Params is the list of parameters.
	Params []WebservicesParam `json:"params,omitempty"`
	// Post indicates if the action uses POST method.
	Post bool `json:"post,omitempty"`
	// Since indicates when the action was introduced.
	Since string `json:"since,omitempty"`
}

WebservicesAction represents an action within a webservice.

type WebservicesChangelog

type WebservicesChangelog struct {
	// Description is the changelog description.
	Description string `json:"description,omitempty"`
	// Version is the version when the change occurred.
	Version string `json:"version,omitempty"`
}

WebservicesChangelog represents a changelog entry for an action.

type WebservicesDefinition

type WebservicesDefinition struct {
	// Actions is the list of actions available in the controller.
	Actions []WebservicesAction `json:"actions,omitempty"`
	// Description is the controller description.
	Description string `json:"description,omitempty"`
	// Path is the controller path.
	Path string `json:"path,omitempty"`
	// Since indicates when the controller was introduced.
	Since string `json:"since,omitempty"`
}

WebservicesDefinition represents a webservice controller.

type WebservicesList

type WebservicesList struct {
	// Webservices is the list of available webservices.
	Webservices []WebservicesDefinition `json:"webServices,omitempty"`
}

WebservicesList represents the response from listing webservices.

type WebservicesListOptions

type WebservicesListOptions struct {
	// IncludeInternals includes internal actions and parameters.
	// Default: false.
	IncludeInternals bool `url:"include_internals,omitempty"`
}

WebservicesListOptions represents options for listing webservices.

type WebservicesParam

type WebservicesParam struct {
	// DefaultValue is the parameter default value.
	DefaultValue string `json:"defaultValue,omitempty"`
	// DeprecatedKey is the deprecated key for the parameter.
	DeprecatedKey string `json:"deprecatedKey,omitempty"`
	// DeprecatedKeySince indicates when the key was deprecated.
	DeprecatedKeySince string `json:"deprecatedKeySince,omitempty"`
	// DeprecatedSince indicates when the parameter was deprecated.
	DeprecatedSince string `json:"deprecatedSince,omitempty"`
	// Description is the parameter description.
	Description string `json:"description,omitempty"`
	// ExampleValue is an example value for the parameter.
	ExampleValue string `json:"exampleValue,omitempty"`
	// Internal indicates if the parameter is internal.
	Internal bool `json:"internal,omitempty"`
	// Key is the parameter key.
	Key string `json:"key,omitempty"`
	// MaxValuesAllowed is the maximum number of values allowed.
	MaxValuesAllowed int `json:"maxValuesAllowed,omitempty"`
	// MaximumLength is the maximum length of the value.
	MaximumLength int `json:"maximumLength,omitempty"`
	// MaximumValue is the maximum value allowed.
	MaximumValue int `json:"maximumValue,omitempty"`
	// MinimumLength is the minimum length of the value.
	MinimumLength int `json:"minimumLength,omitempty"`
	// MinimumValue is the minimum value allowed.
	MinimumValue int `json:"minimumValue,omitempty"`
	// PossibleValues is the list of possible values.
	PossibleValues []string `json:"possibleValues,omitempty"`
	// Required indicates if the parameter is required.
	Required bool `json:"required,omitempty"`
	// Since indicates when the parameter was introduced.
	Since string `json:"since,omitempty"`
}

WebservicesParam represents a parameter for an action.

type WebservicesResponseExampleOptions

type WebservicesResponseExampleOptions struct {
	// Action is the action key (required).
	Action string `url:"action,omitempty"`
	// Controller is the controller key (required).
	Controller string `url:"controller,omitempty"`
}

WebservicesResponseExampleOptions represents options for getting a response example.

type WebservicesService

type WebservicesService struct {
	// contains filtered or unexported fields
}

WebservicesService handles communication with the webservices related methods of the SonarQube API. This service provides access to API documentation and response examples.

Since: 4.2.

func (*WebservicesService) List

List lists available web services. Returns the list of webservices with their actions and parameters.

API endpoint: GET /api/webservices/list. Since: 4.2.

func (*WebservicesService) ResponseExample

ResponseExample returns an example response for a web service action. Returns the response example as a string (the example format depends on the action).

API endpoint: GET /api/webservices/response_example. Since: 4.4.

func (*WebservicesService) ValidateListOpt

func (s *WebservicesService) ValidateListOpt(_ *WebservicesListOptions) error

ValidateListOpt validates the options for the List method.

func (*WebservicesService) ValidateResponseExampleOpt

func (s *WebservicesService) ValidateResponseExampleOpt(opt *WebservicesResponseExampleOptions) error

ValidateResponseExampleOpt validates the options for the ResponseExample method.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL