Skip to content

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

feat: add SearchMyAccessGrants API and use AIP-214 expiration pattern (#19315)

rebelice9a0da3618e83
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 69f47e1d78..2e74df39cf 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -181,6 +181,42 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ /bytebase.v1.AccessGrantService/SearchMyAccessGrants:
+ post:
+ tags:
+ - bytebase.v1.AccessGrantService
+ summary: SearchMyAccessGrants
+ description: Searches access grants created by the caller.
+ operationId: bytebase.v1.AccessGrantService.SearchMyAccessGrants
+ parameters:
+ - name: Connect-Protocol-Version
+ in: header
+ required: true
+ schema:
+ $ref: '#/components/schemas/connect-protocol-version'
+ - name: Connect-Timeout-Ms
+ in: header
+ schema:
+ $ref: '#/components/schemas/connect-timeout-header'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SearchMyAccessGrantsRequest'
+ required: true
+ responses:
+ default:
+ description: Error
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/connect.error'
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SearchMyAccessGrantsResponse'
/bytebase.v1.ActuatorService/DeleteCache:
post:
tags:
@@ -6925,64 +6961,77 @@ components:
- AZURE_OPENAI
bytebase.v1.AccessGrant:
type: object
- properties:
- name:
- type: string
- title: name
- description: |-
- The name of the access grant, generated by the server.
- Format: projects/{project}/accessGrants/{access_grant}
- The {access_grant} segment is a server-generated unique ID.
- creator:
- type: string
- title: creator
- description: |-
- The creator of the access grant.
- Format: users/{email}
- status:
- title: status
- description: |-
- The status of the access grant.
- An ACTIVE grant with `expire_time` in the past is effectively expired
- and no longer authorizes access. Use `expire_time` to determine
- whether an ACTIVE grant has expired.
- $ref: '#/components/schemas/bytebase.v1.AccessGrant.Status'
- expireTime:
- title: expire_time
- description: |-
- The expiration time of the access grant.
- When the current time exceeds this value, an ACTIVE grant is
- considered expired and no longer authorizes access.
- $ref: '#/components/schemas/google.protobuf.Timestamp'
- issue:
- type: string
- title: issue
- description: |-
- The issue associated with the access grant.
- Can be empty.
- Format: projects/{project}/issues/{issue}
- targets:
- type: array
- items:
- type: string
- title: targets
- description: |-
- The target databases for this access grant.
- Format: instances/{instance}/databases/{database}
- query:
- type: string
- title: query
- description: The query permission granted.
- unmask:
- type: boolean
- title: unmask
- description: Whether the grant allows unmasking sensitive data.
- createTime:
- title: create_time
- $ref: '#/components/schemas/google.protobuf.Timestamp'
- updateTime:
- title: update_time
- $ref: '#/components/schemas/google.protobuf.Timestamp'
+ allOf:
+ - properties:
+ name:
+ type: string
+ title: name
+ description: |-
+ The name of the access grant, generated by the server.
+ Format: projects/{project}/accessGrants/{access_grant}
+ The {access_grant} segment is a server-generated unique ID.
+ creator:
+ type: string
+ title: creator
+ description: |-
+ The creator of the access grant.
+ Format: users/{email}
+ status:
+ title: status
+ description: |-
+ The status of the access grant.
+ An ACTIVE grant with `expire_time` in the past is effectively expired
+ and no longer authorizes access. Use `expire_time` to determine
+ whether an ACTIVE grant has expired.
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant.Status'
+ issue:
+ type: string
+ title: issue
+ description: |-
+ The issue associated with the access grant.
+ Can be empty.
+ Format: projects/{project}/issues/{issue}
+ targets:
+ type: array
+ items:
+ type: string
+ title: targets
+ description: |-
+ The target databases for this access grant.
+ Format: instances/{instance}/databases/{database}
+ query:
+ type: string
+ title: query
+ description: The query permission granted.
+ unmask:
+ type: boolean
+ title: unmask
+ description: Whether the grant allows unmasking sensitive data.
+ createTime:
+ title: create_time
+ $ref: '#/components/schemas/google.protobuf.Timestamp'
+ updateTime:
+ title: update_time
+ $ref: '#/components/schemas/google.protobuf.Timestamp'
+ - oneOf:
+ - properties:
+ expireTime:
+ title: expire_time
+ description: The expiration time of the access grant.
+ $ref: '#/components/schemas/google.protobuf.Timestamp'
+ title: expire_time
+ required:
+ - expireTime
+ - properties:
+ ttl:
+ title: ttl
+ description: |-
+ Input only. The time-to-live duration for the access grant.
+ The server computes `expire_time` from this value at creation time.
+ $ref: '#/components/schemas/google.protobuf.Duration'
+ title: ttl
+ required:
+ - ttl
title: AccessGrant
additionalProperties: false
bytebase.v1.AccessGrant.Status:
@@ -15792,6 +15841,52 @@ components:
If this field is omitted, there are no subsequent pages.
title: SearchIssuesResponse
additionalProperties: false
+ bytebase.v1.SearchMyAccessGrantsRequest:
+ type: object
+ properties:
+ parent:
+ type: string
+ title: parent
+ description: |-
+ The parent project to search in.
+ Format: projects/{project}
+ pageSize:
+ type: integer
+ title: page_size
+ format: int32
+ description: The maximum number of access grants to return.
+ pageToken:
+ type: string
+ title: page_token
+ description: A page token from a previous SearchMyAccessGrants call.
+ filter:
+ type: string
+ title: filter
+ description: |-
+ Filter expression using AIP-160 syntax.
+ Supported fields: status, expire_time, create_time
+ Examples:
+ - 'status = "ACTIVE"'
+ - 'status = "ACTIVE" AND expire_time > "2024-02-01T00:00:00Z"'
+ title: SearchMyAccessGrantsRequest
+ additionalProperties: false
+ bytebase.v1.SearchMyAccessGrantsResponse:
+ type: object
+ properties:
+ accessGrants:
+ type: array
+ items:
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ title: access_grants
+ description: The access grants from the specified request.
+ nextPageToken:
+ type: string
+ title: next_page_token
+ description: |-
+ A token, which can be sent as `page_token` to retrieve the next page.
+ If this field is omitted, there are no subsequent pages.
+ title: SearchMyAccessGrantsResponse
+ additionalProperties: false
bytebase.v1.SearchProjectsRequest:
type: object
properties:
diff --git a/backend/generated-go/v1/access_grant_service.pb.go b/backend/generated-go/v1/access_grant_service.pb.go
index fb55194e48..f1fd7931fc 100644
--- a/backend/generated-go/v1/access_grant_service.pb.go
+++ b/backend/generated-go/v1/access_grant_service.pb.go
@@ -10,6 +10,7 @@ import (
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ durationpb "google.golang.org/protobuf/types/known/durationpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
@@ -94,10 +95,15 @@ type AccessGrant struct {
// and no longer authorizes access. Use `expire_time` to determine
// whether an ACTIVE grant has expired.
Status AccessGrant_Status `protobuf:"varint,3,opt,name=status,proto3,enum=bytebase.v1.AccessGrant_Status" json:"status,omitempty"`
- // The expiration time of the access grant.
- // When the current time exceeds this value, an ACTIVE grant is
+ // The expiration of the access grant.
+ // When the current time exceeds `expire_time`, an ACTIVE grant is
// considered expired and no longer authorizes access.
- ExpireTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expire_time,json=expireTime,proto3" json:"expire_time,omitempty"`
+ //
+ // Types that are valid to be assigned to Expiration:
+ //
+ // *AccessGrant_ExpireTime
+ // *AccessGrant_Ttl
+ Expiration isAccessGrant_Expiration `protobuf_oneof:"expiration"`
// The issue associated with the access grant.
// Can be empty.
// Format: projects/{project}/issues/{issue}
@@ -166,9 +172,27 @@ func (x *AccessGrant) GetStatus() AccessGrant_Status {
return AccessGrant_STATUS_UNSPECIFIED
}
+func (x *AccessGrant) GetExpiration() isAccessGrant_Expiration {
+ if x != nil {
+ return x.Expiration
+ }
+ return nil
+}
+
func (x *AccessGrant) GetExpireTime() *timestamppb.Timestamp {
if x != nil {
- return x.ExpireTime
+ if x, ok := x.Expiration.(*AccessGrant_ExpireTime); ok {
+ return x.ExpireTime
+ }
+ }
+ return nil
+}
+
+func (x *AccessGrant) GetTtl() *durationpb.Duration {
+ if x != nil {
+ if x, ok := x.Expiration.(*AccessGrant_Ttl); ok {
+ return x.Ttl
+ }
}
return nil
}
@@ -215,6 +239,25 @@ func (x *AccessGrant) GetUpdateTime() *timestamppb.Timestamp {
return nil
}
+type isAccessGrant_Expiration interface {
+ isAccessGrant_Expiration()
+}
+
+type AccessGrant_ExpireTime struct {
+ // The expiration time of the access grant.
+ ExpireTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=expire_time,json=expireTime,proto3,oneof"`
+}
+
+type AccessGrant_Ttl struct {
+ // Input only. The time-to-live duration for the access grant.
+ // The server computes `expire_time` from this value at creation time.
+ Ttl *durationpb.Duration `protobuf:"bytes,11,opt,name=ttl,proto3,oneof"`
+}
+
+func (*AccessGrant_ExpireTime) isAccessGrant_Expiration() {}
+
+func (*AccessGrant_Ttl) isAccessGrant_Expiration() {}
+
type GetAccessGrantRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
// The name of the access grant to retrieve.
@@ -543,17 +586,150 @@ func (x *RevokeAccessGrantRequest) GetName() string {
return ""
}
+type SearchMyAccessGrantsRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The parent project to search in.
+ // Format: projects/{project}
+ Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
+ // The maximum number of access grants to return.
+ PageSize int32 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"`
+ // A page token from a previous SearchMyAccessGrants call.
+ PageToken string `protobuf:"bytes,3,opt,name=page_token,json=pageToken,proto3" json:"page_token,omitempty"`
+ // Filter expression using AIP-160 syntax.
+ // Supported fields: status, expire_time, create_time
+ // Examples:
+ // - 'status = "ACTIVE"'
+ // - 'status = "ACTIVE" AND expire_time > "2024-02-01T00:00:00Z"'
+ Filter string `protobuf:"bytes,4,opt,name=filter,proto3" json:"filter,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *SearchMyAccessGrantsRequest) Reset() {
+ *x = SearchMyAccessGrantsRequest{}
+ mi := &file_v1_access_grant_service_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *SearchMyAccessGrantsRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SearchMyAccessGrantsRequest) ProtoMessage() {}
+
+func (x *SearchMyAccessGrantsRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_access_grant_service_proto_msgTypes[7]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SearchMyAccessGrantsRequest.ProtoReflect.Descriptor instead.
+func (*SearchMyAccessGrantsRequest) Descriptor() ([]byte, []int) {
+ return file_v1_access_grant_service_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *SearchMyAccessGrantsRequest) GetParent() string {
+ if x != nil {
+ return x.Parent
+ }
+ return ""
+}
+
+func (x *SearchMyAccessGrantsRequest) GetPageSize() int32 {
+ if x != nil {
+ return x.PageSize
+ }
+ return 0
+}
+
+func (x *SearchMyAccessGrantsRequest) GetPageToken() string {
+ if x != nil {
+ return x.PageToken
+ }
+ return ""
+}
+
+func (x *SearchMyAccessGrantsRequest) GetFilter() string {
+ if x != nil {
+ return x.Filter
+ }
+ return ""
+}
+
+type SearchMyAccessGrantsResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The access grants from the specified request.
+ AccessGrants []*AccessGrant `protobuf:"bytes,1,rep,name=access_grants,json=accessGrants,proto3" json:"access_grants,omitempty"`
+ // A token, which can be sent as `page_token` to retrieve the next page.
+ // If this field is omitted, there are no subsequent pages.
+ NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *SearchMyAccessGrantsResponse) Reset() {
+ *x = SearchMyAccessGrantsResponse{}
+ mi := &file_v1_access_grant_service_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *SearchMyAccessGrantsResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*SearchMyAccessGrantsResponse) ProtoMessage() {}
+
+func (x *SearchMyAccessGrantsResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_v1_access_grant_service_proto_msgTypes[8]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use SearchMyAccessGrantsResponse.ProtoReflect.Descriptor instead.
+func (*SearchMyAccessGrantsResponse) Descriptor() ([]byte, []int) {
+ return file_v1_access_grant_service_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *SearchMyAccessGrantsResponse) GetAccessGrants() []*AccessGrant {
+ if x != nil {
+ return x.AccessGrants
+ }
+ return nil
+}
+
+func (x *SearchMyAccessGrantsResponse) GetNextPageToken() string {
+ if x != nil {
+ return x.NextPageToken
+ }
+ return ""
+}
+
var File_v1_access_grant_service_proto protoreflect.FileDescriptor
const file_v1_access_grant_service_proto_rawDesc = "" +
"\n" +
- "\x1dv1/access_grant_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"\xbe\x04\n" +
+ "\x1dv1/access_grant_service.proto\x12\vbytebase.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13v1/annotation.proto\"\x82\x05\n" +
"\vAccessGrant\x12\x12\n" +
"\x04name\x18\x01 \x01(\tR\x04name\x12\x1d\n" +
"\acreator\x18\x02 \x01(\tB\x03\xe0A\x02R\acreator\x12<\n" +
- "\x06status\x18\x03 \x01(\x0e2\x1f.bytebase.v1.AccessGrant.StatusB\x03\xe0A\x03R\x06status\x12;\n" +
- "\vexpire_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\n" +
- "expireTime\x12\x19\n" +
+ "\x06status\x18\x03 \x01(\x0e2\x1f.bytebase.v1.AccessGrant.StatusB\x03\xe0A\x03R\x06status\x12=\n" +
+ "\vexpire_time\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampH\x00R\n" +
+ "expireTime\x122\n" +
+ "\x03ttl\x18\v \x01(\v2\x19.google.protobuf.DurationB\x03\xe0A\x04H\x00R\x03ttl\x12\x19\n" +
"\x05issue\x18\x05 \x01(\tB\x03\xe0A\x03R\x05issue\x12\x1d\n" +
"\atargets\x18\x06 \x03(\tB\x03\xe0A\x02R\atargets\x12\x14\n" +
"\x05query\x18\a \x01(\tR\x05query\x12\x16\n" +
@@ -569,7 +745,9 @@ const file_v1_access_grant_service_proto_rawDesc = "" +
"\n" +
"\x06ACTIVE\x10\x02\x12\v\n" +
"\aREVOKED\x10\x03:M\xeaAJ\n" +
- "\x18bytebase.com/AccessGrant\x12.projects/{project}/accessGrants/{access_grant}\"M\n" +
+ "\x18bytebase.com/AccessGrant\x12.projects/{project}/accessGrants/{access_grant}B\f\n" +
+ "\n" +
+ "expiration\"M\n" +
"\x15GetAccessGrantRequest\x124\n" +
"\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" +
"\x18bytebase.com/AccessGrantR\x04name\"\xa3\x01\n" +
@@ -592,13 +770,24 @@ const file_v1_access_grant_service_proto_rawDesc = "" +
"\x18bytebase.com/AccessGrantR\x04name\"P\n" +
"\x18RevokeAccessGrantRequest\x124\n" +
"\x04name\x18\x01 \x01(\tB \xe0A\x02\xfaA\x1a\n" +
- "\x18bytebase.com/AccessGrantR\x04name2\xad\a\n" +
+ "\x18bytebase.com/AccessGrantR\x04name\"\xa7\x01\n" +
+ "\x1bSearchMyAccessGrantsRequest\x124\n" +
+ "\x06parent\x18\x01 \x01(\tB\x1c\xe0A\x02\xfaA\x16\n" +
+ "\x14bytebase.com/ProjectR\x06parent\x12\x1b\n" +
+ "\tpage_size\x18\x02 \x01(\x05R\bpageSize\x12\x1d\n" +
+ "\n" +
+ "page_token\x18\x03 \x01(\tR\tpageToken\x12\x16\n" +
+ "\x06filter\x18\x04 \x01(\tR\x06filter\"\x85\x01\n" +
+ "\x1cSearchMyAccessGrantsResponse\x12=\n" +
+ "\raccess_grants\x18\x01 \x03(\v2\x18.bytebase.v1.AccessGrantR\faccessGrants\x12&\n" +
+ "\x0fnext_page_token\x18\x02 \x01(\tR\rnextPageToken2\xf0\b\n" +
"\x12AccessGrantService\x12\x9e\x01\n" +
"\x0eGetAccessGrant\x12\".bytebase.v1.GetAccessGrantRequest\x1a\x18.bytebase.v1.AccessGrant\"N\xdaA\x04name\x8a\xea0\x13bb.accessGrants.get\x90\xea0\x01\x82\xd3\xe4\x93\x02&\x12$/v1/{name=projects/*/accessGrants/*}\x12\xb2\x01\n" +
"\x10ListAccessGrants\x12$.bytebase.v1.ListAccessGrantsRequest\x1a%.bytebase.v1.ListAccessGrantsResponse\"Q\xdaA\x06parent\x8a\xea0\x14bb.accessGrants.list\x90\xea0\x01\x82\xd3\xe4\x93\x02&\x12$/v1/{parent=projects/*}/accessGrants\x12\xc8\x01\n" +
"\x11CreateAccessGrant\x12%.bytebase.v1.CreateAccessGrantRequest\x1a\x18.bytebase.v1.AccessGrant\"r\xdaA\x13parent,access_grant\x8a\xea0\x16bb.accessGrants.create\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x024:\faccess_grant\"$/v1/{parent=projects/*}/accessGrants\x12\xbd\x01\n" +
"\x13ActivateAccessGrant\x12'.bytebase.v1.ActivateAccessGrantRequest\x1a\x18.bytebase.v1.AccessGrant\"c\xdaA\x04name\x8a\xea0\x18bb.accessGrants.activate\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x022:\x01*\"-/v1/{name=projects/*/accessGrants/*}:activate\x12\xb5\x01\n" +
- "\x11RevokeAccessGrant\x12%.bytebase.v1.RevokeAccessGrantRequest\x1a\x18.bytebase.v1.AccessGrant\"_\xdaA\x04name\x8a\xea0\x16bb.accessGrants.revoke\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x020:\x01*\"+/v1/{name=projects/*/accessGrants/*}:revokeB\xad\x01\n" +
+ "\x11RevokeAccessGrant\x12%.bytebase.v1.RevokeAccessGrantRequest\x1a\x18.bytebase.v1.AccessGrant\"_\xdaA\x04name\x8a\xea0\x16bb.accessGrants.revoke\x90\xea0\x01\x98\xea0\x01\x82\xd3\xe4\x93\x020:\x01*\"+/v1/{name=projects/*/accessGrants/*}:revoke\x12\xc0\x01\n" +
+ "\x14SearchMyAccessGrants\x12(.bytebase.v1.SearchMyAccessGrantsRequest\x1a).bytebase.v1.SearchMyAccessGrantsResponse\"S\x8a\xea0\x13bb.accessGrants.get\x90\xea0\x02\x82\xd3\xe4\x93\x022:\x01*\"-/v1/{parent=projects/*}/accessGrants:searchMyB\xad\x01\n" +
"\x0fcom.bytebase.v1B\x17AccessGrantServiceProtoP\x01Z4github.com/bytebase/bytebase/backend/generated-go/v1\xa2\x02\x03BXX\xaa\x02\vBytebase.V1\xca\x02\vBytebase\\V1\xe2\x02\x17Bytebase\\V1\\GPBMetadata\xea\x02\fBytebase::V1b\x06proto3"
var (
@@ -614,40 +803,47 @@ func file_v1_access_grant_service_proto_rawDescGZIP() []byte {
}
var file_v1_access_grant_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_v1_access_grant_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
+var file_v1_access_grant_service_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_v1_access_grant_service_proto_goTypes = []any{
- (AccessGrant_Status)(0), // 0: bytebase.v1.AccessGrant.Status
- (*AccessGrant)(nil), // 1: bytebase.v1.AccessGrant
- (*GetAccessGrantRequest)(nil), // 2: bytebase.v1.GetAccessGrantRequest
- (*ListAccessGrantsRequest)(nil), // 3: bytebase.v1.ListAccessGrantsRequest
- (*ListAccessGrantsResponse)(nil), // 4: bytebase.v1.ListAccessGrantsResponse
- (*CreateAccessGrantRequest)(nil), // 5: bytebase.v1.CreateAccessGrantRequest
- (*ActivateAccessGrantRequest)(nil), // 6: bytebase.v1.ActivateAccessGrantRequest
- (*RevokeAccessGrantRequest)(nil), // 7: bytebase.v1.RevokeAccessGrantRequest
- (*timestamppb.Timestamp)(nil), // 8: google.protobuf.Timestamp
+ (AccessGrant_Status)(0), // 0: bytebase.v1.AccessGrant.Status
+ (*AccessGrant)(nil), // 1: bytebase.v1.AccessGrant
+ (*GetAccessGrantRequest)(nil), // 2: bytebase.v1.GetAccessGrantRequest
+ (*ListAccessGrantsRequest)(nil), // 3: bytebase.v1.ListAccessGrantsRequest
+ (*ListAccessGrantsResponse)(nil), // 4: bytebase.v1.ListAccessGrantsResponse
+ (*CreateAccessGrantRequest)(nil), // 5: bytebase.v1.CreateAccessGrantRequest
+ (*ActivateAccessGrantRequest)(nil), // 6: bytebase.v1.ActivateAccessGrantRequest
+ (*RevokeAccessGrantRequest)(nil), // 7: bytebase.v1.RevokeAccessGrantRequest
+ (*SearchMyAccessGrantsRequest)(nil), // 8: bytebase.v1.SearchMyAccessGrantsRequest
+ (*SearchMyAccessGrantsResponse)(nil), // 9: bytebase.v1.SearchMyAccessGrantsResponse
+ (*timestamppb.Timestamp)(nil), // 10: google.protobuf.Timestamp
+ (*durationpb.Duration)(nil), // 11: google.protobuf.Duration
}
var file_v1_access_grant_service_proto_depIdxs = []int32{
0, // 0: bytebase.v1.AccessGrant.status:type_name -> bytebase.v1.AccessGrant.Status
- 8, // 1: bytebase.v1.AccessGrant.expire_time:type_name -> google.protobuf.Timestamp
- 8, // 2: bytebase.v1.AccessGrant.create_time:type_name -> google.protobuf.Timestamp
- 8, // 3: bytebase.v1.AccessGrant.update_time:type_name -> google.protobuf.Timestamp
- 1, // 4: bytebase.v1.ListAccessGrantsResponse.access_grants:type_name -> bytebase.v1.AccessGrant
- 1, // 5: bytebase.v1.CreateAccessGrantRequest.access_grant:type_name -> bytebase.v1.AccessGrant
- 2, // 6: bytebase.v1.AccessGrantService.GetAccessGrant:input_type -> bytebase.v1.GetAccessGrantRequest
- 3, // 7: bytebase.v1.AccessGrantService.ListAccessGrants:input_type -> bytebase.v1.ListAccessGrantsRequest
- 5, // 8: bytebase.v1.AccessGrantService.CreateAccessGrant:input_type -> bytebase.v1.CreateAccessGrantRequest
- 6, // 9: bytebase.v1.AccessGrantService.ActivateAccessGrant:input_type -> bytebase.v1.ActivateAccessGrantRequest
- 7, // 10: bytebase.v1.AccessGrantService.RevokeAccessGrant:input_type -> bytebase.v1.RevokeAccessGrantRequest
- 1, // 11: bytebase.v1.AccessGrantService.GetAccessGrant:output_type -> bytebase.v1.AccessGrant
- 4, // 12: bytebase.v1.AccessGrantService.ListAccessGrants:output_type -> bytebase.v1.ListAccessGrantsResponse
- 1, // 13: bytebase.v1.AccessGrantService.CreateAccessGrant:output_type -> bytebase.v1.AccessGrant
- 1, // 14: bytebase.v1.AccessGrantService.ActivateAccessGrant:output_type -> bytebase.v1.AccessGrant
- 1, // 15: bytebase.v1.AccessGrantService.RevokeAccessGrant:output_type -> bytebase.v1.AccessGrant
- 11, // [11:16] is the sub-list for method output_type
- 6, // [6:11] is the sub-list for method input_type
- 6, // [6:6] is the sub-list for extension type_name
- 6, // [6:6] is the sub-list for extension extendee
- 0, // [0:6] is the sub-list for field type_name
+ 10, // 1: bytebase.v1.AccessGrant.expire_time:type_name -> google.protobuf.Timestamp
+ 11, // 2: bytebase.v1.AccessGrant.ttl:type_name -> google.protobuf.Duration
+ 10, // 3: bytebase.v1.AccessGrant.create_time:type_name -> google.protobuf.Timestamp
+ 10, // 4: bytebase.v1.AccessGrant.update_time:type_name -> google.protobuf.Timestamp
+ 1, // 5: bytebase.v1.ListAccessGrantsResponse.access_grants:type_name -> bytebase.v1.AccessGrant
+ 1, // 6: bytebase.v1.CreateAccessGrantRequest.access_grant:type_name -> bytebase.v1.AccessGrant
+ 1, // 7: bytebase.v1.SearchMyAccessGrantsResponse.access_grants:type_name -> bytebase.v1.AccessGrant
+ 2, // 8: bytebase.v1.AccessGrantService.GetAccessGrant:input_type -> bytebase.v1.GetAccessGrantRequest
+ 3, // 9: bytebase.v1.AccessGrantService.ListAccessGrants:input_type -> bytebase.v1.ListAccessGrantsRequest
+ 5, // 10: bytebase.v1.AccessGrantService.CreateAccessGrant:input_type -> bytebase.v1.CreateAccessGrantRequest
+ 6, // 11: bytebase.v1.AccessGrantService.ActivateAccessGrant:input_type -> bytebase.v1.ActivateAccessGrantRequest
+ 7, // 12: bytebase.v1.AccessGrantService.RevokeAccessGrant:input_type -> bytebase.v1.RevokeAccessGrantRequest
+ 8, // 13: bytebase.v1.AccessGrantService.SearchMyAccessGrants:input_type -> bytebase.v1.SearchMyAccessGrantsRequest
+ 1, // 14: bytebase.v1.AccessGrantService.GetAccessGrant:output_type -> bytebase.v1.AccessGrant
+ 4, // 15: bytebase.v1.AccessGrantService.ListAccessGrants:output_type -> bytebase.v1.ListAccessGrantsResponse
+ 1, // 16: bytebase.v1.AccessGrantService.CreateAccessGrant:output_type -> bytebase.v1.AccessGrant
+ 1, // 17: bytebase.v1.AccessGrantService.ActivateAccessGrant:output_type -> bytebase.v1.AccessGrant
+ 1, // 18: bytebase.v1.AccessGrantService.RevokeAccessGrant:output_type -> bytebase.v1.AccessGrant
+ 9, // 19: bytebase.v1.AccessGrantService.SearchMyAccessGrants:output_type -> bytebase.v1.SearchMyAccessGrantsResponse
+ 14, // [14:20] is the sub-list for method output_type
+ 8, // [8:14] is the sub-list for method input_type
+ 8, // [8:8] is the sub-list for extension type_name
+ 8, // [8:8] is the sub-list for extension extendee
+ 0, // [0:8] is the sub-list for field type_name
}
func init() { file_v1_access_grant_service_proto_init() }
@@ -656,13 +852,17 @@ func file_v1_access_grant_service_proto_init() {
return
}
file_v1_annotation_proto_init()
+ file_v1_access_grant_service_proto_msgTypes[0].OneofWrappers = []any{
+ (*AccessGrant_ExpireTime)(nil),
+ (*AccessGrant_Ttl)(nil),
+ }
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_access_grant_service_proto_rawDesc), len(file_v1_access_grant_service_proto_rawDesc)),
NumEnums: 1,
- NumMessages: 7,
+ NumMessages: 9,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/backend/generated-go/v1/access_grant_service.pb.gw.go b/backend/generated-go/v1/access_grant_service.pb.gw.go
index 9766eb8d5e..46e91b2792 100644
--- a/backend/generated-go/v1/access_grant_service.pb.gw.go
+++ b/backend/generated-go/v1/access_grant_service.pb.gw.go
@@ -262,6 +262,51 @@ func local_request_AccessGrantService_RevokeAccessGrant_0(ctx context.Context, m
return msg, metadata, err
}
+func request_AccessGrantService_SearchMyAccessGrants_0(ctx context.Context, marshaler runtime.Marshaler, client AccessGrantServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq SearchMyAccessGrantsRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ if req.Body != nil {
+ _, _ = io.Copy(io.Discard, req.Body)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ msg, err := client.SearchMyAccessGrants(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
+ return msg, metadata, err
+}
+
+func local_request_AccessGrantService_SearchMyAccessGrants_0(ctx context.Context, marshaler runtime.Marshaler, server AccessGrantServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
+ var (
+ protoReq SearchMyAccessGrantsRequest
+ metadata runtime.ServerMetadata
+ err error
+ )
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
+ }
+ val, ok := pathParams["parent"]
+ if !ok {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "parent")
+ }
+ protoReq.Parent, err = runtime.String(val)
+ if err != nil {
+ return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "parent", err)
+ }
+ msg, err := server.SearchMyAccessGrants(ctx, &protoReq)
+ return msg, metadata, err
+}
+
// RegisterAccessGrantServiceHandlerServer registers the http handlers for service AccessGrantService to "mux".
// UnaryRPC :call AccessGrantServiceServer directly.
// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.
@@ -368,6 +413,26 @@ func RegisterAccessGrantServiceHandlerServer(ctx context.Context, mux *runtime.S
}
forward_AccessGrantService_RevokeAccessGrant_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodPost, pattern_AccessGrantService_SearchMyAccessGrants_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ var stream runtime.ServerTransportStream
+ ctx = grpc.NewContextWithServerTransportStream(ctx, &stream)
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/bytebase.v1.AccessGrantService/SearchMyAccessGrants", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/accessGrants:searchMy"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := local_request_AccessGrantService_SearchMyAccessGrants_0(annotatedContext, inboundMarshaler, server, req, pathParams)
+ md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_AccessGrantService_SearchMyAccessGrants_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
@@ -493,21 +558,40 @@ func RegisterAccessGrantServiceHandlerClient(ctx context.Context, mux *runtime.S
}
forward_AccessGrantService_RevokeAccessGrant_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
+ mux.Handle(http.MethodPost, pattern_AccessGrantService_SearchMyAccessGrants_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
+ ctx, cancel := context.WithCancel(req.Context())
+ defer cancel()
+ inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req)
+ annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/bytebase.v1.AccessGrantService/SearchMyAccessGrants", runtime.WithHTTPPathPattern("/v1/{parent=projects/*}/accessGrants:searchMy"))
+ if err != nil {
+ runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ resp, md, err := request_AccessGrantService_SearchMyAccessGrants_0(annotatedContext, inboundMarshaler, client, req, pathParams)
+ annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
+ if err != nil {
+ runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
+ return
+ }
+ forward_AccessGrantService_SearchMyAccessGrants_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
+ })
return nil
}
var (
- pattern_AccessGrantService_GetAccessGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "accessGrants", "name"}, ""))
- pattern_AccessGrantService_ListAccessGrants_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "accessGrants"}, ""))
- pattern_AccessGrantService_CreateAccessGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "accessGrants"}, ""))
- pattern_AccessGrantService_ActivateAccessGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "accessGrants", "name"}, "activate"))
- pattern_AccessGrantService_RevokeAccessGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "accessGrants", "name"}, "revoke"))
+ pattern_AccessGrantService_GetAccessGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "accessGrants", "name"}, ""))
+ pattern_AccessGrantService_ListAccessGrants_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "accessGrants"}, ""))
+ pattern_AccessGrantService_CreateAccessGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "accessGrants"}, ""))
+ pattern_AccessGrantService_ActivateAccessGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "accessGrants", "name"}, "activate"))
+ pattern_AccessGrantService_RevokeAccessGrant_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 2, 2, 1, 0, 4, 4, 5, 3}, []string{"v1", "projects", "accessGrants", "name"}, "revoke"))
+ pattern_AccessGrantService_SearchMyAccessGrants_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2, 2, 3}, []string{"v1", "projects", "parent", "accessGrants"}, "searchMy"))
)
var (
- forward_AccessGrantService_GetAccessGrant_0 = runtime.ForwardResponseMessage
- forward_AccessGrantService_ListAccessGrants_0 = runtime.ForwardResponseMessage
- forward_AccessGrantService_CreateAccessGrant_0 = runtime.ForwardResponseMessage
- forward_AccessGrantService_ActivateAccessGrant_0 = runtime.ForwardResponseMessage
- forward_AccessGrantService_RevokeAccessGrant_0 = runtime.ForwardResponseMessage
+ forward_AccessGrantService_GetAccessGrant_0 = runtime.ForwardResponseMessage
+ forward_AccessGrantService_ListAccessGrants_0 = runtime.ForwardResponseMessage
+ forward_AccessGrantService_CreateAccessGrant_0 = runtime.ForwardResponseMessage
+ forward_AccessGrantService_ActivateAccessGrant_0 = runtime.ForwardResponseMessage
+ forward_AccessGrantService_RevokeAccessGrant_0 = runtime.ForwardResponseMessage
+ forward_AccessGrantService_SearchMyAccessGrants_0 = runtime.ForwardResponseMessage
)
diff --git a/backend/generated-go/v1/access_grant_service_equal.pb.go b/backend/generated-go/v1/access_grant_service_equal.pb.go
index adf66c52ff..eb5caa1a3c 100644
--- a/backend/generated-go/v1/access_grant_service_equal.pb.go
+++ b/backend/generated-go/v1/access_grant_service_equal.pb.go
@@ -19,7 +19,10 @@ func (x *AccessGrant) Equal(y *AccessGrant) bool {
if x.Status != y.Status {
return false
}
- if p, q := x.ExpireTime, y.ExpireTime; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
+ if p, q := x.GetExpireTime(), y.GetExpireTime(); (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
+ return false
+ }
+ if p, q := x.GetTtl(), y.GetTtl(); (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {
return false
}
if x.Issue != y.Issue {
@@ -145,3 +148,46 @@ func (x *RevokeAccessGrantRequest) Equal(y *RevokeAccessGrantRequest) bool {
}
return true
}
+
+func (x *SearchMyAccessGrantsRequest) Equal(y *SearchMyAccessGrantsRequest) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if x.Parent != y.Parent {
+ return false
+ }
+ if x.PageSize != y.PageSize {
+ return false
+ }
+ if x.PageToken != y.PageToken {
+ return false
+ }
+ if x.Filter != y.Filter {
+ return false
+ }
+ return true
+}
+
+func (x *SearchMyAccessGrantsResponse) Equal(y *SearchMyAccessGrantsResponse) bool {
+ if x == y {
+ return true
+ }
+ if x == nil || y == nil {
+ return x == nil && y == nil
+ }
+ if len(x.AccessGrants) != len(y.AccessGrants) {
+ return false
+ }
+ for i := 0; i < len(x.AccessGrants); i++ {
+ if !x.AccessGrants[i].Equal(y.AccessGrants[i]) {
+ return false
+ }
+ }
+ if x.NextPageToken != y.NextPageToken {
+ return false
+ }
+ return true
+}
diff --git a/backend/generated-go/v1/access_grant_service_grpc.pb.go b/backend/generated-go/v1/access_grant_service_grpc.pb.go
index f3a7fccfb8..25f6545372 100644
--- a/backend/generated-go/v1/access_grant_service_grpc.pb.go
+++ b/backend/generated-go/v1/access_grant_service_grpc.pb.go
@@ -19,11 +19,12 @@ import (
const _ = grpc.SupportPackageIsVersion9
const (
- AccessGrantService_GetAccessGrant_FullMethodName = "/bytebase.v1.AccessGrantService/GetAccessGrant"
- AccessGrantService_ListAccessGrants_FullMethodName = "/bytebase.v1.AccessGrantService/ListAccessGrants"
- AccessGrantService_CreateAccessGrant_FullMethodName = "/bytebase.v1.AccessGrantService/CreateAccessGrant"
- AccessGrantService_ActivateAccessGrant_FullMethodName = "/bytebase.v1.AccessGrantService/ActivateAccessGrant"
- AccessGrantService_RevokeAccessGrant_FullMethodName = "/bytebase.v1.AccessGrantService/RevokeAccessGrant"
+ AccessGrantService_GetAccessGrant_FullMethodName = "/bytebase.v1.AccessGrantService/GetAccessGrant"
+ AccessGrantService_ListAccessGrants_FullMethodName = "/bytebase.v1.AccessGrantService/ListAccessGrants"
+ AccessGrantService_CreateAccessGrant_FullMethodName = "/bytebase.v1.AccessGrantService/CreateAccessGrant"
+ AccessGrantService_ActivateAccessGrant_FullMethodName = "/bytebase.v1.AccessGrantService/ActivateAccessGrant"
+ AccessGrantService_RevokeAccessGrant_FullMethodName = "/bytebase.v1.AccessGrantService/RevokeAccessGrant"
+ AccessGrantService_SearchMyAccessGrants_FullMethodName = "/bytebase.v1.AccessGrantService/SearchMyAccessGrants"
)
// AccessGrantServiceClient is the client API for AccessGrantService service.
@@ -42,6 +43,8 @@ type AccessGrantServiceClient interface {
ActivateAccessGrant(ctx context.Context, in *ActivateAccessGrantRequest, opts ...grpc.CallOption) (*AccessGrant, error)
// Revokes an active access grant.
RevokeAccessGrant(ctx context.Context, in *RevokeAccessGrantRequest, opts ...grpc.CallOption) (*AccessGrant, error)
+ // Searches access grants created by the caller.
+ SearchMyAccessGrants(ctx context.Context, in *SearchMyAccessGrantsRequest, opts ...grpc.CallOption) (*SearchMyAccessGrantsResponse, error)
}
type accessGrantServiceClient struct {
@@ -102,6 +105,16 @@ func (c *accessGrantServiceClient) RevokeAccessGrant(ctx context.Context, in *Re
return out, nil
}
+func (c *accessGrantServiceClient) SearchMyAccessGrants(ctx context.Context, in *SearchMyAccessGrantsRequest, opts ...grpc.CallOption) (*SearchMyAccessGrantsResponse, error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ out := new(SearchMyAccessGrantsResponse)
+ err := c.cc.Invoke(ctx, AccessGrantService_SearchMyAccessGrants_FullMethodName, in, out, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// AccessGrantServiceServer is the server API for AccessGrantService service.
// All implementations must embed UnimplementedAccessGrantServiceServer
// for forward compatibility.
@@ -118,6 +131,8 @@ type AccessGrantServiceServer interface {
ActivateAccessGrant(context.Context, *ActivateAccessGrantRequest) (*AccessGrant, error)
// Revokes an active access grant.
RevokeAccessGrant(context.Context, *RevokeAccessGrantRequest) (*AccessGrant, error)
+ // Searches access grants created by the caller.
+ SearchMyAccessGrants(context.Context, *SearchMyAccessGrantsRequest) (*SearchMyAccessGrantsResponse, error)
mustEmbedUnimplementedAccessGrantServiceServer()
}
@@ -143,6 +158,9 @@ func (UnimplementedAccessGrantServiceServer) ActivateAccessGrant(context.Context
func (UnimplementedAccessGrantServiceServer) RevokeAccessGrant(context.Context, *RevokeAccessGrantRequest) (*AccessGrant, error) {
return nil, status.Error(codes.Unimplemented, "method RevokeAccessGrant not implemented")
}
+func (UnimplementedAccessGrantServiceServer) SearchMyAccessGrants(context.Context, *SearchMyAccessGrantsRequest) (*SearchMyAccessGrantsResponse, error) {
+ return nil, status.Error(codes.Unimplemented, "method SearchMyAccessGrants not implemented")
+}
func (UnimplementedAccessGrantServiceServer) mustEmbedUnimplementedAccessGrantServiceServer() {}
func (UnimplementedAccessGrantServiceServer) testEmbeddedByValue() {}
@@ -254,6 +272,24 @@ func _AccessGrantService_RevokeAccessGrant_Handler(srv interface{}, ctx context.
return interceptor(ctx, in, info, handler)
}
+func _AccessGrantService_SearchMyAccessGrants_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(SearchMyAccessGrantsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(AccessGrantServiceServer).SearchMyAccessGrants(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: AccessGrantService_SearchMyAccessGrants_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(AccessGrantServiceServer).SearchMyAccessGrants(ctx, req.(*SearchMyAccessGrantsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
// AccessGrantService_ServiceDesc is the grpc.ServiceDesc for AccessGrantService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -281,6 +317,10 @@ var AccessGrantService_ServiceDesc = grpc.ServiceDesc{
MethodName: "RevokeAccessGrant",
Handler: _AccessGrantService_RevokeAccessGrant_Handler,
},
+ {
+ MethodName: "SearchMyAccessGrants",
+ Handler: _AccessGrantService_SearchMyAccessGrants_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "v1/access_grant_service.proto",
diff --git a/backend/generated-go/v1/v1connect/access_grant_service.connect.go b/backend/generated-go/v1/v1connect/access_grant_service.connect.go
index ede3ebfb3e..3bd4b293a2 100644
--- a/backend/generated-go/v1/v1connect/access_grant_service.connect.go
+++ b/backend/generated-go/v1/v1connect/access_grant_service.connect.go
@@ -48,6 +48,9 @@ const (
// AccessGrantServiceRevokeAccessGrantProcedure is the fully-qualified name of the
// AccessGrantService's RevokeAccessGrant RPC.
AccessGrantServiceRevokeAccessGrantProcedure = "/bytebase.v1.AccessGrantService/RevokeAccessGrant"
+ // AccessGrantServiceSearchMyAccessGrantsProcedure is the fully-qualified name of the
+ // AccessGrantService's SearchMyAccessGrants RPC.
+ AccessGrantServiceSearchMyAccessGrantsProcedure = "/bytebase.v1.AccessGrantService/SearchMyAccessGrants"
)
// AccessGrantServiceClient is a client for the bytebase.v1.AccessGrantService service.
@@ -62,6 +65,8 @@ type AccessGrantServiceClient interface {
ActivateAccessGrant(context.Context, *connect.Request[v1.ActivateAccessGrantRequest]) (*connect.Response[v1.AccessGrant], error)
// Revokes an active access grant.
RevokeAccessGrant(context.Context, *connect.Request[v1.RevokeAccessGrantRequest]) (*connect.Response[v1.AccessGrant], error)
+ // Searches access grants created by the caller.
+ SearchMyAccessGrants(context.Context, *connect.Request[v1.SearchMyAccessGrantsRequest]) (*connect.Response[v1.SearchMyAccessGrantsResponse], error)
}
// NewAccessGrantServiceClient constructs a client for the bytebase.v1.AccessGrantService service.
@@ -105,16 +110,23 @@ func NewAccessGrantServiceClient(httpClient connect.HTTPClient, baseURL string,
connect.WithSchema(accessGrantServiceMethods.ByName("RevokeAccessGrant")),
connect.WithClientOptions(opts...),
),
+ searchMyAccessGrants: connect.NewClient[v1.SearchMyAccessGrantsRequest, v1.SearchMyAccessGrantsResponse](
+ httpClient,
+ baseURL+AccessGrantServiceSearchMyAccessGrantsProcedure,
+ connect.WithSchema(accessGrantServiceMethods.ByName("SearchMyAccessGrants")),
+ connect.WithClientOptions(opts...),
+ ),
}
}
// accessGrantServiceClient implements AccessGrantServiceClient.
type accessGrantServiceClient struct {
- getAccessGrant *connect.Client[v1.GetAccessGrantRequest, v1.AccessGrant]
- listAccessGrants *connect.Client[v1.ListAccessGrantsRequest, v1.ListAccessGrantsResponse]
- createAccessGrant *connect.Client[v1.CreateAccessGrantRequest, v1.AccessGrant]
- activateAccessGrant *connect.Client[v1.ActivateAccessGrantRequest, v1.AccessGrant]
- revokeAccessGrant *connect.Client[v1.RevokeAccessGrantRequest, v1.AccessGrant]
+ getAccessGrant *connect.Client[v1.GetAccessGrantRequest, v1.AccessGrant]
+ listAccessGrants *connect.Client[v1.ListAccessGrantsRequest, v1.ListAccessGrantsResponse]
+ createAccessGrant *connect.Client[v1.CreateAccessGrantRequest, v1.AccessGrant]
+ activateAccessGrant *connect.Client[v1.ActivateAccessGrantRequest, v1.AccessGrant]
+ revokeAccessGrant *connect.Client[v1.RevokeAccessGrantRequest, v1.AccessGrant]
+ searchMyAccessGrants *connect.Client[v1.SearchMyAccessGrantsRequest, v1.SearchMyAccessGrantsResponse]
}
// GetAccessGrant calls bytebase.v1.AccessGrantService.GetAccessGrant.
@@ -142,6 +154,11 @@ func (c *accessGrantServiceClient) RevokeAccessGrant(ctx context.Context, req *c
return c.revokeAccessGrant.CallUnary(ctx, req)
}
+// SearchMyAccessGrants calls bytebase.v1.AccessGrantService.SearchMyAccessGrants.
+func (c *accessGrantServiceClient) SearchMyAccessGrants(ctx context.Context, req *connect.Request[v1.SearchMyAccessGrantsRequest]) (*connect.Response[v1.SearchMyAccessGrantsResponse], error) {
+ return c.searchMyAccessGrants.CallUnary(ctx, req)
+}
+
// AccessGrantServiceHandler is an implementation of the bytebase.v1.AccessGrantService service.
type AccessGrantServiceHandler interface {
// Gets an access grant by name.
@@ -154,6 +171,8 @@ type AccessGrantServiceHandler interface {
ActivateAccessGrant(context.Context, *connect.Request[v1.ActivateAccessGrantRequest]) (*connect.Response[v1.AccessGrant], error)
// Revokes an active access grant.
RevokeAccessGrant(context.Context, *connect.Request[v1.RevokeAccessGrantRequest]) (*connect.Response[v1.AccessGrant], error)
+ // Searches access grants created by the caller.
+ SearchMyAccessGrants(context.Context, *connect.Request[v1.SearchMyAccessGrantsRequest]) (*connect.Response[v1.SearchMyAccessGrantsResponse], error)
}
// NewAccessGrantServiceHandler builds an HTTP handler from the service implementation. It returns
@@ -193,6 +212,12 @@ func NewAccessGrantServiceHandler(svc AccessGrantServiceHandler, opts ...connect
connect.WithSchema(accessGrantServiceMethods.ByName("RevokeAccessGrant")),
connect.WithHandlerOptions(opts...),
)
+ accessGrantServiceSearchMyAccessGrantsHandler := connect.NewUnaryHandler(
+ AccessGrantServiceSearchMyAccessGrantsProcedure,
+ svc.SearchMyAccessGrants,
+ connect.WithSchema(accessGrantServiceMethods.ByName("SearchMyAccessGrants")),
+ connect.WithHandlerOptions(opts...),
+ )
return "/bytebase.v1.AccessGrantService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {
case AccessGrantServiceGetAccessGrantProcedure:
@@ -205,6 +230,8 @@ func NewAccessGrantServiceHandler(svc AccessGrantServiceHandler, opts ...connect
accessGrantServiceActivateAccessGrantHandler.ServeHTTP(w, r)
case AccessGrantServiceRevokeAccessGrantProcedure:
accessGrantServiceRevokeAccessGrantHandler.ServeHTTP(w, r)
+ case AccessGrantServiceSearchMyAccessGrantsProcedure:
+ accessGrantServiceSearchMyAccessGrantsHandler.ServeHTTP(w, r)
default:
http.NotFound(w, r)
}
@@ -233,3 +260,7 @@ func (UnimplementedAccessGrantServiceHandler) ActivateAccessGrant(context.Contex
func (UnimplementedAccessGrantServiceHandler) RevokeAccessGrant(context.Context, *connect.Request[v1.RevokeAccessGrantRequest]) (*connect.Response[v1.AccessGrant], error) {
return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.AccessGrantService.RevokeAccessGrant is not implemented"))
}
+
+func (UnimplementedAccessGrantServiceHandler) SearchMyAccessGrants(context.Context, *connect.Request[v1.SearchMyAccessGrantsRequest]) (*connect.Response[v1.SearchMyAccessGrantsResponse], error) {
+ return nil, connect.NewError(connect.CodeUnimplemented, errors.New("bytebase.v1.AccessGrantService.SearchMyAccessGrants is not implemented"))
+}
diff --git a/frontend/src/types/proto-es/v1/access_grant_service_pb.d.ts b/frontend/src/types/proto-es/v1/access_grant_service_pb.d.ts
index 9c225c752f..add152de6b 100644
--- a/frontend/src/types/proto-es/v1/access_grant_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/access_grant_service_pb.d.ts
@@ -4,7 +4,7 @@
import type { GenEnum, GenFile, GenMessage, GenService } from "@bufbuild/protobuf/codegenv2";
import type { Message } from "@bufbuild/protobuf";
-import type { Timestamp } from "@bufbuild/protobuf/wkt";
+import type { Duration, Timestamp } from "@bufbuild/protobuf/wkt";
/**
* Describes the file v1/access_grant_service.proto.
@@ -43,13 +43,30 @@ export declare type AccessGrant = Message<"bytebase.v1.AccessGrant"> & {
status: AccessGrant_Status;
/**
- * The expiration time of the access grant.
- * When the current time exceeds this value, an ACTIVE grant is
+ * The expiration of the access grant.
+ * When the current time exceeds `expire_time`, an ACTIVE grant is
* considered expired and no longer authorizes access.
*
- * @generated from field: google.protobuf.Timestamp expire_time = 4;
+ * @generated from oneof bytebase.v1.AccessGrant.expiration
*/
- expireTime?: Timestamp;
+ expiration: {
+ /**
+ * The expiration time of the access grant.
+ *
+ * @generated from field: google.protobuf.Timestamp expire_time = 4;
+ */
+ value: Timestamp;
+ case: "expireTime";
+ } | {
+ /**
+ * Input only. The time-to-live duration for the access grant.
+ * The server computes `expire_time` from this value at creation time.
+ *
+ * @generated from field: google.protobuf.Duration ttl = 11;
+ */
+ value: Duration;
+ case: "ttl";
+ } | { case: undefined; value?: undefined };
/**
* The issue associated with the access grant.
@@ -294,6 +311,76 @@ export declare type RevokeAccessGrantRequest = Message<"bytebase.v1.RevokeAccess
*/
export declare const RevokeAccessGrantRequestSchema: GenMessage<RevokeAccessGrantRequest>;
+/**
+ * @generated from message bytebase.v1.SearchMyAccessGrantsRequest
+ */
+export declare type SearchMyAccessGrantsRequest = Message<"bytebase.v1.SearchMyAccessGrantsRequest"> & {
+ /**
+ * The parent project to search in.
+ * Format: projects/{project}
+ *
+ * @generated from field: string parent = 1;
+ */
+ parent: string;
+
+ /**
+ * The maximum number of access grants to return.
+ *
+ * @generated from field: int32 page_size = 2;
+ */
+ pageSize: number;
+
+ /**
+ * A page token from a previous SearchMyAccessGrants call.
+ *
+ * @generated from field: string page_token = 3;
+ */
+ pageToken: string;
+
+ /**
+ * Filter expression using AIP-160 syntax.
+ * Supported fields: status, expire_time, create_time
+ * Examples:
+ * - 'status = "ACTIVE"'
+ * - 'status = "ACTIVE" AND expire_time > "2024-02-01T00:00:00Z"'
+ *
+ * @generated from field: string filter = 4;
+ */
+ filter: string;
+};
+
+/**
+ * Describes the message bytebase.v1.SearchMyAccessGrantsRequest.
+ * Use `create(SearchMyAccessGrantsRequestSchema)` to create a new message.
+ */
+export declare const SearchMyAccessGrantsRequestSchema: GenMessage<SearchMyAccessGrantsRequest>;
+
+/**
+ * @generated from message bytebase.v1.SearchMyAccessGrantsResponse
+ */
+export declare type SearchMyAccessGrantsResponse = Message<"bytebase.v1.SearchMyAccessGrantsResponse"> & {
+ /**
+ * The access grants from the specified request.
+ *
+ * @generated from field: repeated bytebase.v1.AccessGrant access_grants = 1;
+ */
+ accessGrants: AccessGrant[];
+
+ /**
+ * A token, which can be sent as `page_token` to retrieve the next page.
+ * If this field is omitted, there are no subsequent pages.
+ *
+ * @generated from field: string next_page_token = 2;
+ */
+ nextPageToken: string;
+};
+
+/**
+ * Describes the message bytebase.v1.SearchMyAccessGrantsResponse.
+ * Use `create(SearchMyAccessGrantsResponseSchema)` to create a new message.
+ */
+export declare const SearchMyAccessGrantsResponseSchema: GenMessage<SearchMyAccessGrantsResponse>;
+
/**
* AccessGrantService manages temporary access grants within projects.
*
@@ -350,5 +437,15 @@ export declare const AccessGrantService: GenService<{
input: typeof RevokeAccessGrantRequestSchema;
output: typeof AccessGrantSchema;
},
+ /**
+ * Searches access grants created by the caller.
+ *
+ * @generated from rpc bytebase.v1.AccessGrantService.SearchMyAccessGrants
+ */
+ searchMyAccessGrants: {
+ methodKind: "unary";
+ input: typeof SearchMyAccessGrantsRequestSchema;
+ output: typeof SearchMyAccessGrantsResponseSchema;
+ },
}>;
diff --git a/frontend/src/types/proto-es/v1/access_grant_service_pb.js b/frontend/src/types/proto-es/v1/access_grant_service_pb.js
index e61206467c..4b4f2b134f 100644
--- a/frontend/src/types/proto-es/v1/access_grant_service_pb.js
+++ b/frontend/src/types/proto-es/v1/access_grant_service_pb.js
@@ -7,14 +7,14 @@ import { file_google_api_annotations } from "../google/api/annotations_pb";
import { file_google_api_client } from "../google/api/client_pb";
import { file_google_api_field_behavior } from "../google/api/field_behavior_pb";
import { file_google_api_resource } from "../google/api/resource_pb";
-import { file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
+import { file_google_protobuf_duration, file_google_protobuf_timestamp } from "@bufbuild/protobuf/wkt";
import { file_v1_annotation } from "./annotation_pb";
/**
* Describes the file v1/access_grant_service.proto.
*/
export const file_v1_access_grant_service = /*@__PUR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Y2Vzc19ncmFudIrqMBZiYi5hY2Nlc3NHcmFudHMuY3JlYXRlkOowAZjqMAGC0+STAjQ6DGFjY2Vzc19ncmFudCIkL3YxL3twYXJlbnQ9cHJvamVjdHMvKn0vYWNjZXNzR3JhbnRzEr0BChNBY3RpdmF0ZUFjY2Vzc0dyYW50EicuYnl0ZWJhc2UudjEuQWN0aXZhdGVBY2Nlc3NHcmFudFJlcXVlc3QaGC5ieXRlYmFzZS52MS5BY2Nlc3NHcmFudCJj2kEEbmFtZYrqMBhiYi5hY2Nlc3NHcmFudHMuYWN0aXZhdGWQ6jABmOowAYLT5JMCMjoBKiItL3YxL3tuYW1lPXByb2plY3RzLyovYWNjZXNzR3JhbnRzLyp9OmFjdGl2YXRlErUBChFSZXZva2VBY2Nlc3NHcmFudBIlLmJ5dGViYXNlLnYxLlJldm9rZUFjY2Vzc0dyYW50UmVxdWVzdBoYLmJ5dGViYXNlLnYxLkFjY2Vzc0dyYW50Il/aQQRuYW1liuowFmJiLmFjY2Vzc0dyYW50cy5yZXZva2WQ6jABmOowAYLT5JMCMDoBKiIrL3YxL3tuYW1lPXByb2plY3RzLyovYWNjZXNzR3JhbnRzLyp9OnJldm9rZUKtAQoPY29tLmJ5dGViYXNlLnYxQhdBY2Nlc3NHcmFudFNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_timestamp, file_v1_annotation]);
+ fileDesc("Ch12MS9hY2Nlc3NfZ3JhbnRfc2VydmljZS5wcm90bxILYnl0ZWJhc2UudjEiowQKC0FjY2Vzc0dyYW50EgwKBG5hbWUYASABKAkSFAo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9uc2UiU4rqMBNiYi5hY2Nlc3NHcmFudHMuZ2V0kOowAoLT5JMCMjoBKiItL3YxL3twYXJlbnQ9cHJvamVjdHMvKn0vYWNjZXNzR3JhbnRzOnNlYXJjaE15Qq0BCg9jb20uYnl0ZWJhc2UudjFCF0FjY2Vzc0dyYW50U2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_timestamp, file_v1_annotation]);
/**
* Describes the message bytebase.v1.AccessGrant.
@@ -79,6 +79,20 @@ export const ActivateAccessGrantRequestSchema = /*@__PURE__*/
export const RevokeAccessGrantRequestSchema = /*@__PURE__*/
messageDesc(file_v1_access_grant_service, 6);
+/**
+ * Describes the message bytebase.v1.SearchMyAccessGrantsRequest.
+ * Use `create(SearchMyAccessGrantsRequestSchema)` to create a new message.
+ */
+export const SearchMyAccessGrantsRequestSchema = /*@__PURE__*/
+ messageDesc(file_v1_access_grant_service, 7);
+
+/**
+ * Describes the message bytebase.v1.SearchMyAccessGrantsResponse.
+ * Use `create(SearchMyAccessGrantsResponseSchema)` to create a new message.
+ */
+export const SearchMyAccessGrantsResponseSchema = /*@__PURE__*/
+ messageDesc(file_v1_access_grant_service, 8);
+
/**
* AccessGrantService manages temporary access grants within projects.
*
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 722dff3d58..7eb79077b4 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -7339,6 +7339,54 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ /v1/projects/{project}/accessGrants:searchMy:
+ post:
+ tags:
+ - AccessGrantService
+ summary: SearchMyAccessGrants
+ description: Searches access grants created by the caller.
+ operationId: AccessGrantService_SearchMyAccessGrants
+ parameters:
+ - name: project
+ in: path
+ description: The project id.
+ required: true
+ schema:
+ type: string
+ requestBody:
+ content:
+ application/json:
+ schema:
+ type: object
+ properties:
+ pageSize:
+ type: integer
+ title: page_size
+ format: int32
+ description: The maximum number of access grants to return.
+ pageToken:
+ type: string
+ title: page_token
+ description: A page token from a previous SearchMyAccessGrants call.
+ filter:
+ type: string
+ title: filter
+ description: |-
+ Filter expression using AIP-160 syntax.
+ Supported fields: status, expire_time, create_time
+ Examples:
+ - 'status = "ACTIVE"'
+ - 'status = "ACTIVE" AND expire_time > "2024-02-01T00:00:00Z"'
+ title: SearchMyAccessGrantsRequest
+ additionalProperties: false
+ required: true
+ responses:
+ "200":
+ description: Success
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/bytebase.v1.SearchMyAccessGrantsResponse'
/v1/projects/{project}/auditLogs:export:
post:
tags:
@@ -15807,68 +15855,82 @@ components:
- AZURE_OPENAI
bytebase.v1.AccessGrant:
type: object
- properties:
- name:
- type: string
- title: name
- description: |-
- The name of the access grant, generated by the server.
- Format: projects/{project}/accessGrants/{access_grant}
- The {access_grant} segment is a server-generated unique ID.
- creator:
- type: string
- title: creator
- description: |-
- The creator of the access grant.
- Format: users/{email}
- status:
- title: status
- description: |-
- The status of the access grant.
- An ACTIVE grant with `expire_time` in the past is effectively expired
- and no longer authorizes access. Use `expire_time` to determine
- whether an ACTIVE grant has expired.
- readOnly: true
- $ref: '#/components/schemas/bytebase.v1.AccessGrant.Status'
- expireTime:
- title: expire_time
- description: |-
- The expiration time of the access grant.
- When the current time exceeds this value, an ACTIVE grant is
- considered expired and no longer authorizes access.
- $ref: '#/components/schemas/google.protobuf.Timestamp'
- issue:
- type: string
- title: issue
- description: |-
- The issue associated with the access grant.
- Can be empty.
- Format: projects/{project}/issues/{issue}
- readOnly: true
- targets:
- type: array
- items:
- type: string
- title: targets
- description: |-
- The target databases for this access grant.
- Format: instances/{instance}/databases/{database}
- query:
- type: string
- title: query
- description: The query permission granted.
- unmask:
- type: boolean
- title: unmask
- description: Whether the grant allows unmasking sensitive data.
- createTime:
- title: create_time
- readOnly: true
- $ref: '#/components/schemas/google.protobuf.Timestamp'
- updateTime:
- title: update_time
- readOnly: true
- $ref: '#/components/schemas/google.protobuf.Timestamp'
+ allOf:
+ - properties:
+ name:
+ type: string
+ title: name
+ description: |-
+ The name of the access grant, generated by the server.
+ Format: projects/{project}/accessGrants/{access_grant}
+ The {access_grant} segment is a server-generated unique ID.
+ creator:
+ type: string
+ title: creator
+ description: |-
+ The creator of the access grant.
+ Format: users/{email}
+ status:
+ title: status
+ description: |-
+ The status of the access grant.
+ An ACTIVE grant with `expire_time` in the past is effectively expired
+ and no longer authorizes access. Use `expire_time` to determine
+ whether an ACTIVE grant has expired.
+ readOnly: true
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant.Status'
+ issue:
+ type: string
+ title: issue
+ description: |-
+ The issue associated with the access grant.
+ Can be empty.
+ Format: projects/{project}/issues/{issue}
+ readOnly: true
+ targets:
+ type: array
+ items:
+ type: string
+ title: targets
+ description: |-
+ The target databases for this access grant.
+ Format: instances/{instance}/databases/{database}
+ query:
+ type: string
+ title: query
+ description: The query permission granted.
+ unmask:
+ type: boolean
+ title: unmask
+ description: Whether the grant allows unmasking sensitive data.
+ createTime:
+ title: create_time
+ readOnly: true
+ $ref: '#/components/schemas/google.protobuf.Timestamp'
+ updateTime:
+ title: update_time
+ readOnly: true
+ $ref: '#/components/schemas/google.protobuf.Timestamp'
+ - oneOf:
+ - properties:
+ expireTime:
+ title: expire_time
+ description: The expiration time of the access grant.
+ $ref: '#/components/schemas/google.protobuf.Timestamp'
+ title: expire_time
+ required:
+ - expireTime
+ - properties:
+ ttl:
+ title: ttl
+ description: |-
+ Input only. The time-to-live duration for the access grant.
+ The server computes `expire_time` from this value at creation time.
+ writeOnly: true
+ $ref: '#/components/schemas/google.protobuf.Duration'
+ title: ttl
+ required:
+ - ttl
title: AccessGrant
required:
- creator
@@ -25063,6 +25125,54 @@ components:
If this field is omitted, there are no subsequent pages.
title: SearchIssuesResponse
additionalProperties: false
+ bytebase.v1.SearchMyAccessGrantsRequest:
+ type: object
+ properties:
+ parent:
+ type: string
+ title: parent
+ description: |-
+ The parent project to search in.
+ Format: projects/{project}
+ pageSize:
+ type: integer
+ title: page_size
+ format: int32
+ description: The maximum number of access grants to return.
+ pageToken:
+ type: string
+ title: page_token
+ description: A page token from a previous SearchMyAccessGrants call.
+ filter:
+ type: string
+ title: filter
+ description: |-
+ Filter expression using AIP-160 syntax.
+ Supported fields: status, expire_time, create_time
+ Examples:
+ - 'status = "ACTIVE"'
+ - 'status = "ACTIVE" AND expire_time > "2024-02-01T00:00:00Z"'
+ title: SearchMyAccessGrantsRequest
+ required:
+ - parent
+ additionalProperties: false
+ bytebase.v1.SearchMyAccessGrantsResponse:
+ type: object
+ properties:
+ accessGrants:
+ type: array
+ items:
+ $ref: '#/components/schemas/bytebase.v1.AccessGrant'
+ title: access_grants
+ description: The access grants from the specified request.
+ nextPageToken:
+ type: string
+ title: next_page_token
+ description: |-
+ A token, which can be sent as `page_token` to retrieve the next page.
+ If this field is omitted, there are no subsequent pages.
+ title: SearchMyAccessGrantsResponse
+ additionalProperties: false
bytebase.v1.SearchProjectsRequest:
type: object
properties:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 3a5871808a..883a10ddf6 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -19,6 +19,8 @@
- [ListAccessGrantsRequest](#bytebase-v1-ListAccessGrantsRequest)
- [ListAccessGrantsResponse](#bytebase-v1-ListAccessGrantsResponse)
- [RevokeAccessGrantRequest](#bytebase-v1-RevokeAccessGrantRequest)
+ - [SearchMyAccessGrantsRequest](#bytebase-v1-SearchMyAccessGrantsRequest)
+ - [SearchMyAccessGrantsResponse](#bytebase-v1-SearchMyAccessGrantsResponse)
- [AccessGrant.Status](#bytebase-v1-AccessGrant-Status)
@@ -763,7 +765,8 @@ Authorization method for RPC calls.
| name | [string](#string) | | The name of the access grant, generated by the server. Format: projects/{project}/accessGrants/{access_grant} The {access_grant} segment is a server-generated unique ID. |
| creator | [string](#string) | | The creator of the access grant. Format: users/{email} |
| status | [AccessGrant.Status](#bytebase-v1-AccessGrant-Status) | | The status of the access grant. An ACTIVE grant with `expire_time` in the past is effectively expired and no longer authorizes access. Use `expire_time` to determine whether an ACTIVE grant has expired. |
-| expire_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The expiration time of the access grant. When the current time exceeds this value, an ACTIVE grant is considered expired and no longer authorizes access. |
+| expire_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | The expiration time of the access grant. |
+| ttl | [google.protobuf.Duration](#google-protobuf-Duration) | | Input only. The time-to-live duration for the access grant. The server computes `expire_time` from this value at creation time. |
| issue | [string](#string) | | The issue associated with the access grant. Can be empty. Format: projects/{project}/issues/{issue} |
| targets | [string](#string) | repeated | The target databases for this access grant. Format: instances/{instance}/databases/{database} |
| query | [string](#string) | | The query permission granted. |
@@ -870,6 +873,40 @@ Authorization method for RPC calls.
+
+<a name="bytebase-v1-SearchMyAccessGrantsRequest"></a>
+
+### SearchMyAccessGrantsRequest
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| parent | [string](#string) | | The parent project to search in. Format: projects/{project} |
+| page_size | [int32](#int32) | | The maximum number of access grants to return. |
+| page_token | [string](#string) | | A page token from a previous SearchMyAccessGrants call. |
+| filter | [string](#string) | | Filter expression using AIP-160 syntax. Supported fields: status, expire_time, create_time Examples: - &#39;status = &#34;ACTIVE&#34;&#39; - &#39;status = &#34;ACTIVE&#34; AND expire_time &gt; &#34;2024-02-01T00:00:00Z&#34;&#39; |
+
+
+
+
+
+
+<a name="bytebase-v1-SearchMyAccessGrantsResponse"></a>
+
+### SearchMyAccessGrantsResponse
+
+
+
+| Field | Type | Label | Description |
+| ----- | ---- | ----- | ----------- |
+| access_grants | [AccessGrant](#bytebase-v1-AccessGrant) | repeated | The access grants from the specified request. |
+| next_page_token | [string](#string) | | A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. |
+
+
+
+
+
@@ -903,6 +940,7 @@ AccessGrantService manages temporary access grants within projects.
| CreateAccessGrant | [CreateAccessGrantRequest](#bytebase-v1-CreateAccessGrantRequest) | [AccessGrant](#bytebase-v1-AccessGrant) | Creates an access grant. |
| ActivateAccessGrant | [ActivateAccessGrantRequest](#bytebase-v1-ActivateAccessGrantRequest) | [AccessGrant](#bytebase-v1-AccessGrant) | Activates a pending access grant. |
| RevokeAccessGrant | [RevokeAccessGrantRequest](#bytebase-v1-RevokeAccessGrantRequest) | [AccessGrant](#bytebase-v1-AccessGrant) | Revokes an active access grant. |
+| SearchMyAccessGrants | [SearchMyAccessGrantsRequest](#bytebase-v1-SearchMyAccessGrantsRequest) | [SearchMyAccessGrantsResponse](#bytebase-v1-SearchMyAccessGrantsResponse) | Searches access grants created by the caller. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 84687f6f7a..54e68c8a36 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -237,6 +237,14 @@
<a href="#bytebase.v1.RevokeAccessGrantRequest"><span class="badge">M</span>RevokeAccessGrantRequest</a>
</li>
+ <li>
+ <a href="#bytebase.v1.SearchMyAccessGrantsRequest"><span class="badge">M</span>SearchMyAccessGrantsRequest</a>
+ </li>
+
+ <li>
+ <a href="#bytebase.v1.SearchMyAccessGrantsResponse"><span class="badge">M</span>SearchMyAccessGrantsResponse</a>
+ </li>
+
<li>
<a href="#bytebase.v1.AccessGrant.Status"><span class="badge">E</span>AccessGrant.Status</a>
@@ -2986,9 +2994,15 @@ whether an ACTIVE grant has expired. </p></td>
<td>expire_time</td>
<td><a href="#google.protobuf.Timestamp">google.protobuf.Timestamp</a></td>
<td></td>
- <td><p>The expiration time of the access grant.
-When the current time exceeds this value, an ACTIVE grant is
-considered expired and no longer authorizes access. </p></td>
+ <td><p>The expiration time of the access grant. </p></td>
+ </tr>
+
+ <tr>
+ <td>ttl</td>
+ <td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td>
+ <td></td>
+ <td><p>Input only. The time-to-live duration for the access grant.
+The server computes `expire_time` from this value at creation time. </p></td>
</tr>
<tr>
@@ -3235,6 +3249,88 @@ Format: projects/{project}/accessGrants/{access_grant} </p></td>
+ <h3 id="bytebase.v1.SearchMyAccessGrantsRequest">SearchMyAccessGrantsRequest</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>parent</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>The parent project to search in.
+Format: projects/{project} </p></td>
+ </tr>
+
+ <tr>
+ <td>page_size</td>
+ <td><a href="#int32">int32</a></td>
+ <td></td>
+ <td><p>The maximum number of access grants to return. </p></td>
+ </tr>
+
+ <tr>
+ <td>page_token</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>A page token from a previous SearchMyAccessGrants call. </p></td>
+ </tr>
+
+ <tr>
+ <td>filter</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>Filter expression using AIP-160 syntax.
+Supported fields: status, expire_time, create_time
+Examples:
+ - &#39;status = &#34;ACTIVE&#34;&#39;
+ - &#39;status = &#34;ACTIVE&#34; AND expire_time &gt; &#34;2024-02-01T00:00:00Z&#34;&#39; </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
+ <h3 id="bytebase.v1.SearchMyAccessGrantsResponse">SearchMyAccessGrantsResponse</h3>
+ <p></p>
+
+
+ <table class="field-table">
+ <thead>
+ <tr><td>Field</td><td>Type</td><td>Label</td><td>Description</td></tr>
+ </thead>
+ <tbody>
+
+ <tr>
+ <td>access_grants</td>
+ <td><a href="#bytebase.v1.AccessGrant">AccessGrant</a></td>
+ <td>repeated</td>
+ <td><p>The access grants from the specified request. </p></td>
+ </tr>
+
+ <tr>
+ <td>next_page_token</td>
+ <td><a href="#string">string</a></td>
+ <td></td>
+ <td><p>A token, which can be sent as `page_token` to retrieve the next page.
+If this field is omitted, there are no subsequent pages. </p></td>
+ </tr>
+
+ </tbody>
+ </table>
+
+
+
+
+
<h3 id="bytebase.v1.AccessGrant.Status">AccessGrant.Status</h3>
@@ -3320,6 +3416,13 @@ whether the grant is still valid or has expired.</p></td>
<td><p>Revokes an active access grant.</p></td>
</tr>
+ <tr>
+ <td>SearchMyAccessGrants</td>
+ <td><a href="#bytebase.v1.SearchMyAccessGrantsRequest">SearchMyAccessGrantsRequest</a></td>
+ <td><a href="#bytebase.v1.SearchMyAccessGrantsResponse">SearchMyAccessGrantsResponse</a></td>
+ <td><p>Searches access grants created by the caller.</p></td>
+ </tr>
+
</tbody>
</table>
@@ -3388,6 +3491,16 @@ whether the grant is still valid or has expired.</p></td>
</tr>
+
+
+ <tr>
+ <td>SearchMyAccessGrants</td>
+ <td>POST</td>
+ <td>/v1/{parent=projects/*}/accessGrants:searchMy</td>
+ <td>*</td>
+ </tr>
+
+
</tbody>
</table>
diff --git a/proto/v1/v1/access_grant_service.proto b/proto/v1/v1/access_grant_service.proto
index 44099e5f1a..e24c862cb3 100644
--- a/proto/v1/v1/access_grant_service.proto
+++ b/proto/v1/v1/access_grant_service.proto
@@ -6,6 +6,7 @@ import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
+import "google/protobuf/duration.proto";
import "google/protobuf/timestamp.proto";
import "v1/annotation.proto";
@@ -64,6 +65,16 @@ service AccessGrantService {
option (bytebase.v1.auth_method) = IAM;
option (bytebase.v1.audit) = true;
}
+
+ // Searches access grants created by the caller.
+ rpc SearchMyAccessGrants(SearchMyAccessGrantsRequest) returns (SearchMyAccessGrantsResponse) {
+ option (google.api.http) = {
+ post: "/v1/{parent=projects/*}/accessGrants:searchMy"
+ body: "*"
+ };
+ option (bytebase.v1.permission) = "bb.accessGrants.get";
+ option (bytebase.v1.auth_method) = CUSTOM;
+ }
}
message AccessGrant {
@@ -87,10 +98,17 @@ message AccessGrant {
// whether an ACTIVE grant has expired.
Status status = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
- // The expiration time of the access grant.
- // When the current time exceeds this value, an ACTIVE grant is
+ // The expiration of the access grant.
+ // When the current time exceeds `expire_time`, an ACTIVE grant is
// considered expired and no longer authorizes access.
- google.protobuf.Timestamp expire_time = 4;
+ oneof expiration {
+ // The expiration time of the access grant.
+ google.protobuf.Timestamp expire_time = 4;
+
+ // Input only. The time-to-live duration for the access grant.
+ // The server computes `expire_time` from this value at creation time.
+ google.protobuf.Duration ttl = 11 [(google.api.field_behavior) = INPUT_ONLY];
+ }
// The issue associated with the access grant.
// Can be empty.
@@ -196,3 +214,34 @@ message RevokeAccessGrantRequest {
(google.api.resource_reference) = {type: "bytebase.com/AccessGrant"}
];
}
+
+message SearchMyAccessGrantsRequest {
+ // The parent project to search in.
+ // Format: projects/{project}
+ string parent = 1 [
+ (google.api.field_behavior) = REQUIRED,
+ (google.api.resource_reference) = {type: "bytebase.com/Project"}
+ ];
+
+ // The maximum number of access grants to return.
+ int32 page_size = 2;
+
+ // A page token from a previous SearchMyAccessGrants call.
+ string page_token = 3;
+
+ // Filter expression using AIP-160 syntax.
+ // Supported fields: status, expire_time, create_time
+ // Examples:
+ // - 'status = "ACTIVE"'
+ // - 'status = "ACTIVE" AND expire_time > "2024-02-01T00:00:00Z"'
+ string filter = 4;
+}
+
+message SearchMyAccessGrantsResponse {
+ // The access grants from the specified request.
+ repeated AccessGrant access_grants = 1;
+
+ // A token, which can be sent as `page_token` to retrieve the next page.
+ // If this field is omitted, there are no subsequent pages.
+ string next_page_token = 2;
+}