rally

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBadRouting - returns 400 http error
	ErrBadRouting = errors.New("inconsistent mapping between route and handler (programmer error)")
	// ErrInvalidArgument - returns 400 http error
	ErrInvalidArgument = errors.New("invalid argument")
	// ErrUnauthorized - returns 401 http error
	ErrUnauthorized = errors.New("authorization is invalid")
	// ErrInvalidToken - returns 401 http error
	ErrInvalidToken = errors.New("token contains an invalid number of segments")
	// ErrForbidden - returns 403 http error
	ErrForbidden = errors.New("User not authorized for operation")
)

Functions

func MakePushEventEndpoint

func MakePushEventEndpoint(svc Service) endpoint.Endpoint

MakePushEventEndpoint - endpoint create

func MakeRoutes

func MakeRoutes(r *mux.Router, s Service, logger log.Logger, middleware endpoint.Middleware, auth ...kithttp.RequestFunc)

MakeRoutes - make routes

Types

type Authorizor

type Authorizor struct {
	SecretToken       string
	SignatureRequired bool
	Logger            log.Logger
}

func (*Authorizor) CheckHMAC

func (a *Authorizor) CheckHMAC(ctx context.Context, request interface{}) (err error)

func (*Authorizor) ValidatePayload

func (a *Authorizor) ValidatePayload() endpoint.Middleware

type Changeset

type Changeset struct {
	Ref             string      `json:"_ref,omitempty"`
	CreationDate    string      `json:",omitempty"`
	ObjectID        int         `json:",omitempty"`
	ObjectUUID      string      `json:",omitempty"`
	Subscription    string      `json:",omitempty"`
	Workspace       string      `json:",omitempty"`
	Artifacts       []Reference `json:",omitempty"`
	Author          string      `json:",omitempty"`
	Branch          string      `json:",omitempty"`
	Builds          string      `json:",omitempty"`
	Changes         string      `json:",omitempty"`
	CommitTimestamp string      `json:",omitempty"`
	Message         string      `json:",omitempty"`
	Name            string      `json:",omitempty"`
	Revision        string      `json:",omitempty"`
	SCMRepository   string      `json:",omitempty"`
	Uri             string      `json:",omitempty"`
}

type Commit

type Commit struct {
	ID        string `json:"id"`
	TreeID    string `json:"tree_id"`
	Distinct  bool   `json:"distinct"`
	Message   string `json:"message"`
	Timestamp string `json:"timestamp"`
	URL       string `json:"url"`
	Author    struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"author"`
	Committer struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"committer"`
	Added    []string `json:"added"`
	Removed  []string `json:"removed"`
	Modified []string `json:"modified"`
}

type Config

type Config struct {
	RallyURL          string    `json:"rally-url"`
	APIToken          string    `json:"api-key"`
	Workspace         string    `json:"workspace"`
	SecretToken       string    `json:"secret_token"`
	SignatureRequired bool      `json:"signature_required"`
	InfluxCfg         InfluxCfg `json:"influx_cfg"`
}

type InfluxCfg

type InfluxCfg struct {
	URL      string `json:"url"`
	Username string `json:"username"`
	Password string `json:"password"`
	Database string `json:"database"`
	Tag      string `json:"tag"`
}

InfluxCfg - struct

type PushEvent

