Create Sessions List Self Action (#888)
This commit is contained in:
1 parent
06c59e19bd
commit
02cd972043
12 files changed
+672
-115
No files matched your search
@@ -1833,6 +1833,37 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/sessions:list:self": {
|
||||
"get": {
|
||||
"summary": "Lists all Sessions owned by the requester.",
|
||||
"operationId": "SessionService_ListSelfSessions",
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "A successful response.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/controller.api.services.v1.ListSelfSessionsResponse"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parameters": [
|
||||
{
|
||||
"name": "scope_id",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "recursive",
|
||||
"in": "query",
|
||||
"required": false,
|
||||
"type": "boolean"
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"controller.api.services.v1.SessionService"
|
||||
]
|
||||
}
|
||||
},
|
||||
"/v1/targets": {
|
||||
"get": {
|
||||
"summary": "Lists all Targets.",
|
||||
@@ -4110,6 +4141,17 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"controller.api.services.v1.ListSelfSessionsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"items": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/controller.api.resources.sessions.v1.Session"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"controller.api.services.v1.ListSessionsResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -118,6 +118,108 @@ func (x *GetSessionResponse) GetItem() *sessions.Session {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ListSelfSessionsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
ScopeId string `protobuf:"bytes,1,opt,name=scope_id,json=scopeId,proto3" json:"scope_id,omitempty"`
|
||||
Recursive bool `protobuf:"varint,20,opt,name=recursive,proto3" json:"recursive,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListSelfSessionsRequest) Reset() {
|
||||
*x = ListSelfSessionsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListSelfSessionsRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListSelfSessionsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListSelfSessionsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[2]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListSelfSessionsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListSelfSessionsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *ListSelfSessionsRequest) GetScopeId() string {
|
||||
if x != nil {
|
||||
return x.ScopeId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ListSelfSessionsRequest) GetRecursive() bool {
|
||||
if x != nil {
|
||||
return x.Recursive
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ListSelfSessionsResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Items []*sessions.Session `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ListSelfSessionsResponse) Reset() {
|
||||
*x = ListSelfSessionsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ListSelfSessionsResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ListSelfSessionsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListSelfSessionsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[3]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ListSelfSessionsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListSelfSessionsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *ListSelfSessionsResponse) GetItems() []*sessions.Session {
|
||||
if x != nil {
|
||||
return x.Items
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ListSessionsRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -130,7 +232,7 @@ type ListSessionsRequest struct {
|
||||
func (x *ListSessionsRequest) Reset() {
|
||||
*x = ListSessionsRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[2]
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -143,7 +245,7 @@ func (x *ListSessionsRequest) String() string {
|
||||
func (*ListSessionsRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ListSessionsRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[2]
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[4]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -156,7 +258,7 @@ func (x *ListSessionsRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ListSessionsRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ListSessionsRequest) Descriptor() ([]byte, []int) {
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{2}
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *ListSessionsRequest) GetScopeId() string {
|
||||
@@ -184,7 +286,7 @@ type ListSessionsResponse struct {
|
||||
func (x *ListSessionsResponse) Reset() {
|
||||
*x = ListSessionsResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[3]
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -197,7 +299,7 @@ func (x *ListSessionsResponse) String() string {
|
||||
func (*ListSessionsResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ListSessionsResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[3]
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[5]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -210,7 +312,7 @@ func (x *ListSessionsResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ListSessionsResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ListSessionsResponse) Descriptor() ([]byte, []int) {
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{3}
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *ListSessionsResponse) GetItems() []*sessions.Session {
|
||||
@@ -232,7 +334,7 @@ type CancelSessionRequest struct {
|
||||
func (x *CancelSessionRequest) Reset() {
|
||||
*x = CancelSessionRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[4]
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -245,7 +347,7 @@ func (x *CancelSessionRequest) String() string {
|
||||
func (*CancelSessionRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CancelSessionRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[4]
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[6]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -258,7 +360,7 @@ func (x *CancelSessionRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CancelSessionRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CancelSessionRequest) Descriptor() ([]byte, []int) {
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{4}
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *CancelSessionRequest) GetId() string {
|
||||
@@ -286,7 +388,7 @@ type CancelSessionResponse struct {
|
||||
func (x *CancelSessionResponse) Reset() {
|
||||
*x = CancelSessionResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[5]
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -299,7 +401,7 @@ func (x *CancelSessionResponse) String() string {
|
||||
func (*CancelSessionResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CancelSessionResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[5]
|
||||
mi := &file_controller_api_services_v1_session_service_proto_msgTypes[7]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -312,7 +414,7 @@ func (x *CancelSessionResponse) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use CancelSessionResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CancelSessionResponse) Descriptor() ([]byte, []int) {
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{5}
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *CancelSessionResponse) GetItem() *sessions.Session {
|
||||
@@ -348,66 +450,90 @@ var file_controller_api_services_v1_session_service_proto_rawDesc = []byte{
|
||||
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73,
|
||||
0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d,
|
||||
0x22, 0x4e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x63, 0x6f, 0x70, 0x65,
|
||||
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x63, 0x6f, 0x70, 0x65,
|
||||
0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65, 0x18,
|
||||
0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73, 0x69, 0x76, 0x65,
|
||||
0x22, 0x5b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d,
|
||||
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
|
||||
0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63,
|
||||
0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x40, 0x0a,
|
||||
0x14, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x22,
|
||||
0x5a, 0x0a, 0x15, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a, 0x04, 0x69, 0x74, 0x65, 0x6d,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
|
||||
0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
|
||||
0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x32, 0x95, 0x04, 0x0a, 0x0e,
|
||||
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xa7,
|
||||
0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x2e,
|
||||
0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2e, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x19, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x18,
|
||||
0x12, 0x16, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x20,
|
||||
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x12, 0x9f, 0x01, 0x0a, 0x0c, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2f, 0x2e, 0x63, 0x6f, 0x6e, 0x74,
|
||||
0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x30, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3,
|
||||
0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x92, 0x41, 0x15, 0x12, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c,
|
||||
0x20, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x12, 0xb6, 0x01, 0x0a, 0x0d, 0x43,
|
||||
0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x30, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c,
|
||||
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x31,
|
||||
0x22, 0x52, 0x0a, 0x17, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73,
|
||||
0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73,
|
||||
0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72, 0x73,
|
||||
0x69, 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72,
|
||||
0x73, 0x69, 0x76, 0x65, 0x22, 0x5f, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66,
|
||||
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x43, 0x0a, 0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
|
||||
0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69,
|
||||
0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x05,
|
||||
0x69, 0x74, 0x65, 0x6d, 0x73, 0x22, 0x4e, 0x0a, 0x13, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08,
|
||||
0x73, 0x63, 0x6f, 0x70, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07,
|
||||
0x73, 0x63, 0x6f, 0x70, 0x65, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x75, 0x72,
|
||||
0x73, 0x69, 0x76, 0x65, 0x18, 0x14, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x72, 0x65, 0x63, 0x75,
|
||||
0x72, 0x73, 0x69, 0x76, 0x65, 0x22, 0x5b, 0x0a, 0x14, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a,
|
||||
0x05, 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65,
|
||||
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73,
|
||||
0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x05, 0x69, 0x74, 0x65,
|
||||
0x6d, 0x73, 0x22, 0x40, 0x0a, 0x14, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65,
|
||||
0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x76, 0x65, 0x72,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x22, 0x5a, 0x0a, 0x15, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x41, 0x0a,
|
||||
0x04, 0x69, 0x74, 0x65, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2d, 0x2e, 0x63, 0x6f,
|
||||
0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x72, 0x65, 0x73,
|
||||
0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x2e, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
|
||||
0x76, 0x31, 0x2e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x04, 0x69, 0x74, 0x65, 0x6d,
|
||||
0x32, 0xe4, 0x05, 0x0a, 0x0e, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x12, 0xa7, 0x01, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x12, 0x2d, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x47, 0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x2e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61,
|
||||
0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x47,
|
||||
0x65, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x73,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x62, 0x04, 0x69, 0x74,
|
||||
0x65, 0x6d, 0x92, 0x41, 0x18, 0x12, 0x16, 0x47, 0x65, 0x74, 0x73, 0x20, 0x61, 0x20, 0x73, 0x69,
|
||||
0x6e, 0x67, 0x6c, 0x65, 0x20, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x12, 0x9f, 0x01,
|
||||
0x0a, 0x0c, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2f,
|
||||
0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61, 0x6e, 0x63,
|
||||
0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x18, 0x2f, 0x76, 0x31, 0x2f, 0x73,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, 0x3a, 0x63, 0x61, 0x6e,
|
||||
0x63, 0x65, 0x6c, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d, 0x92, 0x41, 0x14, 0x12,
|
||||
0x12, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x73, 0x20, 0x61, 0x20, 0x53, 0x65, 0x73, 0x73, 0x69,
|
||||
0x6f, 0x6e, 0x2e, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x62, 0x6f, 0x75, 0x6e,
|
||||
0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x67, 0x65,
|
||||
0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2f, 0x61, 0x70, 0x69,
|
||||
0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69,
|
||||
0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73,
|
||||
0x74, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
|
||||
0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0e, 0x12, 0x0c, 0x2f, 0x76, 0x31, 0x2f, 0x73,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x92, 0x41, 0x15, 0x12, 0x13, 0x4c, 0x69, 0x73, 0x74,
|
||||
0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x12,
|
||||
0xcc, 0x01, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, 0x73, 0x73,
|
||||
0x69, 0x6f, 0x6e, 0x73, 0x12, 0x33, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65,
|
||||
0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76,
|
||||
0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f,
|
||||
0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x34, 0x2e, 0x63, 0x6f, 0x6e, 0x74,
|
||||
0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x53, 0x65, 0x6c, 0x66, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
|
||||
0x4d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x12, 0x16, 0x2f, 0x76, 0x31, 0x2f, 0x73, 0x65, 0x73,
|
||||
0x73, 0x69, 0x6f, 0x6e, 0x73, 0x3a, 0x6c, 0x69, 0x73, 0x74, 0x3a, 0x73, 0x65, 0x6c, 0x66, 0x92,
|
||||
0x41, 0x2c, 0x12, 0x2a, 0x4c, 0x69, 0x73, 0x74, 0x73, 0x20, 0x61, 0x6c, 0x6c, 0x20, 0x53, 0x65,
|
||||
0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x20, 0x6f, 0x77, 0x6e, 0x65, 0x64, 0x20, 0x62, 0x79, 0x20,
|
||||
0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x65, 0x72, 0x2e, 0x12, 0xb6,
|
||||
0x01, 0x0a, 0x0d, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e,
|
||||
0x12, 0x30, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e, 0x61, 0x70,
|
||||
0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x61,
|
||||
0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x31, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72, 0x2e,
|
||||
0x61, 0x70, 0x69, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e,
|
||||
0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x40, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x22, 0x18, 0x2f,
|
||||
0x76, 0x31, 0x2f, 0x73, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d,
|
||||
0x3a, 0x63, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x3a, 0x01, 0x2a, 0x62, 0x04, 0x69, 0x74, 0x65, 0x6d,
|
||||
0x92, 0x41, 0x14, 0x12, 0x12, 0x43, 0x61, 0x6e, 0x63, 0x65, 0x6c, 0x73, 0x20, 0x61, 0x20, 0x53,
|
||||
0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x2e, 0x42, 0x4d, 0x5a, 0x4b, 0x67, 0x69, 0x74, 0x68, 0x75,
|
||||
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f,
|
||||
0x62, 0x6f, 0x75, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61,
|
||||
0x6c, 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x6c, 0x65, 0x72,
|
||||
0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x3b, 0x73, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -422,31 +548,36 @@ func file_controller_api_services_v1_session_service_proto_rawDescGZIP() []byte
|
||||
return file_controller_api_services_v1_session_service_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_controller_api_services_v1_session_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
|
||||
var file_controller_api_services_v1_session_service_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
|
||||
var file_controller_api_services_v1_session_service_proto_goTypes = []interface{}{
|
||||
(*GetSessionRequest)(nil), // 0: controller.api.services.v1.GetSessionRequest
|
||||
(*GetSessionResponse)(nil), // 1: controller.api.services.v1.GetSessionResponse
|
||||
(*ListSessionsRequest)(nil), // 2: controller.api.services.v1.ListSessionsRequest
|
||||
(*ListSessionsResponse)(nil), // 3: controller.api.services.v1.ListSessionsResponse
|
||||
(*CancelSessionRequest)(nil), // 4: controller.api.services.v1.CancelSessionRequest
|
||||
(*CancelSessionResponse)(nil), // 5: controller.api.services.v1.CancelSessionResponse
|
||||
(*sessions.Session)(nil), // 6: controller.api.resources.sessions.v1.Session
|
||||
(*GetSessionRequest)(nil), // 0: controller.api.services.v1.GetSessionRequest
|
||||
(*GetSessionResponse)(nil), // 1: controller.api.services.v1.GetSessionResponse
|
||||
(*ListSelfSessionsRequest)(nil), // 2: controller.api.services.v1.ListSelfSessionsRequest
|
||||
(*ListSelfSessionsResponse)(nil), // 3: controller.api.services.v1.ListSelfSessionsResponse
|
||||
(*ListSessionsRequest)(nil), // 4: controller.api.services.v1.ListSessionsRequest
|
||||
(*ListSessionsResponse)(nil), // 5: controller.api.services.v1.ListSessionsResponse
|
||||
(*CancelSessionRequest)(nil), // 6: controller.api.services.v1.CancelSessionRequest
|
||||
(*CancelSessionResponse)(nil), // 7: controller.api.services.v1.CancelSessionResponse
|
||||
(*sessions.Session)(nil), // 8: controller.api.resources.sessions.v1.Session
|
||||
}
|
||||
var file_controller_api_services_v1_session_service_proto_depIdxs = []int32{
|
||||
6, // 0: controller.api.services.v1.GetSessionResponse.item:type_name -> controller.api.resources.sessions.v1.Session
|
||||
6, // 1: controller.api.services.v1.ListSessionsResponse.items:type_name -> controller.api.resources.sessions.v1.Session
|
||||
6, // 2: controller.api.services.v1.CancelSessionResponse.item:type_name -> controller.api.resources.sessions.v1.Session
|
||||
0, // 3: controller.api.services.v1.SessionService.GetSession:input_type -> controller.api.services.v1.GetSessionRequest
|
||||
2, // 4: controller.api.services.v1.SessionService.ListSessions:input_type -> controller.api.services.v1.ListSessionsRequest
|
||||
4, // 5: controller.api.services.v1.SessionService.CancelSession:input_type -> controller.api.services.v1.CancelSessionRequest
|
||||
1, // 6: controller.api.services.v1.SessionService.GetSession:output_type -> controller.api.services.v1.GetSessionResponse
|
||||
3, // 7: controller.api.services.v1.SessionService.ListSessions:output_type -> controller.api.services.v1.ListSessionsResponse
|
||||
5, // 8: controller.api.services.v1.SessionService.CancelSession:output_type -> controller.api.services.v1.CancelSessionResponse
|
||||
6, // [6:9] is the sub-list for method output_type
|
||||
3, // [3:6] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
8, // 0: controller.api.services.v1.GetSessionResponse.item:type_name -> controller.api.resources.sessions.v1.Session
|
||||
8, // 1: controller.api.services.v1.ListSelfSessionsResponse.items:type_name -> controller.api.resources.sessions.v1.Session
|
||||
8, // 2: controller.api.services.v1.ListSessionsResponse.items:type_name -> controller.api.resources.sessions.v1.Session
|
||||
8, // 3: controller.api.services.v1.CancelSessionResponse.item:type_name -> controller.api.resources.sessions.v1.Session
|
||||
0, // 4: controller.api.services.v1.SessionService.GetSession:input_type -> controller.api.services.v1.GetSessionRequest
|
||||
4, // 5: controller.api.services.v1.SessionService.ListSessions:input_type -> controller.api.services.v1.ListSessionsRequest
|
||||
2, // 6: controller.api.services.v1.SessionService.ListSelfSessions:input_type -> controller.api.services.v1.ListSelfSessionsRequest
|
||||
6, // 7: controller.api.services.v1.SessionService.CancelSession:input_type -> controller.api.services.v1.CancelSessionRequest
|
||||
1, // 8: controller.api.services.v1.SessionService.GetSession:output_type -> controller.api.services.v1.GetSessionResponse
|
||||
5, // 9: controller.api.services.v1.SessionService.ListSessions:output_type -> controller.api.services.v1.ListSessionsResponse
|
||||
3, // 10: controller.api.services.v1.SessionService.ListSelfSessions:output_type -> controller.api.services.v1.ListSelfSessionsResponse
|
||||
7, // 11: controller.api.services.v1.SessionService.CancelSession:output_type -> controller.api.services.v1.CancelSessionResponse
|
||||
8, // [8:12] is the sub-list for method output_type
|
||||
4, // [4:8] 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
|
||||
}
|
||||
|
||||
func init() { file_controller_api_services_v1_session_service_proto_init() }
|
||||
@@ -480,7 +611,7 @@ func file_controller_api_services_v1_session_service_proto_init() {
|
||||
}
|
||||
}
|
||||
file_controller_api_services_v1_session_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListSessionsRequest); i {
|
||||
switch v := v.(*ListSelfSessionsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -492,7 +623,7 @@ func file_controller_api_services_v1_session_service_proto_init() {
|
||||
}
|
||||
}
|
||||
file_controller_api_services_v1_session_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListSessionsResponse); i {
|
||||
switch v := v.(*ListSelfSessionsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -504,7 +635,7 @@ func file_controller_api_services_v1_session_service_proto_init() {
|
||||
}
|
||||
}
|
||||
file_controller_api_services_v1_session_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CancelSessionRequest); i {
|
||||
switch v := v.(*ListSessionsRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
@@ -516,6 +647,30 @@ func file_controller_api_services_v1_session_service_proto_init() {
|
||||
}
|
||||
}
|
||||
file_controller_api_services_v1_session_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ListSessionsResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_controller_api_services_v1_session_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CancelSessionRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_controller_api_services_v1_session_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*CancelSessionResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -534,7 +689,7 @@ func file_controller_api_services_v1_session_service_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_controller_api_services_v1_session_service_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 6,
|
||||
NumMessages: 8,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
||||
@@ -119,6 +119,42 @@ func local_request_SessionService_ListSessions_0(ctx context.Context, marshaler
|
||||
|
||||
}
|
||||
|
||||
var (
|
||||
filter_SessionService_ListSelfSessions_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
|
||||
)
|
||||
|
||||
func request_SessionService_ListSelfSessions_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListSelfSessionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SessionService_ListSelfSessions_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := client.ListSelfSessions(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func local_request_SessionService_ListSelfSessions_0(ctx context.Context, marshaler runtime.Marshaler, server SessionServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq ListSelfSessionsRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
|
||||
if err := req.ParseForm(); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_SessionService_ListSelfSessions_0); err != nil {
|
||||
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
|
||||
}
|
||||
|
||||
msg, err := server.ListSelfSessions(ctx, &protoReq)
|
||||
return msg, metadata, err
|
||||
|
||||
}
|
||||
|
||||
func request_SessionService_CancelSession_0(ctx context.Context, marshaler runtime.Marshaler, client SessionServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
|
||||
var protoReq CancelSessionRequest
|
||||
var metadata runtime.ServerMetadata
|
||||
@@ -239,6 +275,29 @@ func RegisterSessionServiceHandlerServer(ctx context.Context, mux *runtime.Serve
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_SessionService_ListSelfSessions_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)
|
||||
rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/controller.api.services.v1.SessionService/ListSelfSessions")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := local_request_SessionService_ListSelfSessions_0(rctx, inboundMarshaler, server, req, pathParams)
|
||||
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_SessionService_ListSelfSessions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_SessionService_CancelSession_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -343,6 +402,26 @@ func RegisterSessionServiceHandlerClient(ctx context.Context, mux *runtime.Serve
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("GET", pattern_SessionService_ListSelfSessions_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)
|
||||
rctx, err := runtime.AnnotateContext(ctx, mux, req, "/controller.api.services.v1.SessionService/ListSelfSessions")
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
resp, md, err := request_SessionService_ListSelfSessions_0(rctx, inboundMarshaler, client, req, pathParams)
|
||||
ctx = runtime.NewServerMetadataContext(ctx, md)
|
||||
if err != nil {
|
||||
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
|
||||
return
|
||||
}
|
||||
|
||||
forward_SessionService_ListSelfSessions_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
|
||||
|
||||
})
|
||||
|
||||
mux.Handle("POST", pattern_SessionService_CancelSession_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
|
||||
ctx, cancel := context.WithCancel(req.Context())
|
||||
defer cancel()
|
||||
@@ -389,6 +468,8 @@ var (
|
||||
|
||||
pattern_SessionService_ListSessions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "sessions"}, ""))
|
||||
|
||||
pattern_SessionService_ListSelfSessions_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "sessions:list"}, "self"))
|
||||
|
||||
pattern_SessionService_CancelSession_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"v1", "sessions", "id"}, "cancel"))
|
||||
)
|
||||
|
||||
@@ -397,5 +478,7 @@ var (
|
||||
|
||||
forward_SessionService_ListSessions_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_SessionService_ListSelfSessions_0 = runtime.ForwardResponseMessage
|
||||
|
||||
forward_SessionService_CancelSession_0 = runtime.ForwardResponseMessage
|
||||
)
|
||||
@@ -27,6 +27,11 @@ type SessionServiceClient interface {
|
||||
// the Sessions being retrieved. If the scope ID is missing, malformed, or
|
||||
// reference a non existing scope, an error is returned.
|
||||
ListSessions(ctx context.Context, in *ListSessionsRequest, opts ...grpc.CallOption) (*ListSessionsResponse, error)
|
||||
// ListSelfSessions returns a list of stored Sessions for the requester.
|
||||
// The request must include the scope ID for the Sessions being retrieved.
|
||||
// If the scope ID is missing, malformed, or reference a non existing scope,
|
||||
// an error is returned.
|
||||
ListSelfSessions(ctx context.Context, in *ListSelfSessionsRequest, opts ...grpc.CallOption) (*ListSelfSessionsResponse, error)
|
||||
// CancelSession cancels an existing Session in boundary. An error
|
||||
// is returned if the request attempts to cancel a Session that does
|
||||
// not exist.
|
||||
@@ -59,6 +64,15 @@ func (c *sessionServiceClient) ListSessions(ctx context.Context, in *ListSession
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *sessionServiceClient) ListSelfSessions(ctx context.Context, in *ListSelfSessionsRequest, opts ...grpc.CallOption) (*ListSelfSessionsResponse, error) {
|
||||
out := new(ListSelfSessionsResponse)
|
||||
err := c.cc.Invoke(ctx, "/controller.api.services.v1.SessionService/ListSelfSessions", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *sessionServiceClient) CancelSession(ctx context.Context, in *CancelSessionRequest, opts ...grpc.CallOption) (*CancelSessionResponse, error) {
|
||||
out := new(CancelSessionResponse)
|
||||
err := c.cc.Invoke(ctx, "/controller.api.services.v1.SessionService/CancelSession", in, out, opts...)
|
||||
@@ -82,6 +96,11 @@ type SessionServiceServer interface {
|
||||
// the Sessions being retrieved. If the scope ID is missing, malformed, or
|
||||
// reference a non existing scope, an error is returned.
|
||||
ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error)
|
||||
// ListSelfSessions returns a list of stored Sessions for the requester.
|
||||
// The request must include the scope ID for the Sessions being retrieved.
|
||||
// If the scope ID is missing, malformed, or reference a non existing scope,
|
||||
// an error is returned.
|
||||
ListSelfSessions(context.Context, *ListSelfSessionsRequest) (*ListSelfSessionsResponse, error)
|
||||
// CancelSession cancels an existing Session in boundary. An error
|
||||
// is returned if the request attempts to cancel a Session that does
|
||||
// not exist.
|
||||
@@ -99,6 +118,9 @@ func (UnimplementedSessionServiceServer) GetSession(context.Context, *GetSession
|
||||
func (UnimplementedSessionServiceServer) ListSessions(context.Context, *ListSessionsRequest) (*ListSessionsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListSessions not implemented")
|
||||
}
|
||||
func (UnimplementedSessionServiceServer) ListSelfSessions(context.Context, *ListSelfSessionsRequest) (*ListSelfSessionsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ListSelfSessions not implemented")
|
||||
}
|
||||
func (UnimplementedSessionServiceServer) CancelSession(context.Context, *CancelSessionRequest) (*CancelSessionResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method CancelSession not implemented")
|
||||
}
|
||||
@@ -151,6 +173,24 @@ func _SessionService_ListSessions_Handler(srv interface{}, ctx context.Context,
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SessionService_ListSelfSessions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ListSelfSessionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(SessionServiceServer).ListSelfSessions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/controller.api.services.v1.SessionService/ListSelfSessions",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(SessionServiceServer).ListSelfSessions(ctx, req.(*ListSelfSessionsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _SessionService_CancelSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(CancelSessionRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -181,6 +221,10 @@ var _SessionService_serviceDesc = grpc.ServiceDesc{
|
||||
MethodName: "ListSessions",
|
||||
Handler: _SessionService_ListSessions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ListSelfSessions",
|
||||
Handler: _SessionService_ListSelfSessions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CancelSession",
|
||||
Handler: _SessionService_CancelSession_Handler,
|
||||
|
||||
@@ -286,11 +286,18 @@ func (r *Repository) CreateScope(ctx context.Context, s *Scope, userId string, o
|
||||
}
|
||||
grants = append(grants, roleGrant)
|
||||
|
||||
roleGrant, err = NewRoleGrant(defaultRolePublicId, "id=*;type=scope;actions=list:self")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, op, errors.WithMsg("unable to create in memory role grant"))
|
||||
}
|
||||
grants = append(grants, roleGrant)
|
||||
|
||||
roleGrant, err = NewRoleGrant(defaultRolePublicId, "id=*;type=auth-method;actions=authenticate,list")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, op, errors.WithMsg("unable to create in memory role grant"))
|
||||
}
|
||||
grants = append(grants, roleGrant)
|
||||
|
||||
roleGrant, err = NewRoleGrant(defaultRolePublicId, "id={{account.id}};actions=read,change-password")
|
||||
if err != nil {
|
||||
return errors.Wrap(err, op, errors.WithMsg("unable to create in memory role grant"))
|
||||
|
||||
@@ -37,6 +37,19 @@ service SessionService {
|
||||
};
|
||||
}
|
||||
|
||||
// ListSelfSessions returns a list of stored Sessions for the requester.
|
||||
// The request must include the scope ID for the Sessions being retrieved.
|
||||
// If the scope ID is missing, malformed, or reference a non existing scope,
|
||||
// an error is returned.
|
||||
rpc ListSelfSessions(ListSelfSessionsRequest) returns (ListSelfSessionsResponse) {
|
||||
option (google.api.http) = {
|
||||
get: "/v1/sessions:list:self"
|
||||
};
|
||||
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
|
||||
summary: "Lists all Sessions owned by the requester."
|
||||
};
|
||||
}
|
||||
|
||||
// CancelSession cancels an existing Session in boundary. An error
|
||||
// is returned if the request attempts to cancel a Session that does
|
||||
// not exist.
|
||||
@@ -60,6 +73,15 @@ message GetSessionResponse {
|
||||
resources.sessions.v1.Session item = 1;
|
||||
}
|
||||
|
||||
message ListSelfSessionsRequest {
|
||||
string scope_id = 1;
|
||||
bool recursive = 20 [json_name="recursive"];
|
||||
}
|
||||
|
||||
message ListSelfSessionsResponse {
|
||||
repeated resources.sessions.v1.Session items = 1;
|
||||
}
|
||||
|
||||
message ListSessionsRequest {
|
||||
string scope_id = 1;
|
||||
bool recursive = 20 [json_name="recursive"];
|
||||
|
||||
@@ -113,7 +113,8 @@ func TestHandleImplementedPaths(t *testing.T) {
|
||||
"400_v1/sc\u200Bopes",
|
||||
"200_v1/scopes",
|
||||
"v1/scopes/someid",
|
||||
"v1/sessions/",
|
||||
"v1/sessions",
|
||||
"v1/sessions:list:self",
|
||||
"v1/sessions/someid",
|
||||
"v1/targets",
|
||||
"v1/targets/someid",
|
||||
|
||||
@@ -89,6 +89,7 @@ var orgAuthorizedCollectionActions = map[string]*structpb.ListValue{
|
||||
"sessions": {
|
||||
Values: []*structpb.Value{
|
||||
structpb.NewStringValue("list"),
|
||||
structpb.NewStringValue("list:self"),
|
||||
},
|
||||
},
|
||||
"users": {
|
||||
|
||||
@@ -32,6 +32,7 @@ var (
|
||||
// this collection
|
||||
CollectionActions = action.ActionSet{
|
||||
action.List,
|
||||
action.ListSelf,
|
||||
}
|
||||
)
|
||||
|
||||
@@ -79,18 +80,39 @@ func (s Service) ListSessions(ctx context.Context, req *pbs.ListSessionsRequest)
|
||||
if err := validateListRequest(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authResults := s.authResult(ctx, req.GetScopeId(), action.List)
|
||||
if authResults.Error != nil {
|
||||
return nil, authResults.Error
|
||||
}
|
||||
|
||||
scopeIds, scopeInfoMap, err := scopeids.GetScopeIds(
|
||||
ctx, s.iamRepoFn, authResults, req.GetScopeId(), req.GetRecursive())
|
||||
sl, err := s.listSessions(ctx, action.List, req.GetScopeId(), req.GetRecursive())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pbs.ListSessionsResponse{Items: sl}, nil
|
||||
}
|
||||
|
||||
seslist, err := s.listFromRepo(ctx, scopeIds)
|
||||
// ListSelfSessions implements the interface pbs.SessionServiceServer.
|
||||
func (s Service) ListSelfSessions(ctx context.Context, req *pbs.ListSelfSessionsRequest) (*pbs.ListSelfSessionsResponse, error) {
|
||||
if err := validateListSelfRequest(req); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sl, err := s.listSessions(ctx, action.ListSelf, req.GetScopeId(), req.GetRecursive())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pbs.ListSelfSessionsResponse{Items: sl}, nil
|
||||
}
|
||||
|
||||
func (s Service) listSessions(ctx context.Context, a action.Type, scopeId string, recursive bool) ([]*pb.Session, error) {
|
||||
authResults := s.authResult(ctx, scopeId, a)
|
||||
if authResults.Error != nil {
|
||||
return nil, authResults.Error
|
||||
}
|
||||
scopeIds, scopeInfoMap, err := scopeids.GetScopeIds(ctx, s.iamRepoFn, authResults, scopeId, recursive)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
opts := []session.Option{session.WithScopeIds(scopeIds)}
|
||||
if a == action.ListSelf {
|
||||
opts = append(opts, session.WithUserId(authResults.UserId))
|
||||
}
|
||||
seslist, err := s.listFromRepo(ctx, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -107,7 +129,7 @@ func (s Service) ListSessions(ctx context.Context, req *pbs.ListSessionsRequest)
|
||||
finalItems = append(finalItems, item)
|
||||
}
|
||||
}
|
||||
return &pbs.ListSessionsResponse{Items: finalItems}, nil
|
||||
return finalItems, err
|
||||
}
|
||||
|
||||
// CancelSession implements the interface pbs.SessionServiceServer.
|
||||
@@ -146,12 +168,12 @@ func (s Service) getFromRepo(ctx context.Context, id string) (*pb.Session, error
|
||||
return toProto(sess), nil
|
||||
}
|
||||
|
||||
func (s Service) listFromRepo(ctx context.Context, scopeIds []string) ([]*pb.Session, error) {
|
||||
func (s Service) listFromRepo(ctx context.Context, opts ...session.Option) ([]*pb.Session, error) {
|
||||
repo, err := s.repoFn()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
seslist, err := repo.ListSessions(ctx, session.WithScopeIds(scopeIds))
|
||||
seslist, err := repo.ListSessions(ctx, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -180,7 +202,7 @@ func (s Service) authResult(ctx context.Context, id string, a action.Type) auth.
|
||||
var parentId string
|
||||
opts := []auth.Option{auth.WithType(resource.Session), auth.WithAction(a)}
|
||||
switch a {
|
||||
case action.List:
|
||||
case action.List, action.ListSelf:
|
||||
parentId = id
|
||||
iamRepo, err := s.iamRepoFn()
|
||||
if err != nil {
|
||||
@@ -280,6 +302,18 @@ func validateListRequest(req *pbs.ListSessionsRequest) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateListSelfRequest(req *pbs.ListSelfSessionsRequest) error {
|
||||
badFields := map[string]string{}
|
||||
if !handlers.ValidId(scope.Project.Prefix(), req.GetScopeId()) &&
|
||||
!req.GetRecursive() {
|
||||
badFields["scope_id"] = "This field must be a valid project scope ID or the list operation must be recursive."
|
||||
}
|
||||
if len(badFields) > 0 {
|
||||
return handlers.InvalidArgumentErrorf("Improperly formatted identifier.", badFields)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func validateCancelRequest(req *pbs.CancelSessionRequest) error {
|
||||
badFields := map[string]string{}
|
||||
if !handlers.ValidId(session.SessionPrefix, req.GetId()) {
|
||||
|
||||
@@ -292,6 +292,151 @@ func TestList(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestListSelf(t *testing.T) {
|
||||
conn, _ := db.TestSetup(t, "postgres")
|
||||
wrap := db.TestWrapper(t)
|
||||
kms := kms.TestKms(t, conn, wrap)
|
||||
|
||||
iamRepo := iam.TestRepo(t, conn, wrap)
|
||||
|
||||
rw := db.New(conn)
|
||||
sessRepo, err := session.NewRepository(rw, rw, kms)
|
||||
require.NoError(t, err)
|
||||
|
||||
iamRepoFn := func() (*iam.Repository, error) {
|
||||
return iamRepo, nil
|
||||
}
|
||||
sessRepoFn := func() (*session.Repository, error) {
|
||||
return sessRepo, nil
|
||||
}
|
||||
|
||||
_, pNoSessions := iam.TestScopes(t, iamRepo)
|
||||
o, pWithSessions := iam.TestScopes(t, iamRepo)
|
||||
|
||||
at1 := authtoken.TestAuthToken(t, conn, kms, o.GetPublicId())
|
||||
hc := static.TestCatalogs(t, conn, pWithSessions.GetPublicId(), 1)[0]
|
||||
hs := static.TestSets(t, conn, hc.GetPublicId(), 1)[0]
|
||||
h := static.TestHosts(t, conn, hc.GetPublicId(), 1)[0]
|
||||
static.TestSetMembers(t, conn, hs.GetPublicId(), []*static.Host{h})
|
||||
tar := target.TestTcpTarget(t, conn, pWithSessions.GetPublicId(), "test", target.WithHostSets([]string{hs.GetPublicId()}))
|
||||
|
||||
var wantSession []*pb.Session
|
||||
for i := 0; i < 10; i++ {
|
||||
sess := session.TestSession(t, conn, wrap, session.ComposedOf{
|
||||
UserId: at1.GetIamUserId(),
|
||||
HostId: h.GetPublicId(),
|
||||
TargetId: tar.GetPublicId(),
|
||||
HostSetId: hs.GetPublicId(),
|
||||
AuthTokenId: at1.GetPublicId(),
|
||||
ScopeId: pWithSessions.GetPublicId(),
|
||||
Endpoint: "tcp://127.0.0.1:22",
|
||||
})
|
||||
|
||||
status, states := convertStates(sess.States)
|
||||
|
||||
wantSession = append(wantSession, &pb.Session{
|
||||
Id: sess.GetPublicId(),
|
||||
ScopeId: pWithSessions.GetPublicId(),
|
||||
AuthTokenId: sess.AuthTokenId,
|
||||
UserId: sess.UserId,
|
||||
TargetId: sess.TargetId,
|
||||
Endpoint: sess.Endpoint,
|
||||
HostSetId: sess.HostSetId,
|
||||
HostId: sess.HostId,
|
||||
Version: sess.Version,
|
||||
UpdatedTime: sess.UpdateTime.GetTimestamp(),
|
||||
CreatedTime: sess.CreateTime.GetTimestamp(),
|
||||
ExpirationTime: sess.ExpirationTime.GetTimestamp(),
|
||||
Scope: &scopes.ScopeInfo{Id: pWithSessions.GetPublicId(), Type: scope.Project.String()},
|
||||
Status: status,
|
||||
States: states,
|
||||
Certificate: sess.Certificate,
|
||||
Type: target.TcpSubType.String(),
|
||||
AuthorizedActions: []string{"read", "cancel"},
|
||||
})
|
||||
}
|
||||
|
||||
at2 := authtoken.TestAuthToken(t, conn, kms, o.GetPublicId())
|
||||
sess := session.TestSession(t, conn, wrap, session.ComposedOf{
|
||||
UserId: at2.GetIamUserId(),
|
||||
HostId: h.GetPublicId(),
|
||||
TargetId: tar.GetPublicId(),
|
||||
HostSetId: hs.GetPublicId(),
|
||||
AuthTokenId: at2.GetPublicId(),
|
||||
ScopeId: pWithSessions.GetPublicId(),
|
||||
Endpoint: "tcp://127.0.0.1:22",
|
||||
})
|
||||
status, states := convertStates(sess.States)
|
||||
wantSession2 := []*pb.Session{{
|
||||
Id: sess.GetPublicId(),
|
||||
ScopeId: pWithSessions.GetPublicId(),
|
||||
AuthTokenId: sess.AuthTokenId,
|
||||
UserId: sess.UserId,
|
||||
TargetId: sess.TargetId,
|
||||
Endpoint: sess.Endpoint,
|
||||
HostSetId: sess.HostSetId,
|
||||
HostId: sess.HostId,
|
||||
Version: sess.Version,
|
||||
UpdatedTime: sess.UpdateTime.GetTimestamp(),
|
||||
CreatedTime: sess.CreateTime.GetTimestamp(),
|
||||
ExpirationTime: sess.ExpirationTime.GetTimestamp(),
|
||||
Scope: &scopes.ScopeInfo{Id: pWithSessions.GetPublicId(), Type: scope.Project.String()},
|
||||
Status: status,
|
||||
States: states,
|
||||
Certificate: sess.Certificate,
|
||||
Type: target.TcpSubType.String(),
|
||||
AuthorizedActions: []string{"read", "cancel"},
|
||||
}}
|
||||
|
||||
cases := []struct {
|
||||
name string
|
||||
userId string
|
||||
req *pbs.ListSelfSessionsRequest
|
||||
res *pbs.ListSelfSessionsResponse
|
||||
err error
|
||||
}{
|
||||
{
|
||||
name: "List Many Sessions",
|
||||
userId: at1.GetIamUserId(),
|
||||
req: &pbs.ListSelfSessionsRequest{ScopeId: pWithSessions.GetPublicId()},
|
||||
res: &pbs.ListSelfSessionsResponse{Items: wantSession},
|
||||
},
|
||||
{
|
||||
name: "List 1 Session",
|
||||
userId: at2.GetIamUserId(),
|
||||
req: &pbs.ListSelfSessionsRequest{ScopeId: pWithSessions.GetPublicId()},
|
||||
res: &pbs.ListSelfSessionsResponse{Items: wantSession2},
|
||||
},
|
||||
{
|
||||
name: "List No Sessions",
|
||||
userId: at1.GetIamUserId(),
|
||||
req: &pbs.ListSelfSessionsRequest{ScopeId: pNoSessions.GetPublicId()},
|
||||
res: &pbs.ListSelfSessionsResponse{},
|
||||
},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
s, err := sessions.NewService(sessRepoFn, iamRepoFn)
|
||||
require.NoError(t, err, "Couldn't create new session service.")
|
||||
|
||||
got, gErr := s.ListSelfSessions(auth.DisabledAuthTestContext(auth.WithScopeId(tc.req.GetScopeId()), auth.WithUserId(tc.userId)), tc.req)
|
||||
if tc.err != nil {
|
||||
require.Error(t, gErr)
|
||||
assert.True(t, errors.Is(gErr, tc.err), "ListSelfSessions(%+v) got error %v, wanted %v", tc.req, gErr, tc.err)
|
||||
}
|
||||
require.NoError(t, gErr)
|
||||
if tc.res != nil {
|
||||
require.Len(t, got.GetItems(), len(tc.res.GetItems()))
|
||||
for i, wantSess := range tc.res.GetItems() {
|
||||
assert.True(t, got.GetItems()[i].GetExpirationTime().AsTime().Sub(wantSess.GetExpirationTime().AsTime()) < 10*time.Millisecond)
|
||||
wantSess.ExpirationTime = got.GetItems()[i].GetExpirationTime()
|
||||
}
|
||||
}
|
||||
assert.Empty(t, cmp.Diff(got, tc.res, protocmp.Transform()), "ListSessions(%q) got response %q, wanted %q", tc.req, got, tc.res)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func convertStates(in []*session.State) (string, []*pb.SessionState) {
|
||||
out := make([]*pb.SessionState, 0, len(in))
|
||||
for _, s := range in {
|
||||
|
||||
@@ -170,8 +170,7 @@ func (r *Repository) ListSessions(ctx context.Context, opt ...Option) ([]*Sessio
|
||||
var args []interface{}
|
||||
|
||||
inClauseCnt := 0
|
||||
switch {
|
||||
case len(opts.withScopeIds) != 0:
|
||||
if len(opts.withScopeIds) != 0 {
|
||||
switch len(opts.withScopeIds) {
|
||||
case 1:
|
||||
inClauseCnt += 1
|
||||
@@ -184,7 +183,8 @@ func (r *Repository) ListSessions(ctx context.Context, opt ...Option) ([]*Sessio
|
||||
}
|
||||
where = append(where, fmt.Sprintf("scope_id in (%s)", strings.Join(idsInClause, ",")))
|
||||
}
|
||||
case opts.withUserId != "":
|
||||
}
|
||||
if opts.withUserId != "" {
|
||||
inClauseCnt += 1
|
||||
where, args = append(where, fmt.Sprintf("user_id = $%d", inClauseCnt)), append(args, opts.withUserId)
|
||||
}
|
||||
@@ -213,7 +213,7 @@ func (r *Repository) ListSessions(ctx context.Context, opt ...Option) ([]*Sessio
|
||||
|
||||
var whereClause string
|
||||
if len(where) > 0 {
|
||||
whereClause = " and " + strings.Join(where, " and")
|
||||
whereClause = " and " + strings.Join(where, " and ")
|
||||
}
|
||||
q := sessionList
|
||||
query := fmt.Sprintf(q, limit, whereClause, opts.withOrder)
|
||||
|
||||
@@ -147,7 +147,30 @@ func TestRepository_ListSession(t *testing.T) {
|
||||
got, err := repo.ListSessions(context.Background(), WithUserId(s.UserId))
|
||||
require.NoError(err)
|
||||
assert.Equal(1, len(got))
|
||||
assert.Equal(got[0].UserId, s.UserId)
|
||||
assert.Equal(s.UserId, got[0].UserId)
|
||||
})
|
||||
t.Run("withUserIdAndwithScopeId", func(t *testing.T) {
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
require.NoError(conn.Where("1=1").Delete(AllocSession()).Error)
|
||||
wantCnt := 5
|
||||
for i := 0; i < wantCnt; i++ {
|
||||
// Scope 1 User 1
|
||||
_ = TestSession(t, conn, wrapper, composedOf)
|
||||
}
|
||||
// Scope 2 User 2
|
||||
s := TestDefaultSession(t, conn, wrapper, iamRepo)
|
||||
|
||||
// Scope 1 User 2
|
||||
coDiffUser := composedOf
|
||||
coDiffUser.AuthTokenId = s.AuthTokenId
|
||||
coDiffUser.UserId = s.UserId
|
||||
wantS := TestSession(t, conn, wrapper, coDiffUser)
|
||||
|
||||
got, err := repo.ListSessions(context.Background(), WithUserId(coDiffUser.UserId), WithScopeIds([]string{coDiffUser.ScopeId}))
|
||||
require.NoError(err)
|
||||
assert.Equal(1, len(got))
|
||||
assert.Equal(wantS.UserId, got[0].UserId)
|
||||
assert.Equal(wantS.ScopeId, got[0].ScopeId)
|
||||
})
|
||||
t.Run("WithSessionIds", func(t *testing.T) {
|
||||
assert, require := assert.New(t), require.New(t)
|
||||
|
||||
Reference in new issue
Block a user