demo

package
v1.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package demo includes fake resource types for working on Consul's generic state storage without having to refer to specific features.

Index

Constants

View Source
const (
	ArtistV1ReadPolicy  = `key_prefix "resource/demo.v1.Artist/" { policy = "read" }`
	ArtistV1WritePolicy = `key_prefix "resource/demo.v1.Artist/" { policy = "write" }`
	ArtistV2ReadPolicy  = `key_prefix "resource/demo.v2.Artist/" { policy = "read" }`
	ArtistV2WritePolicy = `key_prefix "resource/demo.v2.Artist/" { policy = "write" }`
	ArtistV2ListPolicy  = `key_prefix "resource/" { policy = "list" }`
)

Variables

View Source
var (
	// TenancyDefault contains the default values for all tenancy units.
	TenancyDefault = &pbresource.Tenancy{
		Partition: "default",
		PeerName:  "local",
		Namespace: "default",
	}

	// TypeV1Artist represents a musician or group of musicians.
	TypeV1Artist = &pbresource.Type{
		Group:        "demo",
		GroupVersion: "v1",
		Kind:         "Artist",
	}

	// TypeV1Album represents a collection of an artist's songs.
	TypeV1Album = &pbresource.Type{
		Group:        "demo",
		GroupVersion: "v1",
		Kind:         "Album",
	}

	// TypeV2Artist represents a musician or group of musicians.
	TypeV2Artist = &pbresource.Type{
		Group:        "demo",
		GroupVersion: "v2",
		Kind:         "Artist",
	}

	// TypeV2Album represents a collection of an artist's songs.
	TypeV2Album = &pbresource.Type{
		Group:        "demo",
		GroupVersion: "v2",
		Kind:         "Album",
	}
)

Functions

func GenerateV2Album

func GenerateV2Album(artistID *pbresource.ID) (*pbresource.Resource, error)

GenerateV2Album generates a random Album resource, owned by the Artist with the given ID.

func GenerateV2Artist

func GenerateV2Artist() (*pbresource.Resource, error)

GenerateV2Artist generates a random Artist resource.

func RegisterControllers

func RegisterControllers(mgr *controller.Manager)

RegisterControllers registers controllers for the demo types. Should only be called in dev mode.

func RegisterTypes

func RegisterTypes(r resource.Registry)

RegisterTypes registers the demo types. Should only be called in tests and dev mode.

TODO(spatel): We're standing-in key ACLs for demo resources until our ACL system can be more modularly extended (or support generic resource permissions).

Types

This section is empty.

Jump to

Keyboard shortcuts

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