manifest

package
v0.43.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: Apache-2.0 Imports: 21 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 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 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 {
	// Name is the resource provider name. This is also the namespace of the types defined by the resource provider.
	Name string `yaml:"name" 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.

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"`
}

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