models

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

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

Go to latest
Published: Aug 15, 2018 License: MPL-2.0 Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	ID           int           `json:"id"`
	Type         string        `json:"type,omitempty"`
	Status       string        `json:"status,omitempty"`
	ResourceID   string        `json:"resource_id,omitempty"`
	ResourceType string        `json:"resource_type,omitempty"`
	Options      ActionOptions `json:"options,omitempty"`
}

Action : stores environment action data

func (*Action) GetID

func (a *Action) GetID() string

GetID : get the id for the current object

type ActionOptions

type ActionOptions struct {
	Filters     []string `json:"filters,omitempty"`
	BuildID     string   `json:"build_id,omitempty"`
	Environment string   `json:"environment,omitempty"`
	Resolution  string   `json:"resolution,omitempty"`
}

ActionOptions : stores options associated with an action

type Authentication

type Authentication struct {
	Token string `json:"token"`
}

Authentication : stores the return token from an authentication request

type Build

type Build struct {
	ID            string                 `json:"id"`
	EnvironmentID int                    `json:"environment_id"`
	UserID        int                    `json:"user_id"`
	Username      string                 `json:"user_name"`
	Type          string                 `json:"type"`
	Status        string                 `json:"status"`
	Definition    string                 `json:"definition"`
	Mapping       map[string]interface{} `json:"mapping"`
	CreatedAt     string                 `json:"created_at"`
	UpdatedAt     string                 `json:"updated_at"`
	Validation    *Validation            `json:"validation"`
	VPCs          []struct {
		Name   string `json:"name"`
		ID     string `json:"vpc_id"`
		Subnet string `json:"vpc_subnet"`
	} `json:"vpcs"`
	Networks []struct {
		Name             string `json:"name"`
		Subnet           string `json:"network_aws_id"`
		AvailabilityZone string `json:"availability_zone"`
	} `json:"networks"`
	Instances []struct {
		Name          string `json:"name"`
		InstanceAWSID string `json:"instance_aws_id"`
		PublicIP      string `json:"public_ip"`
		IP            string `json:"ip"`
	} `json:"instances"`
	Nats []struct {
		Name            string `json:"name"`
		NatGatewayAWSID string `json:"nat_gateway_aws_id"`
		IP              string `json:"public_ip"`
	} `json:"nats"`
	SecurityGroups []struct {
		Name               string `json:"name"`
		SecurityGroupAWSID string `json:"security_group_aws_id"`
	} `json:"security_groups"`
	ELBs []struct {
		Name    string `json:"name"`
		DNSName string `json:"dns_name"`
	} `json:"elbs"`
	RDSClusters []struct {
		Name     string `json:"name"`
		Endpoint string `json:"endpoint"`
	} `json:"rds_clusters"`
	RDSInstances []struct {
		Name     string `json:"name"`
		Endpoint string `json:"endpoint"`
	} `json:"rds_instances"`
	EBSVolumes []struct {
		Name        string `json:"name"`
		VolumeAWSID string `json:"volume_aws_id"`
	} `json:"ebs_volumes"`
	LoadBalancers []struct {
		ID       string `json:"id"`
		Name     string `json:"name"`
		PublicIP string `json:"public_ip"`
	} `json:"load_balancers"`
	VirtualMachines []struct {
		ID        string `json:"id"`
		Name      string `json:"name"`
		PublicIP  string `json:"public_ip"`
		PrivateIP string `json:"private_ip"`
	} `json:"virtual_machines"`
	SQLDatabases []struct {
		ID         string `json:"id"`
		Name       string `json:"name"`
		ServerName string `json:"server_name"`
	} `json:"sql_databases"`
	IamPolicies []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
		Path string `json:"path"`
	} `json:"iam_policies"`
	IamRoles []struct {
		ID       string   `json:"id"`
		Name     string   `json:"name"`
		Path     string   `json:"path"`
		Policies []string `json:"policies"`
	} `json:"iam_roles"`
	IamInstanceProfiles []struct {
		ID    string   `json:"id"`
		Name  string   `json:"name"`
		Path  string   `json:"path"`
		Roles []string `json:"roles"`
	} `json:"iam_instance_profiles"`
}

