Documentation ¶
Overview ¶
Package cloubotics helps to write operators for different cloud provides like AWS, Azure, or Google Cloud. This way you can monitor the creation, change and deletion of resources and react on them.
Example ¶
Example shows the usage of the cloubotics package.
package main import ( "context" "fmt" "time" "tideland.dev/go/cloubotics" "tideland.dev/go/cloubotics/providers/aws" "tideland.dev/go/cloubotics/types" ) func main() { ctx := context.Background() provider, err := aws.NewProvider(ctx) if err != nil { panic(err) } config, err := types.NewConfig(types.WithProvider(provider)) if err != nil { panic(err) } cloud := cloubotics.NewCloud(ctx, config) mnr, err := cloud.Machines(types.Selector{ IDs: []types.ID{}, Filters: []types.Filter{ { Type: "tag", Name: "env", Values: []string{"test"}, }, }, }).Reconcile(func(res types.Resource) error { // Do something with the machine resource. fmt.Printf("machine: %v\n", res.ID()) return nil }) // Wait some time, then stop the reconciliation. time.Sleep(30 * time.Second) mnr.Stop() }
Output:
Index ¶
Examples ¶
Constants ¶
View Source
const (
// Version is the current version of the cloubotics package.
Version = "0.1.0"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cloud ¶
type Cloud struct {
// contains filtered or unexported fields
}
Cloud is the manager for cloud services.
func (*Cloud) Done ¶
func (c *Cloud) Done() <-chan struct{}
Done allows to wait for the cloud manager to be stopped.
Click to show internal directories.
Click to hide internal directories.