Clarify API GetDatabases vs GetDatabaseServers (#29026)

* Clarify client.GetDatabases vs client.GetDatabaseServers

* address typos
This commit is contained in:
STeve (Xin) Huang 2023-07-13 11:48:19 -04:00 committed by GitHub
parent 8affae4027
commit 2c4b4deb95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1454,6 +1454,10 @@ func (c *Client) GenerateSnowflakeJWT(ctx context.Context, req types.GenerateSno
}
// GetDatabaseServers returns all registered database proxy servers.
//
// Note that in HA setups, a registered database may have multiple
// DatabaseServer entries. Web UI and `tsh db ls` extract databases from this
// list and remove duplicates by name.
func (c *Client) GetDatabaseServers(ctx context.Context, namespace string) ([]types.DatabaseServer, error) {
servers, err := GetAllResources[types.DatabaseServer](ctx, c, &proto.ListResourcesRequest{
Namespace: namespace,
@ -2631,6 +2635,14 @@ func (c *Client) UpdateApp(ctx context.Context, app types.Application) error {
}
// GetApp returns the specified application resource.
//
// Note that application resources here refers to "dynamically-added"
// applications such as applications created by `tctl create`, or the CreateApp
// API. Applications defined in the `app_service.apps` section of the service
// YAML configuration are not collected in this API.
//
// For a full list of registered applications that are served by an application
// service, use GetApplicationServers instead.
func (c *Client) GetApp(ctx context.Context, name string) (types.Application, error) {
if name == "" {
return nil, trace.BadParameter("missing application name")
@ -2643,6 +2655,14 @@ func (c *Client) GetApp(ctx context.Context, name string) (types.Application, er
}
// GetApps returns all application resources.
//
// Note that application resources here refers to "dynamically-added"
// applications such as applications created by `tctl create`, or the CreateApp
// API. Applications defined in the `app_service.apps` section of the service
// YAML configuration are not collected in this API.
//
// For a full list of registered applications that are served by an application
// service, use GetApplicationServers instead.
func (c *Client) GetApps(ctx context.Context) ([]types.Application, error) {
items, err := c.grpc.GetApps(ctx, &emptypb.Empty{})
if err != nil {
@ -2745,6 +2765,16 @@ func (c *Client) UpdateDatabase(ctx context.Context, database types.Database) er
}
// GetDatabase returns the specified database resource.
//
// Note that database resources here refers to "dynamically-added" databases
// such as databases created by `tctl create`, the discovery service, or the
// CreateDatabase API. Databases discovered by the database agent (legacy
// discovery flow using `database_service.aws/database_service.azure`) and
// static databases defined in the `database_service.databases` section of the
// service YAML configuration are not collected in this API.
//
// For a full list of registered databases that are served by a database
// service, use GetDatabaseServers instead.
func (c *Client) GetDatabase(ctx context.Context, name string) (types.Database, error) {
if name == "" {
return nil, trace.BadParameter("missing database name")
@ -2757,6 +2787,16 @@ func (c *Client) GetDatabase(ctx context.Context, name string) (types.Database,
}
// GetDatabases returns all database resources.
//
// Note that database resources here refers to "dynamically-added" databases
// such as databases created by `tctl create`, the discovery service, or the
// CreateDatabase API. Databases discovered by the database agent (legacy
// discovery flow using `database_service.aws/database_service.azure`) and
// static databases defined in the `database_service.databases` section of the
// service YAML configuration are not collected in this API.
//
// For a full list of registered databases that are served by a database
// service, use GetDatabaseServers instead.
func (c *Client) GetDatabases(ctx context.Context) ([]types.Database, error) {
items, err := c.grpc.GetDatabases(ctx, &emptypb.Empty{})
if err != nil {