Skip to content

Commit

Permalink
fix(mgmt): reference owner by ID in credit endpoints. (#330)
Browse files Browse the repository at this point in the history
Because

- There was a confusion in the API and database references to the Credit
owner. At the API level we reference the owner by ID, but the database
will store the UID reference to be resilient against ID updates.

This commit

- Reverts commit 2b79ef0 "fix(vdp):
correct reference to credit owner id->uid (#321)"
  • Loading branch information
jvallesm authored May 14, 2024
1 parent 279d0a3 commit 796a98a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
12 changes: 5 additions & 7 deletions core/mgmt/v1beta/mgmt.proto
Original file line number Diff line number Diff line change
Expand Up @@ -574,13 +574,12 @@ message ValidateTokenResponse {
// GetRemainingCreditRequest represents a request to get the remaining credit
// of a user or organization.
message GetRemainingCreditRequest {
// The user or organization to which the credit belongs. Owners are
// referenced by UID.
// Format: `{[users|organizations]}/{uid}`.
// The user or organization to which the credit belongs.
// Format: `{[users|organizations]}/{id}`.
string owner = 1 [
(google.api.field_behavior) = REQUIRED,
(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {
field_configuration: {path_param_name: "owner_uid"}
field_configuration: {path_param_name: "owner_name"}
}
];
}
Expand All @@ -595,9 +594,8 @@ message GetRemainingCreditResponse {
// SubtractCreditRequest represents a request to subtract Instill Credit from
// an account.
message SubtractCreditRequest {
// The user or organization to which the credit belongs. Owners are
// referenced by UID.
// Format: `{[users|organizations]}/{uid}`.
// The user or organization to which the credit belongs.
// Format: `{[users|organizations]}/{id}`.
string owner = 1 [(google.api.field_behavior) = REQUIRED];
// The credit amount to subtract.
float amount = 2;
Expand Down
9 changes: 4 additions & 5 deletions openapiv2/core/service.swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ paths:
$ref: '#/definitions/googlerpcStatus'
tags:
- Token
/v1beta/{owner_uid}/credit:
/v1beta/{owner_name}/credit:
get:
summary: Get the remaining Instill Credit
description: |-
Expand All @@ -918,11 +918,10 @@ paths:
schema:
$ref: '#/definitions/googlerpcStatus'
parameters:
- name: owner_uid
- name: owner_name
description: |-
The user or organization to which the credit belongs. Owners are
referenced by UID.
Format: `{[users|organizations]}/{uid}`.
The user or organization to which the credit belongs.
Format: `{[users|organizations]}/{id}`.
in: path
required: true
type: string
Expand Down

0 comments on commit 796a98a

Please sign in to comment.