Skip to content

Commit

Permalink
Merge pull request #20091 from influxdata/DBRPmatchswagger
Browse files Browse the repository at this point in the history
fix(api): make the dbrp api match the swagger spec
  • Loading branch information
docmerlin authored Nov 18, 2020
2 parents 4541ab9 + 2b6ff95 commit 1788b47
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,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

0 comments on commit 1788b47

Please sign in to comment.