providercontract

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 4 Imported by: 0 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 providercontract describes explicit resource-provider operations. It does not describe Harness capabilities or external API optional fields.

Index

Constants

View Source
const Supported = "supported"
View Source
const Unsupported = "unsupported"

Variables

View Source
var ErrContract = errors.New("invalid provider operation declaration")
View Source
var ErrUnsupported = errors.New("provider operation unsupported")

Functions

func Require

func Require(p Declared, operation string) error

func UnsupportedReason

func UnsupportedReason(err error, operation string) (string, bool)

UnsupportedReason verifies the operation and safe code before callers fall back or publish the reason. A bare sentinel is a contract violation.

func Validate

func Validate(p Declared, contracts ...reflect.Type) error

Validate checks the existing small interfaces, including methods declared unsupported. Every adapter must explicitly implement those rejections. A new method cannot be silently covered by an old declaration or stub.

Types

type Declared

type Declared interface{ ProviderOperations() Operations }

type Operations

type Operations map[string]Support

Zero values are omissions, never an unsupported declaration.

type Support

type Support struct {
	State  string `json:"state"`
	Reason string `json:"reason,omitempty"`
}

func (Support) Check

func (s Support) Check(operation string) error

type UnsupportedError

type UnsupportedError struct {
	Operation string `json:"operation"`
	Reason    string `json:"reason"`
}

UnsupportedError contains only an operation name and an authored safe code. It never carries a native error, credential, endpoint or resource identifier.

func (*UnsupportedError) Error

func (e *UnsupportedError) Error() string

func (*UnsupportedError) Unwrap

func (e *UnsupportedError) Unwrap() error

Jump to

Keyboard shortcuts

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