manifest

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

manifest contains the parsing and validation logic for a resource provider manifest.

Resource provider manifests are authored by users and used to define the resource types that a resource provider supports.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEmptyResourceProvider added in v0.52.0

func CreateEmptyResourceProvider(ctx context.Context, clientFactory *v20231001preview.ClientFactory, planeName string, resourceProvider ResourceProvider, logger func(format string, args ...any)) error

CreateEmptyResourceProvider creates a resource provider with empty location (no types)

func EnsureResourceProviderExists added in v0.52.0

func EnsureResourceProviderExists(ctx context.Context, clientFactory *v20231001preview.ClientFactory, planeName string, resourceProvider ResourceProvider, logger func(format string, args ...any)) error

EnsureResourceProviderExists ensures a resource provider exists, creating it if necessary

func NewTestClientFactory added in v0.43.0

func NewTestClientFactory(resourceProvidersServer func() ucpfake.ResourceProvidersServer) (*v20231001preview.ClientFactory, error)

NewTestClientFactory creates a new client factory for testing purposes.

func RegisterDirectory added in v0.43.0

func RegisterDirectory(ctx context.Context, clientFactory *v20231001preview.ClientFactory, planeName string, directoryPath string, logger func(format string, args ...any)) error

RegisterDirectory registers all manifest files in a directory

func RegisterFile added in v0.43.0

func RegisterFile(ctx context.Context, clientFactory *v20231001preview.ClientFactory, planeName string, filePath string, logger func(format string, args ...any)) error

RegisterFile registers a manifest file

func RegisterResourceProvider added in v0.49.0

func RegisterResourceProvider(ctx context.Context, clientFactory *v20231001preview.ClientFactory, planeName string, resourceProvider ResourceProvider, logger func(format string, args ...any)) error

RegisterResourceProvider registers a resource provider

func RegisterType added in v0.43.0

func RegisterType(ctx context.Context, clientFactory *v20231001preview.ClientFactory, planeName string, filePath string, typeName string, logger func(format string, args ...any)) error

RegisterType registers a type specified in a manifest file

func WithAPIVersionServerNoError added in v0.43.0

func WithAPIVersionServerNoError() ucpfake.APIVersionsServer

func WithLocationServerNoError added in v0.43.0

func WithLocationServerNoError() ucpfake.LocationsServer

func WithResourceProviderServerInternalError added in v0.43.0

func WithResourceProviderServerInternalError() ucpfake.ResourceProvidersServer

func WithResourceProviderServerNoError added in v0.43.0

func WithResourceProviderServerNoError() ucpfake.ResourceProvidersServer

func WithResourceProviderServerNotFoundError added in v0.43.0

func WithResourceProviderServerNotFoundError() ucpfake.ResourceProvidersServer

func WithResourceTypeServerNoError added in v0.43.0

func WithResourceTypeServerNoError() ucpfake.ResourceTypesServer

Types

type ResourceProvider

type ResourceProvider struct {
	// Namespace is the resource provider name. This is also the namespace of the types defined by the resource provider.
	Namespace string `yaml:"namespace" validate:"required,resourceProviderNamespace"`

	// Location is a map of location name to address in the resource provider.
	Location map[string]string `yaml:"location,omitempty"`

	// Types is a map of resource types in the resource provider.
	Types map[string]*ResourceType `yaml:"types" validate:"dive,keys,resourceType,endkeys,required"`
}

ResourceProvider represents a resource provider manifest.

func ReadBytes

func ReadBytes(data []byte) (*ResourceProvider, error)

ReadBytes reads a resource provider manifest from a byte slice.

func ReadFile

func ReadFile(filePath string) (*ResourceProvider, error)

ReadFile reads a resource provider manifest from a file.

func ValidateManifest added in v0.49.0

func ValidateManifest(ctx context.Context, path string) (resourceProvider *ResourceProvider, err error)

ValidateManifest validates manifest file and returns a resourceprovider if no errors

type ResourceType

type ResourceType struct {
	// Capabilities is a list of capabilities for the resource type.
	Capabilities []string `yaml:"capabilities" validate:"dive,capability"`

	// DefaultAPIVersion is the default API version for the resource type.
	DefaultAPIVersion *string `yaml:"defaultApiVersion,omitempty" validate:"omitempty,apiVersion"`

	// APIVersions is a map of API versions for the resource type.
	APIVersions map[string]*ResourceTypeAPIVersion `yaml:"apiVersions" validate:"dive,keys,apiVersion,endkeys,required"`

	// Description of the resource type.
	Description *string `yaml:"description,omitempty"`
}

ResourceType represents a resource type in a resource provider manifest.

type ResourceTypeAPIVersion

type ResourceTypeAPIVersion struct {
	// Schema is the schema for the resource type.
	//
	// TODO: this allows anything right now, and will be ignored. We'll improve this in
	// a future pull-request.
	Schema any `yaml:"schema" validate:"required"`
}

Jump to

Keyboard shortcuts

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