From e3231070ede06ad4259adf5f07d0b12426b11d97 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Tue, 17 Sep 2024 12:24:40 -0400 Subject: [PATCH] cli bits for 'zrok agent share reserved' (#463) --- agent/agentGrpc/agent.pb.go | 329 ++++++++++++++++++++++--------- agent/agentGrpc/agent.proto | 10 + agent/agentGrpc/agent_grpc.pb.go | 38 ++++ cmd/zrok/agentShareReserved.go | 65 ++++++ 4 files changed, 348 insertions(+), 94 deletions(-) create mode 100644 cmd/zrok/agentShareReserved.go diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index 0b9edaac6..10cce2af6 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -671,6 +671,107 @@ func (*ReleaseShareReply) Descriptor() ([]byte, []int) { return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{10} } +type ReservedShareReply struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ReservedShareReply) Reset() { + *x = ReservedShareReply{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReservedShareReply) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReservedShareReply) ProtoMessage() {} + +func (x *ReservedShareReply) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + 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 ReservedShareReply.ProtoReflect.Descriptor instead. +func (*ReservedShareReply) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} +} + +type ReservedShareRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"` + OverrideEndpoint string `protobuf:"bytes,2,opt,name=overrideEndpoint,proto3" json:"overrideEndpoint,omitempty"` + Insecure bool `protobuf:"varint,3,opt,name=insecure,proto3" json:"insecure,omitempty"` +} + +func (x *ReservedShareRequest) Reset() { + *x = ReservedShareRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ReservedShareRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ReservedShareRequest) ProtoMessage() {} + +func (x *ReservedShareRequest) ProtoReflect() protoreflect.Message { + mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + 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 ReservedShareRequest.ProtoReflect.Descriptor instead. +func (*ReservedShareRequest) Descriptor() ([]byte, []int) { + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} +} + +func (x *ReservedShareRequest) GetToken() string { + if x != nil { + return x.Token + } + return "" +} + +func (x *ReservedShareRequest) GetOverrideEndpoint() string { + if x != nil { + return x.OverrideEndpoint + } + return "" +} + +func (x *ReservedShareRequest) GetInsecure() bool { + if x != nil { + return x.Insecure + } + return false +} + type ShareDetail struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -689,7 +790,7 @@ type ShareDetail struct { func (x *ShareDetail) Reset() { *x = ShareDetail{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -702,7 +803,7 @@ func (x *ShareDetail) String() string { func (*ShareDetail) ProtoMessage() {} func (x *ShareDetail) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[11] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -715,7 +816,7 @@ func (x *ShareDetail) ProtoReflect() protoreflect.Message { // Deprecated: Use ShareDetail.ProtoReflect.Descriptor instead. func (*ShareDetail) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{11} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} } func (x *ShareDetail) GetToken() string { @@ -783,7 +884,7 @@ type StatusRequest struct { func (x *StatusRequest) Reset() { *x = StatusRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -796,7 +897,7 @@ func (x *StatusRequest) String() string { func (*StatusRequest) ProtoMessage() {} func (x *StatusRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[12] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -809,7 +910,7 @@ func (x *StatusRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead. func (*StatusRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{12} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{14} } type StatusReply struct { @@ -824,7 +925,7 @@ type StatusReply struct { func (x *StatusReply) Reset() { *x = StatusReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -837,7 +938,7 @@ func (x *StatusReply) String() string { func (*StatusReply) ProtoMessage() {} func (x *StatusReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[13] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -850,7 +951,7 @@ func (x *StatusReply) ProtoReflect() protoreflect.Message { // Deprecated: Use StatusReply.ProtoReflect.Descriptor instead. func (*StatusReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{13} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{15} } func (x *StatusReply) GetAccesses() []*AccessDetail { @@ -876,7 +977,7 @@ type VersionRequest struct { func (x *VersionRequest) Reset() { *x = VersionRequest{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[16] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -889,7 +990,7 @@ func (x *VersionRequest) String() string { func (*VersionRequest) ProtoMessage() {} func (x *VersionRequest) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[14] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[16] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -902,7 +1003,7 @@ func (x *VersionRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionRequest.ProtoReflect.Descriptor instead. func (*VersionRequest) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{14} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{16} } type VersionReply struct { @@ -916,7 +1017,7 @@ type VersionReply struct { func (x *VersionReply) Reset() { *x = VersionReply{} if protoimpl.UnsafeEnabled { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[17] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -929,7 +1030,7 @@ func (x *VersionReply) String() string { func (*VersionReply) ProtoMessage() {} func (x *VersionReply) ProtoReflect() protoreflect.Message { - mi := &file_agent_agentGrpc_agent_proto_msgTypes[15] + mi := &file_agent_agentGrpc_agent_proto_msgTypes[17] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -942,7 +1043,7 @@ func (x *VersionReply) ProtoReflect() protoreflect.Message { // Deprecated: Use VersionReply.ProtoReflect.Descriptor instead. func (*VersionReply) Descriptor() ([]byte, []int) { - return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{15} + return file_agent_agentGrpc_agent_proto_rawDescGZIP(), []int{17} } func (x *VersionReply) GetV() string { @@ -1030,62 +1131,74 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{ 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x22, 0x13, 0x0a, 0x11, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, - 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, - 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, - 0x0a, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x73, 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, - 0x0a, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, - 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, - 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, - 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x22, 0x0f, 0x0a, 0x0d, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0x5e, 0x0a, 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, - 0x12, 0x29, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, - 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, - 0x73, 0x22, 0x10, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x22, 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x70, 0x6c, 0x79, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, - 0x76, 0x32, 0x8d, 0x03, 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, - 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, - 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, - 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, - 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x12, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, - 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, - 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, - 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, - 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x12, 0x15, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, - 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, - 0x0a, 0x0c, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, - 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, - 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, - 0x61, 0x74, 0x75, 0x73, 0x12, 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, - 0x6c, 0x79, 0x22, 0x00, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, - 0x0f, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x0d, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, - 0x00, 0x42, 0x2a, 0x5a, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, - 0x6f, 0x70, 0x65, 0x6e, 0x7a, 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, - 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x14, 0x0a, 0x12, 0x52, 0x65, 0x73, 0x65, + 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x74, + 0x0a, 0x14, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2a, 0x0a, 0x10, + 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x6f, 0x76, 0x65, 0x72, 0x72, 0x69, 0x64, 0x65, + 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x6e, 0x73, 0x65, + 0x63, 0x75, 0x72, 0x65, 0x22, 0x85, 0x02, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x73, + 0x68, 0x61, 0x72, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x62, 0x61, 0x63, 0x6b, + 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, + 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, + 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x2a, 0x0a, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, + 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, + 0x52, 0x10, 0x66, 0x72, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, + 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x62, 0x61, 0x63, 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x62, 0x61, 0x63, + 0x6b, 0x65, 0x6e, 0x64, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x63, 0x6c, 0x6f, 0x73, 0x65, 0x64, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x6c, + 0x6f, 0x73, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x0f, 0x0a, 0x0d, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x5e, 0x0a, + 0x0b, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x29, 0x0a, 0x08, + 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x08, 0x61, + 0x63, 0x63, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, + 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x22, 0x10, 0x0a, + 0x0e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, + 0x1c, 0x0a, 0x0c, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, + 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76, 0x32, 0xcc, 0x03, + 0x0a, 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x3d, 0x0a, 0x0d, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, + 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x13, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, + 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, + 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x12, 0x2e, 0x50, + 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, + 0x22, 0x00, 0x12, 0x37, 0x0a, 0x0b, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, + 0x65, 0x12, 0x13, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x53, + 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x15, 0x2e, 0x52, + 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, + 0x65, 0x73, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3a, 0x0a, 0x0c, 0x52, 0x65, + 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x14, 0x2e, 0x52, 0x65, 0x6c, + 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x12, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, + 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0d, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x15, 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, + 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, + 0x2e, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, + 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x28, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, + 0x0e, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x0c, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, + 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x0f, 0x2e, 0x56, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0d, 0x2e, 0x56, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a, 0x5a, 0x28, + 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6f, 0x70, 0x65, 0x6e, 0x7a, + 0x69, 0x74, 0x69, 0x2f, 0x7a, 0x72, 0x6f, 0x6b, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x47, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1100,7 +1213,7 @@ func file_agent_agentGrpc_agent_proto_rawDescGZIP() []byte { return file_agent_agentGrpc_agent_proto_rawDescData } -var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 16) +var file_agent_agentGrpc_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*AccessDetail)(nil), // 0: AccessDetail (*PrivateAccessReply)(nil), // 1: PrivateAccessReply @@ -1113,31 +1226,35 @@ var file_agent_agentGrpc_agent_proto_goTypes = []any{ (*ReleaseAccessReply)(nil), // 8: ReleaseAccessReply (*ReleaseShareRequest)(nil), // 9: ReleaseShareRequest (*ReleaseShareReply)(nil), // 10: ReleaseShareReply - (*ShareDetail)(nil), // 11: ShareDetail - (*StatusRequest)(nil), // 12: StatusRequest - (*StatusReply)(nil), // 13: StatusReply - (*VersionRequest)(nil), // 14: VersionRequest - (*VersionReply)(nil), // 15: VersionReply + (*ReservedShareReply)(nil), // 11: ReservedShareReply + (*ReservedShareRequest)(nil), // 12: ReservedShareRequest + (*ShareDetail)(nil), // 13: ShareDetail + (*StatusRequest)(nil), // 14: StatusRequest + (*StatusReply)(nil), // 15: StatusReply + (*VersionRequest)(nil), // 16: VersionRequest + (*VersionReply)(nil), // 17: VersionReply } var file_agent_agentGrpc_agent_proto_depIdxs = []int32{ 0, // 0: StatusReply.accesses:type_name -> AccessDetail - 11, // 1: StatusReply.shares:type_name -> ShareDetail + 13, // 1: StatusReply.shares:type_name -> ShareDetail 2, // 2: Agent.PrivateAccess:input_type -> PrivateAccessRequest 4, // 3: Agent.PrivateShare:input_type -> PrivateShareRequest 6, // 4: Agent.PublicShare:input_type -> PublicShareRequest 7, // 5: Agent.ReleaseAccess:input_type -> ReleaseAccessRequest 9, // 6: Agent.ReleaseShare:input_type -> ReleaseShareRequest - 12, // 7: Agent.Status:input_type -> StatusRequest - 14, // 8: Agent.Version:input_type -> VersionRequest - 1, // 9: Agent.PrivateAccess:output_type -> PrivateAccessReply - 3, // 10: Agent.PrivateShare:output_type -> PrivateShareReply - 5, // 11: Agent.PublicShare:output_type -> PublicShareReply - 8, // 12: Agent.ReleaseAccess:output_type -> ReleaseAccessReply - 10, // 13: Agent.ReleaseShare:output_type -> ReleaseShareReply - 13, // 14: Agent.Status:output_type -> StatusReply - 15, // 15: Agent.Version:output_type -> VersionReply - 9, // [9:16] is the sub-list for method output_type - 2, // [2:9] is the sub-list for method input_type + 12, // 7: Agent.ReservedShare:input_type -> ReservedShareRequest + 14, // 8: Agent.Status:input_type -> StatusRequest + 16, // 9: Agent.Version:input_type -> VersionRequest + 1, // 10: Agent.PrivateAccess:output_type -> PrivateAccessReply + 3, // 11: Agent.PrivateShare:output_type -> PrivateShareReply + 5, // 12: Agent.PublicShare:output_type -> PublicShareReply + 8, // 13: Agent.ReleaseAccess:output_type -> ReleaseAccessReply + 10, // 14: Agent.ReleaseShare:output_type -> ReleaseShareReply + 11, // 15: Agent.ReservedShare:output_type -> ReservedShareReply + 15, // 16: Agent.Status:output_type -> StatusReply + 17, // 17: Agent.Version:output_type -> VersionReply + 10, // [10:18] is the sub-list for method output_type + 2, // [2:10] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name 2, // [2:2] is the sub-list for extension extendee 0, // [0:2] is the sub-list for field type_name @@ -1282,7 +1399,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[11].Exporter = func(v any, i int) any { - switch v := v.(*ShareDetail); i { + switch v := v.(*ReservedShareReply); i { case 0: return &v.state case 1: @@ -1294,7 +1411,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[12].Exporter = func(v any, i int) any { - switch v := v.(*StatusRequest); i { + switch v := v.(*ReservedShareRequest); i { case 0: return &v.state case 1: @@ -1306,7 +1423,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[13].Exporter = func(v any, i int) any { - switch v := v.(*StatusReply); i { + switch v := v.(*ShareDetail); i { case 0: return &v.state case 1: @@ -1318,7 +1435,7 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[14].Exporter = func(v any, i int) any { - switch v := v.(*VersionRequest); i { + switch v := v.(*StatusRequest); i { case 0: return &v.state case 1: @@ -1330,6 +1447,30 @@ func file_agent_agentGrpc_agent_proto_init() { } } file_agent_agentGrpc_agent_proto_msgTypes[15].Exporter = func(v any, i int) any { + switch v := v.(*StatusReply); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[16].Exporter = func(v any, i int) any { + switch v := v.(*VersionRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_agent_agentGrpc_agent_proto_msgTypes[17].Exporter = func(v any, i int) any { switch v := v.(*VersionReply); i { case 0: return &v.state @@ -1348,7 +1489,7 @@ func file_agent_agentGrpc_agent_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_agent_agentGrpc_agent_proto_rawDesc, NumEnums: 0, - NumMessages: 16, + NumMessages: 18, NumExtensions: 0, NumServices: 1, }, diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index d45a7138f..4be28a2c7 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -8,6 +8,7 @@ service Agent { rpc PublicShare(PublicShareRequest) returns (PublicShareReply) {} rpc ReleaseAccess(ReleaseAccessRequest) returns (ReleaseAccessReply) {} rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareReply) {} + rpc ReservedShare(ReservedShareRequest) returns (ReservedShareReply) {} rpc Status(StatusRequest) returns (StatusReply) {} rpc Version(VersionRequest) returns (VersionReply) {} } @@ -73,6 +74,15 @@ message ReleaseShareRequest { message ReleaseShareReply { } +message ReservedShareReply { +} + +message ReservedShareRequest { + string token = 1; + string overrideEndpoint = 2; + bool insecure = 3; +} + message ShareDetail { string token = 1; string shareMode = 2; diff --git a/agent/agentGrpc/agent_grpc.pb.go b/agent/agentGrpc/agent_grpc.pb.go index 47fccc106..30db791f7 100644 --- a/agent/agentGrpc/agent_grpc.pb.go +++ b/agent/agentGrpc/agent_grpc.pb.go @@ -24,6 +24,7 @@ const ( Agent_PublicShare_FullMethodName = "/Agent/PublicShare" Agent_ReleaseAccess_FullMethodName = "/Agent/ReleaseAccess" Agent_ReleaseShare_FullMethodName = "/Agent/ReleaseShare" + Agent_ReservedShare_FullMethodName = "/Agent/ReservedShare" Agent_Status_FullMethodName = "/Agent/Status" Agent_Version_FullMethodName = "/Agent/Version" ) @@ -37,6 +38,7 @@ type AgentClient interface { PublicShare(ctx context.Context, in *PublicShareRequest, opts ...grpc.CallOption) (*PublicShareReply, error) ReleaseAccess(ctx context.Context, in *ReleaseAccessRequest, opts ...grpc.CallOption) (*ReleaseAccessReply, error) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, opts ...grpc.CallOption) (*ReleaseShareReply, error) + ReservedShare(ctx context.Context, in *ReservedShareRequest, opts ...grpc.CallOption) (*ReservedShareReply, error) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) Version(ctx context.Context, in *VersionRequest, opts ...grpc.CallOption) (*VersionReply, error) } @@ -99,6 +101,16 @@ func (c *agentClient) ReleaseShare(ctx context.Context, in *ReleaseShareRequest, return out, nil } +func (c *agentClient) ReservedShare(ctx context.Context, in *ReservedShareRequest, opts ...grpc.CallOption) (*ReservedShareReply, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(ReservedShareReply) + err := c.cc.Invoke(ctx, Agent_ReservedShare_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *agentClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusReply, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(StatusReply) @@ -128,6 +140,7 @@ type AgentServer interface { PublicShare(context.Context, *PublicShareRequest) (*PublicShareReply, error) ReleaseAccess(context.Context, *ReleaseAccessRequest) (*ReleaseAccessReply, error) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) + ReservedShare(context.Context, *ReservedShareRequest) (*ReservedShareReply, error) Status(context.Context, *StatusRequest) (*StatusReply, error) Version(context.Context, *VersionRequest) (*VersionReply, error) mustEmbedUnimplementedAgentServer() @@ -155,6 +168,9 @@ func (UnimplementedAgentServer) ReleaseAccess(context.Context, *ReleaseAccessReq func (UnimplementedAgentServer) ReleaseShare(context.Context, *ReleaseShareRequest) (*ReleaseShareReply, error) { return nil, status.Errorf(codes.Unimplemented, "method ReleaseShare not implemented") } +func (UnimplementedAgentServer) ReservedShare(context.Context, *ReservedShareRequest) (*ReservedShareReply, error) { + return nil, status.Errorf(codes.Unimplemented, "method ReservedShare not implemented") +} func (UnimplementedAgentServer) Status(context.Context, *StatusRequest) (*StatusReply, error) { return nil, status.Errorf(codes.Unimplemented, "method Status not implemented") } @@ -272,6 +288,24 @@ func _Agent_ReleaseShare_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Agent_ReservedShare_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ReservedShareRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(AgentServer).ReservedShare(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Agent_ReservedShare_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(AgentServer).ReservedShare(ctx, req.(*ReservedShareRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Agent_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(StatusRequest) if err := dec(in); err != nil { @@ -335,6 +369,10 @@ var Agent_ServiceDesc = grpc.ServiceDesc{ MethodName: "ReleaseShare", Handler: _Agent_ReleaseShare_Handler, }, + { + MethodName: "ReservedShare", + Handler: _Agent_ReservedShare_Handler, + }, { MethodName: "Status", Handler: _Agent_Status_Handler, diff --git a/cmd/zrok/agentShareReserved.go b/cmd/zrok/agentShareReserved.go new file mode 100644 index 000000000..c4276c56a --- /dev/null +++ b/cmd/zrok/agentShareReserved.go @@ -0,0 +1,65 @@ +package main + +import ( + "context" + "fmt" + "github.com/openziti/zrok/agent/agentClient" + "github.com/openziti/zrok/agent/agentGrpc" + "github.com/openziti/zrok/environment" + "github.com/openziti/zrok/tui" + "github.com/spf13/cobra" +) + +func init() { + agentShareCmd.AddCommand(newAgentShareReservedCommand().cmd) +} + +type agentShareReservedCommand struct { + overrideEndpoint string + insecure bool + cmd *cobra.Command +} + +func newAgentShareReservedCommand() *agentShareReservedCommand { + cmd := &cobra.Command{ + Use: "reserved ", + Short: "Share an existing reserved share in the zrok Agent", + Args: cobra.ExactArgs(1), + } + command := &agentShareReservedCommand{cmd: cmd} + cmd.Flags().StringVar(&command.overrideEndpoint, "override-endpoint", "", "Override the stored target endpoint with a replacement") + cmd.Flags().BoolVar(&command.insecure, "insecure", false, "Enable insecure TLS certificate validation") + cmd.Run = command.run + return command +} + +func (cmd *agentShareReservedCommand) run(_ *cobra.Command, args []string) { + root, err := environment.LoadRoot() + if err != nil { + if !panicInstead { + tui.Error("unable to load environment", err) + } + panic(err) + } + + if !root.IsEnabled() { + tui.Error("unable to load environment; did you 'zrok enable'?", nil) + } + + client, conn, err := agentClient.NewClient(root) + if err != nil { + tui.Error("error connecting to agent", err) + } + defer conn.Close() + + shr, err := client.ReservedShare(context.Background(), &agentGrpc.ReservedShareRequest{ + Token: args[0], + OverrideEndpoint: cmd.overrideEndpoint, + Insecure: cmd.insecure, + }) + if err != nil { + tui.Error("error sharing reserved share", err) + } + + fmt.Println(shr) +}