Documentation
¶
Overview ¶
Package wire holds the JFrog JSON forms that artifactweave exchanges field for field: the legacy v1 and v2 permission targets, the Access v2 permission, the legacy and Access user and group documents, the proxy descriptor, the Smart Remote statistics submission, the JFrog CLI's multipart upload status and the blob mirror additions to the storage summary.
Role ¶
kernel layer: the JFrog wire forms (camelCase, snake_case and kebab-case mixed as JFrog sends them), which converters and handlers map to and from the domain model. It declares types only and imports nothing, so the generated artifactory server and client, the converters and the handlers can all name these types without depending on the domain model.
Inputs ¶
None at run time: the package declares types only.
Outputs ¶
- BlobMirror and the types it holds: the generated artifactory server and client type the storage summary's blobMirrors field with it, named through x-go-type-import in api/src/artifactory/paths-storage.yaml.
- The permission target, permission, user and group forms, which the domain model's converters map to and from one internal shape per entity (decision 0020), and which the security handlers decode and encode.
- StorageSummaryMirrors for the storage summary, MultipartUploadStatus for the JFrog CLI's multipart upload status poll, ProxyConfiguration for the stored proxy descriptor that the remote resolver reads, and SmartStatistics for Smart Remote synchronization.
Invariants ¶
- JSON tags are the wire contract that JFrog's clients read (the JFrog CLI, jfrog-client-go and the JFrog Terraform providers), so a tag never changes to satisfy a linter. Tags use JFrog's names, and artifactweave's own additions to a JFrog document follow that document's case. .golangci.yml exempts this package from tagliatelle's snake_case rule, and decision 0002 limits the exception to the wire models.
- Booleans whose default is not false are pointers, so a converter can tell an absent field from false when a client omits it.
References ¶
- Decision 0002: docs/research/decisions/0002-spec-first-flat-crud-handwritten-item-paths.md, "Wire models and the linter".
- Decision 0020: docs/research/decisions/0020-domain-model.md, "One internal representation per entity" (wire forms live only in the wire packages, and converters produce and consume them).
- Decision 0044: docs/research/decisions/0044-modular-monolith-migration.md, "Public types and published api surface" and "Dependency rules" (rule 2: pkg/client may import this package and artifacts/api/repo, and platform/gen/** may import the same two as a named exception).
- Target layout: docs/research/architecture-options/5-modular-monolith.md, lines 118 to 125 (kernel/wire, the JFrog JSON structs) and line 1059 (the mapping row).
- Plan: docs/implementation/plan.md#p2-stores (task 0), #p4-identity-and-authorization and #p9d-modular-monolith-migration, epic PLT (https://github.com/weaveplatform/artifactweave/issues/938).
- https://github.com/weaveplatform/artifactweave/issues/976
Status ¶
Implemented P2 to P9: the permission target, permission, user and group forms with the domain model in P2 (#3), which the security APIs use from P4; the blob mirror summary in P2b (#66, #87); the multipart upload status in P3 (#91); the proxy descriptor (#645) and the Smart Remote statistics (#675) in P9. Moved here in P9d.
Testing ¶
The package has no tests of its own, since it holds no logic. The tests of the code that encodes each form pin its JSON:
- The permission, user and group forms: the domain model's round trips (TestUnitPermissionV1RoundTrip, TestUnitPermissionV2RoundTrip, TestUnitPermissionAccessRoundTrip, TestUnitUserLegacyRoundTrip, TestUnitUserAccessRoundTrip, TestUnitGroupRoundTrips) and TestUnitWireFormsEvaluateAlike.
- StorageSummaryMirrors: TestAccStorageInfoReportsMirrors.
- MultipartUploadStatus: TestAccMultipartUploadProtocol.
- ProxyConfiguration: TestAccResolverProxyConfiguration.
- SmartStatistics: TestAccSmartStatisticsClaimedOnceAndUncertainty.
Index ¶
- type AccessActions
- type AccessGroup
- type AccessPermission
- type AccessResource
- type AccessTarget
- type AccessUser
- type ActionsV2
- type BlobMirror
- type BlobMirrorMember
- type BlobMirrorRemovedMember
- type LegacyGroup
- type LegacyUser
- type MultipartUploadStatus
- type PermissionTargetV1
- type PermissionTargetV2
- type PrincipalsV1
- type ProxyConfiguration
- type ReplicaTally
- type SectionV2
- type SmartStatistics
- type StorageSummaryMirrors
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessActions ¶
type AccessActions struct {
Users map[string][]string `json:"users,omitempty"`
Groups map[string][]string `json:"groups,omitempty"`
}
AccessActions maps principal names to Access action names.
type AccessGroup ¶
type AccessGroup struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
AutoJoin *bool `json:"auto_join,omitempty"`
AdminPrivileges *bool `json:"admin_privileges,omitempty"`
ExternalID string `json:"external_id,omitempty"`
Members []string `json:"members,omitempty"`
ReportsManager *bool `json:"reports_manager,omitempty"`
WatchManager *bool `json:"watch_manager,omitempty"`
PolicyManager *bool `json:"policy_manager,omitempty"`
PolicyViewer *bool `json:"policy_viewer,omitempty"`
ManageResources *bool `json:"manage_resources,omitempty"`
ManageWebhook *bool `json:"manage_webhook,omitempty"`
Realm string `json:"realm,omitempty"`
RealmAttributes string `json:"realm_attributes,omitempty"`
}
AccessGroup is /access/api/v2/groups/{name}.
type AccessPermission ¶
type AccessPermission struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
Resources map[string]AccessResource `json:"resources"`
}
AccessPermission is /access/api/v2/permissions/{name}.
type AccessResource ¶
type AccessResource struct {
Actions AccessActions `json:"actions,omitzero"`
Targets map[string]AccessTarget `json:"targets"`
}
AccessResource is one resource section of an Access v2 permission.
type AccessTarget ¶
type AccessTarget struct {
IncludePatterns []string `json:"include_patterns"`
ExcludePatterns []string `json:"exclude_patterns"`
}
AccessTarget holds the patterns of one target.
type AccessUser ¶
type AccessUser struct {
Username string `json:"username"`
Email string `json:"email,omitempty"`
Password string `json:"password,omitempty"`
Groups []string `json:"groups,omitempty"`
Admin *bool `json:"admin,omitempty"`
ProfileUpdatable *bool `json:"profile_updatable,omitempty"`
InternalPasswordDisabled *bool `json:"internal_password_disabled,omitempty"`
DisableUIAccess *bool `json:"disable_ui_access,omitempty"`
WatchManager *bool `json:"watch_manager,omitempty"`
PolicyViewer *bool `json:"policy_viewer,omitempty"`
PolicyManager *bool `json:"policy_manager,omitempty"`
ReportsManager *bool `json:"reports_manager,omitempty"`
ResourcesManager *bool `json:"resources_manager,omitempty"`
ManageWebhook *bool `json:"manage_webhook,omitempty"`
PlatformAuditor *bool `json:"platform_auditor,omitempty"`
EffectiveAdmin *bool `json:"effective_admin,omitempty"`
LastLoggedIn *string `json:"last_logged_in"`
Realm string `json:"realm,omitempty"`
Status string `json:"status,omitempty"`
}
AccessUser is /access/api/v2/users/{username}. EffectiveAdmin, Realm, Status and LastLoggedIn are server-owned; Password is write-only. LastLoggedIn is always present and null for a user who never logged in, as Artifactory answers since 7.98.7.
type ActionsV2 ¶
type ActionsV2 struct {
Users map[string][]string `json:"users,omitempty"`
Groups map[string][]string `json:"groups,omitempty"`
}
ActionsV2 maps principal names to legacy action names (read, annotate, write, delete, manage, managedXrayMeta, distribute).
type BlobMirror ¶
type BlobMirror struct {
Tier string `json:"tier"`
Zone string `json:"zone,omitempty"`
Redundancy int `json:"redundancy"`
WriteQuorum int `json:"writeQuorum"`
// UnderReplicatedBlobs counts blobs with fewer present copies than
// Redundancy, not counting blobs being deleted.
UnderReplicatedBlobs int64 `json:"underReplicatedBlobs"`
Members []BlobMirrorMember `json:"members"`
// RemovedMembers are members with replica records that are no longer
// configured; always present, empty when there are none.
RemovedMembers []BlobMirrorRemovedMember `json:"removedMembers"`
}
BlobMirror is one mirrored blob tier, "blob" or "cold_blob".
type BlobMirrorMember ¶
type BlobMirrorMember struct {
Name string `json:"name"`
Zone string `json:"zone,omitempty"`
Backend string `json:"backend,omitempty"`
WriteEnabled bool `json:"writeEnabled"`
// Available is false while the member's breaker is open.
Available bool `json:"available"`
AverageLatencyMs int64 `json:"averageLatencyMs"`
// Replicas is keyed by replica state (present, pending, deleting,
// failed) and always holds all four.
Replicas map[string]ReplicaTally `json:"replicas"`
// SoleCopies counts the blobs whose only present copy is on this
// member; a drained member is safe to remove once it is zero.
SoleCopies int64 `json:"soleCopies"`
}
BlobMirrorMember is one member store of a BlobMirror.
type BlobMirrorRemovedMember ¶
type BlobMirrorRemovedMember struct {
Name string `json:"name"`
Replicas map[string]ReplicaTally `json:"replicas"`
SoleCopies int64 `json:"soleCopies"`
}
BlobMirrorRemovedMember is a member removed from the configuration that still has replica records. The mirror no longer reads from it, so its SoleCopies are out of reach until it is configured again.
type LegacyGroup ¶
type LegacyGroup struct {
Name string `json:"name"`
Description string `json:"description,omitempty"`
AutoJoin *bool `json:"autoJoin,omitempty"`
AdminPrivileges *bool `json:"adminPrivileges,omitempty"`
Realm string `json:"realm,omitempty"`
RealmAttributes string `json:"realmAttributes,omitempty"`
UserNames []string `json:"userNames,omitempty"`
WatchManager *bool `json:"watchManager,omitempty"`
PolicyManager *bool `json:"policyManager,omitempty"`
ReportsManager *bool `json:"reportsManager,omitempty"`
}
LegacyGroup is /artifactory/api/security/groups/{name}.
type LegacyUser ¶
type LegacyUser struct {
Name string `json:"name"`
Email string `json:"email,omitempty"`
Password string `json:"password,omitempty"`
Admin *bool `json:"admin,omitempty"`
ProfileUpdatable *bool `json:"profileUpdatable,omitempty"`
DisableUIAccess *bool `json:"disableUIAccess,omitempty"`
InternalPasswordDisabled *bool `json:"internalPasswordDisabled,omitempty"`
Groups []string `json:"groups,omitempty"`
Realm string `json:"realm,omitempty"`
LastLoggedIn string `json:"lastLoggedIn,omitempty"`
Status string `json:"status,omitempty"`
MFAStatus string `json:"mfaStatus,omitempty"`
PolicyViewer *bool `json:"policyViewer,omitempty"`
PolicyManager *bool `json:"policyManager,omitempty"`
WatchManager *bool `json:"watchManager,omitempty"`
ReportsManager *bool `json:"reportsManager,omitempty"`
}
LegacyUser is /artifactory/api/security/users/{name}. Password is write-only; status, realm, lastLoggedIn and mfaStatus are server-owned.
type MultipartUploadStatus ¶
type MultipartUploadStatus struct {
Status string `json:"status"`
Error string `json:"error,omitempty"`
Progress *int `json:"progress,omitempty"`
ChecksumToken string `json:"checksumToken,omitempty"`
}
MultipartUploadStatus answers the JFrog CLI's multipart upload status poll (POST /artifactory/api/v1/uploads/status), in the shape jfrog-client-go decodes (artifactory/services/utils/multipartupload.go).
type PermissionTargetV1 ¶
type PermissionTargetV1 struct {
Name string `json:"name"`
IncludesPattern string `json:"includesPattern,omitempty"`
ExcludesPattern string `json:"excludesPattern,omitempty"`
Repositories []string `json:"repositories"`
Principals PrincipalsV1 `json:"principals,omitzero"`
}
PermissionTargetV1 is /artifactory/api/security/permissions/{name}. Patterns are single comma-separated strings and the target covers repositories only.
type PermissionTargetV2 ¶
type PermissionTargetV2 struct {
Name string `json:"name"`
Repo *SectionV2 `json:"repo,omitempty"`
Build *SectionV2 `json:"build,omitempty"`
ReleaseBundle *SectionV2 `json:"releaseBundle,omitempty"`
}
PermissionTargetV2 is /artifactory/api/v2/security/permissions/{name}.
type PrincipalsV1 ¶
type PrincipalsV1 struct {
Users map[string][]string `json:"users,omitempty"`
Groups map[string][]string `json:"groups,omitempty"`
}
PrincipalsV1 maps principal names to action letters (r n w d m mxm x).
type ProxyConfiguration ¶
type ProxyConfiguration struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
PlatformDefault bool `json:"platformDefault"`
Services []string `json:"services"`
Domain string `json:"domain"`
NTHost string `json:"ntHost"`
RedirectedToHosts string `json:"redirectedToHosts"`
}
ProxyConfiguration is the non-secret Artifactory descriptor document stored separately from its sealed password. The remote resolver supports HTTP Basic proxies; NTLM-specific fields remain explicit unsupported configurations.
type ReplicaTally ¶
type ReplicaTally struct {
Count int64 `json:"count"`
Bytes int64 `json:"bytes"`
Size string `json:"size"`
}
ReplicaTally counts a member's replica records in one state; Size is Bytes human-formatted as the rest of the summary is.
type SectionV2 ¶
type SectionV2 struct {
IncludePatterns []string `json:"include-patterns"`
ExcludePatterns []string `json:"exclude-patterns"`
Repositories []string `json:"repositories"`
Actions ActionsV2 `json:"actions,omitzero"`
}
SectionV2 is one section of a legacy v2 target. The pattern keys are kebab-case inside an otherwise camelCase document, as JFrog defines them.
type SmartStatistics ¶
type SmartStatistics struct {
RepoPath string `json:"repoPath"`
Path string `json:"path"`
DownloadCount int64 `json:"downloadCount"`
LastDownloaded int64 `json:"lastDownloaded"`
LastDownloadedBy string `json:"lastDownloadedBy"`
RemoteDownloadCount int64 `json:"remoteDownloadCount"`
RemoteLastDownloaded int64 `json:"remoteLastDownloaded"`
RemoteLastDownloadedBy string `json:"remoteLastDownloadedBy"`
}
SmartStatistics is the historical Smart Remote submission shape. Current 7.x parity remains an inference until the #216 capture.
type StorageSummaryMirrors ¶
type StorageSummaryMirrors struct {
BlobMirrors []BlobMirror `json:"blobMirrors"`
}
StorageSummaryMirrors is artifactweave's addition to the storage summary (GET /artifactory/api/storageinfo, decision 0028). Artifactory reports nothing per shard, so these fields have no JFrog counterpart; they follow the summary's camelCase so the document reads as one.