...

Package project

import "edge-infra.dev/pkg/lib/gcp/project"
Overview
Index

Overview ▾

Package project contains convenience functions for working with GCP projects, eg creation, deletion, updating billing accounts

Constants

const (
    // ProjectIDRegexpString is the regular expression that represents valid GCP
    // Project ID strings, per https://cloud.google.com/resource-manager/docs/creating-managing-projects#before_you_begin
    ProjectIDRegexpString = `^[a-z][-a-z0-9]{5,29}[a-z0-9]$`
)

func CreateWithBillingAccount

func CreateWithBillingAccount(crmSvc *crm.Service, cbSvc *cb.APIService, name, folderID, billing string) (*crm.Project, error)

CreateWithBillingAccount creates a new gcp project and associates it with the given billing account.

func DeleteProject

func DeleteProject(crmSvc *crm.Service, projectID string) error

DeleteProject deletes a gcp project associated to the provided project id.

func IsValidProjectID

func IsValidProjectID(id string) error

IsValidProjectID checks the input string against the regular expression for valid GCP Project IDs

func RandAN

func RandAN(n int) string

generates random names that conform to gcp project naming requirements

type IDValidationError

IDValidationError is a contextualized validation error for the Project ID

type IDValidationError struct {
    // contains filtered or unexported fields
}

func (*IDValidationError) Error

func (e *IDValidationError) Error() string

Error prints the contextualized validaton error message for the Project ID