datauser

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFybrikApplication

func CreateFybrikApplication(w http.ResponseWriter, r *http.Request)

CreateFybrikApplication creates a new FybrikApplication CRD with the information provided by the Data User. The body of the request should have a json version of the FybrikApplication TODO - return the unique ID for the requested FybrikApplication. uniqueID=name+geography TODO - store the request body to file TODO - check if the requested FybrikApplication 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

func CredentialRoutes(client *K8sClient) *chi.Mux

CredentialRoutes is a list of the REST APIs supported by the backend of the Data User GUI

func DMARoutes

func DMARoutes(client *K8sClient) *chi.Mux

DMARoutes 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 DeleteFybrikApplication

func DeleteFybrikApplication(w http.ResponseWriter, r *http.Request)

DeleteFybrikApplication deletes the FybrikApplication CRD running in the fybrik 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

func EnvironmentRoutes() *chi.Mux

EnvironmentRoutes provide information about the cluster/namespace in which the GUI is running as well as info about the Fybrik control plane deployment assumptions - ex: Data Catalog in use

func ErrConfigProblem

func ErrConfigProblem(err error) render.Renderer

ErrConfigProblem indicates a problem with the environment configuration

func ErrInvalidRequest

func ErrInvalidRequest(err error) render.Renderer

ErrInvalidRequest creates a structure describing an invalid request 400

func ErrRender

func ErrRender(err error) render.Renderer

ErrRender creates a 422 error

func FybrikApplicationOptions

func FybrikApplicationOptions(w http.ResponseWriter, r *http.Request)

FybrikApplicationOptions 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 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 Fybrik control plane deployment assumptions - ex: Data Catalog in use

func GetFybrikApplication

func GetFybrikApplication(w http.ResponseWriter, r *http.Request)

GetFybrikApplication returns the FybrikApplication CRD, both spec and status associated with the ID provided.

func ListFybrikApplications

func ListFybrikApplications(w http.ResponseWriter, r *http.Request)

ListFybrikApplications returns all of the FybrikApplication instances in the namespace

func OnClientNotSet added in v0.7.0

func OnClientNotSet(w http.ResponseWriter, r *http.Request)

func OnError added in v0.7.0

func OnError(w http.ResponseWriter, r *http.Request, err error)

func StoreCredentials

func StoreCredentials(w http.ResponseWriter, r *http.Request)

StoreCredentials stores the credentials

func SysErrRender

func SysErrRender(err error) render.Renderer

SysErrRender returns errors relating to downstream systems

func UpdateFybrikApplication

func UpdateFybrikApplication(w http.ResponseWriter, r *http.Request)

UpdateFybrikApplication changes the desired state of an existing FybrikApplication 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 FybrikApplication
	UniqueID string `json:"uniqueID"`

	// JSON representation of the FybrikApplication
	DMA dm.FybrikApplication `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 Fybrik
	DataSetIDFormat string `json:"dataSetIDFormat"`
}

EnvironmentInfo contains the info about the user's cluster/namespace and the external systems used by Fybrik

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 K8sInit

func K8sInit() (*K8sClient, error)

K8sInit initializes a client to communicate with kubernetes

func (*K8sClient) CreateApplication

func (f *K8sClient) CreateApplication(obj *app.FybrikApplication) (*app.FybrikApplication, error)

CreateApplication makes a new FybrikApplication CRD

func (*K8sClient) CreateOrUpdateSecret

func (f *K8sClient) CreateOrUpdateSecret(obj *corev1.Secret) (*corev1.Secret, error)

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 FybrikApplication CRD and all its associated components in the fybrik

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.FybrikApplication, error)

GetApplication returns an existing FybrikApplication CRD, including its status information

func (*K8sClient) GetSecret

func (f *K8sClient) GetSecret(name string) (*corev1.Secret, error)

GetSecret returns an existing secret

func (*K8sClient) ListApplications

func (f *K8sClient) ListApplications() (*app.FybrikApplicationList, error)

ListApplications gets the list of existing FybrikApplication CRDs

func (*K8sClient) UpdateApplication

func (f *K8sClient) UpdateApplication(name string, obj *app.FybrikApplication) (*app.FybrikApplication, error)

UpdateApplication updates an existing FybrikApplication 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.

Jump to

Keyboard shortcuts

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