Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): make the dbrp api match the swagger spec #20091

Merged
merged 2 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
1. [20047](https://github.com/influxdata/influxdb/pull/20047): Allow scraper to ignore insecure certificates on a target. Thanks @cmackenzie1!
1. [20076](https://github.com/influxdata/influxdb/pull/20076): Remove internal `influxd upgrade` subcommands from help text.
1. [20074](https://github.com/influxdata/influxdb/pull/20074): Use default DBRP mapping on V1 write when no RP is specified.
1. [20091](https://github.com/influxdata/influxdb/pull/20091): Make the DBRP http API match the swagger spec.

## v2.0.1 [2020-11-10]

Expand Down
6 changes: 3 additions & 3 deletions dbrp/http_server_dbrp.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ type createDBRPRequest struct {
Database string `json:"database"`
RetentionPolicy string `json:"retention_policy"`
Default bool `json:"default"`
Org string `json:"organization"`
OrganizationID influxdb.ID `json:"organization_id"`
BucketID influxdb.ID `json:"bucket_id"`
Org string `json:"org"`
OrganizationID influxdb.ID `json:"orgID"`
BucketID influxdb.ID `json:"bucketID"`
}

func (h *Handler) handlePostDBRP(w http.ResponseWriter, r *http.Request) {
Expand Down
16 changes: 8 additions & 8 deletions dbrp/http_server_dbrp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ func Test_handlePostDBRP(t *testing.T) {
{
Name: "Create valid dbrp",
Input: strings.NewReader(`{
"bucket_id": "5555f7ed2a035555",
"organization_id": "059af7ed2a034000",
"bucketID": "5555f7ed2a035555",
"orgID": "059af7ed2a034000",
"database": "mydb",
"retention_policy": "autogen",
"default": false
Expand All @@ -72,8 +72,8 @@ func Test_handlePostDBRP(t *testing.T) {
{
Name: "Create valid dbrp by org name",
Input: strings.NewReader(`{
"bucket_id": "5555f7ed2a035555",
"organization": "org",
"bucketID": "5555f7ed2a035555",
"org": "org",
"database": "mydb",
"retention_policy": "autogen",
"default": false
Expand All @@ -85,8 +85,8 @@ func Test_handlePostDBRP(t *testing.T) {
{
Name: "Create with invalid orgID",
Input: strings.NewReader(`{
"bucket_id": "5555f7ed2a035555",
"organization_id": "invalid",
"bucketID": "5555f7ed2a035555",
"orgID": "invalid",
"database": "mydb",
"retention_policy": "autogen",
"default": false
Expand All @@ -100,8 +100,8 @@ func Test_handlePostDBRP(t *testing.T) {
{
Name: "Create with invalid org name",
Input: strings.NewReader(`{
"bucket_id": "5555f7ed2a035555",
"organization": "invalid",
"bucketID": "5555f7ed2a035555",
"org": "invalid",
"database": "mydb",
"retention_policy": "autogen",
"default": false
Expand Down
4 changes: 2 additions & 2 deletions dbrp_mapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ type DBRPMappingV2 struct {
// Default indicates if this mapping is the default for the cluster and database.
Default bool `json:"default"`

OrganizationID ID `json:"organization_id"`
BucketID ID `json:"bucket_id"`
OrganizationID ID `json:"orgID"`
BucketID ID `json:"bucketID"`
}

// Validate reports any validation errors for the mapping.
Expand Down