Documentation ¶
Index ¶
- Constants
- func ContainsString(slice []string, s string) bool
- func DeleteIssue(githubi trainingv1alpha1.GithubIssue, ownerRepo string) (trainingv1alpha1.GithubIssue, error)
- func GetIssue(githubi trainingv1alpha1.GithubIssue, ownerRepo string, apiType string) (trainingv1alpha1.GithubIssue, error, bool)
- func GithubAPIcall(ownerRepo string, title string, description string, number int, token string, ...) (*http.Response, []byte, error)
- func HttpHandler(githubi trainingv1alpha1.GithubIssue, httpCode int, expectedCode int, ...) (trainingv1alpha1.GithubIssue, error)
- type GithubRecieve
- type GithubSend
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 ¶
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
Click to show internal directories.
Click to hide internal directories.