repo

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package repo is the repository configuration model: the JSON document that PUT, POST and GET /artifactory/api/repositories/{key} exchange, with JFrog's field names, together with its validation, the defaults Artifactory applies on create, the views each reader gets, the package-type names and a repository's include and exclude patterns.

Role

artifacts module, api layer. Every module that touches repositories reads this model, and only artifacts writes repositories. It is the one artifacts package that other modules, the generated public clients (pkg/client) and the generated servers import: the OpenAPI sources name it in their x-go-type-import blocks, and the layout test lets pkg/client import only it and the wire package among internal packages. As an api package it imports only the kernel (kernel/antpath) and the standard library.

Inputs

  • Repository configuration JSON from the REST API: the create, replace, update and batch requests on /artifactory/api/repositories and /artifactory/api/v2/repositories, decoded into Config.
  • Configuration as code: the YAML descriptor, which internal/configuration/core/descriptor reads into Config (decision 0009), and the JFrog Terraform provider, which sends the REST document.
  • The stored Config of a repository, for ValidateStored, ValidateUpdate and RestoreSecrets.

Outputs

  • Config, its enumerations (Class, PackageType, ChecksumPolicy and the rest) and its nested shapes (Member, CustomHTTPHeader, ContentSynchronisation and the rest). FlexBool reads the booleans JFrog documents as strings, and Flex builds one.
  • Validation errors: Validate, ValidateStored and ValidateKeyPair return a ValidationError, a list of FieldError, and Validate and ValidateStored a NoURLError for a remote whose only fault is a missing URL; ValidateUpdate returns a CreationOnlyError. All wrap ErrInvalid. A malformed flexible boolean fails with ErrNotBoolean.
  • Defaults: Defaults fills what Artifactory fills on create, the package type of a create that sends none included, which it takes from the legacy enable<Type>Support flags; CreateDefaults adds what 7.x sets only on create; DefaultLayout gives the layout the JFrog Terraform provider assigns.
  • Views: Public, the subset a reader who is not an administrator gets; Masked, the configuration without its secrets, as every reader gets it, with RestoreSecrets keeping a sensitive header's stored value on write-back; Full, an administrator's v1 read: Masked with the legacy type flags, force flags, Debian flags and signedUrlTtl that 7.x's read model gives every repository; Relevant, the shape of the v2 read and of the configurations list; and Descriptor, the shared remote configuration, 7.x's masked remote repository descriptor.
  • Package-type names: AllowedPackageTypes per class, AcceptsMember for virtual members, PackageTypeName as listings spell a type, PackageTypesNamed as a listing's filter names stored types (#1408) and PackageTypeDisplayName as the storage summary does.
  • RepoPatterns, which PatternsOf compiles from a Config: a repository's include and exclude patterns, matched with kernel/antpath. AQL, listings, searches and the generic and Maven formats check paths with them.
  • ResolveKey: the stored key that a key as a client sent it names, and whether it names that remote repository's cache ("maven-remote-cache" is the cache of "maven-remote"); the access module evaluates permission targets on the stored key.

Invariants

  • JSON names are JFrog's: camelCase with kebab-case and snake_case mixed into the same structs. Clients and Terraform state compare them, so .golangci.yml exempts this package from tagliatelle (decision 0002).
  • Validation and update error texts reach API clients and Terraform users, so they stay byte-identical. Validate reports every invalid field, not only the first, and applies no defaults: run Defaults first.
  • Booleans are written as JSON booleans on every class, and the strings "true" and "false" are accepted on input; anything else is an error rather than a silent false.
  • Defaults leaves the fields of other classes unset, so a local repository grows no remote-only keys.
  • Masked never returns a secret. RestoreSecrets puts a stored sensitive header value back only where the client sent that header back empty, as Masked showed it, so reading a configuration and writing it back keeps the secret.
  • An unset or empty includesPattern includes everything, as Artifactory's "**/*" does, and an exclude wins over an include.

References

Status

Implemented P0 to P9c: the model, its JSON round trip and validation in P0 and P1, then the fields, defaults and package types of each ecosystem from P3 to P9c. RepoPatterns, PatternsOf and ResolveKey added in P9d. Moved here in P9d.

