Documentation ¶
Index ¶
- Constants
- func FindServiceAndVersion(versionID string) (*api.Service, *api.Version, error)
- func Init(host string, gracePeriod time.Duration, closing chan struct{}) (*mgo.Session, chan struct{}, error)
- type DataStore
- func (d *DataStore) AddNewFailVersion(serviceID string, versionID string) error
- func (d *DataStore) AddNewVersion(serviceID string, versionID string) error
- func (d *DataStore) Close()
- func (d *DataStore) CreatePipeline(pipeline *api.Pipeline) (*api.Pipeline, error)
- func (d *DataStore) CreatePipelineRecord(pipelineRecord *api.PipelineRecord) (*api.PipelineRecord, error)
- func (d *DataStore) CreateProject(project *api.Project) (*api.Project, error)
- func (d *DataStore) CreateToken(token *api.ScmToken) (*api.ScmToken, error)
- func (d *DataStore) DeleteCloudByName(name string) error
- func (d *DataStore) DeleteDeployByID(deployID string) error
- func (d *DataStore) DeletePipelineByID(pipelineID string) error
- func (d *DataStore) DeletePipelineRecordByID(pipelineRecordID string) error
- func (d *DataStore) DeletePipelineRecordsByPipelineID(pipelineID string) error
- func (d *DataStore) DeletePipelinesByProjectID(projectID string) error
- func (d *DataStore) DeleteProjectByID(projectID string) error
- func (d *DataStore) DeleteServiceByID(serviceID string) error
- func (d *DataStore) DeleteToken(projectID, scmType string) error
- func (d *DataStore) DeleteVersionByID(versionID string) error
- func (d *DataStore) FindAllClouds() ([]cloud.Options, error)
- func (d *DataStore) FindCloudByName(name string) (*cloud.Options, error)
- func (d *DataStore) FindDeployByID(deployID string) (*api.Deploy, error)
- func (d *DataStore) FindDeployByUserID(userID string) ([]api.Deploy, error)
- func (d *DataStore) FindLatestVersionByServiceID(serviceID string) (*api.Version, error)
- func (d *DataStore) FindPipelineByID(pipelineID string) (*api.Pipeline, error)
- func (d *DataStore) FindPipelineByName(projectID string, name string) (*api.Pipeline, error)
- func (d *DataStore) FindPipelineByServiceID(serviceID string) (*api.Pipeline, error)
- func (d *DataStore) FindPipelineRecordByID(pipelineRecordID string) (*api.PipelineRecord, error)
- func (d *DataStore) FindPipelineRecordsByPipelineID(pipelineID string, queryParams api.QueryParams) ([]api.PipelineRecord, int, error)
- func (d *DataStore) FindPipelinesByProjectID(projectID string, queryParams api.QueryParams) ([]api.Pipeline, int, error)
- func (d *DataStore) FindProjectByID(projectID string) (*api.Project, error)
- func (d *DataStore) FindProjectByName(name string) (*api.Project, error)
- func (d *DataStore) FindProjectByServiceID(serviceID string) (*api.Project, error)
- func (d *DataStore) FindRecentVersionsByServiceID(serviceID string, filter map[string]interface{}, limit int) ([]api.Version, int, error)
- func (d *DataStore) FindResourceByID(userID string) (*api.Resource, error)
- func (d *DataStore) FindServiceByCondition(userID, servicename string) ([]api.Service, error)
- func (d *DataStore) FindServiceByID(serviceID string) (*api.Service, error)
- func (d *DataStore) FindServicesByUserID(userID string) ([]api.Service, error)
- func (d *DataStore) FindVersionByID(versionID string) (*api.Version, error)
- func (d *DataStore) FindVersionLogByID(LogID string) (*api.VersionLog, error)
- func (d *DataStore) FindVersionLogByVersionID(versionID string) (*api.VersionLog, error)
- func (d *DataStore) FindVersionsByCondition(serviceID, versionname string) ([]api.Version, error)
- func (d *DataStore) FindVersionsByServiceID(serviceID string) ([]api.Version, error)
- func (d *DataStore) FindVersionsWithPaginationByServiceID(serviceID string, filter map[string]interface{}, start, limit int) ([]api.Version, int, error)
- func (d *DataStore) Findtoken(projectID, scmType string) (*api.ScmToken, error)
- func (d *DataStore) FindtokenByUserID(userID, urlvsc string) (*api.VscToken, error)
- func (d *DataStore) GetProjects(queryParams api.QueryParams) ([]api.Project, int, error)
- func (d *DataStore) InsertCloud(doc *cloud.Options) error
- func (d *DataStore) NewDeployDocument(deploy *api.Deploy) (string, error)
- func (d *DataStore) NewResourceDocument(resource *api.Resource) error
- func (d *DataStore) NewServiceDocument(service *api.Service) (string, error)
- func (d *DataStore) NewTokenDocument(token *api.VscToken) error
- func (d *DataStore) NewVersionDocument(version *api.Version) (string, error)
- func (d *DataStore) NewVersionLogDocument(versionLog *api.VersionLog) (string, error)
- func (d *DataStore) Ping() error
- func (d *DataStore) RemoveTokeninDB(userID string, urlvsc string) error
- func (d *DataStore) UpdatePipeline(pipeline *api.Pipeline) error
- func (d *DataStore) UpdatePipelineRecord(pipelineRecord *api.PipelineRecord) error
- func (d *DataStore) UpdateProject(project *api.Project) error
- func (d *DataStore) UpdateRepositoryStatus(serviceID string, status api.RepositoryStatus) error
- func (d *DataStore) UpdateResourceDocument(resource *api.Resource) error
- func (d *DataStore) UpdateResourceStatus(userID string, memory float64, cpu float64) error
- func (d *DataStore) UpdateServiceLastInfo(serviceID string, lasttime time.Time, lastname string) error
- func (d *DataStore) UpdateToken(token *api.VscToken) error
- func (d *DataStore) UpdateToken2(token *api.ScmToken) error
- func (d *DataStore) UpdateVersionDocument(versionID string, version api.Version) error
- func (d *DataStore) UpdateVersionLogDocument(versionLog *api.VersionLog) error
- func (d *DataStore) UpsertCloud(doc *cloud.Options) error
- func (d *DataStore) UpsertDeployDocument(deploy *api.Deploy) (string, error)
- func (d *DataStore) UpsertServiceDocument(service *api.Service) (string, error)
Constants ¶
const ( ResourceCollectionName string = "ResourceCollection" CloudsCollection string = "clouds" )
Variables ¶
This section is empty.
Functions ¶
func FindServiceAndVersion ¶ added in v0.3.0
findVersionAndService finds service and version entity based on version id.
Types ¶
type DataStore ¶
type DataStore struct {
// contains filtered or unexported fields
}
DataStore is the type for mongo db store.
func (*DataStore) AddNewFailVersion ¶
AddNewFailVersion adds a new fail version (version ID) to a given service.
func (*DataStore) AddNewVersion ¶
AddNewVersion adds a new success version (version ID) to a given service.
func (*DataStore) CreatePipeline ¶
CreatePipeline creates the pipeline, returns the pipeline created.
func (*DataStore) CreatePipelineRecord ¶
func (d *DataStore) CreatePipelineRecord(pipelineRecord *api.PipelineRecord) (*api.PipelineRecord, error)
CreatePipelineRecord creates the pipeline record, returns the pipeline record created.
func (*DataStore) CreateProject ¶
CreateProject creates the project, returns the project created.
func (*DataStore) CreateToken ¶
CreateToken creates creates the token, returns the token created.
func (*DataStore) DeleteCloudByName ¶
DeleteCloudByName delete a cloud in db by name
func (*DataStore) DeleteDeployByID ¶
DeleteDeployByID removes deploy by deploy_id.
func (*DataStore) DeletePipelineByID ¶
DeletePipelineByID deletes the pipeline by id.
func (*DataStore) DeletePipelineRecordByID ¶
DeletePipelineRecordByID deletes the pipeline record by id.
func (*DataStore) DeletePipelineRecordsByPipelineID ¶
DeletePipelineRecordsByPipelineID deletes all the pipeline records of one pipeline by pipeline id.
func (*DataStore) DeletePipelinesByProjectID ¶
DeletePipelinesByProjectID deletes all the pipelines in one project by project id.
func (*DataStore) DeleteProjectByID ¶
DeleteProjectByID deletes the project by id.
func (*DataStore) DeleteServiceByID ¶
DeleteServiceByID removes service by service_id.
func (*DataStore) DeleteToken ¶
DeleteToken deletes the token with the project id and scm type.
func (*DataStore) DeleteVersionByID ¶
DeleteVersionByID removes version by versionID.
func (*DataStore) FindAllClouds ¶
FindAllClouds returns all clouds
func (*DataStore) FindCloudByName ¶
FindCloudByName returns a cloud in db by name
func (*DataStore) FindDeployByID ¶
FindDeployByID finds a deploy entity by ID.
func (*DataStore) FindDeployByUserID ¶
FindDeployByUserID finds deploys entity by userID.
func (*DataStore) FindLatestVersionByServiceID ¶
FindLatestVersionByServiceID finds the latest version entity by service ID.
func (*DataStore) FindPipelineByID ¶
FindPipelineByID finds the pipeline by id.
func (*DataStore) FindPipelineByName ¶
FindPipelineByName finds the pipeline by name in one project. If find no pipeline or more than one pipeline, return error.
func (*DataStore) FindPipelineByServiceID ¶ added in v0.3.0
FindPipelineByServiceID finds the pipeline by service id.
func (*DataStore) FindPipelineRecordByID ¶
func (d *DataStore) FindPipelineRecordByID(pipelineRecordID string) (*api.PipelineRecord, error)
FindPipelineRecordByID finds the pipeline record by id.
func (*DataStore) FindPipelineRecordsByPipelineID ¶
func (d *DataStore) FindPipelineRecordsByPipelineID(pipelineID string, queryParams api.QueryParams) ([]api.PipelineRecord, int, error)
FindPipelineRecordsByPipelineID finds the pipeline records by pipelineID.
func (*DataStore) FindPipelinesByProjectID ¶
func (d *DataStore) FindPipelinesByProjectID(projectID string, queryParams api.QueryParams) ([]api.Pipeline, int, error)
FindPipelinesByProjectID finds the pipelines by project id. Will returns all pipelines in this project.
func (*DataStore) FindProjectByID ¶
FindProjectByID finds the project by id.
func (*DataStore) FindProjectByName ¶
FindProjectByName finds the project by name. If find no project or more than one project, return error.
func (*DataStore) FindProjectByServiceID ¶ added in v0.3.0
FindProjectByServiceID finds the project by service id.
func (*DataStore) FindRecentVersionsByServiceID ¶
func (d *DataStore) FindRecentVersionsByServiceID(serviceID string, filter map[string]interface{}, limit int) ([]api.Version, int, error)
FindRecentVersionsByServiceID finds a set of versions with conditions by service ID.
func (*DataStore) FindResourceByID ¶
FindResourceByID finds a resource entity by userID.
func (*DataStore) FindServiceByCondition ¶
FindServiceByCondition finds a list of services via user ID and serice name.
func (*DataStore) FindServiceByID ¶
FindServiceByID finds a service entity by ID.
func (*DataStore) FindServicesByUserID ¶
FindServicesByUserID finds a list of services via user ID.
func (*DataStore) FindVersionByID ¶
FindVersionByID finds a version entity by ID.
func (*DataStore) FindVersionLogByID ¶
func (d *DataStore) FindVersionLogByID(LogID string) (*api.VersionLog, error)
FindVersionLogByID finds a version log entity by ID.
func (*DataStore) FindVersionLogByVersionID ¶
func (d *DataStore) FindVersionLogByVersionID(versionID string) (*api.VersionLog, error)
FindVersionLogByVersionID finds a version log entity by version ID.
func (*DataStore) FindVersionsByCondition ¶
FindVersionsByCondition finds a version entity by service ID and version name.
func (*DataStore) FindVersionsByServiceID ¶
FindVersionsByServiceID finds a version entity by service ID.
func (*DataStore) FindVersionsWithPaginationByServiceID ¶
func (d *DataStore) FindVersionsWithPaginationByServiceID(serviceID string, filter map[string]interface{}, start, limit int) ([]api.Version, int, error)
FindVersionsWithPaginationByServiceID finds a page of versions by service ID.
func (*DataStore) FindtokenByUserID ¶
FindtokenByUserID finds token by UserID.
func (*DataStore) GetProjects ¶
GetProjects gets all projects. Will returns all projects.
func (*DataStore) InsertCloud ¶
InsertCloud insert a new cloud document to db
func (*DataStore) NewDeployDocument ¶
NewDeployDocument creates a new document (record) in mongodb. It returns deploy id of the newly created deploy.
func (*DataStore) NewResourceDocument ¶
NewResourceDocument creates a new document (record) in mongodb.
func (*DataStore) NewServiceDocument ¶
NewServiceDocument creates a new document (record) in mongodb. It returns service id of the newly created service.
func (*DataStore) NewTokenDocument ¶
NewTokenDocument creates a new document (record) in mongodb.
func (*DataStore) NewVersionDocument ¶
NewVersionDocument creates a new document (record) in mongodb. It returns version id of the newly created version.
func (*DataStore) NewVersionLogDocument ¶
func (d *DataStore) NewVersionLogDocument(versionLog *api.VersionLog) (string, error)
NewVersionLogDocument creates a new document (record) in mongodb. It returns version log id of the newly created version.
func (*DataStore) RemoveTokeninDB ¶
RemoveTokeninDB removes token.
func (*DataStore) UpdatePipeline ¶
UpdatePipeline updates the pipeline, please make sure the pipeline id is provided before call this method.
func (*DataStore) UpdatePipelineRecord ¶
func (d *DataStore) UpdatePipelineRecord(pipelineRecord *api.PipelineRecord) error
UpdatePipelineRecord updates the pipeline record.
func (*DataStore) UpdateProject ¶
UpdateProject updates the project, please make sure the project id is provided before call this method.
func (*DataStore) UpdateRepositoryStatus ¶
func (d *DataStore) UpdateRepositoryStatus(serviceID string, status api.RepositoryStatus) error
UpdateRepositoryStatus updates service repository status.
func (*DataStore) UpdateResourceDocument ¶
UpdateResourceDocument update a document (record) in mongodb.
func (*DataStore) UpdateResourceStatus ¶
UpdateResourceStatus updates resource's memory and cpu.
func (*DataStore) UpdateServiceLastInfo ¶
func (d *DataStore) UpdateServiceLastInfo(serviceID string, lasttime time.Time, lastname string) error
UpdateServiceLastInfo updates service's lastCreateTIme and lastVersionName.
func (*DataStore) UpdateToken ¶
UpdateToken update token via user ID.
func (*DataStore) UpdateToken2 ¶
UpdateToken2 updates the token, please make sure the project id and scm type is provided before call this method.
func (*DataStore) UpdateVersionDocument ¶
UpdateVersionDocument updates a version entirely.
func (*DataStore) UpdateVersionLogDocument ¶
func (d *DataStore) UpdateVersionLogDocument(versionLog *api.VersionLog) error
UpdateVersionLogDocument updates a document (record) in mongodb.
func (*DataStore) UpsertCloud ¶
UpsertCloud insert a new cloud document to db
func (*DataStore) UpsertDeployDocument ¶
UpsertDeployDocument upsert a special deploy document