web

package
v0.0.0-...-4cbfb34 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Overview

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Brad Rydzewski, project contributors, Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Brad Rydzewski, project contributors, Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApprovalStatus

func ApprovalStatus(c *gin.Context)

ApprovalStatus generates a response with the current status of a pull request

func GetRepoAndUser

func GetRepoAndUser(c context.Context, slug string) (*model.Repo, *model.User, *model.Capabilities, error)

func Index

func Index(c *gin.Context)

func Login

func Login(c *gin.Context)

Login attempts to authorize a user via GitHub oauth2. If the user does not yet exist, and new account is created. Upon successful login the user is redirected to the main screen.

func LoginToken

func LoginToken(c *gin.Context)

LoginToken authenticates a user with their GitHub token and returns a service API token in the response.

func Logout

func Logout(c *gin.Context)

Logout terminates the session for the currently authenticated user, deleting all session cookies, and redirecting back to the main page.

func ProcessHook

func ProcessHook(c *gin.Context)

func Version

func Version(c *gin.Context)

Version returns a response body with the version number of the service.

Types

type ApprovalHook

type ApprovalHook struct {
	HookCommon
	Repo  *model.Repo
	Issue *model.Issue
}

type ApprovalInfo

type ApprovalInfo struct {
	Policy         *model.ApprovalPolicy
	Approved       bool
	AuthorApproved bool // is the author allowed to submit the pull request
	AuthorAffirmed bool // has the author affirmed ownership of the pull request
	TitleApproved  bool
	AuditApproved  bool
	Approvers      set.Set
	Disapprovers   set.Set
	CurCommentInfo
}

type ApprovalOutput

type ApprovalOutput struct {
	Policy       *model.ApprovalPolicy `json:"policy"`
	Settings     *model.Config         `json:"config"`
	Approved     bool                  `json:"approved"`
	Approvers    set.Set               `json:"approvers"`
	Disapprovers set.Set               `json:"disapprovers"`
}

type CommentHook

type CommentHook struct {
	ApprovalHook
	Comment string
}

func (*CommentHook) IsApproval

func (h *CommentHook) IsApproval(req *model.ApprovalRequest) bool

func (*CommentHook) Process

func (hook *CommentHook) Process(c context.Context) (interface{}, error)

type CurCommentInfo

type CurCommentInfo struct {
	Status CurCommentStatus
	Author string
}

type CurCommentStatus

type CurCommentStatus int
const (
	CurCommentOther CurCommentStatus = iota
	CurCommentNoChange
	CurCommentApproval
	CurCommentDisapproval
	CurCommentPRAuthor
	CurCommentPRTitle
	CurCommentPRAudit
)

type Hook

type Hook interface {
	Process(c context.Context) (interface{}, error)
	SetEvent(event string)
}

type HookCommon

type HookCommon struct {
	Event  string
	Action string
}

func (*HookCommon) SetEvent

func (h *HookCommon) SetEvent(event string)

type HookParams

type HookParams struct {
	Repo     *model.Repo
	User     *model.User
	Cap      *model.Capabilities
	Config   *model.Config
	Snapshot *model.MaintainerSnapshot
	Event    string
	Action   string
	Approval IsApprover
}

func GetHookParameters

func GetHookParameters(c context.Context, h HookCommon, slug string) (HookParams, error)

func GetHookParametersBasic

func GetHookParametersBasic(c context.Context, slug string) (HookParams, error)

type IsApprover

type IsApprover interface {
	IsApproval(req *model.ApprovalRequest) bool
}

type PRHook

type PRHook struct {
	ApprovalHook
	PullRequest *model.PullRequest
}

func (*PRHook) Process

func (hook *PRHook) Process(c context.Context) (interface{}, error)

type PullRequestFeedback

type PullRequestFeedback struct {
	All         []model.Feedback
	Approval    []model.Feedback
	Disapproval []model.Feedback
}

type RepoHook

type RepoHook struct {
	HookCommon
	Name    string
	Owner   string
	BaseURL string
}

func (*RepoHook) Process

func (hook *RepoHook) Process(c context.Context) (interface{}, error)

type RepoOutput

type RepoOutput struct {
	Action string `json:"action"`
	Owner  string `json:"owner"`
	Name   string `json:"name"`
}

type ReviewHook

type ReviewHook struct {
	ApprovalHook
	State lowercase.String
}

func (*ReviewHook) IsApproval

func (h *ReviewHook) IsApproval(req *model.ApprovalRequest) bool

func (*ReviewHook) Process

func (hook *ReviewHook) Process(c context.Context) (interface{}, error)

type StatusHook

type StatusHook struct {
	HookCommon
	SHA    string
	Status *model.CommitStatus
	Repo   *model.Repo
}

func (*StatusHook) Process

func (hook *StatusHook) Process(c context.Context) (interface{}, error)

type StatusResponse

type StatusResponse struct {
	SHA  string `json:"sha,omitempty"`
	Tag  string `json:"tag,omitempty"`
	Err  string `json:"error,omitempty"`
	Info string `json:"info,omitempty"`
}

Directories

Path Synopsis
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
SPDX-Copyright: Copyright (c) Capital One Services, LLC SPDX-License-Identifier: Apache-2.0 Copyright 2017 Capital One Services, LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

Jump to

Keyboard shortcuts

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