ocitags

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ocitags validates OCI free-form and defined tags against the documented limits and tag definitions.

Index

Constants

View Source
const (
	MaxFreeform  = 10
	MaxDefined   = 64
	MaxKeyLen    = 100
	MaxValueLen  = 256
	MaxTotalSize = 5 * 1024
)

Limits from https://docs.oracle.com/en-us/iaas/Content/Tagging/Concepts/taggingoverview.htm.

Variables

This section is empty.

Functions

This section is empty.

Types

type Def

type Def struct {
	EnumValues []string
	HasEnum    bool
	Retired    bool
}

Def is what a tag definition contributes to validation.

type Error

type Error struct {
	Code    string
	Message string
	Status  int
}

Error carries the OCI status and code for a rejected tag set.

func Validate

func Validate(free map[string]string, defined map[string]map[string]any, lookup Lookup) *Error

Validate checks tag counts, key and value shapes, total size and, when lookup is not nil, that every defined tag names an existing, active namespace and key whose ENUM validator accepts the value.

func (*Error) Error

func (e *Error) Error() string

type Lookup

type Lookup func(namespace, key string) (def Def, found bool)

Lookup resolves a namespace and key (case-insensitive) to its definition; found is false when either is unknown.

Jump to

Keyboard shortcuts

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