common

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: May 24, 2017 License: Apache-2.0 Imports: 4 Imported by: 14

Documentation

Index

Constants

View Source
const (
	CredentialKindSSH        = "ssh"
	CredentialKindNET        = "net"
	CredentialKindWIN        = "windows"
	CredentialKindSCM        = "scm"
	CredentialKindAWS        = "aws"
	CredentialKindRAX        = "rax"
	CredentialKindVMWARE     = "vmware"
	CredentialKindSATELLITE6 = "satellite6"
	CredentialKindCLOUDFORMS = "cloudforms"
	CredentialKindGCE        = "gce"
	CredentialKindAZURE      = "azure"
	CredentialKindOPENSTACK  = "openstack"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessControl

type AccessControl struct {
	GranteeID bson.ObjectId `bson:"grantee_id,omitempty" json:"grantee_id,omitempty"`
	Type      string        `bson:"type" json:"type"` // Team or a User
	Role      string        `bson:"role" json:"role"`
}

AccessControl type for storing roles in a object ResourceID ObjectIds highly likely unique

type AccessType

type AccessType struct {
	DirectAccess   []gin.H `json:"direct_access"`
	IndirectAccess []gin.H `json:"indirect_access"`
}

type AccessUser

type AccessUser struct {
	ID      bson.ObjectId `bson:"_id" json:"id"`
	Type    string        `bson:"-" json:"type"`
	URL     string        `bson:"-" json:"url"`
	Related gin.H         `bson:"-" json:"related"`
	Summary *AccessType   `bson:"-" json:"summary_fields"`

	Created         time.Time     `bson:"created" json:"created"`
	Username        string        `bson:"username" json:"username" binding:"required"`
	FirstName       string        `bson:"first_name" json:"first_name"`
	LastName        string        `bson:"last_name" json:"last_name"`
	Email           string        `bson:"email" json:"email" binding:"required"`
	IsSuperUser     bool          `bson:"is_superuser" json:"is_superuser"`
	IsSystemAuditor bool          `bson:"is_system_auditor" json:"is_system_auditor"`
	Password        string        `bson:"password" json:"-"`
	OrganizationID  bson.ObjectId `bson:"organization_id" json:"organization"`
}

type Activity

type Activity struct {
	ID        bson.ObjectId          `bson:"_id" json:"id"`
	Type      string                 `bson:"-" json:"type"`
	ActorID   bson.ObjectId          `bson:"actor_id"`
	Object1ID bson.ObjectId          `bson:"object1_id"`
	Object2ID bson.ObjectId          `bson:"object2_id,omitempty"`
	Links     gin.H                  `bson:"-" json:"links"`
	Meta      gin.H                  `bson:"-" json:"meta"`
	Timestamp time.Time              `bson:"timestamp" json:"timestamp"`
	Operation string                 `bson:"operation" json:"operation"`
	Changes   map[string]interface{} `bson:"changes" json:"changes"`
	Object1   string                 `bson:"object1" json:"object1"`
	Object2   string                 `bson:"object2,omitempty" json:"object2"`
}

Activity is the model for Activity collection

type Credential

type Credential struct {
	ID bson.ObjectId `bson:"_id" json:"id"`
	// required fields
	Name string `bson:"name" json:"name" binding:"required,min=1,max=500"`
	Kind string `bson:"kind" json:"kind" binding:"required,credential_kind"`

	//optional fields
	Cloud             bool           `bson:"cloud,omitempty" json:"cloud"`
	Description       string         `bson:"description,omitempty" json:"description"`
	Host              string         `bson:"host,omitempty" json:"host"`
	Username          string         `bson:"username,omitempty" json:"username"`
	Password          string         `bson:"password,omitempty" json:"password"`
	SecurityToken     string         `bson:"security_token,omitempty" json:"security_token"`
	Project           string         `bson:"project,omitempty" json:"project"`
	Email             string         `bson:"email,omitempty" json:"email" binding:"omitempty,email"`
	Domain            string         `bson:"domain,omitempty" json:"domain"`
	SSHKeyData        string         `bson:"ssh_key_data,omitempty" json:"ssh_key_data"`
	SSHKeyUnlock      string         `bson:"ssh_key_unlock,omitempty" json:"ssh_key_unlock"`
	BecomeMethod      string         `bson:"become_method,omitempty" json:"become_method" binding:"omitempty,become_method"`
	BecomeUsername    string         `bson:"become_username,omitempty" json:"become_username"`
	BecomePassword    string         `bson:"become_password,omitempty" json:"become_password"`
	VaultPassword     string         `bson:"vault_password,omitempty" json:"vault_password"`
	Subscription      string         `bson:"subscription,omitempty" json:"subscription"`
	Tenant            string         `bson:"tenant,omitempty" json:"tenant"`
	Secret            string         `bson:"secret,omitempty" json:"secret"`
	Client            string         `bson:"client,omitempty" json:"client"`
	Authorize         bool           `bson:"authorize,omitempty" json:"authorize"`
	AuthorizePassword string         `bson:"authorize_password,omitempty" json:"authorize_password"`
	OrganizationID    *bson.ObjectId `bson:"organization_id,omitempty" json:"organization"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`

	Roles []AccessControl `bson:"roles" json:"-"`
}

Credential is the model for Credential collection

func (Credential) CloudCredentialExist added in v0.4.0

func (crd Credential) CloudCredentialExist() bool

func (Credential) GetID added in v0.4.0

func (c Credential) GetID() bson.ObjectId

func (Credential) GetOrganizationID added in v0.4.0

func (c Credential) GetOrganizationID() (bson.ObjectId, error)

func (Credential) GetRoles added in v0.4.0

func (c Credential) GetRoles() []AccessControl

func (Credential) GetType added in v0.4.0

func (Credential) GetType() string

func (Credential) IsUnique added in v0.4.0

func (crd Credential) IsUnique() bool

func (Credential) MachineCredentialExist added in v0.4.0

func (crd Credential) MachineCredentialExist() bool

func (Credential) NetworkCredentialExist added in v0.4.0

func (crd Credential) NetworkCredentialExist() bool

func (Credential) OrganizationExist added in v0.4.0

func (crd Credential) OrganizationExist() bool

func (Credential) SCMCredentialExist added in v0.4.0

func (crd Credential) SCMCredentialExist() bool

type Error

type Error struct {
	Code    int      `json:"code"`
	Message string   `json:"message"`
	Errors  []string `json:"errors"`
}

type Notification

type Notification struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	Status                 string `bson:"status" json:"status"`
	Error                  string `bson:"error" json:"error"`
	NotificationsSent      uint64 `bson:"notifications_sent" json:"notifications_sent"`
	NotificationsType      string `bson:"notification_type" json:"notification_type"`
	Recipients             string `bson:"recipients" json:"recipients"`
	Subject                string `bson:"subject" json:"subject"`
	Body                   string `bson:"body" json:"body"`
	NotificationTemplateID string `bson:"notification_template_id" json:"notification_template_id"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`

	Access []AccessControl `bson:"access" json:"-"`
}

