api

package
v0.0.0-...-aa03a8f Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2016 License: Apache-2.0, BSD-3-Clause, CC-BY-3.0, + 3 more Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPoliciesByRepository

func GetPoliciesByRepository(repository string) ([]*models.RepPolicy, error)

GetPoliciesByRepository returns policies according the repository

func TriggerReplication

func TriggerReplication(policyID int64, repository string,
	tags []string, operation string) error

TriggerReplication triggers the replication according to the policy

func TriggerReplicationByRepository

func TriggerReplicationByRepository(repository string, tags []string, operation string)

TriggerReplicationByRepository triggers the replication according to the repository

Types

type BaseAPI

type BaseAPI struct {
	beego.Controller
}

BaseAPI wraps common methods for controllers to host API

func (*BaseAPI) DecodeJSONReq

func (b *BaseAPI) DecodeJSONReq(v interface{})

DecodeJSONReq decodes a json request

func (*BaseAPI) DecodeJSONReqAndValidate

func (b *BaseAPI) DecodeJSONReqAndValidate(v interface{})

DecodeJSONReqAndValidate does both decoding and validation

func (*BaseAPI) GetIDFromURL

func (b *BaseAPI) GetIDFromURL() int64

GetIDFromURL checks the ID in request URL

func (*BaseAPI) Redirect

func (b *BaseAPI) Redirect(statusCode int, resouceID string)

Redirect does redirection to resource URI with http header status code.

func (*BaseAPI) Render

func (b *BaseAPI) Render() error

Render returns nil as it won't render template

func (*BaseAPI) RenderError

func (b *BaseAPI) RenderError(code int, text string)

RenderError provides shortcut to render http error

func (*BaseAPI) Validate

func (b *BaseAPI) Validate(v interface{})

Validate validates v if it implements interface validation.ValidFormer

func (*BaseAPI) ValidateUser

func (b *BaseAPI) ValidateUser() int

ValidateUser checks if the request triggered by a valid user

type LogAPI

type LogAPI struct {
	BaseAPI
	// contains filtered or unexported fields
}

LogAPI handles request api/logs

func (*LogAPI) Get

func (l *LogAPI) Get()

Get returns the recent logs according to parameters

func (*LogAPI) Prepare

func (l *LogAPI) Prepare()

Prepare validates the URL and the user

type ProjectAPI

type ProjectAPI struct {
	BaseAPI
	// contains filtered or unexported fields
}

ProjectAPI handles request to /api/projects/{} /api/projects/{}/logs

func (*ProjectAPI) FilterAccessLog

func (p *ProjectAPI) FilterAccessLog()

FilterAccessLog handles GET to /api/projects/{}/logs

func (*ProjectAPI) Get

func (p *ProjectAPI) Get()

Get ...

func (*ProjectAPI) Head

func (p *ProjectAPI) Head()

Head ...

func (*ProjectAPI) List

func (p *ProjectAPI) List()

List ...

func (*ProjectAPI) Post

func (p *ProjectAPI) Post()

Post ...

func (*ProjectAPI) Prepare

func (p *ProjectAPI) Prepare()

Prepare validates the URL and the user

func (*ProjectAPI) ToggleProjectPublic

func (p *ProjectAPI) ToggleProjectPublic()

ToggleProjectPublic ...

type ProjectMemberAPI

type ProjectMemberAPI struct {
	BaseAPI
	// contains filtered or unexported fields
}

ProjectMemberAPI handles request to /api/projects/{}/members/{}

func (*ProjectMemberAPI) Delete

func (pma *ProjectMemberAPI) Delete()

Delete ...

func (*ProjectMemberAPI) Get

func (pma *ProjectMemberAPI) Get()

Get ...

func (*ProjectMemberAPI) Post

func (pma *ProjectMemberAPI) Post()

Post ...

func (*ProjectMemberAPI) Prepare

func (pma *ProjectMemberAPI) Prepare()

Prepare validates the URL and parms

func (*ProjectMemberAPI) Put

func (pma *ProjectMemberAPI) Put()

Put ...

type RepJobAPI

type RepJobAPI struct {
	BaseAPI
	// contains filtered or unexported fields
}

RepJobAPI handles request to /api/replicationJobs /api/replicationJobs/:id/log

func (*RepJobAPI) Delete

func (ra *RepJobAPI) Delete()

Delete ...

func (*RepJobAPI) GetLog

func (ra *RepJobAPI) GetLog()

GetLog ...

func (*RepJobAPI) List

func (ra *RepJobAPI) List()

List filters jobs according to the policy and repository

