Files
threshold/internal/host/static/example_test.go
T
Michael Gaffney 7d133878be Add base types for host catalog, host set, and host (#272)
* Move static host migrations to higher number

* Add wt_host_address domain type

* Add base tables for host catalog, host set, and host

* Reformat create trigger statements

* Add subtype triggers for host catalog, host set, and host

* Remove wt_host_address domain type

* Rename columns in host_set_member

* Add delete trigger functions for base types

* Add delete after triggers to static host subtypes

* Add protobufs for host base types
2020-08-17 11:00:41 -04:00

40 lines
870 B
Go

package static_test
import (
"fmt"
"github.com/hashicorp/boundary/internal/host/static"
)
func ExampleNewHostCatalog() {
projectPublicId := "p_1234"
catalog, _ := static.NewHostCatalog(projectPublicId, static.WithName("my catalog"))
fmt.Println(catalog.Name)
// Output:
// my catalog
}
func ExampleNewHost() {
catalogPublicId := "sthc_1234"
host, _ := static.NewHost(catalogPublicId, "127.0.0.1")
fmt.Println(host.Address)
// Output:
// 127.0.0.1
}
func ExampleNewHostSet() {
catalogPublicId := "sthc_1234"
set, _ := static.NewHostSet(catalogPublicId, static.WithName("my host set"))
fmt.Println(set.Name)
// Output:
// my host set
}
func ExampleNewHostSetMember() {
setPublicId := "sths_11111"
hostPublicId := "sth_22222"
member, _ := static.NewHostSetMember(setPublicId, hostPublicId)
fmt.Println(member.SetId)
fmt.Println(member.HostId)
}