2020-05-27 18:16:43 -04:00
|
|
|
package static_test
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
|
2020-08-10 17:15:02 -04:00
|
|
|
"github.com/hashicorp/boundary/internal/host/static"
|
2020-05-27 18:16:43 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
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"
|
2020-08-20 08:20:26 -07:00
|
|
|
host, _ := static.NewHost(catalogPublicId, static.WithAddress("127.0.0.1"))
|
2020-05-27 18:16:43 -04:00
|
|
|
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)
|
2020-08-17 11:00:41 -04:00
|
|
|
fmt.Println(member.SetId)
|
|
|
|
|
fmt.Println(member.HostId)
|
2020-05-27 18:16:43 -04:00
|
|
|
}
|