Build : stores build data

func (*Build) GetID

func (a *Build) GetID() string

GetID : get the id for the current object

type Control

type Control struct {
	ID        string  `json:"id"`
	ProfileID string  `json:"profile_id"`
	Status    string  `json:"status"`
	CodeDesc  string  `json:"code_desc"`
	RunTime   float64 `json:"run_time"`
	StartTime string  `json:"start_time"`
	Message   string  `json:"message"`
}

Control describes an individual test within a build validation.

func (*Control) Line

func (c *Control) Line() string

Line : The line position on the policy that the control references

func (*Control) PolicyName

func (c *Control) PolicyName() string

PolicyName : Returns the name of the policy that the control is derrived from

type ControlDetails

type ControlDetails struct {
	ID             string            `json:"id"`
	Title          string            `json:"title"`
	Description    string            `json:"desc"`
	Impact         float32           `json:"impact"`
	References     []string          `json:"refs"`
	Tags           map[string]string `json:"tags"`
	Code           string            `json:"code"`
	Results        []Control         `json:"results"`
	Groups         []Group           `json:"groups"`
	Attributes     []string          `json:"attribues"`
	SHA256         string            `json:"sha256"`
	SourceLocation struct {
		Reference string `json:"ref"`
		Line      int    `json:"line"`
	} `json:"source_location"`
}

ControlDetails describes additional information about a control

func (*ControlDetails) ControlTitle

func (c *ControlDetails) ControlTitle() string

ControlTitle : returns the name of the control

func (*ControlDetails) Passed

func (c *ControlDetails) Passed() bool

Passed : returns true if all control results are passed

type Definition

type Definition struct {
	Name    string `yaml:"name"`
	Project string `yaml:"project"`
}

Definition : stores basic definition data

func (*Definition) GetID

func (d *Definition) GetID() string

GetID : get the id for the current object

func (*Definition) Load

func (d *Definition) Load(data []byte) error

Load : loads a yaml definition

type Diff

type Diff struct {
	From string `json:"from_id,omitempty"`
	To   string `json:"to_id,omitempty"`
}

Diff : diff request

type Environment

type Environment struct {
	ID          int                    `json:"id"`
	ProjectID   int                    `json:"project_id"`
	Project     string                 `json:"project,omitempty"`
	Provider    string                 `json:"provider,omitempty"`
	Name        string                 `json:"name"`
	Type        string                 `json:"type"`
	Status      string                 `json:"status"`
	Options     map[string]interface{} `json:"options,omitempty"`
	Credentials map[string]interface{} `json:"credentials,omitempty"`
	Schedules   map[string]interface{} `json:"schedules,omitempty"`
	Members     []Role                 `json:"members,omitempty"`
}

Environment : stores environment data

func (*Environment) GetID

func (n *Environment) GetID() string

GetID : get the id for the current object

type Error

type Error struct {
	Message    string      `json:"message"`
	Validation *Validation `json:"validation"`
}

Error : stores the error response from ernest

func (Error) Error

func (e Error) Error() string

type Generic

type Generic interface {
	GetID() string
}

Generic : stores data

type Group

type Group struct {
	ID       string   `json:"id"`
	Title    string   `json:"title"`
	Controls []string `json:"controls"`
}

type Import

type Import struct {
	Filters []string `json:"filters"`
}

Import : stores import preferences

type Logger

type Logger struct {
	Type        string `json:"type"`
	Logfile     string `json:"logfile"`
	Hostname    string `json:"hostname"`
	Port        int    `json:"port"`
	Timeout     int    `json:"timeout"`
	Token       string `json:"token"`
	Environment string `json:"environment"`
	UUID        string `json:"uuid"`
}

Logger : stores user data

func (*Logger) GetID

