sandbox

package
v0.0.0-...-62dd403 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: CC0-1.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFirstResource

func GetFirstResource(
	space cfclient.Space,
	apps []cfclient.App,
	instances []cfclient.ServiceInstance,
) (time.Time, error)

GetFirstResource gets the creation timestamp of the earliest-created resource in a space

func ListOrgResources

func ListOrgResources(
	client *cfclient.Client,
	org cfclient.Org,
) (
	spaces []cfclient.Space,
	apps []cfclient.App,
	instances []cfclient.ServiceInstance,
	err error,
)

ListOrgResources fetches apps, service instances, and spaces within an organization

func ListPurgeSpaces

func ListPurgeSpaces(
	spaces []cfclient.Space,
	apps []cfclient.App,
	instances []cfclient.ServiceInstance,
	now time.Time,
	notifyThreshold int,
	purgeThreshold int,
	timeStartsAt time.Time,
) (
	toNotify []SpaceDetails,
	toPurge []SpaceDetails,
	err error,
)

ListPurgeSpaces identifies spaces that will be notified or purged

func ListRecipients

func ListRecipients(userGUIDs map[string]bool, roles []cfclient.SpaceRole) (addresses, developers, managers []string)

ListRecipients get a list of recipient emails from space roles

func ListSandboxOrgs

func ListSandboxOrgs(client *cfclient.Client, prefix string) ([]cfclient.Org, error)

ListSandboxOrgs lists all sandbox organizations

func PurgeSpace

func PurgeSpace(client *cfclient.Client, space cfclient.Space) error

PurgeSpace deletes a space; if the delete fails, it deletes all applications within the space

func RenderTemplate

func RenderTemplate(tmpl *template.Template, data map[string]interface{}) (string, error)

RenderTemplate renders a template to string

func SendMail

func SendMail(
	opts SMTPOptions,
	sender string,
	subject string,
	body string,
	recipients []string,
) error

SendMail sends email via SMTP

Types

type SMTPOptions

type SMTPOptions struct {
	SMTPHost string `envconfig:"smtp_host" required:"true"`
	SMTPPort int    `envconfig:"smtp_port" default:"587"`
	SMTPUser string `envconfig:"smtp_user" required:"true"`
	SMTPPass string `envconfig:"smtp_pass" required:"true"`
	SMTPCert string `envconfig:"smtp_cert"`
}

SMTPOptions describes configation for sending mail via SMTP

type SpaceDetails

type SpaceDetails struct {
	Timestamp time.Time
	Space     cfclient.Space
}

SpaceDetails describes a space and its first resource creation time

Jump to

Keyboard shortcuts

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