type PushEvent struct {
	Ref        string      `json:"ref"`
	Before     string      `json:"before"`
	After      string      `json:"after"`
	Created    bool        `json:"created"`
	Deleted    bool        `json:"deleted"`
	Forced     bool        `json:"forced"`
	BaseRef    interface{} `json:"base_ref"`
	Compare    string      `json:"compare"`
	Commits    []Commit    `json:"commits"`
	HeadCommit interface{} `json:"head_commit"`
	Repository struct {
		ID       int    `json:"id"`
		NodeID   string `json:"node_id"`
		Name     string `json:"name"`
		FullName string `json:"full_name"`
		Owner    struct {
			Name              string `json:"name"`
			Email             string `json:"email"`
			Login             string `json:"login"`
			ID                int    `json:"id"`
			NodeID            string `json:"node_id"`
			AvatarURL         string `json:"avatar_url"`
			GravatarID        string `json:"gravatar_id"`
			URL               string `json:"url"`
			HTMLURL           string `json:"html_url"`
			FollowersURL      string `json:"followers_url"`
			FollowingURL      string `json:"following_url"`
			GistsURL          string `json:"gists_url"`
			StarredURL        string `json:"starred_url"`
			SubscriptionsURL  string `json:"subscriptions_url"`
			OrganizationsURL  string `json:"organizations_url"`
			ReposURL          string `json:"repos_url"`
			EventsURL         string `json:"events_url"`
			ReceivedEventsURL string `json:"received_events_url"`
			Type              string `json:"type"`
			SiteAdmin         bool   `json:"site_admin"`
		} `json:"owner"`
		Private          bool        `json:"private"`
		HTMLURL          string      `json:"html_url"`
		Description      interface{} `json:"description"`
		Fork             bool        `json:"fork"`
		URL              string      `json:"url"`
		ForksURL         string      `json:"forks_url"`
		KeysURL          string      `json:"keys_url"`
		CollaboratorsURL string      `json:"collaborators_url"`
		TeamsURL         string      `json:"teams_url"`
		HooksURL         string      `json:"hooks_url"`
		IssueEventsURL   string      `json:"issue_events_url"`
		EventsURL        string      `json:"events_url"`
		AssigneesURL     string      `json:"assignees_url"`
		BranchesURL      string      `json:"branches_url"`
		TagsURL          string      `json:"tags_url"`
		BlobsURL         string      `json:"blobs_url"`
		GitTagsURL       string      `json:"git_tags_url"`
		GitRefsURL       string      `json:"git_refs_url"`
		TreesURL         string      `json:"trees_url"`
		StatusesURL      string      `json:"statuses_url"`
		LanguagesURL     string      `json:"languages_url"`
		StargazersURL    string      `json:"stargazers_url"`
		ContributorsURL  string      `json:"contributors_url"`
		SubscribersURL   string      `json:"subscribers_url"`
		SubscriptionURL  string      `json:"subscription_url"`
		CommitsURL       string      `json:"commits_url"`
		GitCommitsURL    string      `json:"git_commits_url"`
		CommentsURL      string      `json:"comments_url"`
		IssueCommentURL  string      `json:"issue_comment_url"`
		ContentsURL      string      `json:"contents_url"`
		CompareURL       string      `json:"compare_url"`
		MergesURL        string      `json:"merges_url"`
		ArchiveURL       string      `json:"archive_url"`
		DownloadsURL     string      `json:"downloads_url"`
		IssuesURL        string      `json:"issues_url"`
		PullsURL         string      `json:"pulls_url"`
		MilestonesURL    string      `json:"milestones_url"`
		NotificationsURL string      `json:"notifications_url"`
		LabelsURL        string      `json:"labels_url"`
		ReleasesURL      string      `json:"releases_url"`
		DeploymentsURL   string      `json:"deployments_url"`
		CreatedAt        int         `json:"created_at"`
		UpdatedAt        time.Time   `json:"updated_at"`
		PushedAt         int         `json:"pushed_at"`
		GitURL           string      `json:"git_url"`
		SSHURL           string      `json:"ssh_url"`
		CloneURL         string      `json:"clone_url"`
		SvnURL           string      `json:"svn_url"`
		Homepage         interface{} `json:"homepage"`
		Size             int         `json:"size"`
		StargazersCount  int         `json:"stargazers_count"`
		WatchersCount    int         `json:"watchers_count"`
		Language         interface{} `json:"language"`
		HasIssues        bool        `json:"has_issues"`
		HasProjects      bool        `json:"has_projects"`
		HasDownloads     bool        `json:"has_downloads"`
		HasWiki          bool        `json:"has_wiki"`
		HasPages         bool        `json:"has_pages"`
		ForksCount       int         `json:"forks_count"`
		MirrorURL        interface{} `json:"mirror_url"`
		Archived         bool        `json:"archived"`
		OpenIssuesCount  int         `json:"open_issues_count"`
		License          interface{} `json:"license"`
		Forks            int         `json:"forks"`
		OpenIssues       int         `json:"open_issues"`
		Watchers         int         `json:"watchers"`
		DefaultBranch    string      `json:"default_branch"`
		Stargazers       int         `json:"stargazers"`
		MasterBranch     string      `json:"master_branch"`
	} `json:"repository"`
	Pusher struct {
		Name  string `json:"name"`
		Email string `json:"email"`
	} `json:"pusher"`
	Sender struct {
		Login             string `json:"login"`
		ID                int    `json:"id"`
		NodeID            string `json:"node_id"`
		AvatarURL         string `json:"avatar_url"`
		GravatarID        string `json:"gravatar_id"`
		URL               string `json:"url"`
		HTMLURL           string `json:"html_url"`
		FollowersURL      string `json:"followers_url"`
		FollowingURL      string `json:"following_url"`
		GistsURL          string `json:"gists_url"`
		StarredURL        string `json:"starred_url"`
		SubscriptionsURL  string `json:"subscriptions_url"`
		OrganizationsURL  string `json:"organizations_url"`
		ReposURL          string `json:"repos_url"`
		EventsURL         string `json:"events_url"`
		ReceivedEventsURL string `json:"received_events_url"`
		Type              string `json:"type"`
		SiteAdmin         bool   `json:"site_admin"`
	} `json:"sender"`
}