func (*RepJobAPI) Prepare

func (ra *RepJobAPI) Prepare()

Prepare validates that whether user has system admin role

type RepPolicyAPI

type RepPolicyAPI struct {
	BaseAPI
}

RepPolicyAPI handles /api/replicationPolicies /api/replicationPolicies/:id/enablement

func (*RepPolicyAPI) Get

func (pa *RepPolicyAPI) Get()

Get ...

func (*RepPolicyAPI) List

func (pa *RepPolicyAPI) List()

List filters policies by name and project_id, if name and project_id are nil, List returns all policies

func (*RepPolicyAPI) Post

func (pa *RepPolicyAPI) Post()

Post creates a policy, and if it is enbled, the replication will be triggered right now.

func (*RepPolicyAPI) Prepare

func (pa *RepPolicyAPI) Prepare()

Prepare validates whether the user has system admin role

func (*RepPolicyAPI) Put

func (pa *RepPolicyAPI) Put()

Put modifies name, description, target and enablement of policy

func (*RepPolicyAPI) UpdateEnablement

func (pa *RepPolicyAPI) UpdateEnablement()

UpdateEnablement changes the enablement of the policy

type RepositoryAPI

type RepositoryAPI struct {
	BaseAPI
}

RepositoryAPI handles request to /api/repositories /api/repositories/tags /api/repositories/manifests, the parm has to be put in the query string as the web framework can not parse the URL if it contains veriadic sectors.

func (*RepositoryAPI) Delete

func (ra *RepositoryAPI) Delete()

Delete ...

func (*RepositoryAPI) Get

func (ra *RepositoryAPI) Get()

Get ...

func (*RepositoryAPI) GetManifests

func (ra *RepositoryAPI) GetManifests()

GetManifests handles GET /api/repositories/manifests

func (*RepositoryAPI) GetTags

func (ra *RepositoryAPI) GetTags()

GetTags handles GET /api/repositories/tags

func (*RepositoryAPI) GetTopRepos

func (ra *RepositoryAPI) GetTopRepos()

GetTopRepos handles request GET /api/repositories/top

type SearchAPI

type SearchAPI struct {
	BaseAPI
}

SearchAPI handles requesst to /api/search

func (*SearchAPI) Get

func (s *SearchAPI) Get()

Get ...

type StatisticAPI

type StatisticAPI struct {
	BaseAPI
	// contains filtered or unexported fields
}

StatisticAPI handles request to /api/statistics/

func (*StatisticAPI) Get

func (s *StatisticAPI) Get()

Get total projects and repos of the user

func (*StatisticAPI) Prepare

func (s *StatisticAPI) Prepare()

Prepare validates the URL and the user

type TargetAPI

type TargetAPI struct {
	BaseAPI
}

TargetAPI handles request to /api/targets/ping /api/targets/{}

func (*TargetAPI) Delete

func (t *TargetAPI) Delete()

Delete ...

func (*TargetAPI) Get

func (t *TargetAPI) Get()

Get ...

func (*TargetAPI) List

func (t *TargetAPI) List()

List ...

func (*TargetAPI) ListPolicies

func (t *TargetAPI) ListPolicies()

ListPolicies ...

func (*TargetAPI) Ping

func (t *TargetAPI) Ping()

Ping validates whether the target is reachable and whether the credential is valid

func (*TargetAPI) Post

func (t *TargetAPI) Post()

Post ...

func (*TargetAPI) Prepare

func (t *TargetAPI) Prepare()

Prepare validates the user

func (*TargetAPI) Put

func (t *TargetAPI) Put()

Put ...

type UserAPI

type UserAPI struct {
	BaseAPI

	SelfRegistration bool
	IsAdmin          bool
	AuthMode         string
	// contains filtered or unexported fields
}

UserAPI handles request to /api/users/{}

func (*UserAPI) ChangePassword

func (ua *UserAPI) ChangePassword()

ChangePassword handles PUT to /api/users/{}/password

func (*UserAPI) Delete

func (ua *UserAPI) Delete()

Delete ...

func (*UserAPI) Get

func (ua *UserAPI) Get()

Get ...

func (*UserAPI) Post

func (ua *UserAPI) Post()

Post ...

func (*UserAPI) Prepare

func (ua *UserAPI) Prepare()

Prepare validates the URL and parms

func (*UserAPI) Put

func (ua *UserAPI) Put()

Put ...

func (*UserAPI) ToggleUserAdminRole

func (ua *UserAPI) ToggleUserAdminRole()

ToggleUserAdminRole handles PUT api/users/{}/sysadmin

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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