utils

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeFieldsPlaceholder = "{{NODE_FIELDS}}"

	// Shared GraphQL node field fragments.
	FieldDownloadPath            = "downloadPath"
	FieldPredicateType           = "predicateType"
	FieldPredicateSlug           = "predicateSlug"
	FieldPredicate               = "predicate"
	FieldVerified                = "verified"
	FieldCreatedBy               = "createdBy"
	FieldCreatedAt               = "createdAt"
	FieldSubjectSha256           = "subject { sha256 }"
	FieldSigningKeyAlias         = "signingKey { alias }"
	FieldSigningKeyWithPublicKey = "signingKey {alias, publicKey}"

	// Optional GraphQL fragments.
	AttachmentsFragment = "attachments { name sha256 type downloadPath }"
)
View Source
const DefaultProject = "default"
View Source
const IsoDateTimeLayout = "2006-01-02T15:04:05.000-0700"
View Source
const SonarIntegration = "sonar"

Variables

This section is empty.

Functions

func BuildApplicationVersionRepoKey added in v0.8.1

func BuildApplicationVersionRepoKey(project string) string

func BuildBuildInfoRepoKey

func BuildBuildInfoRepoKey(project string) string

func BuildQuery added in v0.9.0

func BuildQuery(template, nodeFields string) string

BuildQuery replaces every occurrence of NodeFieldsPlaceholder in template with the provided nodeFields string.

func BuildReleaseBundleRepoKey

func BuildReleaseBundleRepoKey(project string) string

func GetEnvVariable

func GetEnvVariable(envVarName string) (string, error)

func IsAttachmentsFieldNotFound added in v0.9.0

func IsAttachmentsFieldNotFound(err error) bool

func IsFlagPositiveNumber

func IsFlagPositiveNumber(flag string) bool

func IsHttpStatusSuccessful added in v0.9.0

func IsHttpStatusSuccessful(statusCode int) bool

func IsRunningUnderGitHubAction

func IsRunningUnderGitHubAction() bool

func IsSonarIntegration

func IsSonarIntegration(integration string) bool

func ParseIsoTimestamp

func ParseIsoTimestamp(isoTimestamp string) (time.Time, error)

func ValidateIntegration

func ValidateIntegration(integration string) error

Types

type AqlResult

type AqlResult struct {
	Results []*servicesUtils.ResultItem `json:"results,omitempty"`
}

func ExecuteAqlQuery

func ExecuteAqlQuery(query string, client *artifactory.ArtifactoryServicesManager) (*AqlResult, error)

ExecuteAqlQuery executes an AQL query and returns the result.

type NodeFieldsBuilder added in v0.9.0

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

NodeFieldsBuilder composes GraphQL node field lists dynamically, avoiding combinatorial explosion of query constants when optional fields (attachments, predicate, publicKey, etc.) are involved.

func NewNodeFieldsBuilder added in v0.9.0

func NewNodeFieldsBuilder(baseFields ...string) *NodeFieldsBuilder

NewNodeFieldsBuilder creates a builder pre-populated with the given base fields.

func (*NodeFieldsBuilder) Build added in v0.9.0

func (b *NodeFieldsBuilder) Build() string

Build returns the space-joined field list ready for insertion into a query template.

func (*NodeFieldsBuilder) WithIf added in v0.9.0

func (b *NodeFieldsBuilder) WithIf(condition bool, field string) *NodeFieldsBuilder

WithIf appends field to the list only when condition is true.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL