cloudsweeper

package
v0.0.0-...-230cbbc Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2019 License: BSD-2-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package cloudsweeper is where all the 'sweeping logic is defined. Such as what to notify about and what to clean up. For using Cloudsweeper in larger organizations, the Organization structure was implemeted.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSAccount

type AWSAccount struct {
	ID                  string `json:"id"`
	CloudsweeperEnabled bool   `json:"cloudsweeper_enabled,omitempty"`
}

AWSAccount represents an account in AWS. An account can have automatic cleanup enabled, indiacated by the CloudsweeperEnabled attribute.

type AWSAccounts

type AWSAccounts []*AWSAccount

AWSAccounts is a list of AWSAccount

type Department

type Department struct {
	Number int    `json:"number"`
	ID     string `json:"id"`
	Name   string `json:"name"`
}

Department represents a department in your org

type Departments

type Departments []*Department

Departments is a list of Department

type Employee

type Employee struct {
	Username     string      `json:"username"`
	RealName     string      `json:"real_name"`
	ManagerID    string      `json:"manager"`
	Manager      *Employee   `json:"-"`
	DepartmentID string      `json:"department"`
	Department   *Department `json:"-"`
	Disabled     bool        `json:"disabled,omitempty"`
	AWSAccounts  AWSAccounts `json:"aws_accounts"`
	GCPProjects  GCPProjects `json:"gcp_projects"`
}

Employee represents an employee, which belong to a department and has a manager. An employee can also have multiple accounts and projects associated with them in AWS and GCP. "Disabled" employees are employees who should no longer be regarded as active in the company

type Employees

type Employees []*Employee

Employees is a list of Employee

type GCPProject

type GCPProject struct {
	ID                  string `json:"id"`
	CloudsweeperEnabled bool   `json:"cloudsweeper_enabled,omitempty"`
}

GCPProject represents a project in GPC. A project can have automatic cleanup enabled, indiacated by the CloudsweeperEnabled attribute.

type GCPProjects

type GCPProjects []*GCPProject

GCPProjects is a list of GCPProject

type Organization

type Organization struct {
	Managers    Employees   `json:"-"`
	ManagerIDs  []managerID `json:"managers"`
	Departments Departments `json:"departments"`
	Employees   Employees   `json:"employees"`
	// contains filtered or unexported fields
}

Organization represents the employees, their departments, and their managers within an organization. This structure was set up for an org wherein all employees have their own cloud accounts, and are aggregated under a single payer account. In the case you have only a single account, this will be superfluous.

func InitOrganization

func InitOrganization(orgData []byte) (*Organization, error)

InitOrganization initializes an organisation from raw data, e.g. the contents of a JSON file.

func (*Organization) AccountToUserMapping

func (org *Organization) AccountToUserMapping(csp cloud.CSP) map[string]string

AccountToUserMapping is a helper method that maps accounts to their owners username. This is useful for sending out emails to the owner of an account.

func (*Organization) EmployeesForManager

func (org *Organization) EmployeesForManager(manager *Employee) (Employees, error)

EmployeesForManager gets all the employees who has the specifed manager as their manager.

func (*Organization) EnabledAccounts

func (org *Organization) EnabledAccounts(csp cloud.CSP) []string

EnabledAccounts will return a list of all cloudsweeper enabled accounts in the specified CSP

func (*Organization) UsernameToEmployeeMapping

func (org *Organization) UsernameToEmployeeMapping() map[string]*Employee

UsernameToEmployeeMapping is a helper method that returns a map of username to Employee struct.

Directories

Path Synopsis
Package find is containing functionality to find more information about a cloud resource given its ID.
Package find is containing functionality to find more information about a cloud resource given its ID.
Package notify is responsible for all actions related to notifying employees and managers about their resources.
Package notify is responsible for all actions related to notifying employees and managers about their resources.

Jump to

Keyboard shortcuts

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