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

InfluxDB 2.0: The "/telegrafs" responses should have "orgID" instead of "OrgID" [area/api] #14062

Closed
bednar opened this issue Jun 5, 2019 · 1 comment · Fixed by #14071
Closed
Labels

Comments

@bednar
Copy link
Contributor

bednar commented Jun 5, 2019

The Telegraf schema is defined as:

TelegrafRequest:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
        agent:
          type: object
          properties:
            collectionInterval:
              type: integer
        plugins:
          type: array
          items:
            $ref: "#/components/schemas/TelegrafRequestPlugin"
        orgID:
          type: string

Telegraf:
      type: object
      allOf:
        - $ref: "#/components/schemas/TelegrafRequest"
        - type: object
          properties:
            id:
              type: string
              readOnly: true
            links:
              type: object
              readOnly: true
              example:
                self: "/api/v2/telegrafs/1"
                lables: "/api/v2/telegrafs/1/labels"
                owners: "/api/v2/telegrafs/1/owners"
                members: "/api/v2/telegrafs/1/members"
              properties:
                self:
                  $ref: "#/components/schemas/Link"
                labels:
                  $ref: "#/components/schemas/Link"
                members:
                  $ref: "#/components/schemas/Link"
                owners:
                  $ref: "#/components/schemas/Link"
            labels:
              readOnly: true
              $ref: "#/components/schemas/Labels"

but the response contains OrgID (uppercase)

-> POST 
-> http://127.0.0.1:9999/api/v2/telegrafs
-> {
	"name": "TelegrafConfig1559721891728-IT",
	"description": "test-config",
	"agent": {
		"collectionInterval": 1000
	},
	"plugins": [{
		"comment": "Output to Influx 2.0",
		"name": "influxdb_v2",
		"type": "output",
		"config": {
			"urls": ["http://127.0.0.1:9999"],
			"token": "$INFLUX_TOKEN",
			"organization": "my-org",
			"bucket": "my-bucket"
		}
	}, {
		"name": "cpu",
		"type": "input"
	}],
	"orgID": "03f5aa235c002000"
}

<- 201
<- Created
<- {
	"id": "03f5aa2ef3c02000",
	"OrgID": "03f5aa235c002000",
	"name": "TelegrafConfig1559721891728-IT",
	"description": "test-config",
	"agent": {
		"collectionInterval": 1000
	},
	"plugins": [{
		"name": "influxdb_v2",
		"type": "output",
		"comment": "Output to Influx 2.0",
		"config": {
			"urls": ["http://127.0.0.1:9999"],
			"token": "$INFLUX_TOKEN",
			"organization": "my-org",
			"bucket": "my-bucket"
		}
	}, {
		"name": "cpu",
		"type": "input",
		"comment": "",
		"config": {}
	}],
	"labels": [],
	"links": {
		"self": "/api/v2/telegrafs/03f5aa2ef3c02000",
		"labels": "/api/v2/telegrafs/03f5aa2ef3c02000/labels",
		"members": "/api/v2/telegrafs/03f5aa2ef3c02000/members",
		"owners": "/api/v2/telegrafs/03f5aa2ef3c02000/owners"
	}
}

caused by #13411, cc @kelwang

@bednar bednar added the area/api label Jun 5, 2019
@bednar
Copy link
Contributor Author

bednar commented Jun 5, 2019

The telegrafConfigEncode should be change from:

type telegrafConfigEncode struct {
		ID          platform.ID                  `json:"id"`
		OrgID       platform.ID                  `json:"OrgID,omitempty"`
		...
}

to

type telegrafConfigEncode struct {
		ID          platform.ID                  `json:"id"`
		OrgID       platform.ID                  `json:"orgID,omitempty"`
		...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant