common

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2017 License: Apache-2.0 Imports: 5 Imported by: 14

Documentation

Index

Constants

View Source
const (
	Create       = "create"
	Update       = "update"
	Delete       = "delete"
	Associate    = "associate"
	Disassociate = "disassociate"
)

Activity 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"`
	ObjectID    bson.ObjectId `bson:"object_id" json:"object_id"`
	ActorID     bson.ObjectId `bson:"actor_id" json:"actor_id"`
	Type        string        `bson:"type" json:"type"`
	Description string        `bson:"description" json:"description"`
	Created     time.Time     `bson:"created" json:"created"`
}

Activity is the model for Activity collection

type ActivityCredential added in v0.4.0

type ActivityCredential struct {
	ID        bson.ObjectId `bson:"_id" json:"id"`
	Type      string        `bson:"-" json:"type"`
	URL       string        `bson:"-" json:"url"`
	ActorID   bson.ObjectId `bson:"actor_id" json:"actor_id"`
	Related   gin.H         `bson:"-" json:"related"`
	Summary   gin.H         `bson:"-" json:"summary_fields"`
	Timestamp time.Time     `bson:"timestamp" json:"timestamp"`
	Operation string        `bson:"operation" json:"operation"`
	Object1   Credential    `bson:"object1" json:"object1"`
	Object2   *Credential   `bson:"object2" json:"object2"`
}

ActivityCredential is the model for Credential collection

type ActivityOrganization added in v0.4.0

type ActivityOrganization struct {
	ID        bson.ObjectId `bson:"_id" json:"id"`
	Type      string        `bson:"-" json:"type"`
	URL       string        `bson:"-" json:"url"`
	ActorID   bson.ObjectId `bson:"actor_id" json:"actor_id"`
	Related   gin.H         `bson:"-" json:"related"`
	Summary   gin.H         `bson:"-" json:"summary_fields"`
	Timestamp time.Time     `bson:"timestamp" json:"timestamp"`
	Operation string        `bson:"operation" json:"operation"`
	Object1   Organization  `bson:"object1" json:"object1"`
	Object2   *Organization `bson:"object2" json:"object2"`
}

ActivityOrganization is the model for Organization collection

type ActivityProject added in v0.4.0

type ActivityProject struct {
	ID        bson.ObjectId `bson:"_id" json:"id"`
	Type      string        `bson:"-" json:"type"`
	URL       string        `bson:"-" json:"url"`
	ActorID   bson.ObjectId `bson:"actor_id" json:"actor_id"`
	Related   gin.H         `bson:"-" json:"related"`
	Summary   gin.H         `bson:"-" json:"summary_fields"`
	Timestamp time.Time     `bson:"timestamp" json:"timestamp"`
	Operation string        `bson:"operation" json:"operation"`
	Object1   Project       `bson:"object1" json:"object1"`
	Object2   *Project      `bson:"object2" json:"object2"`
}

ActivityProject is the model for Project collection

type ActivityTeam added in v0.4.0

type ActivityTeam struct {
	ID        bson.ObjectId `bson:"_id" json:"id"`
	Type      string        `bson:"-" json:"type"`
	URL       string        `bson:"-" json:"url"`
	ActorID   bson.ObjectId `bson:"actor_id" json:"actor_id"`
	Related   gin.H         `bson:"-" json:"related"`
	Summary   gin.H         `bson:"-" json:"summary_fields"`
	Timestamp time.Time     `bson:"timestamp" json:"timestamp"`
	Operation string        `bson:"operation" json:"operation"`
	Object1   Team          `bson:"object1" json:"object1"`
	Object2   *Team         `bson:"object2" json:"object2"`
}

ActivityTeam is the model for Team collection

type ActivityUser added in v0.4.0

type ActivityUser struct {
	ID        bson.ObjectId `bson:"_id" json:"id"`
	Type      string        `bson:"-" json:"type"`
	URL       string        `bson:"-" json:"url"`
	ActorID   bson.ObjectId `bson:"actor_id" json:"actor_id"`
	Related   gin.H         `bson:"-" json:"related"`
	Summary   gin.H         `bson:"-" json:"summary_fields"`
	Timestamp time.Time     `bson:"timestamp" json:"timestamp"`
	Operation string        `bson:"operation" json:"operation"`
	Object1   User          `bson:"object1" json:"object1"`
	Object2   *User         `bson:"object2" json:"object2"`
}

ActivityUser is the model for User 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"`
	URL     string `bson:"-" json:"url"`
	Related gin.H  `bson:"-" json:"related"`
	Summary gin.H  `bson:"-" json:"summary_fields"`

	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"`
	URL           string `bson:"-" json:"url"`
	Related       gin.H  `bson:"-" json:"related"`
	SummaryFields gin.H  `bson:"-" json:"summary_fields"`

	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"`
	URL           string `bson:"-" json:"url"`
	Related       gin.H  `bson:"-" json:"related"`
	SummaryFields gin.H  `bson:"-" json:"summary_fields"`

	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"`
	URL     string        `bson:"-" json:"url"`
	Related gin.H         `bson:"-" json:"related"`
	Summary gin.H         `bson:"-" json:"summary_fields"`

	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 PatchCredential

type PatchCredential struct {
	Name              *string        `json:"name" binding:"omitempty,min=1,max=500"`
	Kind              *string        `json:"kind" binding:"omitempty,credential_kind"`
	Cloud             *bool          `json:"cloud"`
	Description       *string        `json:"description"`
	Host              *string        `json:"host"`
	Username          *string        `json:"username"`
	Password          *string        `json:"password"`
	SecurityToken     *string        `json:"security_token"`
	Project           *string        `json:"project"`
	Domain            *string        `json:"domain"`
	SSHKeyData        *string        `json:"ssh_key_data"`
	SSHKeyUnlock      *string        `json:"ssh_key_unlock"`
	BecomeMethod      *string        `json:"become_method" binding:"omitempty,become_method"`
	BecomeUsername    *string        `json:"become_username"`
	BecomePassword    *string        `json:"become_password"`
	VaultPassword     *string        `json:"vault_password"`
	Subscription      *string        `json:"subscription"`
	Tenant            *string        `json:"tenant"`
	Secret            *string        `json:"secret"`
	Client            *string        `json:"client"`
	Authorize         *bool          `json:"authorize"`
	AuthorizePassword *string        `json:"authorize_password"`
	OrganizationID    *bson.ObjectId `json:"organization"`
}

type PatchOrganization

type PatchOrganization struct {
	Name        *string `json:"name" binding:"omitempty,min=1,max=500"`
	Description *string `json:"description"`
}

type PatchProject

type PatchProject struct {
	Name                  *string        `json:"name" binding:"omitempty,min=1,max=500"`
	ScmType               *string        `json:"scm_type" binding:"omitempty,scmtype"`
	OrganizationID        *bson.ObjectId `json:"organization"`
	Description           *string        `json:"description"`
	ScmURL                *string        `json:"scm_url" binding:"omitempty,url"`
	ScmBranch             *string        `json:"scm_branch"`
	ScmClean              *bool          `json:"scm_clean"`
	ScmDeleteOnUpdate     *bool          `json:"scm_delete_on_update"`
	ScmCredentialID       *bson.ObjectId `json:"credential"`
	ScmDeleteOnNextUpdate *bool          `json:"scm_delete_on_next_update"`
	ScmUpdateOnLaunch     *bool          `json:"scm_update_on_launch"`
	ScmUpdateCacheTimeout *int           `json:"scm_update_cache_timeout"`
}

PatchProject is the model for PATCH requests

type PatchTeam

type PatchTeam struct {
	Name           *string        `json:"name" binding:"omitempty,min=1,max=500"`
	OrganizationID *bson.ObjectId `json:"organization"`
	Description    *string        `json:"description"`
}

type PatchUser added in v0.4.0

type PatchUser struct {
	Username        *string `json:"username" binding:"omitempty,min=1,max=30"`
	FirstName       *string `json:"first_name" binding:"omitempty,min=1,max=30"`
	LastName        *string `json:"last_name" binding:"omitempty,min=1,max=30"`
	Email           *string `json:"email" binding:"omitempty,email"`
	IsSuperUser     *bool   `json:"is_superuser"`
	IsSystemAuditor *bool   `json:"is_system_auditor"`
	Password        *string `json:"password"`
}

type Project

type Project 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 gin.H  `bson:"-" json:"summary_fields"`

	// 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:"credentail_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"`
	Results  interface{} `json:"results"`
}

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"`
	URL     string `bson:"-" json:"url"`
	Related gin.H  `bson:"-" json:"related"`
	Summary gin.H  `bson:"-" json:"summary_fields"`

	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"`
	URL     string        `bson:"-" json:"url"`
	Related gin.H         `bson:"-" json:"related"`

	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