Commit Graph
9 Commits
Author SHA1 Message Date
Lisa Kim 8aefef1ae6 [Web:Discover] Bring back db service checker (#21062)
* [Backend]: allow more db fields to be updatable

* Add preventing duplicate keys for label creator

* Add sort compare fn helper

* Update db request update object

* Update CreateDatabase component

- Uncomment and touch up db service checker
- Fix db service label checking
- Allow user to make changes to updatable db fields
- Split defining db name and the other fields into
  two views, to prevent user from changing the db name
  which is not allowed with the update action

* Address CR: use nil value to determine CACert update

* Few more touch ups
- address CR: don't OR update db request field CACert
  and use consistent camelCasing
- remove the skip button for deploying service since
  we have the service checker now, which auto skips it
  for user if detects service
- refactor label matching for both register database
  and deploy service steps

* Address CR: make all fields updatable

* Update service polling after rebase
2023-02-06 18:44:39 +00:00
Marco André Dinis f90a1bd452 WebAPI/CreateDB: improve error message when DB already exists (#20345)
When creating a database with the same name of an already existing one,
we were getting a raw error (depends on the backend implementation:
memory, lite, dynamo, ...).
This message is shown to the user which sees it as a cryptic error.

To improve this we should present the error in a better way and provide
an immediate action.
2023-01-26 08:05:18 +00:00
STeve (Xin) Huang 48fbd369ed Enable database fetchers for discovery service (#19739) 2023-01-13 14:03:06 +00:00
Lisa Kim fe1acfc6d3 [Discover] Fix yaml formatting with yaml lists for db join token request (#19939)
* Fix yaml formatting with yaml lists
* Snuck in adding db access checker result 
   with webapi create db endpoint
2023-01-06 18:38:10 +00:00
Lisa Kim 296255f868 [Discover] Add ons for database flow (#19063)
* Add db access rule required for db discovery
  in editors role

For the webapi layer:
* Return db access with user context
* Add AWS RDS fields for creating db request
* Return hostname of each queried db server
2022-12-06 19:20:11 +00:00
rosstimothy 07e2ca13e4 Prevent race from causing remote clients from being closed (#19010)
* Prevent race from causing remote clients from being closed

`web.SessionContext` was susceptible to races retrieving `auth.ClientI`
for remote sites. The mutex on the remote client cache was not held for
the duration of the `GetUserClient` which meant two simultaneous requests
could find no client existed in the cache, create one and then add it to
the cache. When the second client is added to the cache it would close the
first client created, which results in the `use of closed network connection`
error displaying on the web UI as described in #17173.

To remedy this the portion of `GetUserClient` that retrieves the remote client
is now protected by a `singleflight.Group`. This ensures that races on creating
a client no longer happen.

`web.SessionContext` was slightly refactored to make it easier to test, to
remove some unnecessary operations, and to provide `context.Context` to `GetUserClient`.
Additionally, all `web.SessionContext` variables which were named `ctx` in `lib/web`
have been renamed to avoid confusion as that often refers to a `context.Context`.

Fixes #17173
2022-12-05 20:10:01 +00:00
Marco André Dinis 692d2661f4 WebAPI: Get database endpoint (#18041)
* WebAPI: Get database endpoint

This commit creates a new endpoint to return a single databse by its
name.

```
GET /webapi/sites/:site/databases/:database

{
  "name": "<database_name>",
  "desc": "<description>",
  "protocol": "<protocol>",
  "type": "<type>",
  "labels": [
    {"name": "<name>", "value": "<value>"},
    ...
  ],
  "database_users": ["<db_user1>", ...],
  "database_names": ["<db_name1>", ...],
}
```

The `database_users` and `database_names` will list the available
Database User and Names for the current user, based on its roles.
2022-11-10 16:25:09 +00:00
STeve (Xin) Huang d8f4581606 Web API for getting database IAM policy (#17635) 2022-11-09 13:58:17 +00:00
Marco André Dinis 80f4f61032 Create and Update database http endpoints (#17783)
This commit adds two new endpoints:
Create a database with

```
POST .../databases
{
  "name": "<databasename>",
  "protocol": "<protocol>",
  "uri": "<uri>",
  "labels": [{"name":"<name>", "value": "<value>"}...]
}
```

Update a database's `ca_cert` (the only updatable field for now)
```
PUT .../databases/:database
{
  "ca_cert": "------BEGIN CERTIFICATE-----\n <certificate> --END..."
}
```
2022-11-08 11:37:01 +00:00