func (Notification) GetType added in v0.4.0

func (Notification) GetType() string

type NotificationTemplate

type NotificationTemplate struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	Description               string `bson:"description" json:"description"`
	Name                      string `bson:"name" json:"name"`
	NotificationsType         string `bson:"notification_type" json:"notification_type"`
	NotificationConfiguration string `bson:"notification_configuration" json:"notification_configuration"`
	Subject                   string `bson:"subject" json:"subject"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`

	Roles []AccessControl `bson:"access" json:"-"`
}

func (NotificationTemplate) GetRoles added in v0.4.0

func (n NotificationTemplate) GetRoles() []AccessControl

func (NotificationTemplate) GetType added in v0.4.0

func (NotificationTemplate) GetType() string

type Organization

type Organization struct {
	ID    bson.ObjectId `bson:"_id" json:"id"`
	Type  string        `bson:"-" json:"type"`
	Links gin.H         `bson:"-" json:"links"`
	Meta  gin.H         `bson:"-" json:"meta"`

	Name        string `bson:"name" json:"name" binding:"required,min=1,max=500"`
	Description string `bson:"description" json:"description"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Roles []AccessControl `bson:"roles" json:"-"`
}

Organization is the model for organization collection

func (Organization) Exist added in v0.4.0

func (org Organization) Exist() bool

func (Organization) GetOrganizationID added in v0.4.0

func (org Organization) GetOrganizationID() (bson.ObjectId, error)

func (Organization) GetRoles added in v0.4.0

func (org Organization) GetRoles() []AccessControl

func (Organization) GetType added in v0.4.0

func (Organization) GetType() string

func (Organization) IsUnique added in v0.4.0

func (org Organization) IsUnique() bool

type Project

type Project struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`

	// required fields
	Name           string        `bson:"name" json:"name" binding:"required,min=1,max=500"`
	ScmType        string        `bson:"scm_type" json:"scm_type" binding:"required,scmtype"`
	OrganizationID bson.ObjectId `bson:"organization_id" json:"organization" binding:"required"`

	Description           string        `bson:"description,omitempty" json:"description"`
	LocalPath             string        `bson:"local_path,omitempty" json:"local_path" binding:"omitempty,naproperty"`
	ScmURL                string        `bson:"scm_url,omitempty" json:"scm_url" binding:"url"`
	Kind                  string        `bson:"kind,omitempty" json:"kind" binding:"project_kind"`
	ScmBranch             string        `bson:"scm_branch,omitempty" json:"scm_branch"`
	ScmClean              bool          `bson:"scm_clean,omitempty" json:"scm_clean"`
	ScmDeleteOnUpdate     bool          `bson:"scm_delete_on_update,omitempty" json:"scm_delete_on_update"`
	ScmCredentialID       bson.ObjectId `bson:"credential_id,omitempty" json:"credential"`
	ScmDeleteOnNextUpdate bool          `bson:"scm_delete_on_next_update,omitempty" json:"scm_delete_on_next_update"`
	ScmUpdateOnLaunch     bool          `bson:"scm_update_on_launch,omitempty" json:"scm_update_on_launch"`
	ScmUpdateCacheTimeout int           `bson:"scm_update_cache_timeout,omitempty" json:"scm_update_cache_timeout"`

	// only output
	LastJob          *bson.ObjectId `bson:"last_job,omitempty" json:"last_job" binding:"omitempty,naproperty"`
	LastJobRun       *time.Time     `bson:"last_job_run,omitempty" json:"last_job_run" binding:"omitempty,naproperty"`
	LastJobFailed    bool           `bson:"last_job_failed,omitempty" json:"last_job_failed" binding:"omitempty,naproperty"`
	HasSchedules     bool           `bson:"has_schedules,omitempty" json:"has_schedules" binding:"omitempty,naproperty"`
	NextJobRun       *time.Time     `bson:"next_job_run,omitempty" json:"next_job_run" binding:"omitempty,naproperty"`
	Status           string         `bson:"status,omitempty" json:"status" binding:"omitempty,naproperty"`
	LastUpdateFailed bool           `bson:"last_update_failed,omitempty" json:"last_update_failed" binding:"omitempty,naproperty"`
	LastUpdated      *time.Time     `bson:"last_updated,omitempty" json:"last_updated" binding:"omitempty,naproperty"`

	CreatedByID  bson.ObjectId `bson:"created_by_id" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by_id" json:"-"`

	Created  time.Time `bson:"created" json:"created" binding:"omitempty,naproperty"`
	Modified time.Time `bson:"modified" json:"modified" binding:"omitempty,naproperty"`

	Roles []AccessControl `bson:"roles" json:"-"`
}

