Documentation
¶
Overview ¶
Package object is the object behavior: the objects of the Object Store of the fleet, which other behaviors read, such as the content of a file.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Behavior = behavior.Register(behavior.Define( "object", "The objects of the object store of the fleet, such as a file uploaded with osapi client file upload", behavior.Node, behavior.Internal, behavior.Platform(behavior.PlatformDebian, newStore), behavior.Platform(behavior.PlatformLinux, newStore), behavior.Platform(behavior.PlatformDarwin, newStore), behavior.Read("get", Get).Key("name"). Describe("Get an object of the object store"). Explain("Reads the object from the object store of the fleet, with the content type that "+ "its upload gave it, raw or template, and the SHA-256 of its content. A template is "+ "not rendered: the behavior that deploys it renders it. An agent with no object store "+ "reports skipped."). Example("A unit file", GetInput{Name: "example.service"}, Object{ Name: "example.service", Content: unit, ContentType: types.ContentRaw, SHA256: "4d38310b40344ae465b2f1f88758809f31ef1aa8287c756a1d65c76ca27dc243", }, behavior.Stored("example.service", unit, types.ContentRaw), ). Example("A template", GetInput{Name: "motd.tmpl"}, Object{ Name: "motd.tmpl", Content: "Welcome to {{ .Hostname }}\n", ContentType: types.ContentTemplate, SHA256: "08c60853fd0933d9903a112a64bb4c742c03961a4e56af1940173403a09746e2", }, behavior.Stored("motd.tmpl", "Welcome to {{ .Hostname }}\n", types.ContentTemplate), ). Fails("An object the store does not have", GetInput{Name: "nosuch"}, "not found"). Fails("No name", GetInput{}, "Name"). Fails("A name over 255 characters", GetInput{Name: strings.Repeat("a", 256)}, "Name"), ))
Behavior reads the objects of the object store of the fleet: the files that a person uploads once with osapi client file upload, and that behaviors deploy by name. It is a building block: a behavior that deploys a file requires it, gets the content with it, and writes the content with managedfile.
Functions ¶
This section is empty.
Types ¶
type GetInput ¶
type GetInput struct {
Name string `` /* 150-byte string literal not displayed */
}
GetInput names the object to read.
type Object ¶
type Object struct {
Name string `json:"name" doc:"The name of the object"`
Content string `json:"content" doc:"The content of the object"`
ContentType types.ContentType `json:"content_type" doc:"raw, or template for an object whose content is a Go template"`
SHA256 string `json:"sha256" doc:"The SHA-256 of the content, in hex"`
}
Object is an object of the object store.