Skip to content

Commit

Permalink
API to receive an email address and set it (#2095)
Browse files Browse the repository at this point in the history
* Generate swagger code for new endpoints
* Implemetn swagger APIs
* Add unit tests
  • Loading branch information
reivaj05 committed Jun 9, 2022
1 parent 5a8e029 commit c509e5d
Show file tree
Hide file tree
Showing 25 changed files with 2,400 additions and 0 deletions.
67 changes: 67 additions & 0 deletions models/mp_integration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions operatorapi/configure_operator.go
Expand Up @@ -89,6 +89,7 @@ func configureAPI(api *operations.OperatorAPI) http.Handler {
registerVolumesHandlers(api)
// Namespaces handlers
registerNamespaceHandlers(api)
registerMarketplaceHandlers(api)

api.PreServerShutdown = func() {}

Expand Down
210 changes: 210 additions & 0 deletions operatorapi/embedded_spec.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions operatorapi/k8s_client.go
Expand Up @@ -39,6 +39,10 @@ type K8sClientI interface {
createSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.CreateOptions) (*v1.Secret, error)
updateSecret(ctx context.Context, namespace string, secret *v1.Secret, opts metav1.UpdateOptions) (*v1.Secret, error)
getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error)
getConfigMap(ctx context.Context, namespace, configMap string, opts metav1.GetOptions) (*v1.ConfigMap, error)
createConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error)
updateConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error)
deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error
}

// Interface implementation
Expand Down Expand Up @@ -87,3 +91,19 @@ func (c *k8sClient) getStorageClasses(ctx context.Context, opts metav1.ListOptio
func (c *k8sClient) getPVC(ctx context.Context, namespace string, pvcName string, opts metav1.GetOptions) (*v1.PersistentVolumeClaim, error) {
return c.client.CoreV1().PersistentVolumeClaims(namespace).Get(ctx, pvcName, opts)
}

func (c *k8sClient) getConfigMap(ctx context.Context, namespace, name string, opts metav1.GetOptions) (*v1.ConfigMap, error) {
return c.client.CoreV1().ConfigMaps(namespace).Get(ctx, name, opts)
}

func (c *k8sClient) createConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.CreateOptions) (*v1.ConfigMap, error) {
return c.client.CoreV1().ConfigMaps(namespace).Create(ctx, cm, opts)
}

func (c *k8sClient) updateConfigMap(ctx context.Context, namespace string, cm *v1.ConfigMap, opts metav1.UpdateOptions) (*v1.ConfigMap, error) {
return c.client.CoreV1().ConfigMaps(namespace).Update(ctx, cm, opts)
}

func (c *k8sClient) deleteConfigMap(ctx context.Context, namespace string, name string, opts metav1.DeleteOptions) error {
return c.client.CoreV1().ConfigMaps(namespace).Delete(ctx, name, opts)
}

0 comments on commit c509e5d

Please sign in to comment.