cloubotics

package module
v0.0.0-...-31a046a Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: BSD-3-Clause Imports: 2 Imported by: 0

README

Tideland Go Cloud Robotics

GitHub release GitHub license Go Module GoDoc Workflow Go Report Card

Description

Reconciler for cloud provider ressources analogous to the Kubernetes Operator SDK. Starting with AWS, later GCP, Azure and others will follow.

Contributors

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 NewCloud

func NewCloud(ctx context.Context, config *types.Config) *Cloud

NewCloud creates a new cloud manager with the given options.

func (*Cloud) Done

func (c *Cloud) Done() <-chan struct{}

Done allows to wait for the cloud manager to be stopped.

func (*Cloud) Err

func (c *Cloud) Err() error

Err returns an error if the cloud manager was stopped with an error.

func (*Cloud) Machines

func (c *Cloud) Machines(selector types.Selector) types.Machiner

Machines returns the selected machines of the cloud.

func (*Cloud) Stop

func (c *Cloud) Stop()

Stop stops the cloud manager.

Directories

Path Synopsis
providers
aws

Jump to

Keyboard shortcuts

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