etcdhandler

package
v0.0.0-...-7eac525 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Proof of Concepts for the Cloud-Barista Multi-Cloud Project.

ETCD Hander (ETCD Version 3 API, Thanks ETCD.)

by powerkim@powerkim.co.kr, 2019.03.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddServer

func AddServer(ctx context.Context, cli *clientv3.Client, provider *string, instanceId *string, addserver *string, fetchtype *string)

func AddServerToService

func AddServerToService(ctx context.Context, cli *clientv3.Client, svcId *string, svcName *string, provider *string, instanceId *string, addserver *string, fetchtype *string)

func AddService

func AddService(ctx context.Context, cli *clientv3.Client, svcId *string, svcName *string, fetchtype *string)

func Close

func Close(cli *clientv3.Client)

func Connect

func Connect(moniServerPort *string) (*clientv3.Client, error)

func DelAllServers

func DelAllServers(ctx context.Context, cli *clientv3.Client)

func DelAllSvcs

func DelAllSvcs(ctx context.Context, cli *clientv3.Client)
func AddServerToSvc(ctx context.Context, cli *clientv3.Client, provider *string, instanceId *string, addserver *string, fetchtype *string) {
        // /server/aws/i-1234567890abcdef0/129.254.175:2019  PULL
        cli.Put(ctx, "/server/"+ *provider + "/" + *instanceId + "/" + *addserver, *fetchtype)
        fmt.Println("added a " + *addserver + " into the Server List...\n")
}
func DelSvc(ctx context.Context, cli *clientv3.Client, delserver *string) {
        // get with prefix, all list of /server's key
        resp, err := cli.Get(ctx, "/server", clientv3.WithPrefix(), clientv3.WithSort(clientv3.SortByKey, clientv3.SortDescend))
        if err != nil {
                log.Fatal(err)
        }

        for _, ev := range resp.Kvs {
                //fmt.Printf("%s : %s\n", strings.Trim(string(ev.Key), "/server/"), ev.Value)
                // /server/aws/i-1234567890abcdef0/129.254.175:2019
                if strings.Contains(string(ev.Key), *delserver) {
                        cli.Delete(ctx, string(ev.Key))
                        fmt.Println("deleted a " + *delserver + " from the Server List...\n")
                }
        }
}

func DelProviderAllServers

func DelProviderAllServers(ctx context.Context, cli *clientv3.Client, provider *string)

func DelProviderServer

func DelProviderServer(ctx context.Context, cli *clientv3.Client, provider *string, delserver *string)

func DelServer

func DelServer(ctx context.Context, cli *clientv3.Client, delserver *string)

func GetServersInService

func GetServersInService(ctx context.Context, cli *clientv3.Client, serviceId *string) []*string

func InstanceIDListAWS

func InstanceIDListAWS(ctx context.Context, cli *clientv3.Client) []*string

func InstanceIDListAZURE

func InstanceIDListAZURE(ctx context.Context, cli *clientv3.Client) []*string

func InstanceIDListGCP

func InstanceIDListGCP(ctx context.Context, cli *clientv3.Client) []*string

func ServerList

func ServerList(ctx context.Context, cli *clientv3.Client) []*string

func ServerListAWS

func ServerListAWS(ctx context.Context, cli *clientv3.Client) []*string

func ServerListGCP

func ServerListGCP(ctx context.Context, cli *clientv3.Client) []*string

func ServiceList

func ServiceList(ctx context.Context, cli *clientv3.Client) []*string

Types

This section is empty.

Directories

Path Synopsis
Proof of Concepts for the Cloud-Barista Multi-Cloud Project.
Proof of Concepts for the Cloud-Barista Multi-Cloud Project.

Jump to

Keyboard shortcuts

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