type PushResponse

type PushResponse struct {
	Result string  `json:"result"`
	Errors []error `json:"errors"`
}

type RallyCreateResult

type RallyCreateResult struct {
	CreateResult struct {
		RallyAPIMajor string        `json:"_rallyAPIMajor"`
		RallyAPIMinor string        `json:"_rallyAPIMinor"`
		Errors        []interface{} `json:"Errors"`
		Warnings      []interface{} `json:"Warnings"`
		Object        struct {
			RallyAPIMajor string    `json:"_rallyAPIMajor"`
			RallyAPIMinor string    `json:"_rallyAPIMinor"`
			Ref           string    `json:"_ref"`
			RefObjectUUID string    `json:"_refObjectUUID"`
			ObjectVersion string    `json:"_objectVersion"`
			RefObjectName string    `json:"_refObjectName"`
			CreationDate  time.Time `json:"CreationDate"`
			CreatedAt     string    `json:"_CreatedAt"`
			ObjectID      int64     `json:"ObjectID"`
			ObjectUUID    string    `json:"ObjectUUID"`
			VersionID     string    `json:"VersionId"`
			Subscription  struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				RefObjectName string `json:"_refObjectName"`
				Type          string `json:"_type"`
			} `json:"Subscription"`
			Workspace struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				RefObjectName string `json:"_refObjectName"`
				Type          string `json:"_type"`
			} `json:"Workspace"`
			Description string `json:"Description"`
			Name        string `json:"Name"`
			Projects    struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Projects"`
			SCMType string `json:"SCMType"`
			URI     string `json:"Uri"`
			Type    string `json:"_type"`
		} `json:"Object"`
	} `json:"CreateResult"`
}

type RallyQueryResults

type RallyQueryResults struct {
	QueryResult struct {
		RallyAPIMajor    string        `json:"_rallyAPIMajor"`
		RallyAPIMinor    string        `json:"_rallyAPIMinor"`
		Errors           []interface{} `json:"Errors"`
		Warnings         []interface{} `json:"Warnings"`
		TotalResultCount float64       `json:"TotalResultCount"`
		StartIndex       int           `json:"StartIndex"`
		PageSize         int           `json:"PageSize"`
		Results          []RallyResult `json:"Results"`
	} `json:"QueryResult"`
}

type RallyResult

type RallyResult struct {
	RallyAPIMajor string `json:"_rallyAPIMajor"`
	RallyAPIMinor string `json:"_rallyAPIMinor"`
	Ref           string `json:"_ref"`
	RefObjectUUID string `json:"_refObjectUUID"`
	RefObjectName string `json:"_refObjectName"`
	Type          string `json:"_type"`
}

type Reference

type Reference struct {
	Count         int    `json:",omitempty"`
	Ref           string `json:"_ref,omitempty"`
	Type          string `json:"_type,omitempty"`
	RefObjectName string `json:"_refObjectName,omitempty"`
	RefObjectUUID string `json:"_refObjectUUID,omitempty"`
}

type Service

type Service interface {
	ReceivePush(ctx context.Context, event PushEvent) (PushResponse, error)
	FindRallyArtifact(commit Commit) (artifacts map[string]string)
}

func NewInstrumentedService

func NewInstrumentedService(s Service, count metrics.Counter, callDur metrics.Histogram, c client.Client, in *kitinflux.Influx) Service

NewInstrumentedService - contructor function to wrap Service for metrics

func NewLoggingService

func NewLoggingService(s Service, logger log.Logger) Service

NewLoggingService logs each method call to s.

func NewPushReceiveService

func NewPushReceiveService(l log.Logger, cfg Config) Service

type UpdateResult

