github

package
v0.0.0-...-841a3e8 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Fail_Repo     = "Fail repo"
	Created_Code  = 201 // https://docs.github.com/en/rest/reference/issues#create-an-issue
	Ok_Code       = 200
	FinalizerName = "batch.tutorial.kubebuilder.io/finalizer"

	REST_ERROR = "REST API error"
	HTTP_ERROR = "Repo or Token error"
	JSON_ERROR = "Parsing error"

	PATCH = "PATCH call"
	POST  = "POST call"
	GET   = "GET call"
)

Variables

This section is empty.

Functions

func ContainsString

func ContainsString(slice []string, s string) bool

Helper functions to check and remove string from a slice of string. From https://book.kubebuilder.io/reference/using-finalizers.html

func DeleteIssue

func DeleteIssue(githubi trainingv1alpha1.GithubIssue, ownerRepo string) (trainingv1alpha1.GithubIssue, error)

DeleteIssue check if FinalizerName has been registered, make a REST API call to close the Issue, then check http response and eventually unregister FinalizerName

func GetIssue

func GetIssue(githubi trainingv1alpha1.GithubIssue, ownerRepo string, apiType string) (trainingv1alpha1.GithubIssue, error, bool)

GetIssue creates a githubissue or fetch and update. Then it chcecks for errors of REST, bad token/repo or JSON and eventually update the K8s object

func GithubAPIcall

func GithubAPIcall(ownerRepo string, title string, description string, number int, token string, apiType string) (*http.Response, []byte, error)

GithubAPIcall makes a HTTP call based apiType variable to Github.com

func HttpHandler

func HttpHandler(githubi trainingv1alpha1.GithubIssue, httpCode int, expectedCode int, ownerRepo string) (trainingv1alpha1.GithubIssue, error)

HttpHandler check for a mismatch between httpCode and the expected code, and update the Stauts accordingly

Types

type GithubRecieve

type GithubRecieve struct {
	Repo        string `json:"url"` // or `json:"html_url"`
	Title       string `json:"title"`
	Description string `json:"body"` // It is called 'body' in the json file
	State       string `json:"state,omitempty"`
	Number      int    `json:"number,omitempty"`
}

A GithubRecieve struct to map the entire Response

type GithubSend

type GithubSend struct {
	Title       string `json:"title,omitempty"`
	Body        string `json:"body,omitempty"`
	State       string `json:"state,omitempty"`
	ClosingTime string `json:"closed_at,omitempty"`
}

GithubSend - specify data fields for new github issue submission

Jump to

Keyboard shortcuts

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