diff --git a/agent/agentGrpc/agent.pb.go b/agent/agentGrpc/agent.pb.go index db9c9e2a..f749fcd4 100644 --- a/agent/agentGrpc/agent.pb.go +++ b/agent/agentGrpc/agent.pb.go @@ -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 ( diff --git a/agent/agentGrpc/agent.pb.gw.go b/agent/agentGrpc/agent.pb.gw.go index c4fa58b3..b8b234d6 100644 --- a/agent/agentGrpc/agent.pb.gw.go +++ b/agent/agentGrpc/agent.pb.gw.go @@ -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 diff --git a/agent/agentGrpc/agent.proto b/agent/agentGrpc/agent.proto index 2a4d0425..e03fa546 100644 --- a/agent/agentGrpc/agent.proto +++ b/agent/agentGrpc/agent.proto @@ -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" diff --git a/agent/agentGrpc/agent.swagger.json b/agent/agentGrpc/agent.swagger.json index 34d79678..c868d48b 100644 --- a/agent/agentGrpc/agent.swagger.json +++ b/agent/agentGrpc/agent.swagger.json @@ -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", diff --git a/agent/agentUi/src/AccessCard.jsx b/agent/agentUi/src/AccessCard.jsx index 150f5c0b..a531d96c 100644 --- a/agent/agentUi/src/AccessCard.jsx +++ b/agent/agentUi/src/AccessCard.jsx @@ -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 (
-

{props.access.frontendToken} []

+

{props.access.frontendToken} []

{props.access.token} → {props.access.bindAddress}

+

); } diff --git a/agent/agentUi/src/AgentUi.jsx b/agent/agentUi/src/AgentUi.jsx index 9fe88a01..05369415 100644 --- a/agent/agentUi/src/AgentUi.jsx +++ b/agent/agentUi/src/AgentUi.jsx @@ -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: + element: }, { 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 ( <> - + - +

Share...

-
+ public @@ -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 }} > proxy @@ -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 }} - > - - - + /> + +
+
+
+ + +

Access...

+
+ + +
- ); +); } export default AgentUi; \ No newline at end of file diff --git a/agent/agentUi/src/NavBar.jsx b/agent/agentUi/src/NavBar.jsx index 567c9433..1a1827f8 100644 --- a/agent/agentUi/src/NavBar.jsx +++ b/agent/agentUi/src/NavBar.jsx @@ -19,8 +19,8 @@ const NavBar = (props) => { zrok Agent { props.version !== "" ? " | " + props.version : ""} - - + + ) diff --git a/agent/agentUi/src/Overview.jsx b/agent/agentUi/src/Overview.jsx index 37cb1ba6..3031e39a 100644 --- a/agent/agentUi/src/Overview.jsx +++ b/agent/agentUi/src/Overview.jsx @@ -10,17 +10,17 @@ const Overview = (props) => { props.overview.forEach((row) => { switch(row.type) { case "share": - cards.push(); + cards.push(); break; case "access": - cards.push(); + cards.push(); break; } }); } else { cards.push(
-
Your zrok Agent is empty! Add a share or access share to get started.
+
Your zrok Agent is empty! Add a share or access share to get started.
); } diff --git a/agent/agentUi/src/api/README.md b/agent/agentUi/src/api/README.md index b9717bdc..25316a72 100644 --- a/agent/agentUi/src/api/README.md +++ b/agent/agentUi/src/api/README.md @@ -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 | diff --git a/agent/agentUi/src/api/docs/AgentApi.md b/agent/agentUi/src/api/docs/AgentApi.md index 3b2aa387..88d4b8a7 100644 --- a/agent/agentUi/src/api/docs/AgentApi.md +++ b/agent/agentUi/src/api/docs/AgentApi.md @@ -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) diff --git a/agent/agentUi/src/api/src/api/AgentApi.js b/agent/agentUi/src/api/src/api/AgentApi.js index aadb389a..31b1b9d8 100644 --- a/agent/agentUi/src/api/src/api/AgentApi.js +++ b/agent/agentUi/src/api/src/api/AgentApi.js @@ -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.} [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