type UpdateResult struct {
	OperationResult struct {
		RallyAPIMajor string        `json:"_rallyAPIMajor"`
		RallyAPIMinor string        `json:"_rallyAPIMinor"`
		Errors        []interface{} `json:"Errors"`
		Warnings      []interface{} `json:"Warnings"`
		Object        struct {
			RallyAPIMajor string    `json:"_rallyAPIMajor"`
			RallyAPIMinor string    `json:"_rallyAPIMinor"`
			Ref           string    `json:"_ref"`
			RefObjectUUID string    `json:"_refObjectUUID"`
			ObjectVersion string    `json:"_objectVersion"`
			RefObjectName string    `json:"_refObjectName"`
			CreationDate  time.Time `json:"CreationDate"`
			CreatedAt     string    `json:"_CreatedAt"`
			ObjectID      int64     `json:"ObjectID"`
			ObjectUUID    string    `json:"ObjectUUID"`
			VersionID     string    `json:"VersionId"`
			Subscription  struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				RefObjectName string `json:"_refObjectName"`
				Type          string `json:"_type"`
			} `json:"Subscription"`
			Workspace struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				RefObjectName string `json:"_refObjectName"`
				Type          string `json:"_type"`
			} `json:"Workspace"`
			Changesets struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Changesets"`
			Connections struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Connections"`
			CreatedBy struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				RefObjectName string `json:"_refObjectName"`
				Type          string `json:"_type"`
			} `json:"CreatedBy"`
			Description string `json:"Description"`
			Discussion  struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Discussion"`
			DisplayColor                 string      `json:"DisplayColor"`
			Expedite                     bool        `json:"Expedite"`
			FormattedID                  string      `json:"FormattedID"`
			LastUpdateDate               time.Time   `json:"LastUpdateDate"`
			LatestDiscussionAgeInMinutes interface{} `json:"LatestDiscussionAgeInMinutes"`
			Milestones                   struct {
				RallyAPIMajor string        `json:"_rallyAPIMajor"`
				RallyAPIMinor string        `json:"_rallyAPIMinor"`
				Ref           string        `json:"_ref"`
				Type          string        `json:"_type"`
				TagsNameArray []interface{} `json:"_tagsNameArray"`
				Count         int           `json:"Count"`
			} `json:"Milestones"`
			Name  string `json:"Name"`
			Notes string `json:"Notes"`
			Owner struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				RefObjectName string `json:"_refObjectName"`
				Type          string `json:"_type"`
			} `json:"Owner"`
			Project struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				RefObjectName string `json:"_refObjectName"`
				Type          string `json:"_type"`
			} `json:"Project"`
			Ready           bool `json:"Ready"`
			RevisionHistory struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				Type          string `json:"_type"`
			} `json:"RevisionHistory"`
			Tags struct {
				RallyAPIMajor string        `json:"_rallyAPIMajor"`
				RallyAPIMinor string        `json:"_rallyAPIMinor"`
				Ref           string        `json:"_ref"`
				Type          string        `json:"_type"`
				TagsNameArray []interface{} `json:"_tagsNameArray"`
				Count         int           `json:"Count"`
			} `json:"Tags"`
			FlowState struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				RefObjectUUID string `json:"_refObjectUUID"`
				RefObjectName string `json:"_refObjectName"`
				Type          string `json:"_type"`
			} `json:"FlowState"`
			FlowStateChangedDate time.Time   `json:"FlowStateChangedDate"`
			LastBuild            interface{} `json:"LastBuild"`
			LastRun              interface{} `json:"LastRun"`
			PassingTestCaseCount int         `json:"PassingTestCaseCount"`
			ScheduleState        string      `json:"ScheduleState"`
			ScheduleStatePrefix  string      `json:"ScheduleStatePrefix"`
			TestCaseCount        int         `json:"TestCaseCount"`
			Attachments          struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Attachments"`
			Package       interface{} `json:"Package"`
			AcceptedDate  interface{} `json:"AcceptedDate"`
			Blocked       bool        `json:"Blocked"`
			BlockedReason interface{} `json:"BlockedReason"`
			Blocker       interface{} `json:"Blocker"`
			Children      struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Children"`
			DefectStatus string `json:"DefectStatus"`
			Defects      struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Defects"`
			DirectChildrenCount int         `json:"DirectChildrenCount"`
			DragAndDropRank     string      `json:"DragAndDropRank"`
			HasParent           bool        `json:"HasParent"`
			InProgressDate      time.Time   `json:"InProgressDate"`
			Iteration           interface{} `json:"Iteration"`
			Parent              interface{} `json:"Parent"`
			PlanEstimate        interface{} `json:"PlanEstimate"`
			Predecessors        struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Predecessors"`
			Recycled bool        `json:"Recycled"`
			Release  interface{} `json:"Release"`
			Risks    struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Risks"`
			Successors struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Successors"`
			TaskActualTotal    int    `json:"TaskActualTotal"`
			TaskEstimateTotal  int    `json:"TaskEstimateTotal"`
			TaskRemainingTotal int    `json:"TaskRemainingTotal"`
			TaskStatus         string `json:"TaskStatus"`
			Tasks              struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"Tasks"`
			TestCaseStatus string `json:"TestCaseStatus"`
			TestCases      struct {
				RallyAPIMajor string `json:"_rallyAPIMajor"`
				RallyAPIMinor string `json:"_rallyAPIMinor"`
				Ref           string `json:"_ref"`
				Type          string `json:"_type"`
				Count         int    `json:"Count"`
			} `json:"TestCases"`
			Type string `json:"_type"`
		} `json:"Object"`
	} `json:"OperationResult"`
}

Jump to

Keyboard shortcuts

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