Initial commit

This commit is contained in:
2021-03-21 23:10:46 +01:00
commit 3144420a47
22 changed files with 2364 additions and 0 deletions

29
cloud/google.go Normal file
View File

@@ -0,0 +1,29 @@
package gcp
import (
"context"
"fmt"
"google.golang.org/api/compute/v1"
)
// ComputeClient wraps the original *compute.Service
type ComputeClient struct {
*compute.Service
Project string
}
// NewComputeClient will initialize a GCP compute API client
func NewComputeClient(project string) (*ComputeClient, error) {
var err error
ctx := context.Background()
s, err := compute.NewService(ctx)
if err != nil {
err = fmt.Errorf("Couldn't initialize GCP client (Compute): %v", err)
return nil, err
}
computeService := &ComputeClient{s, project}
return computeService, nil
}