-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PLAT-14801] add v2 API to list YBC Gflags metadata
Summary: Add the following v2 API ``` GET v2/metadata/list-ybc-gflags Response: [ { "name": "cores_dir", "meaning": "Path to the cores directory", "default_value": "/home/yugabyte/cores", "type": "string" }, { "name": "max_retries", "meaning": "Max number of retries.", "default_value": "10", "type": "int32" },... ] ``` The metadata was fetched from `yb-controller-server --help` Test Plan: Added UT. Manually tested as well. Reviewers: #yba-api-review, vkumar, sneelakantan Reviewed By: #yba-api-review, sneelakantan Subscribers: yugaware Differential Revision: https://phorge.dev.yugabyte.com/D37793
- Loading branch information
1 parent
a3f3bfe
commit a95dc94
Showing
11 changed files
with
431 additions
and
1 deletion.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
managed/src/main/java/api/v2/controllers/BackupAndRestoreApiControllerImp.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
|
||
package api.v2.controllers; | ||
|
||
import api.v2.handlers.BackupAndRestoreHandler; | ||
import api.v2.models.GflagMetadata; | ||
import com.google.inject.Inject; | ||
import java.util.List; | ||
import play.mvc.Http; | ||
|
||
public class BackupAndRestoreApiControllerImp extends BackupAndRestoreApiControllerImpInterface { | ||
|
||
@Inject BackupAndRestoreHandler backupAndRestoreHandler; | ||
|
||
@Override | ||
public List<GflagMetadata> listYbcGflagsMetadata(Http.Request request) throws Exception { | ||
return backupAndRestoreHandler.listYbcGflagsMetadata(request); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
managed/src/main/java/api/v2/handlers/BackupAndRestoreHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
|
||
package api.v2.handlers; | ||
|
||
import api.v2.mappers.GflagsMetadataMapper; | ||
import api.v2.models.GflagMetadata; | ||
import com.google.inject.Singleton; | ||
import com.yugabyte.yw.forms.ybc.YbcGflags; | ||
import java.util.List; | ||
import play.mvc.Http; | ||
|
||
@Singleton | ||
public class BackupAndRestoreHandler { | ||
|
||
public List<GflagMetadata> listYbcGflagsMetadata(Http.Request request) { | ||
return GflagsMetadataMapper.INSTANCE.toGflagMetadataList(YbcGflags.ybcGflagsMetadata.values()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
managed/src/main/java/api/v2/mappers/GflagsMetadataMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Copyright (c) YugaByte, Inc. | ||
|
||
package api.v2.mappers; | ||
|
||
import api.v2.models.GflagMetadata; | ||
import com.yugabyte.yw.forms.ybc.YbcGflags.YbcGflagsMetadata; | ||
import java.util.Collection; | ||
import java.util.List; | ||
import org.mapstruct.Mapper; | ||
import org.mapstruct.Mapping; | ||
import org.mapstruct.factory.Mappers; | ||
|
||
@Mapper(config = CentralConfig.class) | ||
public interface GflagsMetadataMapper { | ||
GflagsMetadataMapper INSTANCE = Mappers.getMapper(GflagsMetadataMapper.class); | ||
|
||
@Mapping(source = "flagName", target = "name") | ||
@Mapping(source = "defaultValue", target = "_default") | ||
GflagMetadata toGflagMetadata(YbcGflagsMetadata metadata); | ||
|
||
List<GflagMetadata> toGflagMetadataList(Collection<YbcGflagsMetadata> metadataList); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
managed/src/main/resources/openapi/components/responses/YbcGflagsResp.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
description: OK | ||
content: | ||
application/json: | ||
schema: | ||
type: array | ||
items: | ||
$ref: "../schemas/GflagMetadata.yaml" |
16 changes: 16 additions & 0 deletions
16
managed/src/main/resources/openapi/components/schemas/GflagMetadata.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
title: GflagMetadata | ||
description: Metadata for Gflags of YB Controller. | ||
type: object | ||
properties: | ||
name: | ||
description: The name of the flag. | ||
type: string | ||
meaning: | ||
description: A brief description of what the flag does. | ||
type: string | ||
default: | ||
description: The default value of the flag. | ||
type: string | ||
type: | ||
description: The data type of the flag. | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.