Project is the model for project collection

func (Project) Exist added in v0.4.0

func (project Project) Exist() bool

func (Project) GetCredential added in v0.4.0

func (h Project) GetCredential() (Credential, error)

func (Project) GetOrganizationID added in v0.4.0

func (p Project) GetOrganizationID() (bson.ObjectId, error)

func (Project) GetRoles added in v0.4.0

func (p Project) GetRoles() []AccessControl

func (Project) GetType added in v0.4.0

func (Project) GetType() string

func (Project) IsUnique added in v0.4.0

func (project Project) IsUnique() bool

func (Project) OrganizationExist added in v0.4.0

func (project Project) OrganizationExist() bool

func (*Project) SCMCredentialExist added in v0.4.0

func (project *Project) SCMCredentialExist() bool

type Response

type Response struct {
	Count    int         `json:"count"`
	Next     interface{} `json:"next"`
	Previous interface{} `json:"previous"`
	Data     interface{} `json:"data"`
}

type RoleObj added in v0.4.0

type RoleObj struct {
	Disassociate bool          `json:"disassociate"`
	Role         string        `json:"role" binding:"required"`
	ResourceID   bson.ObjectId `json:"resource" binding:"required"`
	ResourceType string        `json:"resource_type" binding:"required,resource_type"`
}