func (n *Logger) GetID() string

GetID : get the id for the current object

type Notification

type Notification struct {
	ID      int      `json:"id"`
	Name    string   `json:"name"`
	Type    string   `json:"type"`
	Config  string   `json:"config"`
	Sources []string `json:"sources"`
}

Notification : stores user data

func (*Notification) GetID

func (n *Notification) GetID() string

GetID : get the id for the current object

type Policy

type Policy struct {
	ID           int      `json:"id"`
	Name         string   `json:"name"`
	Revisions    []int    `json:"revisions"`
	Environments []string `json:"environments"`
}

Policy : stores policy data

func (*Policy) GetID

func (n *Policy) GetID() string

GetID : get the id for the current object

type PolicyDocument

type PolicyDocument struct {
	ID         int    `json:"id"`
	PolicyID   int    `json:"policy_id"`
	Revision   int    `json:"revision"`
	Username   string `json:"username"`
	Definition string `json:"definition"`
	CreatedAt  string `json:"created_at"`
}

PolicyDocument : stores policy document data

type Profile

type Profile struct {
	Supports []string         `json:"supports"`
	Title    string           `json:"title"`
	Name     string           `json:"name"`
	Controls []ControlDetails `json:"controls"`
}

Profile describes the policy document and its test results

func (*Profile) PolicyName

func (p *Profile) PolicyName() string

PolicyName : Returns the name of the policy that the control is derrived from

type Project

type Project struct {
	ID           int                    `json:"id"`
	Name         string                 `json:"name"`
	Type         string                 `json:"type"`
	Credentials  map[string]interface{} `json:"credentials,omitempty"`
	Environments []string               `json:"environments,omitempty"`
	Members      []Role                 `json:"members,omitempty"`
}

Project : stores project data

func (*Project) GetID

func (n *Project) GetID() string

GetID : get the id for the current object

type Role

type Role struct {
	UID      uint   `json:"id"`
	ID       string `json:"resource_id"`
	User     string `json:"user_id"`
	Role     string `json:"role"`
	Resource string `json:"resource_type"`
}

Role : stores user data

func (*Role) GetID

func (n *Role) GetID() string

GetID : get the id for the current object

type Session

type Session struct {
	ID       int    `json:"id"`
	GroupID  int    `json:"group_id"`
	Username string `json:"username"`
	Email    string `json:"email"`
	Admin    *bool  `json:"admin"`
}

Session ...

func (*Session) IsAdmin

func (s *Session) IsAdmin() bool

IsAdmin ..

type Statistics

type Statistics struct {
	Duration float64 `json:"duration"`
}

Statistics describes stats for the build validate service.

type User

type User struct {
	ID                 int    `json:"id"`
	GroupID            int    `json:"group_id"`
	Email              string `json:"email"`
	Username           string `json:"username"`
	Password           string `json:"password,omitempty"`
	OldPassword        string `json:"oldpassword,omitempty"`
	Salt               string `json:"salt,omitempty"`
	Admin              bool   `json:"admin"`
	Type               string `json:"type"`
	MFA                *bool  `json:"mfa"`
	MFASecret          string `json:"mfa_secret"`
	EnvMemberships     []Role `json:"env_memberships"`
	ProjectMemberships []Role `json:"project_memberships"`
	Disabled           *bool  `json:"disabled"`
}

User : stores user data

func (*User) GetID

func (n *User) GetID() string

GetID : get the id for the current object

type Validation

type Validation struct {
	Version    string     `json:"version"`
	Controls   []Control  `json:"controls"`
	Profiles   []Profile  `json:"profiles"`
	Statistics Statistics `json:"statistics"`
}

Validation describes a response from the build validate service.

func (*Validation) Passed

func (v *Validation) Passed() bool

Passed : returns true if validation rules passed

func (*Validation) Stats

func (v *Validation) Stats() (int, int, int)

Stats : returns the passed, failed and total test count

Jump to

Keyboard shortcuts

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