zrok office hours - zrok agent ui development (#221)

This commit is contained in:
Michael Quigley 2024-10-11 13:12:07 -04:00
parent c424190d96
commit a9abb8f01b
No known key found for this signature in database
GPG Key ID: 9B60314A9DD20A62
11 changed files with 588 additions and 72 deletions

View File

@ -1232,49 +1232,53 @@ var file_agent_agentGrpc_agent_proto_rawDesc = []byte{
0x73, 0x65, 0x12, 0x0c, 0x0a, 0x01, 0x76, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x01, 0x76,
0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f,
0x69, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x73, 0x6f,
0x6c, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x32, 0xee, 0x04, 0x0a, 0x05, 0x41,
0x67, 0x65, 0x6e, 0x74, 0x12, 0x40, 0x0a, 0x0d, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72,
0x6c, 0x65, 0x45, 0x6e, 0x64, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x32, 0xac, 0x05, 0x0a, 0x05, 0x41,
0x67, 0x65, 0x6e, 0x74, 0x12, 0x5f, 0x0a, 0x0d, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72,
0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x15, 0x2e, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72,
0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x41,
0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 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, 0x16,
0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 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, 0x15,
0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x22, 0x16, 0x2f,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x17, 0x2f, 0x76,
0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x50, 0x72,
0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x5f, 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, 0x16, 0x2e,
0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x22, 0x17, 0x2f,
0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65,
0x53, 0x68, 0x61, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65,
0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x12, 0x15, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65,
0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e,
0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x0c, 0x53, 0x68, 0x61, 0x72, 0x65,
0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x14, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50,
0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e,
0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x22, 0x16, 0x2f, 0x76,
0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69,
0x76, 0x61, 0x74, 0x65, 0x12, 0x57, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62,
0x6c, 0x69, 0x63, 0x12, 0x13, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65,
0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e,
0x74, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x43, 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, 0x0f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12,
0x12, 0x10, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x74, 0x61, 0x74,
0x75, 0x73, 0x12, 0x47, 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, 0x10,
0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67,
0x65, 0x6e, 0x74, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 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,
0x41, 0x63, 0x63, 0x65, 0x73, 0x73, 0x12, 0x5b, 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, 0x15, 0x2e, 0x52,
0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x22, 0x16, 0x2f, 0x76, 0x31,
0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x53, 0x68,
0x61, 0x72, 0x65, 0x12, 0x40, 0x0a, 0x0d, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65,
0x72, 0x76, 0x65, 0x64, 0x12, 0x15, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65,
0x72, 0x76, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x53, 0x68,
0x61, 0x72, 0x65, 0x52, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x0c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72,
0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x14, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69,
0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x53, 0x68,
0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x22, 0x1e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x18, 0x22, 0x16, 0x2f, 0x76, 0x31, 0x2f,
0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x50, 0x72, 0x69, 0x76, 0x61,
0x74, 0x65, 0x12, 0x57, 0x0a, 0x0b, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69,
0x63, 0x12, 0x13, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x53, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75,
0x62, 0x6c, 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1d, 0x82, 0xd3,
0xe4, 0x93, 0x02, 0x17, 0x22, 0x15, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f,
0x73, 0x68, 0x61, 0x72, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x43, 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, 0x0f, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x12, 0x10,
0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
0x12, 0x47, 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, 0x10, 0x2e, 0x56,
0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19,
0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x67, 0x65, 0x6e,
0x74, 0x2f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 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 (

View File

@ -31,6 +31,78 @@ var _ = runtime.String
var _ = utilities.NewDoubleArray
var _ = metadata.Join
var (
filter_Agent_AccessPrivate_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Agent_AccessPrivate_0(ctx context.Context, marshaler runtime.Marshaler, client AgentClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AccessPrivateRequest
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_Agent_AccessPrivate_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.AccessPrivate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Agent_AccessPrivate_0(ctx context.Context, marshaler runtime.Marshaler, server AgentServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq AccessPrivateRequest
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_Agent_AccessPrivate_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.AccessPrivate(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Agent_ReleaseAccess_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
func request_Agent_ReleaseAccess_0(ctx context.Context, marshaler runtime.Marshaler, client AgentClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ReleaseAccessRequest
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_Agent_ReleaseAccess_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := client.ReleaseAccess(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
return msg, metadata, err
}
func local_request_Agent_ReleaseAccess_0(ctx context.Context, marshaler runtime.Marshaler, server AgentServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ReleaseAccessRequest
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_Agent_ReleaseAccess_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
msg, err := server.ReleaseAccess(ctx, &protoReq)
return msg, metadata, err
}
var (
filter_Agent_ReleaseShare_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)
@ -181,6 +253,56 @@ func local_request_Agent_Version_0(ctx context.Context, marshaler runtime.Marsha
// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAgentHandlerFromEndpoint instead.
func RegisterAgentHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AgentServer) error {
mux.Handle("POST", pattern_Agent_AccessPrivate_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)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Agent/AccessPrivate", runtime.WithHTTPPathPattern("/v1/agent/accessPrivate"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Agent_AccessPrivate_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Agent_AccessPrivate_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Agent_ReleaseAccess_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)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/.Agent/ReleaseAccess", runtime.WithHTTPPathPattern("/v1/agent/releaseAccess"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := local_request_Agent_ReleaseAccess_0(annotatedContext, inboundMarshaler, server, req, pathParams)
md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer())
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Agent_ReleaseAccess_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Agent_ReleaseShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@ -347,6 +469,50 @@ func RegisterAgentHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc
// "AgentClient" to call the correct interceptors.
func RegisterAgentHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AgentClient) error {
mux.Handle("POST", pattern_Agent_AccessPrivate_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)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Agent/AccessPrivate", runtime.WithHTTPPathPattern("/v1/agent/accessPrivate"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Agent_AccessPrivate_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Agent_AccessPrivate_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Agent_ReleaseAccess_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)
var err error
var annotatedContext context.Context
annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/.Agent/ReleaseAccess", runtime.WithHTTPPathPattern("/v1/agent/releaseAccess"))
if err != nil {
runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err)
return
}
resp, md, err := request_Agent_ReleaseAccess_0(annotatedContext, inboundMarshaler, client, req, pathParams)
annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md)
if err != nil {
runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err)
return
}
forward_Agent_ReleaseAccess_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...)
})
mux.Handle("POST", pattern_Agent_ReleaseShare_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
ctx, cancel := context.WithCancel(req.Context())
defer cancel()
@ -461,6 +627,10 @@ func RegisterAgentHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie
}
var (
pattern_Agent_AccessPrivate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "agent", "accessPrivate"}, ""))
pattern_Agent_ReleaseAccess_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "agent", "releaseAccess"}, ""))
pattern_Agent_ReleaseShare_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "agent", "releaseShare"}, ""))
pattern_Agent_SharePrivate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v1", "agent", "sharePrivate"}, ""))
@ -473,6 +643,10 @@ var (
)
var (
forward_Agent_AccessPrivate_0 = runtime.ForwardResponseMessage
forward_Agent_ReleaseAccess_0 = runtime.ForwardResponseMessage
forward_Agent_ReleaseShare_0 = runtime.ForwardResponseMessage
forward_Agent_SharePrivate_0 = runtime.ForwardResponseMessage

View File

@ -5,8 +5,16 @@ option go_package = "github.com/openziti/zrok/agent/agentGrpc";
import "google/api/annotations.proto";
service Agent {
rpc AccessPrivate(AccessPrivateRequest) returns (AccessPrivateResponse) {}
rpc ReleaseAccess(ReleaseAccessRequest) returns (ReleaseAccessResponse) {}
rpc AccessPrivate(AccessPrivateRequest) returns (AccessPrivateResponse) {
option(google.api.http) = {
post: "/v1/agent/accessPrivate"
};
}
rpc ReleaseAccess(ReleaseAccessRequest) returns (ReleaseAccessResponse) {
option(google.api.http) = {
post: "/v1/agent/releaseAccess"
};
}
rpc ReleaseShare(ReleaseShareRequest) returns (ReleaseShareResponse) {
option(google.api.http) = {
post: "/v1/agent/releaseShare"

View File

@ -16,6 +16,82 @@
"application/json"
],
"paths": {
"/v1/agent/accessPrivate": {
"post": {
"operationId": "Agent_AccessPrivate",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/AccessPrivateResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "token",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "bindAddress",
"in": "query",
"required": false,
"type": "string"
},
{
"name": "responseHeaders",
"in": "query",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
}
],
"tags": [
"Agent"
]
}
},
"/v1/agent/releaseAccess": {
"post": {
"operationId": "Agent_ReleaseAccess",
"responses": {
"200": {
"description": "A successful response.",
"schema": {
"$ref": "#/definitions/ReleaseAccessResponse"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/rpcStatus"
}
}
},
"parameters": [
{
"name": "frontendToken",
"in": "query",
"required": false,
"type": "string"
}
],
"tags": [
"Agent"
]
}
},
"/v1/agent/releaseShare": {
"post": {
"operationId": "Agent_ReleaseShare",

View File

@ -1,12 +1,18 @@
import LanIcon from "@mui/icons-material/Lan";
import DeleteIcon from "@mui/icons-material/Delete";
const AccessCard = (props) => {
const releaseClicked = () => {
props.releaseAccess({frontendToken: props.access.frontendToken}, (err, data) => { console.log("releaseClicked", data); });
}
return (
<div className={"card"}>
<h2>{props.access.frontendToken} [<LanIcon />]</h2>
<h2>{props.access.frontendToken} [<LanIcon/>]</h2>
<p>
{props.access.token} &rarr; {props.access.bindAddress}
</p>
<p><DeleteIcon onClick={releaseClicked}/></p>
</div>
);
}

View File

@ -12,6 +12,7 @@ const AgentUi = () => {
const [version, setVersion] = useState("");
const [overview, setOverview] = useState(new Map());
const [newShare, setNewShare] = useState(false);
const [newAccess, setNewAccess] = useState(false);
let api = new AgentApi(new ApiClient(window.location.protocol+'//'+window.location.host));
const openNewShare = () => {
@ -20,7 +21,13 @@ const AgentUi = () => {
const closeNewShare = () => {
setNewShare(false);
}
const shareStyle = {
const openNewAccess = () => {
setNewAccess(true);
}
const closeNewAccess = () => {
setNewAccess(false);
}
const modalStyle = {
position: 'absolute',
top: '25%',
left: '50%',
@ -58,13 +65,27 @@ const AgentUi = () => {
const releaseShare = (opts) => {
api.agentReleaseShare(opts, (err, data) => {
console.log(data);
})
});
}
const releaseAccess = (opts) => {
console.log("opts", opts);
api.agentReleaseAccess(opts, (err, data) => {
console.log(data);
});
}
const router = createBrowserRouter([
{
path: "/",
element: <Overview releaseShare={releaseShare} version={version} overview={overview} shareClick={openNewShare} />
element: <Overview
releaseShare={releaseShare}
releaseAccess={releaseAccess}
version={version}
overview={overview}
shareClick={openNewShare}
accessClick={openNewAccess}
/>
},
{
path: "/share/:token",
@ -94,7 +115,16 @@ const AgentUi = () => {
}
}
const formik = useFormik({
const accessHandler = (values) => {
api.agentAccessPrivate({
token: values.token,
bindAddress: values.bindAddress,
}, (err, data) => {
closeNewAccess();
});
}
const newShareForm = useFormik({
initialValues: {
shareMode: "public",
backendMode: "proxy",
@ -103,26 +133,34 @@ const AgentUi = () => {
onSubmit: shareHandler,
});
const newAccessForm = useFormik({
initialValues: {
token: "",
bindAddress: "",
},
onSubmit: accessHandler,
})
return (
<>
<NavBar version={version} shareClick={openNewShare} />
<NavBar version={version} shareClick={openNewShare} accessClick={openNewAccess} />
<RouterProvider router={router} />
<Modal
open={newShare}
onClose={closeNewShare}
>
<Box sx={{ ...shareStyle }}>
<Box sx={{ ...modalStyle }}>
<h2>Share...</h2>
<form onSubmit={formik.handleSubmit}>
<form onSubmit={newShareForm.handleSubmit}>
<TextField
fullWidth
select
id="shareMode"
name="shareMode"
label="Share Mode"
value={formik.values.shareMode}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
value={newShareForm.values.shareMode}
onChange={newShareForm.handleChange}
onBlur={newShareForm.handleBlur}
sx={{ mt: 2 }}
>
<MenuItem value="public">public</MenuItem>
@ -133,9 +171,9 @@ const AgentUi = () => {
id="backendMode"
name="backendMode"
label="Backend Mode"
value={formik.values.backendMode}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
value={newShareForm.values.backendMode}
onChange={newShareForm.handleChange}
onBlur={newShareForm.handleBlur}
sx={{ mt: 2 }}
>
<MenuItem value="proxy">proxy</MenuItem>
@ -146,21 +184,48 @@ const AgentUi = () => {
id="target"
name="target"
label="Target"
value={formik.values.target}
onChange={formik.handleChange}
onBlur={formik.handleBlur}
value={newShareForm.values.target}
onChange={newShareForm.handleChange}
onBlur={newShareForm.handleBlur}
sx={{ mt: 2 }}
>
</TextField>
<Button color="primary" variant="contained" type="submit" sx={{ mt: 2 }}>
Create Share
</Button>
/>
<Button color="primary" variant="contained" type="submit" sx={{ mt: 2 }}>Create Share</Button>
</form>
</Box>
</Modal>
<Modal
open={newAccess}
onClose={closeNewAccess}
>
<Box sx={{...modalStyle}}>
<h2>Access...</h2>
<form onSubmit={newAccessForm.handleSubmit}>
<TextField
fullWidth
id="token"
name="token"
label="Share Token"
value={newAccessForm.values.token}
onChange={newAccessForm.handleChange}
onBlur={newAccessForm.handleBlur}
sx={{ mt: 2 }}
/>
<TextField
fullWidth
id="bindAddress"
name="bindAddress"
label="Bind Address"
value={newAccessForm.values.bindAddress}
onChange={newAccessForm.handleChange}
onBlur={newAccessForm.handleBlur}
sx={{ mt: 2 }}
/>
<Button color="primary" variant="contained" type="submit" sx={{ mt: 2 }}>Create Access</Button>
</form>
</Box>
</Modal>
</>
);
);
}
export default AgentUi;

View File

@ -19,8 +19,8 @@ const NavBar = (props) => {
<Typography variant="p" component={"div"} sx={{flexGrow: 1}}>
zrok Agent { props.version !== "" ? " | " + props.version : ""}
</Typography>
<Button color="inherit" onClick={props.shareClick}><LanIcon /></Button>
<Button color="inherit"><ShareIcon /></Button>
<Button color="inherit" onClick={props.shareClick}><ShareIcon /></Button>
<Button color="inherit" onClick={props.accessClick}><LanIcon /></Button>
</Toolbar>
</AppBar>
)

View File

@ -10,17 +10,17 @@ const Overview = (props) => {
props.overview.forEach((row) => {
switch(row.type) {
case "share":
cards.push(<ShareCard releaseShare={props.releaseShare} share={row.v} />);
cards.push(<ShareCard releaseShare={props.releaseShare} share={row.v} key={row.v.token} />);
break;
case "access":
cards.push(<AccessCard access={row.v} />);
cards.push(<AccessCard releaseAccess={props.releaseAccess} access={row.v} key={row.v.frontendToken} />);
break;
}
});
} else {
cards.push(<div key="help" className={"card"}>
<h5>Your zrok Agent is empty! Add a <a href="#" onClick={props.shareClick}>share <ShareIcon /></a> or <a href={"#"}>access <LanIcon /></a> share to get started.</h5>
<h5>Your zrok Agent is empty! Add a <a href="#" onClick={props.shareClick}>share <ShareIcon /></a> or <a href={"#"} onClick={props.accessClick}>access <LanIcon /></a> share to get started.</h5>
</div>);
}

View File

@ -104,7 +104,9 @@ var AgentAgentGrpcAgentProto = require('agent_agent_grpc_agent_proto');
var api = new AgentAgentGrpcAgentProto.AgentApi()
var opts = {
'token': "token_example" // {String}
'token': "token_example", // {String}
'bindAddress': "bindAddress_example", // {String}
'responseHeaders': ["null"] // {[String]}
};
var callback = function(error, data, response) {
if (error) {
@ -113,7 +115,7 @@ var callback = function(error, data, response) {
console.log('API called successfully. Returned data: ' + data);
}
};
api.agentReleaseShare(opts, callback);
api.agentAccessPrivate(opts, callback);
```
@ -123,6 +125,8 @@ All URIs are relative to *http://localhost*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AgentAgentGrpcAgentProto.AgentApi* | [**agentAccessPrivate**](docs/AgentApi.md#agentAccessPrivate) | **POST** /v1/agent/accessPrivate |
*AgentAgentGrpcAgentProto.AgentApi* | [**agentReleaseAccess**](docs/AgentApi.md#agentReleaseAccess) | **POST** /v1/agent/releaseAccess |
*AgentAgentGrpcAgentProto.AgentApi* | [**agentReleaseShare**](docs/AgentApi.md#agentReleaseShare) | **POST** /v1/agent/releaseShare |
*AgentAgentGrpcAgentProto.AgentApi* | [**agentSharePrivate**](docs/AgentApi.md#agentSharePrivate) | **POST** /v1/agent/sharePrivate |
*AgentAgentGrpcAgentProto.AgentApi* | [**agentSharePublic**](docs/AgentApi.md#agentSharePublic) | **POST** /v1/agent/sharePublic |

View File

@ -4,6 +4,8 @@ All URIs are relative to *http://localhost*
Method | HTTP request | Description
------------- | ------------- | -------------
[**agentAccessPrivate**](AgentApi.md#agentAccessPrivate) | **POST** /v1/agent/accessPrivate |
[**agentReleaseAccess**](AgentApi.md#agentReleaseAccess) | **POST** /v1/agent/releaseAccess |
[**agentReleaseShare**](AgentApi.md#agentReleaseShare) | **POST** /v1/agent/releaseShare |
[**agentSharePrivate**](AgentApi.md#agentSharePrivate) | **POST** /v1/agent/sharePrivate |
[**agentSharePublic**](AgentApi.md#agentSharePublic) | **POST** /v1/agent/sharePublic |
@ -12,6 +14,100 @@ Method | HTTP request | Description
## agentAccessPrivate
> AccessPrivateResponse agentAccessPrivate(opts)
### Example
```javascript
import AgentAgentGrpcAgentProto from 'agent_agent_grpc_agent_proto';
let apiInstance = new AgentAgentGrpcAgentProto.AgentApi();
let opts = {
'token': "token_example", // String |
'bindAddress': "bindAddress_example", // String |
'responseHeaders': ["null"] // [String] |
};
apiInstance.agentAccessPrivate(opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**token** | **String**| | [optional]
**bindAddress** | **String**| | [optional]
**responseHeaders** | [**[String]**](String.md)| | [optional]
### Return type
[**AccessPrivateResponse**](AccessPrivateResponse.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## agentReleaseAccess
> Object agentReleaseAccess(opts)
### Example
```javascript
import AgentAgentGrpcAgentProto from 'agent_agent_grpc_agent_proto';
let apiInstance = new AgentAgentGrpcAgentProto.AgentApi();
let opts = {
'frontendToken': "frontendToken_example" // String |
};
apiInstance.agentReleaseAccess(opts, (error, data, response) => {
if (error) {
console.error(error);
} else {
console.log('API called successfully. Returned data: ' + data);
}
});
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**frontendToken** | **String**| | [optional]
### Return type
**Object**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
## agentReleaseShare
> Object agentReleaseShare(opts)

View File

@ -13,6 +13,7 @@
import ApiClient from "../ApiClient";
import AccessPrivateResponse from '../model/AccessPrivateResponse';
import RpcStatus from '../model/RpcStatus';
import SharePrivateResponse from '../model/SharePrivateResponse';
import SharePublicResponse from '../model/SharePublicResponse';
@ -38,6 +39,88 @@ export default class AgentApi {
}
/**
* Callback function to receive the result of the agentAccessPrivate operation.
* @callback module:api/AgentApi~agentAccessPrivateCallback
* @param {String} error Error message, if any.
* @param {module:model/AccessPrivateResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* @param {Object} opts Optional parameters
* @param {String} [token]
* @param {String} [bindAddress]
* @param {Array.<String>} [responseHeaders]
* @param {module:api/AgentApi~agentAccessPrivateCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/AccessPrivateResponse}
*/
agentAccessPrivate(opts, callback) {
opts = opts || {};
let postBody = null;
let pathParams = {
};
let queryParams = {
'token': opts['token'],
'bindAddress': opts['bindAddress'],
'responseHeaders': this.apiClient.buildCollectionParam(opts['responseHeaders'], 'multi')
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = AccessPrivateResponse;
return this.apiClient.callApi(
'/v1/agent/accessPrivate', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
/**
* Callback function to receive the result of the agentReleaseAccess operation.
* @callback module:api/AgentApi~agentReleaseAccessCallback
* @param {String} error Error message, if any.
* @param {Object} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* @param {Object} opts Optional parameters
* @param {String} [frontendToken]
* @param {module:api/AgentApi~agentReleaseAccessCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link Object}
*/
agentReleaseAccess(opts, callback) {
opts = opts || {};
let postBody = null;
let pathParams = {
};
let queryParams = {
'frontendToken': opts['frontendToken']
};
let headerParams = {
};
let formParams = {
};
let authNames = [];
let contentTypes = [];
let accepts = ['application/json'];
let returnType = Object;
return this.apiClient.callApi(
'/v1/agent/releaseAccess', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
authNames, contentTypes, accepts, returnType, null, callback
);
}
/**
* Callback function to receive the result of the agentReleaseShare operation.
* @callback module:api/AgentApi~agentReleaseShareCallback