Documentation ¶
Index ¶
- func AuthClient() (*authorization.AuthorizationV1Client, error)
- func Client(scheme *runtime.Scheme) (client.Client, error)
- func CreateOrPatchObject(obj, original, parent runtime.Object, cli client.Client, ...) error
- func FileExists(path string) bool
- func GetGitCli(cfg *cicdv1.IntegrationConfig, cli client.Client) (git.Client, error)
- func Namespace() (string, error)
- func ParseApproversList(str string) ([]string, error)
- func ParseEmailFromUsers(users []string) []string
- func RandomString(length int) string
- func RespondError(w http.ResponseWriter, code int, msg string) error
- func RespondJSON(w http.ResponseWriter, data interface{}) error
- type ErrorResponse
- type RestClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthClient ¶
func AuthClient() (*authorization.AuthorizationV1Client, error)
AuthClient is a K8s client for Authorization
func CreateOrPatchObject ¶ added in v0.1.4
func CreateOrPatchObject(obj, original, parent runtime.Object, cli client.Client, scheme *runtime.Scheme) error
CreateOrPatchObject patches the object if it exists, and creates one if not
func ParseApproversList ¶
ParseApproversList parses user/email from line-separated and comma-separated approvers list
func ParseEmailFromUsers ¶
ParseEmailFromUsers parses email from approvers list
func RandomString ¶
RandomString generate random string with lower case alphabets and digits
func RespondError ¶
func RespondError(w http.ResponseWriter, code int, msg string) error
RespondError responds to a HTTP request with body of ErrorResponse
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, data interface{}) error
RespondJSON responds with arbitrary data objects
Types ¶
type ErrorResponse ¶
type ErrorResponse struct {
Message string `json:"message"`
}
ErrorResponse is a common struct for responding error for HTTP requests
type RestClient ¶ added in v0.4.0
type RestClient interface { Get(name string, getOpt *metav1.GetOptions, into runtime.Object) error List(listOpt *metav1.ListOptions, into runtime.Object) error Watch(listOpt *metav1.ListOptions) (watch.Interface, error) Create(obj runtime.Object, createOpt *metav1.CreateOptions) error Update(obj runtime.Object, opts *metav1.UpdateOptions) error Delete(name string, opt *metav1.DeleteOptions) error }
RestClient is a group-version-resource specific rest client
func NewGroupVersionResourceClient ¶ added in v0.4.0
func NewGroupVersionResourceClient(cfg *rest.Config, ns string, groupVersionResource schema.GroupVersionResource) (RestClient, error)
NewGroupVersionResourceClient creates a new group-version-resource specific rest client