domains

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cert

func Cert(value string) basic.Op

func Description

func Description(value string) basic.Op

func FQDN

func FQDN(value string) basic.Op

func Id

func Id(value string) basic.Op

func Key

func Key(value string) basic.Op

func SmartOps

func SmartOps(value []string) basic.Op

func Tags

func Tags(value []string) basic.Op

func Type

func Type(value string) basic.Op

func UseCertificate

func UseCertificate(value bool) basic.Op

Types

type Domain

type Domain interface {
	Get() Getter
	common.Resource[*structureSpec.Domain]
}
Example
package main

import (
	"fmt"

	"github.com/spf13/afero"
	"github.com/taubyte/tau/pkg/schema/domains"
	"github.com/taubyte/tau/pkg/schema/project"
)

func main() {
	// Create a new file system in memory
	fs := afero.NewMemMapFs()

	// Open a new project with a virtual file system
	project, err := project.Open(project.VirtualFS(fs, "/"))
	if err != nil {
		return
	}

	// Create or open an domain
	dom, err := project.Domain("test_dom", "")
	if err != nil {
		return
	}

	// Set and write domain fields
	err = dom.Set(true,
		domains.Id("QmaEBKzOyrYL1D6gtqD86Nyr2hvXAxWHcMCu9ffxLaByMc"),
		domains.Description("a basic domain"),
		domains.Tags([]string{"tag1", "tag2"}),
		domains.FQDN("hal.computers.com"),
	)
	if err != nil {
		return
	}

	// Display the Description
	fmt.Println(dom.Get().Description())

	// Open the config.yaml of the domain
	config, err := afero.ReadFile(fs, "/domains/test_dom.yaml")
	if err != nil {
		return
	}

	// Print config.yaml
	fmt.Println(string(config))

}
Output:

a basic domain
id: QmaEBKzOyrYL1D6gtqD86Nyr2hvXAxWHcMCu9ffxLaByMc
description: a basic domain
tags:
    - tag1
    - tag2
fqdn: hal.computers.com

func Open

func Open(seer *seer.Seer, name, application string) (Domain, error)

type Getter

type Getter interface {
	basic.ResourceGetter[*structureSpec.Domain]
	FQDN() string
	UseCertificate() bool
	Type() string
	Cert() string
	Key() string
}

func Yaml

func Yaml(name, application string, yamlData []byte) (Getter, error)

Jump to

Keyboard shortcuts

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