Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: introduce expiration duration

d-bytebase9b2ccaadad13
diff --git a/frontend/src/types/proto/store/issue.ts b/frontend/src/types/proto/store/issue.ts
index b31357aa59..ad18e5b8a4 100644
--- a/frontend/src/types/proto/store/issue.ts
+++ b/frontend/src/types/proto/store/issue.ts
@@ -1,5 +1,6 @@
/* eslint-disable */
import * as _m0 from "protobufjs/minimal";
+import { Duration } from "../google/protobuf/duration";
import { Expr } from "../google/type/expr";
import { IssuePayloadApproval } from "./approval";
@@ -22,6 +23,7 @@ export interface GrantRequest {
/** The requested user, e.g. users/[email protected]. */
user: string;
condition?: Expr;
+ expiration?: Duration;
}
function createBaseIssuePayload(): IssuePayload {
@@ -173,7 +175,7 @@ export const Grouping = {
};
function createBaseGrantRequest(): GrantRequest {
- return { role: "", user: "", condition: undefined };
+ return { role: "", user: "", condition: undefined, expiration: undefined };
}
export const GrantRequest = {
@@ -187,6 +189,9 @@ export const GrantRequest = {
if (message.condition !== undefined) {
Expr.encode(message.condition, writer.uint32(26).fork()).ldelim();
}
+ if (message.expiration !== undefined) {
+ Duration.encode(message.expiration, writer.uint32(34).fork()).ldelim();
+ }
return writer;
},
@@ -218,6 +223,13 @@ export const GrantRequest = {
message.condition = Expr.decode(reader, reader.uint32());
continue;
+ case 4:
+ if (tag !== 34) {
+ break;
+ }
+
+ message.expiration = Duration.decode(reader, reader.uint32());
+ continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
@@ -232,6 +244,7 @@ export const GrantRequest = {
role: isSet(object.role) ? String(object.role) : "",
user: isSet(object.user) ? String(object.user) : "",
condition: isSet(object.condition) ? Expr.fromJSON(object.condition) : undefined,
+ expiration: isSet(object.expiration) ? Duration.fromJSON(object.expiration) : undefined,
};
},
@@ -240,6 +253,8 @@ export const GrantRequest = {
message.role !== undefined && (obj.role = message.role);
message.user !== undefined && (obj.user = message.user);
message.condition !== undefined && (obj.condition = message.condition ? Expr.toJSON(message.condition) : undefined);
+ message.expiration !== undefined &&
+ (obj.expiration = message.expiration ? Duration.toJSON(message.expiration) : undefined);
return obj;
},
@@ -254,6 +269,9 @@ export const GrantRequest = {
message.condition = (object.condition !== undefined && object.condition !== null)
? Expr.fromPartial(object.condition)
: undefined;
+ message.expiration = (object.expiration !== undefined && object.expiration !== null)
+ ? Duration.fromPartial(object.expiration)
+ : undefined;
return message;
},
};
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index d26b9fa25b..26d02a7071 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -1160,6 +1160,7 @@ OIDCIdentityProviderConfig is the structure for OIDC identity provider config.
| role | [string](#string) | | The requested role, e.g. roles/EXPORTER. |
| user | [string](#string) | | The requested user, e.g. users/[email protected]. |
| condition | [google.type.Expr](#google-type-Expr) | | |
+| expiration | [google.protobuf.Duration](#google-protobuf-Duration) | | |
diff --git a/proto/generated-go/store/issue.pb.go b/proto/generated-go/store/issue.pb.go
index e0f3856664..2a7249feea 100644
--- a/proto/generated-go/store/issue.pb.go
+++ b/proto/generated-go/store/issue.pb.go
@@ -10,6 +10,7 @@ import (
expr "google.golang.org/genproto/googleapis/type/expr"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ durationpb "google.golang.org/protobuf/types/known/durationpb"
reflect "reflect"
sync "sync"
)
@@ -140,8 +141,9 @@ type GrantRequest struct {
// The requested role, e.g. roles/EXPORTER.
Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"`
// The requested user, e.g. users/[email protected].
- User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
- Condition *expr.Expr `protobuf:"bytes,3,opt,name=condition,proto3" json:"condition,omitempty"`
+ User string `protobuf:"bytes,2,opt,name=user,proto3" json:"user,omitempty"`
+ Condition *expr.Expr `protobuf:"bytes,3,opt,name=condition,proto3" json:"condition,omitempty"`
+ Expiration *durationpb.Duration `protobuf:"bytes,4,opt,name=expiration,proto3" json:"expiration,omitempty"`
}
func (x *GrantRequest) Reset() {
@@ -197,12 +199,21 @@ func (x *GrantRequest) GetCondition() *expr.Expr {
return nil
}
+func (x *GrantRequest) GetExpiration() *durationpb.Duration {
+ if x != nil {
+ return x.Expiration
+ }
+ return nil
+}
+
var File_store_issue_proto protoreflect.FileDescriptor
var file_store_issue_proto_rawDesc = []byte{
0x0a, 0x11, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x2f, 0x69, 0x73, 0x73, 0x75, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x73, 0x74,
- 0x6f, 0x72, 0x65, 0x1a, 0x16, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x74, 0x79, 0x70, 0x65,
+ 0x6f, 0x72, 0x65, 0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
+ 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x74, 0x79, 0x70, 0x65,
0x2f, 0x65, 0x78, 0x70, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x14, 0x73, 0x74, 0x6f,
0x72, 0x65, 0x2f, 0x61, 0x70, 0x70, 0x72, 0x6f, 0x76, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x22, 0xc9, 0x01, 0x0a, 0x0c, 0x49, 0x73, 0x73, 0x75, 0x65, 0x50, 0x61, 0x79, 0x6c, 0x6f,
@@ -221,15 +232,19 @@ var file_store_issue_proto_rawDesc = []byte{
0x08, 0x47, 0x72, 0x6f, 0x75, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2e, 0x0a, 0x13, 0x64, 0x61, 0x74,
0x61, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x5f, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x64, 0x61, 0x74, 0x61, 0x62, 0x61, 0x73, 0x65,
- 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x67, 0x0a, 0x0c, 0x47, 0x72, 0x61,
- 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f, 0x6c,
- 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12, 0x0a,
- 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65,
- 0x72, 0x12, 0x2f, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x74, 0x79,
- 0x70, 0x65, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69,
- 0x6f, 0x6e, 0x42, 0x14, 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d,
- 0x67, 0x6f, 0x2f, 0x73, 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x47, 0x72, 0x6f, 0x75, 0x70, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0xa2, 0x01, 0x0a, 0x0c, 0x47, 0x72,
+ 0x61, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x72, 0x6f,
+ 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x12, 0x12,
+ 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73,
+ 0x65, 0x72, 0x12, 0x2f, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18,
+ 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x74,
+ 0x79, 0x70, 0x65, 0x2e, 0x45, 0x78, 0x70, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x64, 0x69, 0x74,
+ 0x69, 0x6f, 0x6e, 0x12, 0x39, 0x0a, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69,
+ 0x6f, 0x6e, 0x52, 0x0a, 0x65, 0x78, 0x70, 0x69, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x14,
+ 0x5a, 0x12, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x73,
+ 0x74, 0x6f, 0x72, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -251,17 +266,19 @@ var file_store_issue_proto_goTypes = []interface{}{
(*GrantRequest)(nil), // 2: bytebase.store.GrantRequest
(*IssuePayloadApproval)(nil), // 3: bytebase.store.IssuePayloadApproval
(*expr.Expr)(nil), // 4: google.type.Expr
+ (*durationpb.Duration)(nil), // 5: google.protobuf.Duration
}
var file_store_issue_proto_depIdxs = []int32{
3, // 0: bytebase.store.IssuePayload.approval:type_name -> bytebase.store.IssuePayloadApproval
2, // 1: bytebase.store.IssuePayload.grant_request:type_name -> bytebase.store.GrantRequest
1, // 2: bytebase.store.IssuePayload.grouping:type_name -> bytebase.store.Grouping
4, // 3: bytebase.store.GrantRequest.condition:type_name -> google.type.Expr
- 4, // [4:4] is the sub-list for method output_type
- 4, // [4:4] is the sub-list for method input_type
- 4, // [4:4] is the sub-list for extension type_name
- 4, // [4:4] is the sub-list for extension extendee
- 0, // [0:4] is the sub-list for field type_name
+ 5, // 4: bytebase.store.GrantRequest.expiration:type_name -> google.protobuf.Duration
+ 5, // [5:5] is the sub-list for method output_type
+ 5, // [5:5] is the sub-list for method input_type
+ 5, // [5:5] is the sub-list for extension type_name
+ 5, // [5:5] is the sub-list for extension extendee
+ 0, // [0:5] is the sub-list for field type_name
}
func init() { file_store_issue_proto_init() }
diff --git a/proto/store/issue.proto b/proto/store/issue.proto
index fc0f6bd7c0..36776bcad7 100644
--- a/proto/store/issue.proto
+++ b/proto/store/issue.proto
@@ -2,6 +2,7 @@ syntax = "proto3";
package bytebase.store;
+import "google/protobuf/duration.proto";
import "google/type/expr.proto";
import "store/approval.proto";
@@ -24,4 +25,5 @@ message GrantRequest {
// The requested user, e.g. users/[email protected].
string user = 2;
google.type.Expr condition = 3;
+ google.protobuf.Duration expiration = 4;
}