Testing

  • TestUnitFixturesRoundTrip: the documents in testdata decode and encode back unchanged.
  • The TestUnitValidate* family: the rules and their messages, every error of a document reported at once (TestUnitValidateCollectsEveryError), the key rules that ValidateStored skips, and the fields only a create may set (TestUnitValidateUpdate).
  • TestUnitDefaults and the per-ecosystem default tests.
  • TestUnitPublic, TestUnitMaskedAndRestoreSecrets and the TestUnitRelevant family: the views. The two *MatchesTheDocumentedSample tests compare them with JFrog's documented samples, and TestUnitReadFieldSets lists the v1 and v2 reads' fields.
  • TestUnitFullCarriesEveryLegacyFlag, TestUnitForceFlagsOnEveryClass, TestUnitSignedURLTTLIsOnEveryRead and TestUnitCreateTakesItsTypeFromTheLegacyFlags: the fields Full derives and the type a create takes from the legacy flags (#1479).
  • TestUnitAllowedPackageTypes, TestUnitPackageTypeName, TestUnitPackageTypesNamed, TestUnitPackageTypeDisplayName and TestUnitEveryAcceptedTypeHasAListingName: the package-type names.
  • TestUnitRepoPatterns: includes, excludes and folders that lead to included content.

Index

Constants

View Source
const (
	DefaultIncludesPattern                = "**/*"
	DefaultRetrievalCachePeriodSecs       = 7200
	DefaultDockerRetrievalCachePeriodSecs = 21600
	DefaultMissedRetrievalCachePeriodSecs = 1800
	DefaultGoMissedRetrievalCachePeriod   = 600
	DefaultSocketTimeoutMillis            = 15000
	DefaultAssumedOfflinePeriodSecs       = 300
	DefaultMetadataRetrievalTimeoutSecs   = 60
	DefaultDockerTagRetention             = 1
	DefaultVirtualRetrievalCachePeriod    = 7200
	DefaultPyPIRegistryURL                = "https://pypi.org"
	DefaultPyPIRepositorySuffix           = "simple"
	DefaultFeedContextPath                = "api/v2"
	DefaultDownloadContextPath            = "api/v2/package"
	DefaultV3FeedURL                      = "https://api.nuget.org/v3/index.json"
	DefaultVCSType                        = "GIT"
	DefaultBowerRegistryURL               = "https://registry.bower.io"
	DefaultCargoGitRegistryURL            = "https://github.com/rust-lang/crates.io-index"
	DefaultComposerRegistryURL            = "https://packagist.org"
	DefaultTerraformRegistryURL           = "https://registry.terraform.io"
	DefaultTerraformProvidersURL          = "https://releases.hashicorp.com"
	// DefaultAIEditorExtensionsPattern is the external dependency pattern an
	// AI Editor Extensions remote takes: VSCODE_EXTERNAL_DEPENDENCIES_PATTERNS
	// of 7.161.26's PackageTypeConfigFields, which covers the Visual Studio
	// Marketplace's CDN.
	DefaultAIEditorExtensionsPattern = "**/**vsassets.io/**"
	// DefaultSignedURLTTL is what a read gives signedUrlTtl when it was
	// never set (Full), the default of 7.161.26's RepositoryConfigurationBase
	// and RepoBaseDescriptor.
	DefaultSignedURLTTL = 90
	// DefaultXrayDataTTL is what a read gives xrayDataTtl when it was never
	// set (Full): DEFAULT_DATA_TTL of 7.161.26's read model, and 90 in every
	// local dump and remote sample read.
	DefaultXrayDataTTL = 90
)

Default values documented for repository configuration fields. Each one must match docs/research/03-repository-configuration-model.md, which cites JFrog's configuration-json-files page; the Terraform providers compare the values they read back against these.

View Source
const (
	MinRetrievalCachePeriodSecs           = 30
	MinChocolateyRetrievalCachePeriodSecs = 14400
)

Minimums of a remote repository's retrievalCachePeriodSecs. JFrog's remote repositories page gives 30 seconds for most remote repositories and 14,400 for a NuGet remote that proxies community.chocolatey.org; SaaS 7.144.2's notice exempts smart remote repositories from the 30.

View Source
const (
	LayoutMaven2            = "maven-2-default"
	LayoutMaven1            = "maven-1-default"
	LayoutIvy               = "ivy-default"
	LayoutGradle            = "gradle-default"
	LayoutSBT               = "sbt-default"
	LayoutSBTIvy            = "sbt-ivy-default"
	LayoutSimple            = "simple-default"
	LayoutNPM               = "npm-default"
	LayoutNuGet             = "nuget-default"
	LayoutGo                = "go-default"
	LayoutTerraformModule   = "terraform-module-default"
	LayoutTerraformProvider = "terraform-provider-default"
	LayoutCargo             = "cargo-default"
	LayoutBower             = "bower-default"
	LayoutComposer          = "composer-default"
	LayoutConan             = "conan-default"
	LayoutPuppet            = "puppet-default"
	LayoutAnsible           = "ansible-default"
	LayoutSwift             = "swift-default"
	LayoutNix               = "nix-default"
	LayoutBuild             = "build-default"
)

Layout identifiers bundled with Artifactory.

View Source
const DefaultHexRepositoryURL = "https://repo.hex.pm"

DefaultHexRepositoryURL is HexConfiguration's hexRepositoryUrl default (PackageTypeConfigFields.HEX_REGISTRY_URL).

View Source
const HTTPRepoDescriptorClass = "org.artifactory.descriptor.repo.HttpRepoDescriptor"

HTTPRepoDescriptorClass is the "@class" of the shared remote configuration: 7.161.26's RepoBaseDescriptor carries @JsonTypeInfo(use = CLASS), and RepoConfigurationResource.getRemoteDescriptor answers with an HttpRepoDescriptor, whose comment says this "@class" is what the deprecated endpoint returns.

View Source
const MsgNoURL = "No URL defined for remote repository"

MsgNoURL is 7.x's refusal of a remote repository saved without a URL, as JFrog's Terraform provider (12.11.14) quotes it for the AI Editor Extensions and JetBrains Plugins remotes; JFrog's create repository reference makes url mandatory for every remote. The text is not in the 7.161.26 OSS tree, so its status and envelope are [I].

Variables

View Source
var ErrInvalid = errors.New("invalid repository configuration")

ErrInvalid is the sentinel every validation failure wraps.

View Source
var ErrNotBoolean = errors.New("value is not a boolean")

ErrNotBoolean reports a flexible boolean that is neither a JSON boolean nor the strings "true" or "false".

Functions

func AcceptsMember

func AcceptsMember(virtual, member PackageType) bool

AcceptsMember reports whether a virtual repository of package type virtual may list a member of package type member. A generic virtual repository aggregates any type; the Maven family shares one metadata format, so its types mix; every other type takes only its own.

func CreateDefaults

func CreateDefaults(c *Config)

CreateDefaults applies what 7.x sets on a repository only when it is created, after Defaults and once the URL has given up a user name and password written into it (repos.PrepareCreate), as 7.x's interceptors run after processUrlCredentials. An npm remote whose URL starts with https://npm.pkg.github.com gets bypassHeadRequests on, whatever was sent: 7.161.26's NpmGithubRegistrySettingsProviderPackage sets it through PackageRemoteRepoConfigurationInterceptor, which runs on create only, while npm.remote.enforce.default.configuration.enabled is on, as it is by default (ConstantValues). An update keeps what is stored or sent.

func DefaultLayout

func DefaultLayout(packageType PackageType, terraformType TerraformType) string

DefaultLayout returns the repoLayoutRef the JFrog Terraform provider assigns to a package type when the caller sets none (its default_repo_layout_map). The REST API gives a create without one createLayout's layout instead, which differs for most types. Nothing in artifactweave calls this outside the tests; it is exported for importers of internal/artifacts/api/repo that want the ecosystem-appropriate layout.

func PackageTypeDisplayName

func PackageTypeDisplayName(packageType string) string

PackageTypeDisplayName returns the spelling of packageType that Artifactory 7.x's storage summary (GET /api/storageinfo) shows, such as "Generic", "npm" or "RPM". jfrog-cli-core's transfer-files compares it with "Maven", "Gradle", "Ivy", "Docker", "Conan", "NuGet" and "SBT" to order uploads. The lookup ignores case, and a type with no display name of its own is spelled as PackageTypeName spells it.

func PackageTypeName

func PackageTypeName(packageType string) string

PackageTypeName returns the spelling of packageType that Artifactory 7.x listings show, such as "Generic", "Npm" or "YUM" for rpm. The lookup ignores case. A type with no entry gets its first letter capitalised, which is how most enumeration names are formed, and an empty type stays empty.

func ResolveKey

func ResolveKey(key string) (stored string, cached bool)

ResolveKey maps a repository key as a client sent it to the stored key and whether it names that repository's cache: "maven-remote-cache" is the cache of "maven-remote". Validate refuses keys that end in the suffix, so the mapping is unambiguous. It is published here because access evaluates permission targets on the stored key and may not import the artifacts module's core.

func RestoreSecrets

func RestoreSecrets(stored Config, updated *Config)

RestoreSecrets copies stored sensitive header values into updated where updated carries the same header back with the empty value Masked gave it, so a client that reads a configuration and writes it back does not wipe its secrets.

func Validate

func Validate(c *Config) error

Validate checks the rules a create or full update must satisfy. It returns nil, a NoURLError when that is the only fault, or a ValidationError list; it does not apply defaults, so run Defaults first when validating a document that relies on them.

func ValidateBypassHead

func ValidateBypassHead(stored, updated *Config) error

ValidateBypassHead checks updated, the configuration an update of stored leaves once merged but before Defaults, which turns bypassHeadRequests back on for this type whatever the update sent. As 7.161.26's interceptor does, it refuses only a change from on to off; an update that leaves the field out, resets it with null or repeats true passes.

func ValidateKeyPair

func ValidateKeyPair(c *Config, field, name, pairType string) error

ValidateKeyPair checks that a key pair a repository's field (primaryKeyPairRef or secondaryKeyPairRef) names, called name, of type pairType, is one the repository can use. Alpine indexes require RSA; Debian Release metadata and local or federated Terraform PROVIDER repositories require GPG signing keys.

func ValidateStored

func ValidateStored(c *Config) error

ValidateStored is Validate for an update, which keeps the stored key: it skips the key rules, which that key met when a client created it or which the server set aside when it created the repository under a name they reserve. The server's build-info repository also keeps its package type, buildinfo, which no class allows a client to choose.

func ValidateUpdate

func ValidateUpdate(stored, updated *Config) error

ValidateUpdate checks updated, the configuration an update of stored leaves once merged, defaulted and validated, against the fields of stored's package type that only a create may set: a CreationOnlyError names the first one it changes. An update that leaves such a field out, repeats its stored value, or sets one the repository was created without where the field allows it, passes.

Types

type BypassHeadError

type BypassHeadError struct{ Key string }

BypassHeadError is an update that turns bypassHeadRequests off on an AI Editor Extensions remote that has it on. It unwraps to ErrInvalid.

func (BypassHeadError) Error

func (e BypassHeadError) Error() string

Error is 7.161.26's own message for the change, which its PackageRepoConfigChangeInterceptor throws as an IllegalArgumentException; the text is the message of the 400 response a refused update gets.

func (BypassHeadError) Unwrap

func (BypassHeadError) Unwrap() error

Unwrap lets errors.Is(err, ErrInvalid) work.

type ChecksumPolicy

type ChecksumPolicy string

ChecksumPolicy governs client-supplied checksums on local repositories.

const (
	ClientChecksums          ChecksumPolicy = "client-checksums"
	ServerGeneratedChecksums ChecksumPolicy = "server-generated-checksums"
)

Checksum policies.

type Class

type Class string

Class is the repository class carried in the rclass field.

const (
	Local     Class = "local"
	Remote    Class = "remote"
	Virtual   Class = "virtual"
	Federated Class = "federated"
)

Repository classes. Listing endpoints echo them upper-case under "type".

type Config

type Config struct {
	// Common
	Key                 string      `json:"key"`
	Class               Class       `json:"rclass"`
	PackageType         PackageType `json:"packageType,omitempty"`
	ProjectKey          string      `json:"projectKey,omitempty"`
	Environments        []string    `json:"environments,omitempty"`
	Description         string      `json:"description"`
	Notes               string      `json:"notes"`
	IncludesPattern     *string     `json:"includesPattern,omitempty"`
	ExcludesPattern     *string     `json:"excludesPattern,omitempty"`
	RepoLayoutRef       string      `json:"repoLayoutRef,omitempty"`
	BlackedOut          *bool       `json:"blackedOut,omitempty"`
	XrayIndex           *bool       `json:"xrayIndex,omitempty"`
	PropertySets        []string    `json:"propertySets,omitempty"`
	PriorityResolution  *FlexBool   `json:"priorityResolution,omitempty"`
	DownloadRedirect    *FlexBool   `json:"downloadRedirect,omitempty"`
	CDNRedirect         *FlexBool   `json:"cdnRedirect,omitempty"`
	PrimaryKeyPairRef   string      `json:"primaryKeyPairRef,omitempty"`
	SecondaryKeyPairRef string      `json:"secondaryKeyPairRef,omitempty"`
	SignedURLTTL        *int        `json:"signedUrlTtl,omitempty"`
	XrayDataTTL         *int        `json:"xrayDataTtl,omitempty"`

	// Local and federated
	ChecksumPolicyType              ChecksumPolicy          `json:"checksumPolicyType,omitempty"`
	HandleReleases                  *bool                   `json:"handleReleases,omitempty"`
	HandleSnapshots                 *bool                   `json:"handleSnapshots,omitempty"`
	MaxUniqueSnapshots              *int                    `json:"maxUniqueSnapshots,omitempty"`
	SnapshotVersionBehavior         SnapshotVersionBehavior `json:"snapshotVersionBehavior,omitempty"`
	SuppressPomConsistencyChecks    *bool                   `json:"suppressPomConsistencyChecks,omitempty"`
	MaxUniqueTags                   *int                    `json:"maxUniqueTags,omitempty"`
	DockerTagRetention              *int                    `json:"dockerTagRetention,omitempty"`
	DockerAPIVersion                DockerAPIVersion        `json:"dockerApiVersion,omitempty"`
	BlockPushingSchema1             *FlexBool               `json:"blockPushingSchema1,omitempty"`
	ArchiveBrowsingEnabled          *bool                   `json:"archiveBrowsingEnabled,omitempty"`
	EnableFileListsIndexing         *FlexBool               `json:"enableFileListsIndexing,omitempty"`
	OptionalIndexCompressionFormats []string                `json:"optionalIndexCompressionFormats,omitempty"`
	DebianTrivialLayout             *bool                   `json:"debianTrivialLayout,omitempty"`
	DdebSupported                   *bool                   `json:"ddebSupported,omitempty"`
	CalculateYumMetadata            *bool                   `json:"calculateYumMetadata,omitempty"`
	YumRootDepth                    *int                    `json:"yumRootDepth,omitempty"`
	YumGroupFileNames               string                  `json:"yumGroupFileNames,omitempty"`
	TerraformType                   TerraformType           `json:"terraformType,omitempty"`
	EncryptStates                   *bool                   `json:"encryptStates,omitempty"`
	ForceNugetAuthentication        *bool                   `json:"forceNugetAuthentication,omitempty"`
	ForceP2Authentication           *bool                   `json:"forceP2Authentication,omitempty"`
	ForceConanAuthentication        *bool                   `json:"forceConanAuthentication,omitempty"`
	ForceMetadataNameVersion        *bool                   `json:"forceMetadataNameVersion,omitempty"`
	ForceNonDuplicateChart          *bool                   `json:"forceNonDuplicateChart,omitempty"`
	EnableComposerV1Indexing        *bool                   `json:"enableComposerV1Indexing,omitempty"`
	Members                         []Member                `json:"members,omitempty"`

	// Settings of 7.161.26's read model that its configuration XSD
	// (artifactory.xsd) does not hold, so the YAML descriptor refuses them
	// (descriptor:"-"). Each is accepted and stored; nothing acts on it.
	EnableNormalizedVersion *bool `json:"enableNormalizedVersion,omitempty" descriptor:"-"`
	MLRepoLayout            *bool `json:"mlRepoLayout,omitempty"            descriptor:"-"`
	SendContext             *bool `json:"sendContext,omitempty"             descriptor:"-"`

	// The legacy enable<Type>Support flags of every class. A create
	// without packageType takes its type from them (Defaults), and the v1
	// read derives them from the package type (Full); none is stored.
	// descriptor:"-" keeps a flag out of the YAML descriptor's keys
	// (internal/configuration/core/descriptor, jsonFields): 7.161.26's
	// repository descriptor (RepoBaseDescriptor) and configuration XSD hold
	// none of them. enableConanSupport, which the descriptor took before
	// the others were added (#1479), keeps its place there.
	EnableBowerSupport     *bool `json:"enableBowerSupport,omitempty"     descriptor:"-"`
	EnableChefSupport      *bool `json:"enableChefSupport,omitempty"      descriptor:"-"`
	EnableCocoaPodsSupport *bool `json:"enableCocoaPodsSupport,omitempty" descriptor:"-"`
	EnableComposerSupport  *bool `json:"enableComposerSupport,omitempty"  descriptor:"-"`
	EnableConanSupport     *bool `json:"enableConanSupport,omitempty"`
	EnableDebianSupport    *bool `json:"enableDebianSupport,omitempty"    descriptor:"-"`
	EnableDistRepoSupport  *bool `json:"enableDistRepoSupport,omitempty"  descriptor:"-"`
	EnableDockerSupport    *bool `json:"enableDockerSupport,omitempty"    descriptor:"-"`
	EnableGemsSupport      *bool `json:"enableGemsSupport,omitempty"      descriptor:"-"`
	EnableGitLfsSupport    *bool `json:"enableGitLfsSupport,omitempty"    descriptor:"-"`
	EnableNpmSupport       *bool `json:"enableNpmSupport,omitempty"       descriptor:"-"`
	EnableNuGetSupport     *bool `json:"enableNuGetSupport,omitempty"     descriptor:"-"`
	EnablePuppetSupport    *bool `json:"enablePuppetSupport,omitempty"    descriptor:"-"`
	EnablePypiSupport      *bool `json:"enablePypiSupport,omitempty"      descriptor:"-"`
	EnableVagrantSupport   *bool `json:"enableVagrantSupport,omitempty"   descriptor:"-"`

	// Cargo, local and remote
	CargoAnonymousAccess *bool `json:"cargoAnonymousAccess,omitempty"`
	CargoInternalIndex   *bool `json:"cargoInternalIndex,omitempty"`

	// Remote
	URL                               string                  `json:"url,omitempty"`
	Username                          string                  `json:"username,omitempty"`
	Password                          string                  `json:"password,omitempty"`
	Proxy                             string                  `json:"proxy,omitempty"`
	DisableProxy                      *bool                   `json:"disableProxy,omitempty"`
	RemoteRepoLayoutRef               string                  `json:"remoteRepoLayoutRef,omitempty"`
	RemoteRepoChecksumPolicyType      RemoteChecksumPolicy    `json:"remoteRepoChecksumPolicyType,omitempty"`
	HardFail                          *bool                   `json:"hardFail,omitempty"`
	Offline                           *bool                   `json:"offline,omitempty"`
	StoreArtifactsLocally             *bool                   `json:"storeArtifactsLocally,omitempty"`
	SocketTimeoutMillis               *int                    `json:"socketTimeoutMillis,omitempty"`
	LocalAddress                      string                  `json:"localAddress,omitempty"`
	RetrievalCachePeriodSecs          *int                    `json:"retrievalCachePeriodSecs,omitempty"`
	MissedRetrievalCachePeriodSecs    *int                    `json:"missedRetrievalCachePeriodSecs,omitempty"`
	MetadataRetrievalTimeoutSecs      *int                    `json:"metadataRetrievalTimeoutSecs,omitempty"`
	AssumedOfflinePeriodSecs          *int                    `json:"assumedOfflinePeriodSecs,omitempty"`
	UnusedArtifactsCleanupPeriodHours *int                    `json:"unusedArtifactsCleanupPeriodHours,omitempty"`
	FetchJarsEagerly                  *bool                   `json:"fetchJarsEagerly,omitempty"`
	FetchSourcesEagerly               *bool                   `json:"fetchSourcesEagerly,omitempty"`
	RejectInvalidJars                 *bool                   `json:"rejectInvalidJars,omitempty"`
	ShareConfiguration                *bool                   `json:"shareConfiguration,omitempty"`
	SynchronizeProperties             *bool                   `json:"synchronizeProperties,omitempty"`
	BlockMismatchingMimeTypes         *bool                   `json:"blockMismatchingMimeTypes,omitempty"`
	MismatchingMimeTypesOverrideList  string                  `json:"mismatchingMimeTypesOverrideList,omitempty"`
	AllowAnyHostAuth                  *bool                   `json:"allowAnyHostAuth,omitempty"`
	EnableCookieManagement            *bool                   `json:"enableCookieManagement,omitempty"`
	EnableTokenAuthentication         *bool                   `json:"enableTokenAuthentication,omitempty"`
	BypassHeadRequests                *bool                   `json:"bypassHeadRequests,omitempty"`
	ClientTLSCertificate              string                  `json:"clientTlsCertificate,omitempty"`
	ListRemoteFolderItems             *FlexBool               `json:"listRemoteFolderItems,omitempty"`
	QueryParams                       string                  `json:"queryParams,omitempty"`
	PropagateQueryParams              *bool                   `json:"propagateQueryParams,omitempty"`
	RetrieveSha256FromServer          *bool                   `json:"retrieveSha256FromServer,omitempty"`
	Curated                           *bool                   `json:"curated,omitempty"`
	PassThrough                       *bool                   `json:"passThrough,omitempty"`
	DisableURLNormalization           *bool                   `json:"disableUrlNormalization,omitempty"`
	CustomHTTPHeaders                 []CustomHTTPHeader      `json:"customHttpHeaders,omitempty"`
	ContentSynchronisation            *ContentSynchronisation `json:"contentSynchronisation,omitempty"`
	PyPIRegistryURL                   string                  `json:"pyPIRegistryUrl,omitempty"`
	PyPIRepositorySuffix              string                  `json:"pyPIRepositorySuffix,omitempty"`
	FeedContextPath                   *string                 `json:"feedContextPath,omitempty"`
	DownloadContextPath               *string                 `json:"downloadContextPath,omitempty"`
	V3FeedURL                         string                  `json:"v3FeedUrl,omitempty"`
	SymbolServerURL                   string                  `json:"symbolServerUrl,omitempty"`
	ChartsBaseURL                     string                  `json:"chartsBaseUrl,omitempty"`
	TerraformRegistryURL              string                  `json:"terraformRegistryUrl,omitempty"`
	TerraformProvidersURL             string                  `json:"terraformProvidersUrl,omitempty"`
	VCSType                           string                  `json:"vcsType,omitempty"`
	VCSGitProvider                    VCSGitProvider          `json:"vcsGitProvider,omitempty"`
	VCSGitDownloadURL                 string                  `json:"vcsGitDownloadUrl,omitempty"`
	DockerProjectID                   string                  `json:"dockerProjectId,omitempty"`
	BowerRegistryURL                  string                  `json:"bowerRegistryUrl,omitempty"`
	GitRegistryURL                    string                  `json:"gitRegistryUrl,omitempty"`
	ComposerRegistryURL               string                  `json:"composerRegistryUrl,omitempty"`
	PodsSpecsRepoURL                  string                  `json:"podsSpecsRepoUrl,omitempty"`
	PodsCdnURL                        string                  `json:"podsCdnUrl,omitempty"`
	// P2ChildOrigins explicitly admits origins named by remote composite sites.
	// The repository URL's own origin is always admitted.
	P2ChildOrigins []string `json:"p2ChildOrigins,omitempty"`
	HexPublicKey   string   `json:"hexPublicKey,omitempty"`

	// Shared by remote and virtual
	ExternalDependenciesEnabled    *bool    `json:"externalDependenciesEnabled,omitempty"`
	ExternalDependenciesPatterns   []string `json:"externalDependenciesPatterns,omitempty"`
	ExternalDependenciesRemoteRepo string   `json:"externalDependenciesRemoteRepo,omitempty"`

	// Virtual
	Repositories                                  []string         `json:"repositories,omitempty"`
	DefaultDeploymentRepo                         string           `json:"defaultDeploymentRepo,omitempty"`
	ArtifactoryRequestsCanRetrieveRemoteArtifacts *bool            `json:"artifactoryRequestsCanRetrieveRemoteArtifacts,omitempty"`
	VirtualRetrievalCachePeriodSecs               *int             `json:"virtualRetrievalCachePeriodSecs,omitempty"`
	KeyPair                                       string           `json:"keyPair,omitempty"`
	PomRepositoryReferencesCleanupPolicy          PomCleanupPolicy `json:"pomRepositoryReferencesCleanupPolicy,omitempty"`
	ForceMavenAuthentication                      *bool            `json:"forceMavenAuthentication,omitempty"`
	HideUnauthorizedResources                     *bool            `json:"hideUnauthorizedResources,omitempty"`
	ResolveDockerTagsByTimestamp                  *bool            `json:"resolveDockerTagsByTimestamp,omitempty"`
	CachingLocalForeignLayersEnabled              *bool            `json:"cachingLocalForeignLayersEnabled,omitempty"`
	UseNamespaces                                 *bool            `json:"useNamespaces,omitempty"`
	DebianDefaultArchitectures                    string           `json:"debianDefaultArchitectures,omitempty"`
	P2URLs                                        []string         `json:"p2Urls,omitempty"`

	// Shown names the fields a read writes even when empty: username,
	// password, localAddress, dockerProjectId and keyPair as "", and
	// customHttpHeaders as []. 7.161.26's read model holds each as "" or []
	// by default where omitempty would leave the key out; the remote
	// credentials read as "" in every sample read of a remote repository.
	// Only Full sets it, and Relevant takes out what it leaves out; nothing
	// stores or decodes it.
	Shown []string `json:"-" descriptor:"-"`
}

Config is the repository configuration document. Optional scalars are pointers so that "not supplied" is distinguishable from the zero value: an update is partial, and Defaults fills only what the caller left nil.

description and notes have no omitempty: every read, the non-admin view included, carries them as "" when unset, as Artifactory's reads do, and stored documents carry them too. The non-admin view (Public) always shows notes as "". An update encoded from a Config therefore sets both, so a caller that means to leave them alone sends its own JSON without them.

func Defaults

func Defaults(c *Config) *Config

Defaults fills every field the caller left unset with the value Artifactory would apply on create. It returns the config so it can be chained; the receiver is modified in place. Fields that belong to another class are left alone so a local repository does not grow remote-only keys.

func Full

func Full(c Config) Config

Full returns what an administrator's v1 read, GET /api/repositories/{key}, sends of c: Masked(c) completed to 7.161.26's read model of c's class (LocalRepositoryConfigurationImpl for a local repository and, through it, FederatedRepositoryConfigurationImpl; HttpRepositoryConfigurationImpl; VirtualRepositoryConfigurationImpl; each extends RepositoryConfigurationBase). The v1 read writes every field of the model, whatever the package type, as its dumps of Docker, npm and Maven local repositories (RTFACT-29415, RTFACT-30672, RTFACT-31100) and the Terraform provider's sample reads of generic local and remote repositories and remotes of other types (samples/generic-repo-local.json, samples/repository_remote) show. A field the model reads only from the configuration of its own package types has its default for every other type, whatever was stored.

The model's fields that artifactweave does not hold are left out [I]: the nested per-type settings of a remote (gitLabResolveSubgroups, podsForceModifyIndex, authUrl and the other types' registry URLs), gridTopologyId and federationOnGrid. No dump of a remote, virtual or federated repository's v1 read from 7.161.26 was found, so that each carries what its model holds is inferred [I]. The v2 read and the configurations list keep what Relevant keeps of Full.

func Masked

func Masked(c Config) Config

Masked returns c without its secrets, for every reader: the remote password and the values of sensitive custom headers. An update that omits the password, or sends a sensitive header back with an empty value, keeps the stored secret (RestoreSecrets). The repositories API's reads send Full and the shared remote configuration Descriptor, each of which starts from Masked.

It also lists no environments as [] rather than leaving the key out, as Artifactory does: the Terraform provider defaults project_environments to an empty set and reads an absent key as null, so every plan would show a change. It lists no property sets as [] too, as Artifactory's configuration samples do, except on a virtual repository, whose configuration has no such field.

A Debian repository that never set ddebSupported or debianTrivialLayout reads them as false, the value it acts on (#1372). 7.161.26's configuration model (RepositoryConfigurationBase, the base of every class's) holds both with the default false; RTFACT-30304 shows "ddebSupported" : false in a Debian remote's configuration, and the Terraform provider's sample reads (samples/repository_remote/debian.json and samples/generic-repo-local.json) give both false. No dump of a virtual repository's read was found [I]. The v2 read keeps only what Relevant keeps of them.

func Public

func Public(c Config) Config

Public returns the subset of c that a caller who can read the repository but is not an administrator receives: identity, layout and patterns, with nothing that configures access or holds a secret.

func Relevant

func Relevant(c Config) Config

Relevant returns c without the fields 7.x's v2 read leaves out for its package type and class (v2Fields), the shape GET /api/v2/repositories/{key} and each entry of GET /api/repositories/configurations return: a generic repository has no Maven or Docker fields, as JFrog's generic local samples of both show.

func (Config) MarshalJSON

func (c Config) MarshalJSON() ([]byte, error)

MarshalJSON writes environments, repositories and propertySets as [] when the slice is empty but not nil, which omitempty would drop: Masked relies on that for API responses, and a nil slice still leaves the key out. It writes the fields Shown names even when empty. The outer fields shadow the embedded ones because encoding/json prefers the shallower field.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes a repository document. FlexBool already accepts both spellings, so this only exists because the generated API server wraps Config in response types that delegate both directions to it; without the method the wrapper does not compile.

type ContentSyncSource

type ContentSyncSource struct {
	OriginAbsenceDetection bool `json:"originAbsenceDetection"`
}

ContentSyncSource is the source section of contentSynchronisation.

type ContentSynchronisation

type ContentSynchronisation struct {
	Enabled    bool               `json:"enabled"`
	Statistics *EnabledFlag       `json:"statistics,omitempty"`
	Properties *EnabledFlag       `json:"properties,omitempty"`
	Source     *ContentSyncSource `json:"source,omitempty"`
}

ContentSynchronisation configures a smart remote repository.

type CreationOnlyError

type CreationOnlyError struct {
	Field       string
	PackageType PackageType
	Once        bool
}

CreationOnlyError is an update that changes a field its repository takes only when it is created, or, with Once, a field it may take once and then keep. It unwraps to ErrInvalid.

func (CreationOnlyError) Error

func (e CreationOnlyError) Error() string

Error names the field and the repository's package type, as listings spell it, and says whether the field is set only on create or only once. The text is the message of the 400 response a refused update gets.

func (CreationOnlyError) Unwrap

func (CreationOnlyError) Unwrap() error

Unwrap lets errors.Is(err, ErrInvalid) work.

type CustomHTTPHeader

type CustomHTTPHeader struct {
	Name      string `json:"name"`
	Value     string `json:"value"`
	Sensitive bool   `json:"sensitive"`
}

CustomHTTPHeader is one entry of a remote repository's customHttpHeaders.

type DescriptorCargo

type DescriptorCargo struct {
	AnonymousAccess bool `json:"cargoAnonymousAccess"`
	InternalIndex   bool `json:"cargoInternalIndex"`
}

DescriptorCargo is CargoConfiguration.

type DescriptorCocoaPods

type DescriptorCocoaPods struct {
	SpecsRepoURL     string           `json:"cocoaPodsSpecsRepoUrl,omitempty"`
	ForceModifyIndex bool             `json:"cocoaPodsForceModifyIndex"`
	SpecRepoProvider DescriptorVCSGit `json:"specRepoProvider"`
}

DescriptorCocoaPods is CocoaPodsConfiguration: its specRepoProvider is renamed, so it follows cocoaPodsForceModifyIndex.

type DescriptorContentSync

type DescriptorContentSync struct {
	Enabled    bool              `json:"enabled"`
	Statistics EnabledFlag       `json:"statistics"`
	Properties EnabledFlag       `json:"properties"`
	Source     ContentSyncSource `json:"source"`
}

DescriptorContentSync is ContentSynchronisationDescriptor, whose three nested objects are never null.

type DescriptorExternal

type DescriptorExternal struct {
	Enabled  bool     `json:"enabled"`
	Patterns []string `json:"pattern,omitempty"`
}

DescriptorExternal is ExternalDependenciesConfig. Its patterns take the @XmlElement name "pattern", as customHttpHeader does [I]; remoteRepo is never set on a remote's descriptor, so it is left out.

type DescriptorGo

type DescriptorGo struct {
	GitLabResolveSubgroups bool `json:"gitLabResolveSubgroups"`
}

DescriptorGo is GoConfiguration.

type DescriptorHF

type DescriptorHF struct {
	MLRepoLayout bool `json:"mlRepoLayout"`
}

DescriptorHF is HuggingFaceMLRemoteConfiguration.

type DescriptorNuGet

type DescriptorNuGet struct {
	FeedContextPath     string `json:"feedContextPath"`
	DownloadContextPath string `json:"downloadContextPath"`
	V3FeedURL           string `json:"v3FeedUrl"`
	SymbolServerURL     string `json:"symbolServerUrl"`
}

DescriptorNuGet is NuGetConfiguration, whose four paths default to "".

type DescriptorPyPI

type DescriptorPyPI struct {
	RegistryURL      string `json:"pyPIRegistryUrl"`
	RepositorySuffix string `json:"repositorySuffix"`
}

DescriptorPyPI is PypiConfiguration without the context paths artifactweave does not hold.

type DescriptorRegistry

type DescriptorRegistry struct {
	BowerRegistryURL      string `json:"bowerRegistryUrl,omitempty"`
	ComposerRegistryURL   string `json:"composerRegistryUrl,omitempty"`
	ChartsBaseURL         string `json:"chartsBaseUrl,omitempty"`
	RegistryURL           string `json:"registryUrl,omitempty"`
	TerraformRegistryURL  string `json:"terraformRegistryUrl,omitempty"`
	TerraformProvidersURL string `json:"terraformProvidersUrl,omitempty"`
	HexRepositoryURL      string `json:"hexRepositoryUrl,omitempty"`
	HexPublicKey          string `json:"hexPublicKey,omitempty"`
}

DescriptorRegistry is each of the per-type objects that hold only URLs or a key: BowerConfiguration, ComposerConfiguration, HelmConfiguration, GitConfiguration, TerraformConfiguration, HexConfiguration and AnsibleRemoteConfiguration. Each sets only the fields of its own type, and 7.x's leaves a null one out, so the rest stay empty and unwritten.

type DescriptorVCS

type DescriptorVCS struct {
	Type string           `json:"type"`
	Git  DescriptorVCSGit `json:"git"`
}

DescriptorVCS is VcsConfiguration.

type DescriptorVCSGit

type DescriptorVCSGit struct {
	Provider    VCSGitProvider `json:"provider"`
	DownloadURL string         `json:"downloadUrl,omitempty"`
}

DescriptorVCSGit is VcsGitConfiguration: CocoaPods' specRepoProvider has the same shape.

type DescriptorXray

type DescriptorXray struct {
	Enabled              bool    `json:"enabled"`
	DataTTL              int     `json:"dataTtl"`
	XrayNotAvailableMode *string `json:"xrayNotAvailableMode"`
}

DescriptorXray is XrayRepoConfigDescriptor. Its xrayNotAvailableMode is @XmlElement(nillable = true), which the mapper writes even when null; no remote here has one [I].

type DockerAPIVersion

type DockerAPIVersion string

DockerAPIVersion is the Docker registry API version a repository speaks.

const (
	DockerV1 DockerAPIVersion = "V1"
	DockerV2 DockerAPIVersion = "V2"
)

Docker API versions. V1 is legacy and only accepted for compatibility.

type EnabledFlag

type EnabledFlag struct {
	Enabled bool `json:"enabled"`
}

EnabledFlag is a nested {"enabled": bool} object.

type FieldError

type FieldError struct {
	Field   string
	Message string
}

FieldError reports one invalid field. Field is the JSON name so the error can be shown to API clients and Terraform users as they see the document.

func (FieldError) Error

func (e FieldError) Error() string

Error is the field's JSON name, a colon and the message: one entry of a ValidationError's text.

type FlexBool

type FlexBool struct {
	Value bool
}

FlexBool is a boolean that JFrog documents inconsistently. JFrog's JSON documentation and OpenAPI schema declare enableFileListsIndexing, downloadRedirect, cdnRedirect, priorityResolution and blockPushingSchema1 as strings on local and federated repositories, federated members[].enabled as a string, and remote listRemoteFolderItems as the string "false" (docs/research/03-repository-configuration-model.md, "Typing traps"). Artifactory itself sends JSON booleans: the JFrog Terraform provider 12.11.14 decodes all seven into Go bools on every class and fails its refresh on a quoted value, and its sample local repository shows "cdnRedirect": false. So the server writes booleans and accepts both spellings on input, for clients that followed the documentation.

func Flex

func Flex(v bool) *FlexBool

Flex is a convenience constructor for literals in configuration code.

func (*FlexBool) Bool

func (f *FlexBool) Bool() bool

Bool returns the value, or false when the pointer is nil.

func (FlexBool) MarshalJSON

func (f FlexBool) MarshalJSON() ([]byte, error)

MarshalJSON writes a JSON boolean, never the documented string spelling.

func (*FlexBool) UnmarshalJSON

func (f *FlexBool) UnmarshalJSON(b []byte) error

UnmarshalJSON accepts true, false, "true" and "false". Anything else is an error rather than a silent false, because a misspelt flag on a repository that controls redirects or indexing must not pass validation unnoticed.

type Member

type Member struct {
	URL     string    `json:"url"`
	Enabled *FlexBool `json:"enabled,omitempty"`
}

Member is one federated repository member. enabled is a FlexBool because JFrog documents it as a string; nil means the caller did not say, and Defaults turns that into true.

type NoURLError

type NoURLError struct{}

NoURLError is a remote repository whose only fault is that it has no URL. Its text is MsgNoURL alone, without ErrInvalid's prefix, so a client that matches 7.x's message finds it. It unwraps to ErrInvalid.

func (NoURLError) Error

func (NoURLError) Error() string

Error is MsgNoURL.

func (NoURLError) Unwrap

func (NoURLError) Unwrap() error

Unwrap lets errors.Is(err, ErrInvalid) work.

type PackageType

type PackageType string

PackageType is the ecosystem a repository serves.

const (
	Alpine           PackageType = "alpine"
	Cargo            PackageType = "cargo"
	Composer         PackageType = "composer"
	Bower            PackageType = "bower"
	Chef             PackageType = "chef"
	CocoaPods        PackageType = "cocoapods"
	Conan            PackageType = "conan"
	Conda            PackageType = "conda"
	Cran             PackageType = "cran"
	Debian           PackageType = "debian"
	Docker           PackageType = "docker"
	Helm             PackageType = "helm"
	HelmOCI          PackageType = "helmoci"
	HuggingFaceML    PackageType = "huggingfaceml"
	Gems             PackageType = "gems"
	GitLFS           PackageType = "gitlfs"
	Go               PackageType = "go"
	Gradle           PackageType = "gradle"
	Ivy              PackageType = "ivy"
	Maven            PackageType = "maven"
	NPM              PackageType = "npm"
	NuGet            PackageType = "nuget"
	OCI              PackageType = "oci"
	Opkg             PackageType = "opkg"
	Pub              PackageType = "pub"
	Puppet           PackageType = "puppet"
	PyPI             PackageType = "pypi"
	RPM              PackageType = "rpm"
	SBT              PackageType = "sbt"
	Swift            PackageType = "swift"
	Terraform        PackageType = "terraform"
	TerraformBackend PackageType = "terraformbackend"
	Vagrant          PackageType = "vagrant"
	Ansible          PackageType = "ansible"
	BazelModules     PackageType = "bazelmodules"
	Generic          PackageType = "generic"
	VCS              PackageType = "vcs"
	P2               PackageType = "p2"
	Hex              PackageType = "hex"
	Nix              PackageType = "nix"
	MachineLearning  PackageType = "machinelearning"
	// AIEditorExtensions and JetBrainsPlugins proxy IDE marketplaces and
	// exist only for remote repositories.
	AIEditorExtensions PackageType = "aieditorextensions"
	JetBrainsPlugins   PackageType = "jetbrainsplugins"
	LuaRocks           PackageType = "luarocks"
	NIMModel           PackageType = "nimmodel"
	Skills             PackageType = "skills"
	AgentPlugins       PackageType = "agentplugins"
	AgentPackages      PackageType = "agentpackages"
	// ReleaseBundles is the type of the repositories that store release
	// bundles, local and federated only, as the Terraform provider's map
	// offers it. No package handler serves it yet.
	ReleaseBundles PackageType = "releasebundles"
	// BuildInfo is the type of the built-in artifactory-build-info
	// repository. It is in no AllowedPackageTypes list, so the repositories
	// API cannot create another; an update of that one repository keeps it
	// (ValidateStored).
	BuildInfo PackageType = "buildinfo"
	// Distribution is the type 7.x gives a create that sends
	// enableDistRepoSupport and no packageType (Defaults). It is in no
	// AllowedPackageTypes list, so such a create answers 400.
	Distribution PackageType = "distribution"
)

Package types, in the order JFrog's JSON documentation lists them, then the types that page does not list. VCS exists only for remote repositories, P2 for remote and virtual ones.

func AllowedPackageTypes

func AllowedPackageTypes(class Class) []PackageType

AllowedPackageTypes returns the package types a repository of the given class may declare, or nil for an unknown class.

func PackageTypesNamed

func PackageTypesNamed(name string) []PackageType

PackageTypesNamed returns, sorted, the package types a listing's package type filter names when it compares without regard to case both the configured type and the name the listing shows, as Get Repositories does: "yum" names rpm, and "MAVEN" maven. It lets a store filter by a list of stored values in place of comparing each repository. Besides the types with a listing name it holds name folded to lower-case ASCII, which is the stored spelling of any type without one that equals name without regard to case: a configured type is always lower case (Validate checks it against AllowedPackageTypes).

type PomCleanupPolicy

type PomCleanupPolicy string

PomCleanupPolicy is the virtual repository POM repository-reference policy.

const (
	DiscardActiveReference PomCleanupPolicy = "discard_active_reference"
	DiscardAnyReference    PomCleanupPolicy = "discard_any_reference"
	Nothing                PomCleanupPolicy = "nothing"
)

POM cleanup policies.

type RemoteChecksumPolicy

type RemoteChecksumPolicy string

RemoteChecksumPolicy governs checksums fetched from an upstream.

const (
	GenerateIfAbsent  RemoteChecksumPolicy = "generate-if-absent"
	Fail              RemoteChecksumPolicy = "fail"
	IgnoreAndGenerate RemoteChecksumPolicy = "ignore-and-generate"
	PassThru          RemoteChecksumPolicy = "pass-thru"
)

Remote checksum policies.

type RemoteDescriptor

type RemoteDescriptor struct {
	Class string `json:"@class"`
	Key   string `json:"key"`

	AllowAnyHostAuth          bool   `json:"allowAnyHostAuth"`
	SocketTimeoutMillis       int    `json:"socketTimeoutMillis"`
	EnableCookieManagement    bool   `json:"enableCookieManagement"`
	EnableTokenAuthentication bool   `json:"enableTokenAuthentication"`
	DisableProxy              bool   `json:"disableProxy"`
	QueryParams               string `json:"queryParams,omitempty"`
	PropagateQueryParams      bool   `json:"propagateQueryParams"`
	ClientTLSCertificate      string `json:"clientTlsCertificate,omitempty"`
	DisableURLNormalization   bool   `json:"disableUrlNormalization"`
	RetrieveSha256FromServer  bool   `json:"retrieveSha256FromServer"`
	// customHttpHeaders' @XmlElement name, not its @XmlElementWrapper's:
	// the mapper leaves USE_WRAPPER_NAME_AS_PROPERTY_NAME off [I].
	CustomHTTPHeader []CustomHTTPHeader `json:"customHttpHeader"`

	Type                         string           `json:"type"`
	Description                  string           `json:"description,omitempty"`
	Notes                        string           `json:"notes,omitempty"`
	IncludesPattern              string           `json:"includesPattern"`
	ExcludesPattern              string           `json:"excludesPattern,omitempty"`
	DockerAPIVersion             DockerAPIVersion `json:"dockerApiVersion"`
	ForceNugetAuthentication     bool             `json:"forceNugetAuthentication"`
	ForceConanAuthentication     bool             `json:"forceConanAuthentication"`
	DdebSupported                bool             `json:"ddebSupported"`
	SignedURLTTL                 int              `json:"signedUrlTtl"`
	BlackedOut                   bool             `json:"blackedOut"`
	HandleReleases               bool             `json:"handleReleases"`
	HandleSnapshots              bool             `json:"handleSnapshots"`
	MaxUniqueSnapshots           int              `json:"maxUniqueSnapshots"`
	MaxUniqueTags                int              `json:"maxUniqueTags"`
	BlockPushingSchema1          bool             `json:"blockPushingSchema1"`
	SuppressPomConsistencyChecks bool             `json:"suppressPomConsistencyChecks"`
	ArchiveBrowsingEnabled       bool             `json:"archiveBrowsingEnabled"`
	PriorityResolution           bool             `json:"priorityResolution"`

	StoreArtifactsLocally             bool                  `json:"storeArtifactsLocally"`
	FetchJarsEagerly                  bool                  `json:"fetchJarsEagerly"`
	FetchSourcesEagerly               bool                  `json:"fetchSourcesEagerly"`
	ExternalDependencies              *DescriptorExternal   `json:"externalDependencies,omitempty"`
	ShareConfiguration                bool                  `json:"shareConfiguration"`
	URL                               string                `json:"url,omitempty"`
	HardFail                          bool                  `json:"hardFail"`
	Offline                           bool                  `json:"offline"`
	RetrievalCachePeriodSecs          int                   `json:"retrievalCachePeriodSecs"`
	MetadataRetrievalTimeoutSecs      int                   `json:"metadataRetrievalTimeoutSecs"`
	AssumedOfflinePeriodSecs          int                   `json:"assumedOfflinePeriodSecs"`
	MissedRetrievalCachePeriodSecs    int                   `json:"missedRetrievalCachePeriodSecs"`
	UnusedArtifactsCleanupPeriodHours int                   `json:"unusedArtifactsCleanupPeriodHours"`
	SynchronizeProperties             bool                  `json:"synchronizeProperties"`
	ListRemoteFolderItems             bool                  `json:"listRemoteFolderItems"`
	BypassHeadRequests                bool                  `json:"bypassHeadRequests"`
	RejectInvalidJars                 bool                  `json:"rejectInvalidJars"`
	NuGet                             *DescriptorNuGet      `json:"nuget,omitempty"`
	PyPI                              *DescriptorPyPI       `json:"pypi,omitempty"`
	VCS                               *DescriptorVCS        `json:"vcs,omitempty"`
	Bower                             *DescriptorRegistry   `json:"bower,omitempty"`
	Composer                          *DescriptorRegistry   `json:"composer,omitempty"`
	CocoaPods                         *DescriptorCocoaPods  `json:"cocoaPods,omitempty"`
	Helm                              *DescriptorRegistry   `json:"helm,omitempty"`
	Git                               *DescriptorRegistry   `json:"git,omitempty"`
	Terraform                         *DescriptorRegistry   `json:"terraform,omitempty"`
	Hex                               *DescriptorRegistry   `json:"hex,omitempty"`
	Go                                *DescriptorGo         `json:"go,omitempty"`
	HuggingFace                       *DescriptorHF         `json:"huggingFace,omitempty"`
	Ansible                           *DescriptorRegistry   `json:"ansible,omitempty"`
	BlockMismatchingMimeTypes         bool                  `json:"blockMismatchingMimeTypes"`
	MismatchingMimeTypesOverrideList  string                `json:"mismatchingMimeTypesOverrideList,omitempty"`
	RepoLayoutRef                     string                `json:"repoLayoutRef,omitempty"`
	CargoConfig                       *DescriptorCargo      `json:"cargoConfig,omitempty"`
	PrimaryKeyPairRef                 string                `json:"primaryKeyPairRef,omitempty"`
	SecondaryKeyPairRef               string                `json:"secondaryKeyPairRef,omitempty"`
	Xray                              DescriptorXray        `json:"xray"`
	DownloadRedirect                  EnabledFlag           `json:"downloadRedirect"`
	CDNRedirect                       EnabledFlag           `json:"cdnRedirect"`
	RemoteRepoChecksumPolicyType      string                `json:"remoteRepoChecksumPolicyType"`
	RemoteRepoLayoutRef               string                `json:"remoteRepoLayoutRef,omitempty"`
	ContentSynchronisation            DescriptorContentSync `json:"contentSynchronisation"`
}

RemoteDescriptor is the shared remote configuration, GET /api/repositories/{key}/configuration: 7.161.26's HttpRepoDescriptor as RepoConfigurationResource.getRemoteDescriptor builds it from the stored remote (HttpRepoDescriptor(RemoteRepoConfig, ...)), masks it (maskData clears the username, password, proxy, local address and property sets) and writes it with the REST JsonProvider's mapper.

That mapper reads the descriptors' JAXB annotations after Jackson's own (JakartaXmlBindAnnotationModule, priority SECONDARY) and leaves nulls out (NON_NULL). The package's @XmlAccessorType(FIELD) makes it write every field but the @XmlTransient ones (enableNormalizedVersion, forceP2Authentication, dockerProjectId, sendContext, passThrough, curated, cocoaPodsCdnUrl) and no getter, so queryParams is the raw field. A field's @XmlElement name renames it (xray, downloadRedirect, cdnRedirect, remoteRepoChecksumPolicyType, customHttpHeader), an @XmlIDREF writes the referenced object's id (repoLayoutRef, remoteRepoLayoutRef and the key pair refs), and an enumeration writes its @JsonProperty name (the RepoType names PackageTypeName gives, GEN_IF_ABSENT, GIT, GITHUB).

The fields follow the mapper's order as read from Jackson's property collector [I]: "@class", then key (the @XmlID, which Jackson's object identity puts first), HttpRepoDescriptor's propOrder, the fields without an @XmlElement name superclass first, then the renamed ones. JSON objects are unordered, so no client depends on it.

What artifactweave does not hold is left out, as 7.x leaves out a null: gridTopologyId, p2OriginalUrl, the PyPI context paths, the Ansible authUrl. A string artifactweave holds empty is left out too, though 7.x may hold "" for some [I].

func Descriptor

func Descriptor(c Config) RemoteDescriptor

Descriptor returns the shared remote configuration of the remote repository c. Each value is what HttpRepoDescriptor's constructor sets from the stored configuration, or the descriptor's field default where artifactweave holds none; the per-type settings follow its setPackageTypeConfig:

  • the Maven group (Maven, Gradle, Ivy, SBT, P2) takes suppressPomConsistencyChecks, fetchJarsEagerly, fetchSourcesEagerly and rejectInvalidJars from its configuration, and every other type has true, false, false and false;
  • Docker, OCI and Helm OCI take dockerApiVersion, blockPushingSchema1, maxUniqueTags and externalDependencies, and every other type has V2, true and 0. 7.161.26's switch names OCI alone, but its reverse mapping (buildPackageTypeConfig) and its defaults (RemoteDefaultPackageConfigSetter) treat the three alike (isDockerGroup), so Docker and Helm OCI losing their settings is not what it intends;
  • NuGet, Conan and Debian take forceNugetAuthentication, forceConanAuthentication and ddebSupported, false for the others;
  • externalDependencies, for Go, Helm, the Docker group, CocoaPods, Swift, AI editor extensions and Terraform, appears when the repository holds externalDependenciesEnabled, as 7.x's appears when the configuration has the key;
  • vcs appears for VCS always, and for Go, Bower, CocoaPods, Composer and Terraform when vcsType is set;
  • each type's own object (nuget, pypi, bower, composer, cocoaPods, helm, terraform, hex, go, huggingFace, ansible, cargoConfig and, for Cargo with a gitRegistryUrl, git) appears for that type only.

The xray, downloadRedirect, cdnRedirect and contentSynchronisation objects appear for every remote: 7.x builds each when the stored configuration has it, which a remote created through the REST API is assumed to have [I]. A sensitive header's value is "" as Masked gives it: maskData leaves header values alone, but a sensitive header is one whose value 7.x keeps from readers, and this answer goes to every signed-in user [I]. A user name and password written into the URL are left out, as 7.x moves them into the username and password on save (RemoteRepoConfig.processUrlCredentials, which repos.PrepareCreate and repos.Merge follow) and maskData then clears them.

type RepoPatterns

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

RepoPatterns are a repository's include and exclude patterns: Ant patterns, comma-separated in the configuration. AQL filters what it finds with them, and the generic format refuses writes they reject.

func PatternsOf

func PatternsOf(c Config) RepoPatterns

PatternsOf compiles c's patterns. An unset or empty includesPattern includes everything, as Artifactory's default "**/*" does.

func (RepoPatterns) Accepts

func (p RepoPatterns) Accepts(path string, folder bool) bool

Accepts reports whether the patterns admit path. A folder is admitted when an include could match something below it, so the folders leading to included files stay visible.

type SnapshotVersionBehavior

type SnapshotVersionBehavior string

SnapshotVersionBehavior decides how Maven snapshot file names are stored.

const (
	Unique    SnapshotVersionBehavior = "unique"
	NonUnique SnapshotVersionBehavior = "non-unique"
	Deployer  SnapshotVersionBehavior = "deployer"
)

Snapshot version behaviours.

type TerraformType

type TerraformType string

TerraformType distinguishes module and provider registries.

const (
	TerraformModule   TerraformType = "MODULE"
	TerraformProvider TerraformType = "PROVIDER"
)

Terraform repository types.

func (*TerraformType) UnmarshalJSON

func (t *TerraformType) UnmarshalJSON(b []byte) error

UnmarshalJSON accepts any case because JFrog's own Terraform provider sends "module" and "provider" while the documentation and the server use upper case.

type VCSGitProvider

type VCSGitProvider string

VCSGitProvider names the Git hosting flavour of a VCS remote.

const (
	GitHub           VCSGitProvider = "GITHUB"
	GitHubEnterprise VCSGitProvider = "GITHUBENTERPRISE"
	GitLab           VCSGitProvider = "GITLAB"
	Bitbucket        VCSGitProvider = "BITBUCKET"
	OldStash         VCSGitProvider = "OLDSTASH"
	Stash            VCSGitProvider = "STASH"
	ArtifactoryVCS   VCSGitProvider = "ARTIFACTORY"
	CustomVCS        VCSGitProvider = "CUSTOM"
)

VCS Git providers.

type ValidationError

type ValidationError []FieldError

ValidationError is the list of field errors Validate found. It unwraps to ErrInvalid.

func (ValidationError) Error

func (es ValidationError) Error() string

Error is ErrInvalid's text, a colon, then every field error in the order they were found, joined by "; ". The text is the message of the 400 response a refused create or update gets.

func (ValidationError) Unwrap

func (es ValidationError) Unwrap() error

Unwrap lets errors.Is(err, ErrInvalid) work on the list.

Jump to

Keyboard shortcuts

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