Documentation ¶
Index ¶
- Constants
- func Auth3Scale(client *http.Client, redirectUrl, keycloakHost, clientId, secret string) (string, error)
- func DoAuthOpenshiftUser(authPageURL string, username string, password string, httpClient *http.Client, ...) error
- func OpenshiftClientSubmitForm(browser *browser.Browser, username, password string, idp string, ...) error
- func OpenshiftUserReconcileCheck(openshiftClient *OpenshiftClient, k8sclient dynclient.Client, ...) error
- func ParseHtmlResponse(r *http.Response) (*goquery.Document, error)
- func ProxyOAuth(client *http.Client, host string, username string, password string) (*http.Client, error)
- type CallbackOptions
- type LoginOptions
- type OpenshiftClient
- func (oc *OpenshiftClient) DoOpenshiftCreatePodInANamespace(namespace string, podCR *corev1.Pod) error
- func (oc *OpenshiftClient) DoOpenshiftCreateProject(projectCR *projectv1.ProjectRequest) error
- func (oc *OpenshiftClient) DoOpenshiftCreateServiceInANamespace(namespace string, serviceCR *corev1.Service) error
- func (oc *OpenshiftClient) DoOpenshiftDeleteRequest(path string) (*http.Response, error)
- func (oc *OpenshiftClient) DoOpenshiftGetRequest(path string) (*http.Response, error)
- func (oc *OpenshiftClient) DoOpenshiftPostRequest(path string, data []byte) (*http.Response, error)
- func (oc *OpenshiftClient) DoOpenshiftPutRequest(path string, data []byte) (*http.Response, error)
- func (oc *OpenshiftClient) GetProject(projectName string) (*projectv1.Project, error)
- func (oc *OpenshiftClient) GetRequest(path string) (*http.Response, error)
- func (oc *OpenshiftClient) ListPods(projectName string) (*corev1.PodList, error)
- func (oc *OpenshiftClient) ListProjects() (*projectv1.ProjectList, error)
- func (oc *OpenshiftClient) PerformRequest(req *http.Request) (*http.Response, error)
- type SimpleLogger
- type ThreeScaleAPIClient
- type ThreeScaleAPIClientImpl
- func (r *ThreeScaleAPIClientImpl) CreateProduct(name string) (string, error)
- func (r *ThreeScaleAPIClientImpl) DeleteProduct(id string) error
- func (r *ThreeScaleAPIClientImpl) GetUserId(username string) (string, error)
- func (r *ThreeScaleAPIClientImpl) Login3Scale(clientSecret string) error
- func (r *ThreeScaleAPIClientImpl) LoginOpenshift(masterUrl, username, password, namespacePrefix string) error
- func (r *ThreeScaleAPIClientImpl) Ping() error
- func (r *ThreeScaleAPIClientImpl) SendUserInvitation(name string) (string, error)
- func (r *ThreeScaleAPIClientImpl) SetUserAsAdmin(username string, email string, userID string) error
- func (r *ThreeScaleAPIClientImpl) VerifyUserIsAdmin(userID string) (bool, error)
- type User
Constants ¶
const ( ThreeScalePingUrl = "%v/p/admin/applications" ThreeScaleProductCreateUrl = "%v/apiconfig/services" ThreeScaleProductDeleteUrl = "%v/apiconfig/services/%v" ThreeScaleClient = "3scale" ThreeScaleUserInviteUrl = "%v/p/admin/account/invitations/" )
const ( OpenshiftPathListProjects = "/api/kubernetes/apis/project.openshift.io/v1/projects" OpenshiftPathGetProject = "/api/kubernetes/apis/project.openshift.io/v1/projects/%v" OpenshiftPathListPods = "/api/kubernetes/api/v1/namespaces/%v/pods" OpenshiftPathGetSecret = "/api/kubernetes/api/v1/namespaces/%s/secrets" PathListRHMI = "/apis/integreatly.org/v1alpha1/namespaces/%s/rhmis" PathGetRHMI = "/apis/integreatly.org/v1alpha1/namespaces/%s/rhmis/%s" PathGetRoute = "/apis/route.openshift.io/v1/namespaces/%s/routes/%s" )
#nosec G101 -- This is a false positive
const ( OpenshiftAuthenticationNamespace = "openshift-authentication" OpenshiftOAuthRouteName = "oauth-openshift" PathProjectRequests = "/apis/project.openshift.io/v1/projectrequests" PathProjects = "/api/kubernetes/apis/apis/project.openshift.io/v1/projects" )
Variables ¶
This section is empty.
Functions ¶
func Auth3Scale ¶
func DoAuthOpenshiftUser ¶
func DoAuthOpenshiftUser(authPageURL string, username string, password string, httpClient *http.Client, idp string, l SimpleLogger) error
doAuthOpenshiftUser this function expects users and IDP to be created via `./scripts/setup-sso-idp.sh`
func OpenshiftClientSubmitForm ¶
func OpenshiftClientSubmitForm(browser *browser.Browser, username, password string, idp string, l SimpleLogger) error
openshiftOAuthProxyLogin Retrieve a cookie by logging in through the OpenShift OAuth Proxy
func OpenshiftUserReconcileCheck ¶
func OpenshiftUserReconcileCheck(openshiftClient *OpenshiftClient, k8sclient dynclient.Client, namespacePrefix, username string) error
Checks if openshift user has been reconciled to the openshift realm in keycloak
Types ¶
type CallbackOptions ¶
type CallbackOptions struct { Response string `url:"response_type"` Scope string `url:"scope"` State string `url:"state"` }
CallbackOptions used to create and parse url callback options
type LoginOptions ¶
LoginOptions used to create and parse url login options
type OpenshiftClient ¶
func NewOpenshiftClient ¶
func NewOpenshiftClient(httpClient *http.Client, masterUrl string) *OpenshiftClient
func (*OpenshiftClient) DoOpenshiftCreatePodInANamespace ¶
func (oc *OpenshiftClient) DoOpenshiftCreatePodInANamespace(namespace string, podCR *corev1.Pod) error
func (*OpenshiftClient) DoOpenshiftCreateProject ¶
func (oc *OpenshiftClient) DoOpenshiftCreateProject(projectCR *projectv1.ProjectRequest) error
func (*OpenshiftClient) DoOpenshiftCreateServiceInANamespace ¶
func (oc *OpenshiftClient) DoOpenshiftCreateServiceInANamespace(namespace string, serviceCR *corev1.Service) error
func (*OpenshiftClient) DoOpenshiftDeleteRequest ¶
func (oc *OpenshiftClient) DoOpenshiftDeleteRequest(path string) (*http.Response, error)
make a delete request, expects a path
func (*OpenshiftClient) DoOpenshiftGetRequest ¶
func (oc *OpenshiftClient) DoOpenshiftGetRequest(path string) (*http.Response, error)
makes a get request, expects a path
func (*OpenshiftClient) DoOpenshiftPostRequest ¶
makes a post request, expects a path and the body
func (*OpenshiftClient) DoOpenshiftPutRequest ¶
makes a put request, expects a path and the body
func (*OpenshiftClient) GetProject ¶
func (oc *OpenshiftClient) GetProject(projectName string) (*projectv1.Project, error)
returns a project
func (*OpenshiftClient) GetRequest ¶
func (oc *OpenshiftClient) GetRequest(path string) (*http.Response, error)
makes a get request to the specified openshift api endpoint
func (*OpenshiftClient) ListPods ¶
func (oc *OpenshiftClient) ListPods(projectName string) (*corev1.PodList, error)
returns all pods in a namesapce
func (*OpenshiftClient) ListProjects ¶
func (oc *OpenshiftClient) ListProjects() (*projectv1.ProjectList, error)
returns all projects
func (*OpenshiftClient) PerformRequest ¶
Common function for setting auth headers on request and performing the request
type SimpleLogger ¶
type SimpleLogger interface {
Log(...interface{})
}
type ThreeScaleAPIClient ¶
type ThreeScaleAPIClient interface { Ping() error LoginOpenshift(masterUrl, username, password, namespacePrefix string) error Login3Scale(clientSecret string) error CreateProduct(name string) (string, error) DeleteProduct(href string) error SendUserInvitation(name string) (string, error) SetUserAsAdmin(username string, email string, userID string) error GetUserId(username string) (string, error) VerifyUserIsAdmin(userID string) (bool, error) }
func NewThreeScaleAPIClient ¶
func NewThreeScaleAPIClient(host, keycloakHost, redirectUrl string, client *http.Client, kubeClient k8sclient.Client, logger SimpleLogger) ThreeScaleAPIClient
type ThreeScaleAPIClientImpl ¶
type ThreeScaleAPIClientImpl struct {
// contains filtered or unexported fields
}
func (*ThreeScaleAPIClientImpl) CreateProduct ¶
func (r *ThreeScaleAPIClientImpl) CreateProduct(name string) (string, error)
Create a 3Scale product
func (*ThreeScaleAPIClientImpl) DeleteProduct ¶
func (r *ThreeScaleAPIClientImpl) DeleteProduct(id string) error
Delete a 3Scale product by id
func (*ThreeScaleAPIClientImpl) GetUserId ¶
func (r *ThreeScaleAPIClientImpl) GetUserId(username string) (string, error)
func (*ThreeScaleAPIClientImpl) Login3Scale ¶
func (r *ThreeScaleAPIClientImpl) Login3Scale(clientSecret string) error
func (*ThreeScaleAPIClientImpl) LoginOpenshift ¶
func (r *ThreeScaleAPIClientImpl) LoginOpenshift(masterUrl, username, password, namespacePrefix string) error
func (*ThreeScaleAPIClientImpl) Ping ¶
func (r *ThreeScaleAPIClientImpl) Ping() error
Call the applications endpoint of 3Scale to make sure it is available and the user has permissions to retrieve the list of applications
func (*ThreeScaleAPIClientImpl) SendUserInvitation ¶
func (r *ThreeScaleAPIClientImpl) SendUserInvitation(name string) (string, error)
Create a 3Scale user invite
func (*ThreeScaleAPIClientImpl) SetUserAsAdmin ¶
func (r *ThreeScaleAPIClientImpl) SetUserAsAdmin(username string, email string, userID string) error
func (*ThreeScaleAPIClientImpl) VerifyUserIsAdmin ¶
func (r *ThreeScaleAPIClientImpl) VerifyUserIsAdmin(userID string) (bool, error)