type SCMUpdate

type SCMUpdate struct {
	ExtraVars gin.H `bson:"extra_vars,omitempty" json:"extra_vars,omitempty"`
}

type Team

type Team struct {
	ID bson.ObjectId `bson:"_id" json:"id"`

	Type  string `bson:"-" json:"type"`
	Links gin.H  `bson:"-" json:"links"`
	Meta  gin.H  `bson:"-" json:"meta"`

	Name           string        `bson:"name" json:"name" binding:"required,min=1,max=500"`
	OrganizationID bson.ObjectId `bson:"organization_id" json:"organization" binding:"required"`

	Description string `bson:"description,omitempty" json:"description"`

	CreatedByID  bson.ObjectId `bson:"created_by" json:"-"`
	ModifiedByID bson.ObjectId `bson:"modified_by" json:"-"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Roles []AccessControl `bson:"roles" json:"-"`
}

team is the model for organization collection

func (Team) GetOrganizationID added in v0.4.0

func (tm Team) GetOrganizationID() (bson.ObjectId, error)

func (Team) GetRoles added in v0.4.0

func (tm Team) GetRoles() []AccessControl

func (Team) GetType added in v0.4.0

func (Team) GetType() string

func (Team) IsUnique added in v0.4.0

func (team Team) IsUnique() bool

func (Team) OrganizationExist added in v0.4.0

func (team Team) OrganizationExist() bool

type User

type User struct {
	ID    bson.ObjectId `bson:"_id" json:"id"`
	Type  string        `bson:"-" json:"type"`
	Links gin.H         `bson:"-" json:"links"`

	Username        string `bson:"username" json:"username" binding:"required,min=1,max=30"`
	FirstName       string `bson:"first_name" json:"first_name,min=1,max=30"`
	LastName        string `bson:"last_name" json:"last_name,min=1,max=30"`
	Email           string `bson:"email" json:"email" binding:"required,email"`
	IsSuperUser     bool   `bson:"is_superuser" json:"is_superuser"`
	IsSystemAuditor bool   `bson:"is_system_auditor" json:"is_system_auditor"`
	Password        string `bson:"password,omitempty" json:"password"`

	Created  time.Time `bson:"created" json:"created"`
	Modified time.Time `bson:"modified" json:"modified"`

	Roles []AccessControl `bson:"roles" json:"-"`
}

User is model for user collection

func (User) GetRoles added in v0.4.0

func (u User) GetRoles() []AccessControl

func (User) GetType added in v0.4.0

func (User) GetType() string

func (User) IsUniqueEmail added in v0.4.0

func (user User) IsUniqueEmail() bool

func (User) IsUniqueUsername added in v0.4.0

func (user User) IsUniqueUsername() bool

Jump to

Keyboard shortcuts

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