Documentation
¶
Index ¶
- func CreateM4DApplication(w http.ResponseWriter, r *http.Request)
- func CredentialOptions(w http.ResponseWriter, r *http.Request)
- func CredentialRoutes(client *K8sClient) *chi.Mux
- func DMARoutes(client *K8sClient) *chi.Mux
- func DeleteCredentials(w http.ResponseWriter, r *http.Request)
- func DeleteM4DApplication(w http.ResponseWriter, r *http.Request)
- func EnvOptions(w http.ResponseWriter, r *http.Request)
- func EnvironmentRoutes() *chi.Mux
- func ErrConfigProblem(err error) render.Renderer
- func ErrInvalidRequest(err error) render.Renderer
- func ErrRender(err error) render.Renderer
- func GetCredentials(w http.ResponseWriter, r *http.Request)
- func GetCurrentNamespace() string
- func GetEnvInfo(w http.ResponseWriter, r *http.Request)
- func GetM4DApplication(w http.ResponseWriter, r *http.Request)
- func ListM4DApplications(w http.ResponseWriter, r *http.Request)
- func M4DApplicationOptions(w http.ResponseWriter, r *http.Request)
- func StoreCredentials(w http.ResponseWriter, r *http.Request)
- func SysErrRender(err error) render.Renderer
- func UpdateM4DApplication(w http.ResponseWriter, r *http.Request)
- type CredsSuccessResponse
- type DMASuccessResponse
- type EnvironmentInfo
- type ErrResponse
- type K8sClient
- func (f *K8sClient) CreateApplication(obj *app.M4DApplication) (*app.M4DApplication, error)
- func (f *K8sClient) CreateOrUpdateSecret(obj *corev1.Secret) (*corev1.Secret, error)
- func (f *K8sClient) DeleteApplication(name string, options *meta_v1.DeleteOptions) error
- func (f *K8sClient) DeleteSecret(name string, options *meta_v1.DeleteOptions) error
- func (f *K8sClient) GetApplication(name string) (*app.M4DApplication, error)
- func (f *K8sClient) GetSecret(name string) (*corev1.Secret, error)
- func (f *K8sClient) ListApplications(opts meta_v1.ListOptions) (*app.M4DApplicationList, error)
- func (f *K8sClient) UpdateApplication(name string, obj *app.M4DApplication) (*app.M4DApplication, error)
- type UserCredentials
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateM4DApplication ¶
func CreateM4DApplication(w http.ResponseWriter, r *http.Request)
CreateM4DApplication creates a new M4DApplication CRD with the information provided by the Data User. The body of the request should have a json version of the M4DApplication TODO - return the unique ID for the requested M4DApplication. uniqueID=name+geography TODO - store the request body to file TODO - check if the requested M4DApplication already exists
func CredentialOptions ¶
func CredentialOptions(w http.ResponseWriter, r *http.Request)
CredentialOptions returns an OK status, but more importantly its header is set to indicate that future POST, PUT and DELETE calls are allowed as per the header values set when the router was initiated in main.go
func CredentialRoutes ¶
CredentialRoutes is a list of the REST APIs supported by the backend of the Data User GUI
func DeleteCredentials ¶
func DeleteCredentials(w http.ResponseWriter, r *http.Request)
DeleteCredentials deletes the secret
func DeleteM4DApplication ¶
func DeleteM4DApplication(w http.ResponseWriter, r *http.Request)
DeleteM4DApplication deletes the M4DApplication CRD running in the m4d control plane, and all of the components associated with it - ex: blueprint, modules that perform read, write, copy, transform, etc.
func EnvOptions ¶
func EnvOptions(w http.ResponseWriter, r *http.Request)
EnvOptions returns an OK status, but more importantly its header is set to indicate that future POST, PUT and DELETE calls are allowed as per the header values set when the router was initiated in main.go
func EnvironmentRoutes ¶
EnvironmentRoutes provide information about the cluster/namespace in which the GUI is running as well as info about the M4D control plane deployment assumptions - ex: Data Catalog in use
func ErrConfigProblem ¶
ErrConfigProblem indicates a problem with the environment configuration
func ErrInvalidRequest ¶
ErrInvalidRequest creates a structure describing an invalid request 400
func GetCredentials ¶
func GetCredentials(w http.ResponseWriter, r *http.Request)
GetCredentials returns the credentials for a specified system, namespace and compute
func GetCurrentNamespace ¶
func GetCurrentNamespace() string
GetCurrentNamespace returns the namespace in which the REST api service is deployed - which should be a user namespace
func GetEnvInfo ¶
func GetEnvInfo(w http.ResponseWriter, r *http.Request)
GetEnvInfo provide information about the cluster/namespace in which the GUI is running as well as info about the M4D control plane deployment assumptions - ex: Data Catalog in use
func GetM4DApplication ¶
func GetM4DApplication(w http.ResponseWriter, r *http.Request)
GetM4DApplication returns the M4DApplication CRD, both spec and status associated with the ID provided.
func ListM4DApplications ¶
func ListM4DApplications(w http.ResponseWriter, r *http.Request)
ListM4DApplications returns all of the M4DApplication instances in the namespace
func M4DApplicationOptions ¶
func M4DApplicationOptions(w http.ResponseWriter, r *http.Request)
M4DApplicationOptions returns an OK status, but more importantly its header is set to indicate that future POST, PUT and DELETE calls are allowed as per the header values set when the router was initiated in main.go
func StoreCredentials ¶
func StoreCredentials(w http.ResponseWriter, r *http.Request)
StoreCredentials stores the credentials
func SysErrRender ¶
SysErrRender returns errors relating to downstream systems
func UpdateM4DApplication ¶
func UpdateM4DApplication(w http.ResponseWriter, r *http.Request)
UpdateM4DApplication changes the desired state of an existing M4DApplication CRD
Types ¶
type CredsSuccessResponse ¶
type CredsSuccessResponse struct {
// JSON representation of the Secret
Secret string `json:"jsonDMA,omitempty"`
// Secret name
Name string `json:"name,omitempty"`
// Optional message about the action performed
Message string `json:"message,omitempty"`
}
CredsSuccessResponse - Structure returned when REST API is successful
type DMASuccessResponse ¶
type DMASuccessResponse struct {
// UniqueID of the M4DApplication
UniqueID string `json:"uniqueID"`
// JSON representation of the M4DApplication
DMA dm.M4DApplication `json:"jsonDMA,omitempty"`
// Optional message about the action performed
Message string `json:"message,omitempty"`
}
DMASuccessResponse - Structure returned when REST API is successful
type EnvironmentInfo ¶
type EnvironmentInfo struct {
// Namespace in which the GUI and GUI server are running
Namespace string `json:"namespace"`
// Geography in which the GUI and GUI server are running
Geography string `json:"geography"`
// Systems and the credentials they require
Systems map[string][]string `json:"systems"`
// DataSetIDStruct format which must be provided to M4D
DataSetIDFormat string `json:"dataSetIDFormat"`
}
EnvironmentInfo contains the info about the user's cluster/namespace and the external systems used by M4D
type ErrResponse ¶
type ErrResponse struct {
Err error `json:"-"` // low-level runtime error
HTTPStatusCode int `json:"-"` // http response status code
StatusText string `json:"status"` // user-level status message
AppCode int64 `json:"code,omitempty"` // application-specific error code
ErrorText string `json:"error,omitempty"` // application-level error message, for debugging
}
ErrResponse renderer type for handling all sorts of errors.
In the best case scenario, the excellent github.com/pkg/errors package helps reveal information on the error, setting it on Err, and in the Render() method, using it to set the application-specific error code in AppCode.
func (*ErrResponse) Render ¶
func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error
Render returns an error code
type K8sClient ¶
type K8sClient struct {
// contains filtered or unexported fields
}
K8sClient contains the contextual info about the REST client for k8s
func (*K8sClient) CreateApplication ¶
func (f *K8sClient) CreateApplication(obj *app.M4DApplication) (*app.M4DApplication, error)
CreateApplication makes a new M4DApplication CRD
func (*K8sClient) CreateOrUpdateSecret ¶
CreateOrUpdateSecret makes a new Secret or updates an existing one using received credentials
func (*K8sClient) DeleteApplication ¶
func (f *K8sClient) DeleteApplication(name string, options *meta_v1.DeleteOptions) error
DeleteApplication terminates the existing M4DApplication CRD and all its associated components in the m4d
func (*K8sClient) DeleteSecret ¶
func (f *K8sClient) DeleteSecret(name string, options *meta_v1.DeleteOptions) error
DeleteSecret deletes the existing secret
func (*K8sClient) GetApplication ¶
func (f *K8sClient) GetApplication(name string) (*app.M4DApplication, error)
GetApplication returns an existing M4DApplication CRD, including its status information
func (*K8sClient) ListApplications ¶
func (f *K8sClient) ListApplications(opts meta_v1.ListOptions) (*app.M4DApplicationList, error)
ListApplications gets the list of existing M4DApplication CRDs
func (*K8sClient) UpdateApplication ¶
func (f *K8sClient) UpdateApplication(name string, obj *app.M4DApplication) (*app.M4DApplication, error)
UpdateApplication updates an existing M4DApplication CRD
type UserCredentials ¶
type UserCredentials struct {
SecretName string `json:"secretName"`
System string `json:"system"` // system to access using the credentials, e.g. Egeria
Credentials map[string]string `json:"credentials"` // often username and password, but could be token or other types of credentials
}
UserCredentials contains the credentials needed to access a given system for the purpose of running a specific compute function.