diff --git a/tavern/internal/builder/builderpb/builder.pb.go b/tavern/internal/builder/builderpb/builder.pb.go index df0609620..dd2041ff8 100644 --- a/tavern/internal/builder/builderpb/builder.pb.go +++ b/tavern/internal/builder/builderpb/builder.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 +// protoc-gen-go v1.36.11 // protoc v3.21.12 // source: builder.proto @@ -651,110 +651,58 @@ func (x *UploadBuildArtifactResponse) GetAssetId() int64 { var File_builder_proto protoreflect.FileDescriptor -var file_builder_proto_rawDesc = string([]byte{ - 0x0a, 0x0d, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x07, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x22, 0x42, 0x0a, 0x04, 0x54, 0x6f, 0x6d, 0x65, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x47, 0x0a, 0x13, - 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x6f, 0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, - 0x74, 0x6f, 0x6d, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, - 0x6f, 0x6d, 0x65, 0x49, 0x64, 0x22, 0x40, 0x0a, 0x14, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, - 0x64, 0x54, 0x6f, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0x18, 0x0a, 0x16, 0x43, 0x6c, 0x61, 0x69, 0x6d, - 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x22, 0xd5, 0x02, 0x0a, 0x0d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x53, - 0x70, 0x65, 0x63, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, - 0x02, 0x69, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x5f, 0x6f, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x4f, 0x73, - 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x69, 0x6d, 0x61, 0x67, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x49, 0x6d, 0x61, 0x67, - 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x53, 0x63, - 0x72, 0x69, 0x70, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, - 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x61, 0x72, 0x74, - 0x69, 0x66, 0x61, 0x63, 0x74, 0x50, 0x61, 0x74, 0x68, 0x12, 0x28, 0x0a, 0x10, 0x70, 0x72, 0x65, - 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x72, 0x65, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x53, 0x63, 0x72, - 0x69, 0x70, 0x74, 0x12, 0x2a, 0x0a, 0x11, 0x70, 0x6f, 0x73, 0x74, 0x5f, 0x62, 0x75, 0x69, 0x6c, - 0x64, 0x5f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, - 0x70, 0x6f, 0x73, 0x74, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x12, - 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x03, 0x65, 0x6e, - 0x76, 0x12, 0x23, 0x0a, 0x05, 0x74, 0x6f, 0x6d, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x0d, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x54, 0x6f, 0x6d, 0x65, 0x52, - 0x05, 0x74, 0x6f, 0x6d, 0x65, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x74, 0x75, 0x70, 0x5f, - 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, - 0x74, 0x75, 0x70, 0x53, 0x63, 0x72, 0x69, 0x70, 0x74, 0x22, 0x47, 0x0a, 0x17, 0x43, 0x6c, 0x61, - 0x69, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2c, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x01, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x42, 0x75, - 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x70, 0x65, 0x63, 0x52, 0x05, 0x74, 0x61, 0x73, - 0x6b, 0x73, 0x22, 0x9e, 0x01, 0x0a, 0x1c, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x69, - 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, - 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, - 0x74, 0x70, 0x75, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, - 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x66, 0x69, - 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x63, - 0x6f, 0x64, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x65, 0x78, 0x69, 0x74, 0x43, - 0x6f, 0x64, 0x65, 0x22, 0x1f, 0x0a, 0x1d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x69, - 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x70, 0x0a, 0x1a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x75, - 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x61, - 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0c, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, - 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0x38, 0x0a, 0x1b, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, - 0x42, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x61, 0x73, 0x73, 0x65, 0x74, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x61, 0x73, 0x73, 0x65, 0x74, 0x49, 0x64, - 0x2a, 0x81, 0x01, 0x0a, 0x0c, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x46, 0x6f, 0x72, 0x6d, 0x61, - 0x74, 0x12, 0x1d, 0x0a, 0x19, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x4d, - 0x41, 0x54, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x15, 0x0a, 0x11, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, - 0x54, 0x5f, 0x42, 0x49, 0x4e, 0x10, 0x01, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x41, 0x52, 0x47, 0x45, - 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x4d, 0x41, 0x54, 0x5f, 0x43, 0x44, 0x59, 0x4c, 0x49, 0x42, 0x10, - 0x02, 0x12, 0x21, 0x0a, 0x1d, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x46, 0x4f, 0x52, 0x4d, - 0x41, 0x54, 0x5f, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x49, - 0x43, 0x45, 0x10, 0x03, 0x32, 0x84, 0x03, 0x0a, 0x07, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, - 0x12, 0x56, 0x0a, 0x0f, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, - 0x73, 0x6b, 0x73, 0x12, 0x1f, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x43, 0x6c, - 0x61, 0x69, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6a, 0x0a, 0x15, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x12, 0x25, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, - 0x65, 0x72, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x54, 0x61, - 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x00, 0x28, 0x01, 0x12, 0x64, 0x0a, 0x13, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x75, - 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x23, 0x2e, 0x62, 0x75, - 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x75, 0x69, 0x6c, - 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x24, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, - 0x64, 0x42, 0x75, 0x69, 0x6c, 0x64, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x12, 0x4f, 0x0a, 0x0c, 0x44, 0x6f, - 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x6f, 0x6d, 0x65, 0x12, 0x1c, 0x2e, 0x62, 0x75, 0x69, - 0x6c, 0x64, 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x6f, 0x6d, - 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x62, 0x75, 0x69, 0x6c, 0x64, - 0x65, 0x72, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x6f, 0x6d, 0x65, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, 0x2d, 0x5a, 0x2b, 0x72, - 0x65, 0x61, 0x6c, 0x6d, 0x2e, 0x70, 0x75, 0x62, 0x2f, 0x74, 0x61, 0x76, 0x65, 0x72, 0x6e, 0x2f, - 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, - 0x2f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x65, 0x72, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -}) +const file_builder_proto_rawDesc = "" + + "\n" + + "\rbuilder.proto\x12\abuilder\"B\n" + + "\x04Tome\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12\x16\n" + + "\x06params\x18\x03 \x01(\tR\x06params\"G\n" + + "\x13DownloadTomeRequest\x12\x17\n" + + "\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x17\n" + + "\atome_id\x18\x02 \x01(\x03R\x06tomeId\"@\n" + + "\x14DownloadTomeResponse\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\x12\x14\n" + + "\x05chunk\x18\x02 \x01(\fR\x05chunk\"\x18\n" + + "\x16ClaimBuildTasksRequest\"\xd5\x02\n" + + "\rBuildTaskSpec\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x1b\n" + + "\ttarget_os\x18\x02 \x01(\tR\btargetOs\x12\x1f\n" + + "\vbuild_image\x18\x03 \x01(\tR\n" + + "buildImage\x12!\n" + + "\fbuild_script\x18\x04 \x01(\tR\vbuildScript\x12#\n" + + "\rartifact_path\x18\x06 \x01(\tR\fartifactPath\x12(\n" + + "\x10pre_build_script\x18\a \x01(\tR\x0epreBuildScript\x12*\n" + + "\x11post_build_script\x18\b \x01(\tR\x0fpostBuildScript\x12\x10\n" + + "\x03env\x18\t \x03(\tR\x03env\x12#\n" + + "\x05tomes\x18\n" + + " \x03(\v2\r.builder.TomeR\x05tomes\x12!\n" + + "\fsetup_script\x18\v \x01(\tR\vsetupScript\"G\n" + + "\x17ClaimBuildTasksResponse\x12,\n" + + "\x05tasks\x18\x01 \x03(\v2\x16.builder.BuildTaskSpecR\x05tasks\"\x9e\x01\n" + + "\x1cStreamBuildTaskOutputRequest\x12\x17\n" + + "\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x16\n" + + "\x06output\x18\x02 \x01(\tR\x06output\x12\x14\n" + + "\x05error\x18\x03 \x01(\tR\x05error\x12\x1a\n" + + "\bfinished\x18\x04 \x01(\bR\bfinished\x12\x1b\n" + + "\texit_code\x18\x05 \x01(\x03R\bexitCode\"\x1f\n" + + "\x1dStreamBuildTaskOutputResponse\"p\n" + + "\x1aUploadBuildArtifactRequest\x12\x17\n" + + "\atask_id\x18\x01 \x01(\x03R\x06taskId\x12#\n" + + "\rartifact_name\x18\x02 \x01(\tR\fartifactName\x12\x14\n" + + "\x05chunk\x18\x03 \x01(\fR\x05chunk\"8\n" + + "\x1bUploadBuildArtifactResponse\x12\x19\n" + + "\basset_id\x18\x01 \x01(\x03R\aassetId*\x81\x01\n" + + "\fTargetFormat\x12\x1d\n" + + "\x19TARGET_FORMAT_UNSPECIFIED\x10\x00\x12\x15\n" + + "\x11TARGET_FORMAT_BIN\x10\x01\x12\x18\n" + + "\x14TARGET_FORMAT_CDYLIB\x10\x02\x12!\n" + + "\x1dTARGET_FORMAT_WINDOWS_SERVICE\x10\x032\x84\x03\n" + + "\aBuilder\x12V\n" + + "\x0fClaimBuildTasks\x12\x1f.builder.ClaimBuildTasksRequest\x1a .builder.ClaimBuildTasksResponse\"\x00\x12j\n" + + "\x15StreamBuildTaskOutput\x12%.builder.StreamBuildTaskOutputRequest\x1a&.builder.StreamBuildTaskOutputResponse\"\x00(\x01\x12d\n" + + "\x13UploadBuildArtifact\x12#.builder.UploadBuildArtifactRequest\x1a$.builder.UploadBuildArtifactResponse\"\x00(\x01\x12O\n" + + "\fDownloadTome\x12\x1c.builder.DownloadTomeRequest\x1a\x1d.builder.DownloadTomeResponse\"\x000\x01B-Z+realm.pub/tavern/internal/builder/builderpbb\x06proto3" var ( file_builder_proto_rawDescOnce sync.Once diff --git a/tavern/internal/builder/builderpb/builder_grpc.pb.go b/tavern/internal/builder/builderpb/builder_grpc.pb.go index 795053e8f..024279a80 100644 --- a/tavern/internal/builder/builderpb/builder_grpc.pb.go +++ b/tavern/internal/builder/builderpb/builder_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.6.1 // - protoc v3.21.12 // source: builder.proto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Builder_ClaimBuildTasks_FullMethodName = "/builder.Builder/ClaimBuildTasks" @@ -30,9 +30,9 @@ const ( // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type BuilderClient interface { ClaimBuildTasks(ctx context.Context, in *ClaimBuildTasksRequest, opts ...grpc.CallOption) (*ClaimBuildTasksResponse, error) - StreamBuildTaskOutput(ctx context.Context, opts ...grpc.CallOption) (Builder_StreamBuildTaskOutputClient, error) - UploadBuildArtifact(ctx context.Context, opts ...grpc.CallOption) (Builder_UploadBuildArtifactClient, error) - DownloadTome(ctx context.Context, in *DownloadTomeRequest, opts ...grpc.CallOption) (Builder_DownloadTomeClient, error) + StreamBuildTaskOutput(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[StreamBuildTaskOutputRequest, StreamBuildTaskOutputResponse], error) + UploadBuildArtifact(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[UploadBuildArtifactRequest, UploadBuildArtifactResponse], error) + DownloadTome(ctx context.Context, in *DownloadTomeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DownloadTomeResponse], error) } type builderClient struct { @@ -53,83 +53,39 @@ func (c *builderClient) ClaimBuildTasks(ctx context.Context, in *ClaimBuildTasks return out, nil } -func (c *builderClient) StreamBuildTaskOutput(ctx context.Context, opts ...grpc.CallOption) (Builder_StreamBuildTaskOutputClient, error) { +func (c *builderClient) StreamBuildTaskOutput(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[StreamBuildTaskOutputRequest, StreamBuildTaskOutputResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Builder_ServiceDesc.Streams[0], Builder_StreamBuildTaskOutput_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &builderStreamBuildTaskOutputClient{ClientStream: stream} + x := &grpc.GenericClientStream[StreamBuildTaskOutputRequest, StreamBuildTaskOutputResponse]{ClientStream: stream} return x, nil } -type Builder_StreamBuildTaskOutputClient interface { - Send(*StreamBuildTaskOutputRequest) error - CloseAndRecv() (*StreamBuildTaskOutputResponse, error) - grpc.ClientStream -} - -type builderStreamBuildTaskOutputClient struct { - grpc.ClientStream -} - -func (x *builderStreamBuildTaskOutputClient) Send(m *StreamBuildTaskOutputRequest) error { - return x.ClientStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Builder_StreamBuildTaskOutputClient = grpc.ClientStreamingClient[StreamBuildTaskOutputRequest, StreamBuildTaskOutputResponse] -func (x *builderStreamBuildTaskOutputClient) CloseAndRecv() (*StreamBuildTaskOutputResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(StreamBuildTaskOutputResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *builderClient) UploadBuildArtifact(ctx context.Context, opts ...grpc.CallOption) (Builder_UploadBuildArtifactClient, error) { +func (c *builderClient) UploadBuildArtifact(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[UploadBuildArtifactRequest, UploadBuildArtifactResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Builder_ServiceDesc.Streams[1], Builder_UploadBuildArtifact_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &builderUploadBuildArtifactClient{ClientStream: stream} + x := &grpc.GenericClientStream[UploadBuildArtifactRequest, UploadBuildArtifactResponse]{ClientStream: stream} return x, nil } -type Builder_UploadBuildArtifactClient interface { - Send(*UploadBuildArtifactRequest) error - CloseAndRecv() (*UploadBuildArtifactResponse, error) - grpc.ClientStream -} - -type builderUploadBuildArtifactClient struct { - grpc.ClientStream -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Builder_UploadBuildArtifactClient = grpc.ClientStreamingClient[UploadBuildArtifactRequest, UploadBuildArtifactResponse] -func (x *builderUploadBuildArtifactClient) Send(m *UploadBuildArtifactRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *builderUploadBuildArtifactClient) CloseAndRecv() (*UploadBuildArtifactResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(UploadBuildArtifactResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *builderClient) DownloadTome(ctx context.Context, in *DownloadTomeRequest, opts ...grpc.CallOption) (Builder_DownloadTomeClient, error) { +func (c *builderClient) DownloadTome(ctx context.Context, in *DownloadTomeRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[DownloadTomeResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Builder_ServiceDesc.Streams[2], Builder_DownloadTome_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &builderDownloadTomeClient{ClientStream: stream} + x := &grpc.GenericClientStream[DownloadTomeRequest, DownloadTomeResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -139,51 +95,41 @@ func (c *builderClient) DownloadTome(ctx context.Context, in *DownloadTomeReques return x, nil } -type Builder_DownloadTomeClient interface { - Recv() (*DownloadTomeResponse, error) - grpc.ClientStream -} - -type builderDownloadTomeClient struct { - grpc.ClientStream -} - -func (x *builderDownloadTomeClient) Recv() (*DownloadTomeResponse, error) { - m := new(DownloadTomeResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Builder_DownloadTomeClient = grpc.ServerStreamingClient[DownloadTomeResponse] // BuilderServer is the server API for Builder service. // All implementations must embed UnimplementedBuilderServer -// for forward compatibility +// for forward compatibility. type BuilderServer interface { ClaimBuildTasks(context.Context, *ClaimBuildTasksRequest) (*ClaimBuildTasksResponse, error) - StreamBuildTaskOutput(Builder_StreamBuildTaskOutputServer) error - UploadBuildArtifact(Builder_UploadBuildArtifactServer) error - DownloadTome(*DownloadTomeRequest, Builder_DownloadTomeServer) error + StreamBuildTaskOutput(grpc.ClientStreamingServer[StreamBuildTaskOutputRequest, StreamBuildTaskOutputResponse]) error + UploadBuildArtifact(grpc.ClientStreamingServer[UploadBuildArtifactRequest, UploadBuildArtifactResponse]) error + DownloadTome(*DownloadTomeRequest, grpc.ServerStreamingServer[DownloadTomeResponse]) error mustEmbedUnimplementedBuilderServer() } -// UnimplementedBuilderServer must be embedded to have forward compatible implementations. -type UnimplementedBuilderServer struct { -} +// UnimplementedBuilderServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedBuilderServer struct{} func (UnimplementedBuilderServer) ClaimBuildTasks(context.Context, *ClaimBuildTasksRequest) (*ClaimBuildTasksResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClaimBuildTasks not implemented") + return nil, status.Error(codes.Unimplemented, "method ClaimBuildTasks not implemented") } -func (UnimplementedBuilderServer) StreamBuildTaskOutput(Builder_StreamBuildTaskOutputServer) error { - return status.Errorf(codes.Unimplemented, "method StreamBuildTaskOutput not implemented") +func (UnimplementedBuilderServer) StreamBuildTaskOutput(grpc.ClientStreamingServer[StreamBuildTaskOutputRequest, StreamBuildTaskOutputResponse]) error { + return status.Error(codes.Unimplemented, "method StreamBuildTaskOutput not implemented") } -func (UnimplementedBuilderServer) UploadBuildArtifact(Builder_UploadBuildArtifactServer) error { - return status.Errorf(codes.Unimplemented, "method UploadBuildArtifact not implemented") +func (UnimplementedBuilderServer) UploadBuildArtifact(grpc.ClientStreamingServer[UploadBuildArtifactRequest, UploadBuildArtifactResponse]) error { + return status.Error(codes.Unimplemented, "method UploadBuildArtifact not implemented") } -func (UnimplementedBuilderServer) DownloadTome(*DownloadTomeRequest, Builder_DownloadTomeServer) error { - return status.Errorf(codes.Unimplemented, "method DownloadTome not implemented") +func (UnimplementedBuilderServer) DownloadTome(*DownloadTomeRequest, grpc.ServerStreamingServer[DownloadTomeResponse]) error { + return status.Error(codes.Unimplemented, "method DownloadTome not implemented") } func (UnimplementedBuilderServer) mustEmbedUnimplementedBuilderServer() {} +func (UnimplementedBuilderServer) testEmbeddedByValue() {} // UnsafeBuilderServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to BuilderServer will @@ -193,6 +139,13 @@ type UnsafeBuilderServer interface { } func RegisterBuilderServer(s grpc.ServiceRegistrar, srv BuilderServer) { + // If the following call panics, it indicates UnimplementedBuilderServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Builder_ServiceDesc, srv) } @@ -215,77 +168,29 @@ func _Builder_ClaimBuildTasks_Handler(srv interface{}, ctx context.Context, dec } func _Builder_StreamBuildTaskOutput_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(BuilderServer).StreamBuildTaskOutput(&builderStreamBuildTaskOutputServer{ServerStream: stream}) -} - -type Builder_StreamBuildTaskOutputServer interface { - SendAndClose(*StreamBuildTaskOutputResponse) error - Recv() (*StreamBuildTaskOutputRequest, error) - grpc.ServerStream + return srv.(BuilderServer).StreamBuildTaskOutput(&grpc.GenericServerStream[StreamBuildTaskOutputRequest, StreamBuildTaskOutputResponse]{ServerStream: stream}) } -type builderStreamBuildTaskOutputServer struct { - grpc.ServerStream -} - -func (x *builderStreamBuildTaskOutputServer) SendAndClose(m *StreamBuildTaskOutputResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *builderStreamBuildTaskOutputServer) Recv() (*StreamBuildTaskOutputRequest, error) { - m := new(StreamBuildTaskOutputRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Builder_StreamBuildTaskOutputServer = grpc.ClientStreamingServer[StreamBuildTaskOutputRequest, StreamBuildTaskOutputResponse] func _Builder_UploadBuildArtifact_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(BuilderServer).UploadBuildArtifact(&builderUploadBuildArtifactServer{ServerStream: stream}) + return srv.(BuilderServer).UploadBuildArtifact(&grpc.GenericServerStream[UploadBuildArtifactRequest, UploadBuildArtifactResponse]{ServerStream: stream}) } -type Builder_UploadBuildArtifactServer interface { - SendAndClose(*UploadBuildArtifactResponse) error - Recv() (*UploadBuildArtifactRequest, error) - grpc.ServerStream -} - -type builderUploadBuildArtifactServer struct { - grpc.ServerStream -} - -func (x *builderUploadBuildArtifactServer) SendAndClose(m *UploadBuildArtifactResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *builderUploadBuildArtifactServer) Recv() (*UploadBuildArtifactRequest, error) { - m := new(UploadBuildArtifactRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Builder_UploadBuildArtifactServer = grpc.ClientStreamingServer[UploadBuildArtifactRequest, UploadBuildArtifactResponse] func _Builder_DownloadTome_Handler(srv interface{}, stream grpc.ServerStream) error { m := new(DownloadTomeRequest) if err := stream.RecvMsg(m); err != nil { return err } - return srv.(BuilderServer).DownloadTome(m, &builderDownloadTomeServer{ServerStream: stream}) -} - -type Builder_DownloadTomeServer interface { - Send(*DownloadTomeResponse) error - grpc.ServerStream + return srv.(BuilderServer).DownloadTome(m, &grpc.GenericServerStream[DownloadTomeRequest, DownloadTomeResponse]{ServerStream: stream}) } -type builderDownloadTomeServer struct { - grpc.ServerStream -} - -func (x *builderDownloadTomeServer) Send(m *DownloadTomeResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Builder_DownloadTomeServer = grpc.ServerStreamingServer[DownloadTomeResponse] // Builder_ServiceDesc is the grpc.ServiceDesc for Builder service. // It's only intended for direct use with grpc.RegisterService, diff --git a/tavern/internal/c2/api_claim_tasks.go b/tavern/internal/c2/api_claim_tasks.go index cc826f74f..c4f32b81e 100644 --- a/tavern/internal/c2/api_claim_tasks.go +++ b/tavern/internal/c2/api_claim_tasks.go @@ -63,6 +63,7 @@ func (srv *Server) handleTomeAutomation(ctx context.Context, beaconID int, hostI ), ). WithTome(). + WithCreator(). All(ctx) if err != nil { @@ -138,6 +139,9 @@ func (srv *Server) handleTomeAutomation(ctx context.Context, beaconID int, hostI if st.Parameters != "" { questCreate.SetParameters(st.Parameters) } + if st.Edges.Creator != nil { + questCreate.SetCreator(st.Edges.Creator) + } q, err := questCreate.Save(ctx) if err != nil { slog.ErrorContext(ctx, "failed to create automated quest", "err", err, "scheduled_task_id", st.ID, "tome_id", tome.ID) diff --git a/tavern/internal/c2/c2pb/c2.pb.go b/tavern/internal/c2/c2pb/c2.pb.go index 8ae3166ba..679b9c655 100644 --- a/tavern/internal/c2/c2pb/c2.pb.go +++ b/tavern/internal/c2/c2pb/c2.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 +// protoc-gen-go v1.36.11 // protoc v3.21.12 // source: c2.proto @@ -2177,313 +2177,171 @@ func (x *CreatePortalResponse) GetMote() *portalpb.Mote { var File_c2_proto protoreflect.FileDescriptor -var file_c2_proto_rawDesc = string([]byte{ - 0x0a, 0x08, 0x63, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x63, 0x32, 0x1a, 0x1f, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x0e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x0c, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x27, 0x0a, - 0x05, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, - 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x22, 0xee, 0x01, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x6e, 0x73, - 0x70, 0x6f, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x72, 0x69, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x75, 0x72, 0x69, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, - 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x76, - 0x61, 0x6c, 0x12, 0x26, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x12, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, - 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x78, - 0x74, 0x72, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x78, 0x74, 0x72, 0x61, - 0x12, 0x16, 0x0a, 0x06, 0x6a, 0x69, 0x74, 0x74, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x02, - 0x52, 0x06, 0x6a, 0x69, 0x74, 0x74, 0x65, 0x72, 0x22, 0x5d, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, - 0x12, 0x19, 0x0a, 0x15, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x55, 0x4e, - 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x54, - 0x52, 0x41, 0x4e, 0x53, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x47, 0x52, 0x50, 0x43, 0x10, 0x01, 0x12, - 0x13, 0x0a, 0x0f, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x48, 0x54, 0x54, - 0x50, 0x31, 0x10, 0x02, 0x12, 0x11, 0x0a, 0x0d, 0x54, 0x52, 0x41, 0x4e, 0x53, 0x50, 0x4f, 0x52, - 0x54, 0x5f, 0x44, 0x4e, 0x53, 0x10, 0x03, 0x22, 0x67, 0x0a, 0x13, 0x41, 0x76, 0x61, 0x69, 0x6c, - 0x61, 0x62, 0x6c, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x2d, - 0x0a, 0x0a, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, - 0x74, 0x52, 0x0a, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x12, 0x21, 0x0a, - 0x0c, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x61, 0x63, 0x74, 0x69, 0x76, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, - 0x22, 0xd1, 0x01, 0x0a, 0x06, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x12, 0x1e, 0x0a, 0x0a, 0x69, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x70, - 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x04, 0x68, 0x6f, 0x73, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x63, 0x32, 0x2e, 0x48, 0x6f, 0x73, - 0x74, 0x52, 0x04, 0x68, 0x6f, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x05, 0x61, 0x67, 0x65, 0x6e, 0x74, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x63, 0x32, 0x2e, 0x41, 0x67, 0x65, 0x6e, - 0x74, 0x52, 0x05, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x12, 0x4a, 0x0a, 0x14, 0x61, 0x76, 0x61, 0x69, - 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x73, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x63, 0x32, 0x2e, 0x41, 0x76, 0x61, 0x69, - 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x52, - 0x13, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x70, - 0x6f, 0x72, 0x74, 0x73, 0x22, 0xfe, 0x01, 0x0a, 0x04, 0x48, 0x6f, 0x73, 0x74, 0x12, 0x1e, 0x0a, - 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x12, 0x0a, - 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, - 0x65, 0x12, 0x2d, 0x0a, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0e, 0x32, 0x11, 0x2e, 0x63, 0x32, 0x2e, 0x48, 0x6f, 0x73, 0x74, 0x2e, 0x50, 0x6c, - 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, - 0x12, 0x1d, 0x0a, 0x0a, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x70, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x70, 0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x49, 0x70, 0x22, - 0x74, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x18, 0x0a, 0x14, 0x50, - 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, - 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, - 0x4d, 0x5f, 0x57, 0x49, 0x4e, 0x44, 0x4f, 0x57, 0x53, 0x10, 0x01, 0x12, 0x12, 0x0a, 0x0e, 0x50, - 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x4c, 0x49, 0x4e, 0x55, 0x58, 0x10, 0x02, 0x12, - 0x12, 0x0a, 0x0e, 0x50, 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, 0x4d, 0x41, 0x43, 0x4f, - 0x53, 0x10, 0x03, 0x12, 0x10, 0x0a, 0x0c, 0x50, 0x4c, 0x41, 0x54, 0x46, 0x4f, 0x52, 0x4d, 0x5f, - 0x42, 0x53, 0x44, 0x10, 0x04, 0x22, 0x6b, 0x0a, 0x04, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x22, 0x0a, - 0x04, 0x74, 0x6f, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x65, 0x6c, - 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x54, 0x6f, 0x6d, 0x65, 0x52, 0x04, 0x74, 0x6f, 0x6d, - 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x71, 0x75, 0x65, 0x73, 0x74, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x71, 0x75, 0x65, 0x73, 0x74, 0x4e, 0x61, 0x6d, 0x65, - 0x12, 0x10, 0x0a, 0x03, 0x6a, 0x77, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6a, - 0x77, 0x74, 0x22, 0x9c, 0x01, 0x0a, 0x09, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, - 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x49, - 0x64, 0x12, 0x1f, 0x0a, 0x0b, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x5f, 0x69, 0x64, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, - 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, - 0x10, 0x0a, 0x03, 0x6a, 0x77, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6a, 0x77, - 0x74, 0x22, 0x1d, 0x0a, 0x09, 0x54, 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x10, - 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, - 0x22, 0xe3, 0x01, 0x0a, 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, - 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, - 0x45, 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x42, 0x0a, 0x0f, - 0x65, 0x78, 0x65, 0x63, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, - 0x70, 0x52, 0x0d, 0x65, 0x78, 0x65, 0x63, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x12, 0x44, 0x0a, 0x10, 0x65, 0x78, 0x65, 0x63, 0x5f, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, - 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, - 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, - 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x65, 0x78, 0x65, 0x63, 0x46, 0x69, 0x6e, 0x69, - 0x73, 0x68, 0x65, 0x64, 0x41, 0x74, 0x22, 0x22, 0x0a, 0x0e, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, - 0x61, 0x73, 0x6b, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x22, 0xe8, 0x01, 0x0a, 0x0f, 0x53, - 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x0e, - 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, - 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, - 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x23, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x45, - 0x72, 0x72, 0x6f, 0x72, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x42, 0x0a, 0x0f, 0x65, - 0x78, 0x65, 0x63, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, - 0x52, 0x0d, 0x65, 0x78, 0x65, 0x63, 0x53, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, - 0x44, 0x0a, 0x10, 0x65, 0x78, 0x65, 0x63, 0x5f, 0x66, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, - 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, - 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, - 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0e, 0x65, 0x78, 0x65, 0x63, 0x46, 0x69, 0x6e, 0x69, 0x73, - 0x68, 0x65, 0x64, 0x41, 0x74, 0x22, 0x38, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x10, 0x0a, - 0x03, 0x6a, 0x77, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6a, 0x77, 0x74, 0x22, - 0x48, 0x0a, 0x10, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, - 0x65, 0x78, 0x74, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x74, 0x61, 0x73, - 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x68, 0x65, 0x6c, - 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x6a, 0x77, 0x74, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6a, 0x77, 0x74, 0x22, 0x37, 0x0a, 0x11, 0x43, 0x6c, 0x61, - 0x69, 0x6d, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x22, - 0x0a, 0x06, 0x62, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, - 0x2e, 0x63, 0x32, 0x2e, 0x42, 0x65, 0x61, 0x63, 0x6f, 0x6e, 0x52, 0x06, 0x62, 0x65, 0x61, 0x63, - 0x6f, 0x6e, 0x22, 0x64, 0x0a, 0x12, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x54, 0x61, 0x73, 0x6b, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, - 0x6b, 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x12, 0x2e, 0x0a, 0x0b, 0x73, 0x68, 0x65, 0x6c, - 0x6c, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, - 0x63, 0x32, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x0a, 0x73, 0x68, - 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x22, 0xae, 0x01, 0x0a, 0x11, 0x46, 0x65, 0x74, - 0x63, 0x68, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, - 0x0a, 0x0c, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x12, 0x44, 0x0a, 0x12, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x74, 0x61, - 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x14, 0x2e, 0x63, 0x32, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x10, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x54, - 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x42, 0x09, - 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x2a, 0x0a, 0x12, 0x46, 0x65, 0x74, - 0x63, 0x68, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, - 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x22, 0xd6, 0x01, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, - 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x34, 0x0a, 0x0c, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, - 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x44, 0x0a, 0x12, 0x73, 0x68, 0x65, 0x6c, 0x6c, - 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x32, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, - 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x10, 0x73, 0x68, 0x65, - 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x34, 0x0a, - 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x43, 0x72, 0x65, - 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x0a, 0x63, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, - 0x69, 0x61, 0x6c, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x1a, - 0x0a, 0x18, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, - 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe8, 0x01, 0x0a, 0x11, 0x52, - 0x65, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x34, 0x0a, 0x0c, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, - 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x44, 0x0a, 0x12, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, - 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x32, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, - 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x10, 0x73, 0x68, 0x65, 0x6c, - 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x26, 0x0a, 0x04, - 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x63, 0x32, 0x2e, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, - 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x24, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x04, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x14, 0x0a, 0x12, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x46, - 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xcc, 0x01, 0x0a, 0x18, - 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x0c, 0x74, 0x61, 0x73, 0x6b, - 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, - 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, - 0x00, 0x52, 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x44, - 0x0a, 0x12, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x32, 0x2e, - 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x48, 0x00, 0x52, 0x10, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x50, 0x72, - 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x42, - 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, 0x1b, 0x0a, 0x19, 0x52, 0x65, - 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x6c, 0x0a, 0x17, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x12, 0x29, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, - 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x26, 0x0a, - 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, - 0x63, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x06, 0x6f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x22, 0x7b, 0x0a, 0x1c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x53, - 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2e, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x32, 0x2e, 0x53, 0x68, 0x65, 0x6c, - 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x52, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x2b, 0x0a, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x63, 0x32, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x6c, - 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x22, 0xb0, 0x01, 0x0a, 0x13, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x4f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x3e, 0x0a, 0x0b, 0x74, 0x61, - 0x73, 0x6b, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x1b, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x4f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0a, - 0x74, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x12, 0x4e, 0x0a, 0x11, 0x73, 0x68, - 0x65, 0x6c, 0x6c, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x20, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x48, 0x00, 0x52, 0x0f, 0x73, 0x68, 0x65, 0x6c, 0x6c, - 0x54, 0x61, 0x73, 0x6b, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x42, 0x09, 0x0a, 0x07, 0x6d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x16, 0x0a, 0x14, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x4f, - 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xe1, 0x01, - 0x0a, 0x13, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x0c, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x32, - 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, 0x0b, - 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x44, 0x0a, 0x12, 0x73, - 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x32, 0x2e, 0x53, 0x68, 0x65, - 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, - 0x10, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x12, 0x2f, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, - 0x1b, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x53, 0x68, 0x65, 0x6c, - 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, - 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, - 0x74, 0x22, 0x5b, 0x0a, 0x14, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x53, 0x68, 0x65, 0x6c, - 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x04, 0x6b, 0x69, 0x6e, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1b, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x76, - 0x65, 0x72, 0x73, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0xbe, - 0x01, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x34, 0x0a, 0x0c, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, - 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, - 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, 0x52, - 0x0b, 0x74, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x12, 0x44, 0x0a, 0x12, - 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x63, 0x32, 0x2e, 0x53, 0x68, - 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x48, 0x00, - 0x52, 0x10, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x54, 0x61, 0x73, 0x6b, 0x43, 0x6f, 0x6e, 0x74, 0x65, - 0x78, 0x74, 0x12, 0x20, 0x0a, 0x04, 0x6d, 0x6f, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x0c, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x4d, 0x6f, 0x74, 0x65, 0x52, 0x04, - 0x6d, 0x6f, 0x74, 0x65, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x78, 0x74, 0x22, - 0x38, 0x0a, 0x14, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x6d, 0x6f, 0x74, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x4d, - 0x6f, 0x74, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x74, 0x65, 0x2a, 0x70, 0x0a, 0x0e, 0x52, 0x65, 0x70, - 0x6f, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x20, 0x0a, 0x1c, 0x52, - 0x45, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x1b, 0x0a, - 0x17, 0x52, 0x45, 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x4b, 0x49, 0x4e, - 0x44, 0x5f, 0x4f, 0x4e, 0x44, 0x49, 0x53, 0x4b, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x52, 0x45, - 0x50, 0x4f, 0x52, 0x54, 0x5f, 0x46, 0x49, 0x4c, 0x45, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, - 0x43, 0x52, 0x45, 0x45, 0x4e, 0x53, 0x48, 0x4f, 0x54, 0x10, 0x02, 0x2a, 0x8f, 0x01, 0x0a, 0x17, - 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x2a, 0x0a, 0x26, 0x52, 0x45, 0x56, 0x45, 0x52, - 0x53, 0x45, 0x5f, 0x53, 0x48, 0x45, 0x4c, 0x4c, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, - 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, - 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x45, 0x5f, 0x53, - 0x48, 0x45, 0x4c, 0x4c, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, 0x45, 0x5f, 0x4b, 0x49, 0x4e, - 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x01, 0x12, 0x23, 0x0a, 0x1f, 0x52, 0x45, 0x56, 0x45, - 0x52, 0x53, 0x45, 0x5f, 0x53, 0x48, 0x45, 0x4c, 0x4c, 0x5f, 0x4d, 0x45, 0x53, 0x53, 0x41, 0x47, - 0x45, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x50, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x32, 0xb9, 0x04, - 0x0a, 0x02, 0x43, 0x32, 0x12, 0x3d, 0x0a, 0x0a, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x54, 0x61, 0x73, - 0x6b, 0x73, 0x12, 0x15, 0x2e, 0x63, 0x32, 0x2e, 0x43, 0x6c, 0x61, 0x69, 0x6d, 0x54, 0x61, 0x73, - 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x63, 0x32, 0x2e, 0x43, - 0x6c, 0x61, 0x69, 0x6d, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x0a, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x12, 0x15, 0x2e, 0x63, 0x32, 0x2e, 0x46, 0x65, 0x74, 0x63, 0x68, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x63, 0x32, 0x2e, 0x46, 0x65, - 0x74, 0x63, 0x68, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x30, 0x01, 0x12, 0x4d, 0x0a, 0x10, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x43, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x1b, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x43, - 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x12, - 0x15, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, - 0x72, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, - 0x12, 0x50, 0x0a, 0x11, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, - 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1c, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, - 0x74, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x50, - 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0c, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x4f, 0x75, 0x74, 0x70, - 0x75, 0x74, 0x12, 0x17, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x4f, 0x75, - 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x63, 0x32, - 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x4f, 0x75, 0x74, 0x70, 0x75, 0x74, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0c, 0x52, 0x65, 0x76, 0x65, 0x72, - 0x73, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x12, 0x17, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x76, - 0x65, 0x72, 0x73, 0x65, 0x53, 0x68, 0x65, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x18, 0x2e, 0x63, 0x32, 0x2e, 0x52, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x53, 0x68, 0x65, - 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, - 0x12, 0x47, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, - 0x12, 0x17, 0x2e, 0x63, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, - 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x63, 0x32, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x23, 0x5a, 0x21, 0x72, 0x65, 0x61, - 0x6c, 0x6d, 0x2e, 0x70, 0x75, 0x62, 0x2f, 0x74, 0x61, 0x76, 0x65, 0x72, 0x6e, 0x2f, 0x69, 0x6e, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x32, 0x2f, 0x63, 0x32, 0x70, 0x62, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -}) +const file_c2_proto_rawDesc = "" + + "\n" + + "\bc2.proto\x12\x02c2\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x0eeldritch.proto\x1a\fportal.proto\"'\n" + + "\x05Agent\x12\x1e\n" + + "\n" + + "identifier\x18\x01 \x01(\tR\n" + + "identifier\"\xee\x01\n" + + "\tTransport\x12\x10\n" + + "\x03uri\x18\x01 \x01(\tR\x03uri\x12\x1a\n" + + "\binterval\x18\x02 \x01(\x04R\binterval\x12&\n" + + "\x04type\x18\x03 \x01(\x0e2\x12.c2.Transport.TypeR\x04type\x12\x14\n" + + "\x05extra\x18\x04 \x01(\tR\x05extra\x12\x16\n" + + "\x06jitter\x18\x05 \x01(\x02R\x06jitter\"]\n" + + "\x04Type\x12\x19\n" + + "\x15TRANSPORT_UNSPECIFIED\x10\x00\x12\x12\n" + + "\x0eTRANSPORT_GRPC\x10\x01\x12\x13\n" + + "\x0fTRANSPORT_HTTP1\x10\x02\x12\x11\n" + + "\rTRANSPORT_DNS\x10\x03\"g\n" + + "\x13AvailableTransports\x12-\n" + + "\n" + + "transports\x18\x01 \x03(\v2\r.c2.TransportR\n" + + "transports\x12!\n" + + "\factive_index\x18\x02 \x01(\rR\vactiveIndex\"\xd1\x01\n" + + "\x06Beacon\x12\x1e\n" + + "\n" + + "identifier\x18\x01 \x01(\tR\n" + + "identifier\x12\x1c\n" + + "\tprincipal\x18\x02 \x01(\tR\tprincipal\x12\x1c\n" + + "\x04host\x18\x03 \x01(\v2\b.c2.HostR\x04host\x12\x1f\n" + + "\x05agent\x18\x04 \x01(\v2\t.c2.AgentR\x05agent\x12J\n" + + "\x14available_transports\x18\x05 \x01(\v2\x17.c2.AvailableTransportsR\x13availableTransports\"\xfe\x01\n" + + "\x04Host\x12\x1e\n" + + "\n" + + "identifier\x18\x01 \x01(\tR\n" + + "identifier\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\x12-\n" + + "\bplatform\x18\x03 \x01(\x0e2\x11.c2.Host.PlatformR\bplatform\x12\x1d\n" + + "\n" + + "primary_ip\x18\x04 \x01(\tR\tprimaryIp\"t\n" + + "\bPlatform\x12\x18\n" + + "\x14PLATFORM_UNSPECIFIED\x10\x00\x12\x14\n" + + "\x10PLATFORM_WINDOWS\x10\x01\x12\x12\n" + + "\x0ePLATFORM_LINUX\x10\x02\x12\x12\n" + + "\x0ePLATFORM_MACOS\x10\x03\x12\x10\n" + + "\fPLATFORM_BSD\x10\x04\"k\n" + + "\x04Task\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\"\n" + + "\x04tome\x18\x02 \x01(\v2\x0e.eldritch.TomeR\x04tome\x12\x1d\n" + + "\n" + + "quest_name\x18\x03 \x01(\tR\tquestName\x12\x10\n" + + "\x03jwt\x18\x04 \x01(\tR\x03jwt\"\x9c\x01\n" + + "\tShellTask\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x14\n" + + "\x05input\x18\x02 \x01(\tR\x05input\x12\x19\n" + + "\bshell_id\x18\x03 \x01(\x03R\ashellId\x12\x1f\n" + + "\vsequence_id\x18\x04 \x01(\x04R\n" + + "sequenceId\x12\x1b\n" + + "\tstream_id\x18\x05 \x01(\tR\bstreamId\x12\x10\n" + + "\x03jwt\x18\x06 \x01(\tR\x03jwt\"\x1d\n" + + "\tTaskError\x12\x10\n" + + "\x03msg\x18\x01 \x01(\tR\x03msg\"\xe3\x01\n" + + "\n" + + "TaskOutput\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" + + "\x06output\x18\x02 \x01(\tR\x06output\x12#\n" + + "\x05error\x18\x03 \x01(\v2\r.c2.TaskErrorR\x05error\x12B\n" + + "\x0fexec_started_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\rexecStartedAt\x12D\n" + + "\x10exec_finished_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\x0eexecFinishedAt\"\"\n" + + "\x0eShellTaskError\x12\x10\n" + + "\x03msg\x18\x01 \x01(\tR\x03msg\"\xe8\x01\n" + + "\x0fShellTaskOutput\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x03R\x02id\x12\x16\n" + + "\x06output\x18\x02 \x01(\tR\x06output\x12#\n" + + "\x05error\x18\x03 \x01(\v2\r.c2.TaskErrorR\x05error\x12B\n" + + "\x0fexec_started_at\x18\x04 \x01(\v2\x1a.google.protobuf.TimestampR\rexecStartedAt\x12D\n" + + "\x10exec_finished_at\x18\x05 \x01(\v2\x1a.google.protobuf.TimestampR\x0eexecFinishedAt\"8\n" + + "\vTaskContext\x12\x17\n" + + "\atask_id\x18\x01 \x01(\x03R\x06taskId\x12\x10\n" + + "\x03jwt\x18\x02 \x01(\tR\x03jwt\"H\n" + + "\x10ShellTaskContext\x12\"\n" + + "\rshell_task_id\x18\x01 \x01(\x03R\vshellTaskId\x12\x10\n" + + "\x03jwt\x18\x02 \x01(\tR\x03jwt\"7\n" + + "\x11ClaimTasksRequest\x12\"\n" + + "\x06beacon\x18\x01 \x01(\v2\n" + + ".c2.BeaconR\x06beacon\"d\n" + + "\x12ClaimTasksResponse\x12\x1e\n" + + "\x05tasks\x18\x01 \x03(\v2\b.c2.TaskR\x05tasks\x12.\n" + + "\vshell_tasks\x18\x02 \x03(\v2\r.c2.ShellTaskR\n" + + "shellTasks\"\xae\x01\n" + + "\x11FetchAssetRequest\x124\n" + + "\ftask_context\x18\x01 \x01(\v2\x0f.c2.TaskContextH\x00R\vtaskContext\x12D\n" + + "\x12shell_task_context\x18\x02 \x01(\v2\x14.c2.ShellTaskContextH\x00R\x10shellTaskContext\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04nameB\t\n" + + "\acontext\"*\n" + + "\x12FetchAssetResponse\x12\x14\n" + + "\x05chunk\x18\x01 \x01(\fR\x05chunk\"\xd6\x01\n" + + "\x17ReportCredentialRequest\x124\n" + + "\ftask_context\x18\x01 \x01(\v2\x0f.c2.TaskContextH\x00R\vtaskContext\x12D\n" + + "\x12shell_task_context\x18\x02 \x01(\v2\x14.c2.ShellTaskContextH\x00R\x10shellTaskContext\x124\n" + + "\n" + + "credential\x18\x03 \x01(\v2\x14.eldritch.CredentialR\n" + + "credentialB\t\n" + + "\acontext\"\x1a\n" + + "\x18ReportCredentialResponse\"\xe8\x01\n" + + "\x11ReportFileRequest\x124\n" + + "\ftask_context\x18\x01 \x01(\v2\x0f.c2.TaskContextH\x00R\vtaskContext\x12D\n" + + "\x12shell_task_context\x18\x02 \x01(\v2\x14.c2.ShellTaskContextH\x00R\x10shellTaskContext\x12&\n" + + "\x04kind\x18\x03 \x01(\x0e2\x12.c2.ReportFileKindR\x04kind\x12$\n" + + "\x05chunk\x18\x04 \x01(\v2\x0e.eldritch.FileR\x05chunkB\t\n" + + "\acontext\"\x14\n" + + "\x12ReportFileResponse\"\xcc\x01\n" + + "\x18ReportProcessListRequest\x124\n" + + "\ftask_context\x18\x01 \x01(\v2\x0f.c2.TaskContextH\x00R\vtaskContext\x12D\n" + + "\x12shell_task_context\x18\x02 \x01(\v2\x14.c2.ShellTaskContextH\x00R\x10shellTaskContext\x12)\n" + + "\x04list\x18\x03 \x01(\v2\x15.eldritch.ProcessListR\x04listB\t\n" + + "\acontext\"\x1b\n" + + "\x19ReportProcessListResponse\"l\n" + + "\x17ReportTaskOutputMessage\x12)\n" + + "\acontext\x18\x01 \x01(\v2\x0f.c2.TaskContextR\acontext\x12&\n" + + "\x06output\x18\x02 \x01(\v2\x0e.c2.TaskOutputR\x06output\"{\n" + + "\x1cReportShellTaskOutputMessage\x12.\n" + + "\acontext\x18\x01 \x01(\v2\x14.c2.ShellTaskContextR\acontext\x12+\n" + + "\x06output\x18\x02 \x01(\v2\x13.c2.ShellTaskOutputR\x06output\"\xb0\x01\n" + + "\x13ReportOutputRequest\x12>\n" + + "\vtask_output\x18\x01 \x01(\v2\x1b.c2.ReportTaskOutputMessageH\x00R\n" + + "taskOutput\x12N\n" + + "\x11shell_task_output\x18\x02 \x01(\v2 .c2.ReportShellTaskOutputMessageH\x00R\x0fshellTaskOutputB\t\n" + + "\amessage\"\x16\n" + + "\x14ReportOutputResponse\"\xe1\x01\n" + + "\x13ReverseShellRequest\x124\n" + + "\ftask_context\x18\x01 \x01(\v2\x0f.c2.TaskContextH\x00R\vtaskContext\x12D\n" + + "\x12shell_task_context\x18\x02 \x01(\v2\x14.c2.ShellTaskContextH\x00R\x10shellTaskContext\x12/\n" + + "\x04kind\x18\x03 \x01(\x0e2\x1b.c2.ReverseShellMessageKindR\x04kind\x12\x12\n" + + "\x04data\x18\x04 \x01(\fR\x04dataB\t\n" + + "\acontext\"[\n" + + "\x14ReverseShellResponse\x12/\n" + + "\x04kind\x18\x01 \x01(\x0e2\x1b.c2.ReverseShellMessageKindR\x04kind\x12\x12\n" + + "\x04data\x18\x02 \x01(\fR\x04data\"\xbe\x01\n" + + "\x13CreatePortalRequest\x124\n" + + "\ftask_context\x18\x01 \x01(\v2\x0f.c2.TaskContextH\x00R\vtaskContext\x12D\n" + + "\x12shell_task_context\x18\x02 \x01(\v2\x14.c2.ShellTaskContextH\x00R\x10shellTaskContext\x12 \n" + + "\x04mote\x18\x03 \x01(\v2\f.portal.MoteR\x04moteB\t\n" + + "\acontext\"8\n" + + "\x14CreatePortalResponse\x12 \n" + + "\x04mote\x18\x01 \x01(\v2\f.portal.MoteR\x04mote*p\n" + + "\x0eReportFileKind\x12 \n" + + "\x1cREPORT_FILE_KIND_UNSPECIFIED\x10\x00\x12\x1b\n" + + "\x17REPORT_FILE_KIND_ONDISK\x10\x01\x12\x1f\n" + + "\x1bREPORT_FILE_KIND_SCREENSHOT\x10\x02*\x8f\x01\n" + + "\x17ReverseShellMessageKind\x12*\n" + + "&REVERSE_SHELL_MESSAGE_KIND_UNSPECIFIED\x10\x00\x12#\n" + + "\x1fREVERSE_SHELL_MESSAGE_KIND_DATA\x10\x01\x12#\n" + + "\x1fREVERSE_SHELL_MESSAGE_KIND_PING\x10\x022\xb9\x04\n" + + "\x02C2\x12=\n" + + "\n" + + "ClaimTasks\x12\x15.c2.ClaimTasksRequest\x1a\x16.c2.ClaimTasksResponse\"\x00\x12=\n" + + "\n" + + "FetchAsset\x12\x15.c2.FetchAssetRequest\x1a\x16.c2.FetchAssetResponse0\x01\x12M\n" + + "\x10ReportCredential\x12\x1b.c2.ReportCredentialRequest\x1a\x1c.c2.ReportCredentialResponse\x12=\n" + + "\n" + + "ReportFile\x12\x15.c2.ReportFileRequest\x1a\x16.c2.ReportFileResponse(\x01\x12P\n" + + "\x11ReportProcessList\x12\x1c.c2.ReportProcessListRequest\x1a\x1d.c2.ReportProcessListResponse\x12C\n" + + "\fReportOutput\x12\x17.c2.ReportOutputRequest\x1a\x18.c2.ReportOutputResponse\"\x00\x12G\n" + + "\fReverseShell\x12\x17.c2.ReverseShellRequest\x1a\x18.c2.ReverseShellResponse\"\x00(\x010\x01\x12G\n" + + "\fCreatePortal\x12\x17.c2.CreatePortalRequest\x1a\x18.c2.CreatePortalResponse\"\x00(\x010\x01B#Z!realm.pub/tavern/internal/c2/c2pbb\x06proto3" var ( file_c2_proto_rawDescOnce sync.Once diff --git a/tavern/internal/c2/c2pb/c2_grpc.pb.go b/tavern/internal/c2/c2pb/c2_grpc.pb.go index 23c65e903..51674be80 100644 --- a/tavern/internal/c2/c2pb/c2_grpc.pb.go +++ b/tavern/internal/c2/c2pb/c2_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.6.1 // - protoc v3.21.12 // source: c2.proto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( C2_ClaimTasks_FullMethodName = "/c2.C2/ClaimTasks" @@ -42,7 +42,7 @@ type C2Client interface { // - "file-size": The number of bytes contained by the file. // // If no associated file can be found, a NotFound status error is returned. - FetchAsset(ctx context.Context, in *FetchAssetRequest, opts ...grpc.CallOption) (C2_FetchAssetClient, error) + FetchAsset(ctx context.Context, in *FetchAssetRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FetchAssetResponse], error) // Report a credential from the host to the server. ReportCredential(ctx context.Context, in *ReportCredentialRequest, opts ...grpc.CallOption) (*ReportCredentialResponse, error) // Report a file from the host to the server. @@ -52,16 +52,16 @@ type C2Client interface { // // Content is provided as chunks, the size of which are up to the agent to define (based on memory constraints). // Any existing files at the provided path for the host are replaced. - ReportFile(ctx context.Context, opts ...grpc.CallOption) (C2_ReportFileClient, error) + ReportFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ReportFileRequest, ReportFileResponse], error) // Report the active list of running processes. This list will replace any previously reported // lists for the same host. ReportProcessList(ctx context.Context, in *ReportProcessListRequest, opts ...grpc.CallOption) (*ReportProcessListResponse, error) // Report execution output. ReportOutput(ctx context.Context, in *ReportOutputRequest, opts ...grpc.CallOption) (*ReportOutputResponse, error) // Open a reverse shell bi-directional stream. - ReverseShell(ctx context.Context, opts ...grpc.CallOption) (C2_ReverseShellClient, error) + ReverseShell(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReverseShellRequest, ReverseShellResponse], error) // Open a portal bi-directional stream. - CreatePortal(ctx context.Context, opts ...grpc.CallOption) (C2_CreatePortalClient, error) + CreatePortal(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CreatePortalRequest, CreatePortalResponse], error) } type c2Client struct { @@ -82,13 +82,13 @@ func (c *c2Client) ClaimTasks(ctx context.Context, in *ClaimTasksRequest, opts . return out, nil } -func (c *c2Client) FetchAsset(ctx context.Context, in *FetchAssetRequest, opts ...grpc.CallOption) (C2_FetchAssetClient, error) { +func (c *c2Client) FetchAsset(ctx context.Context, in *FetchAssetRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FetchAssetResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &C2_ServiceDesc.Streams[0], C2_FetchAsset_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &c2FetchAssetClient{ClientStream: stream} + x := &grpc.GenericClientStream[FetchAssetRequest, FetchAssetResponse]{ClientStream: stream} if err := x.ClientStream.SendMsg(in); err != nil { return nil, err } @@ -98,22 +98,8 @@ func (c *c2Client) FetchAsset(ctx context.Context, in *FetchAssetRequest, opts . return x, nil } -type C2_FetchAssetClient interface { - Recv() (*FetchAssetResponse, error) - grpc.ClientStream -} - -type c2FetchAssetClient struct { - grpc.ClientStream -} - -func (x *c2FetchAssetClient) Recv() (*FetchAssetResponse, error) { - m := new(FetchAssetResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type C2_FetchAssetClient = grpc.ServerStreamingClient[FetchAssetResponse] func (c *c2Client) ReportCredential(ctx context.Context, in *ReportCredentialRequest, opts ...grpc.CallOption) (*ReportCredentialResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -125,40 +111,18 @@ func (c *c2Client) ReportCredential(ctx context.Context, in *ReportCredentialReq return out, nil } -func (c *c2Client) ReportFile(ctx context.Context, opts ...grpc.CallOption) (C2_ReportFileClient, error) { +func (c *c2Client) ReportFile(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[ReportFileRequest, ReportFileResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &C2_ServiceDesc.Streams[1], C2_ReportFile_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &c2ReportFileClient{ClientStream: stream} + x := &grpc.GenericClientStream[ReportFileRequest, ReportFileResponse]{ClientStream: stream} return x, nil } -type C2_ReportFileClient interface { - Send(*ReportFileRequest) error - CloseAndRecv() (*ReportFileResponse, error) - grpc.ClientStream -} - -type c2ReportFileClient struct { - grpc.ClientStream -} - -func (x *c2ReportFileClient) Send(m *ReportFileRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *c2ReportFileClient) CloseAndRecv() (*ReportFileResponse, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(ReportFileResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type C2_ReportFileClient = grpc.ClientStreamingClient[ReportFileRequest, ReportFileResponse] func (c *c2Client) ReportProcessList(ctx context.Context, in *ReportProcessListRequest, opts ...grpc.CallOption) (*ReportProcessListResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) @@ -180,73 +144,35 @@ func (c *c2Client) ReportOutput(ctx context.Context, in *ReportOutputRequest, op return out, nil } -func (c *c2Client) ReverseShell(ctx context.Context, opts ...grpc.CallOption) (C2_ReverseShellClient, error) { +func (c *c2Client) ReverseShell(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ReverseShellRequest, ReverseShellResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &C2_ServiceDesc.Streams[2], C2_ReverseShell_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &c2ReverseShellClient{ClientStream: stream} + x := &grpc.GenericClientStream[ReverseShellRequest, ReverseShellResponse]{ClientStream: stream} return x, nil } -type C2_ReverseShellClient interface { - Send(*ReverseShellRequest) error - Recv() (*ReverseShellResponse, error) - grpc.ClientStream -} - -type c2ReverseShellClient struct { - grpc.ClientStream -} - -func (x *c2ReverseShellClient) Send(m *ReverseShellRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *c2ReverseShellClient) Recv() (*ReverseShellResponse, error) { - m := new(ReverseShellResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type C2_ReverseShellClient = grpc.BidiStreamingClient[ReverseShellRequest, ReverseShellResponse] -func (c *c2Client) CreatePortal(ctx context.Context, opts ...grpc.CallOption) (C2_CreatePortalClient, error) { +func (c *c2Client) CreatePortal(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[CreatePortalRequest, CreatePortalResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &C2_ServiceDesc.Streams[3], C2_CreatePortal_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &c2CreatePortalClient{ClientStream: stream} + x := &grpc.GenericClientStream[CreatePortalRequest, CreatePortalResponse]{ClientStream: stream} return x, nil } -type C2_CreatePortalClient interface { - Send(*CreatePortalRequest) error - Recv() (*CreatePortalResponse, error) - grpc.ClientStream -} - -type c2CreatePortalClient struct { - grpc.ClientStream -} - -func (x *c2CreatePortalClient) Send(m *CreatePortalRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *c2CreatePortalClient) Recv() (*CreatePortalResponse, error) { - m := new(CreatePortalResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type C2_CreatePortalClient = grpc.BidiStreamingClient[CreatePortalRequest, CreatePortalResponse] // C2Server is the server API for C2 service. // All implementations must embed UnimplementedC2Server -// for forward compatibility +// for forward compatibility. type C2Server interface { // Contact the server for new tasks to execute. ClaimTasks(context.Context, *ClaimTasksRequest) (*ClaimTasksResponse, error) @@ -257,7 +183,7 @@ type C2Server interface { // - "file-size": The number of bytes contained by the file. // // If no associated file can be found, a NotFound status error is returned. - FetchAsset(*FetchAssetRequest, C2_FetchAssetServer) error + FetchAsset(*FetchAssetRequest, grpc.ServerStreamingServer[FetchAssetResponse]) error // Report a credential from the host to the server. ReportCredential(context.Context, *ReportCredentialRequest) (*ReportCredentialResponse, error) // Report a file from the host to the server. @@ -267,48 +193,52 @@ type C2Server interface { // // Content is provided as chunks, the size of which are up to the agent to define (based on memory constraints). // Any existing files at the provided path for the host are replaced. - ReportFile(C2_ReportFileServer) error + ReportFile(grpc.ClientStreamingServer[ReportFileRequest, ReportFileResponse]) error // Report the active list of running processes. This list will replace any previously reported // lists for the same host. ReportProcessList(context.Context, *ReportProcessListRequest) (*ReportProcessListResponse, error) // Report execution output. ReportOutput(context.Context, *ReportOutputRequest) (*ReportOutputResponse, error) // Open a reverse shell bi-directional stream. - ReverseShell(C2_ReverseShellServer) error + ReverseShell(grpc.BidiStreamingServer[ReverseShellRequest, ReverseShellResponse]) error // Open a portal bi-directional stream. - CreatePortal(C2_CreatePortalServer) error + CreatePortal(grpc.BidiStreamingServer[CreatePortalRequest, CreatePortalResponse]) error mustEmbedUnimplementedC2Server() } -// UnimplementedC2Server must be embedded to have forward compatible implementations. -type UnimplementedC2Server struct { -} +// UnimplementedC2Server must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedC2Server struct{} func (UnimplementedC2Server) ClaimTasks(context.Context, *ClaimTasksRequest) (*ClaimTasksResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClaimTasks not implemented") + return nil, status.Error(codes.Unimplemented, "method ClaimTasks not implemented") } -func (UnimplementedC2Server) FetchAsset(*FetchAssetRequest, C2_FetchAssetServer) error { - return status.Errorf(codes.Unimplemented, "method FetchAsset not implemented") +func (UnimplementedC2Server) FetchAsset(*FetchAssetRequest, grpc.ServerStreamingServer[FetchAssetResponse]) error { + return status.Error(codes.Unimplemented, "method FetchAsset not implemented") } func (UnimplementedC2Server) ReportCredential(context.Context, *ReportCredentialRequest) (*ReportCredentialResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReportCredential not implemented") + return nil, status.Error(codes.Unimplemented, "method ReportCredential not implemented") } -func (UnimplementedC2Server) ReportFile(C2_ReportFileServer) error { - return status.Errorf(codes.Unimplemented, "method ReportFile not implemented") +func (UnimplementedC2Server) ReportFile(grpc.ClientStreamingServer[ReportFileRequest, ReportFileResponse]) error { + return status.Error(codes.Unimplemented, "method ReportFile not implemented") } func (UnimplementedC2Server) ReportProcessList(context.Context, *ReportProcessListRequest) (*ReportProcessListResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReportProcessList not implemented") + return nil, status.Error(codes.Unimplemented, "method ReportProcessList not implemented") } func (UnimplementedC2Server) ReportOutput(context.Context, *ReportOutputRequest) (*ReportOutputResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ReportOutput not implemented") + return nil, status.Error(codes.Unimplemented, "method ReportOutput not implemented") } -func (UnimplementedC2Server) ReverseShell(C2_ReverseShellServer) error { - return status.Errorf(codes.Unimplemented, "method ReverseShell not implemented") +func (UnimplementedC2Server) ReverseShell(grpc.BidiStreamingServer[ReverseShellRequest, ReverseShellResponse]) error { + return status.Error(codes.Unimplemented, "method ReverseShell not implemented") } -func (UnimplementedC2Server) CreatePortal(C2_CreatePortalServer) error { - return status.Errorf(codes.Unimplemented, "method CreatePortal not implemented") +func (UnimplementedC2Server) CreatePortal(grpc.BidiStreamingServer[CreatePortalRequest, CreatePortalResponse]) error { + return status.Error(codes.Unimplemented, "method CreatePortal not implemented") } func (UnimplementedC2Server) mustEmbedUnimplementedC2Server() {} +func (UnimplementedC2Server) testEmbeddedByValue() {} // UnsafeC2Server may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to C2Server will @@ -318,6 +248,13 @@ type UnsafeC2Server interface { } func RegisterC2Server(s grpc.ServiceRegistrar, srv C2Server) { + // If the following call panics, it indicates UnimplementedC2Server was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&C2_ServiceDesc, srv) } @@ -344,21 +281,11 @@ func _C2_FetchAsset_Handler(srv interface{}, stream grpc.ServerStream) error { if err := stream.RecvMsg(m); err != nil { return err } - return srv.(C2Server).FetchAsset(m, &c2FetchAssetServer{ServerStream: stream}) + return srv.(C2Server).FetchAsset(m, &grpc.GenericServerStream[FetchAssetRequest, FetchAssetResponse]{ServerStream: stream}) } -type C2_FetchAssetServer interface { - Send(*FetchAssetResponse) error - grpc.ServerStream -} - -type c2FetchAssetServer struct { - grpc.ServerStream -} - -func (x *c2FetchAssetServer) Send(m *FetchAssetResponse) error { - return x.ServerStream.SendMsg(m) -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type C2_FetchAssetServer = grpc.ServerStreamingServer[FetchAssetResponse] func _C2_ReportCredential_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReportCredentialRequest) @@ -379,30 +306,11 @@ func _C2_ReportCredential_Handler(srv interface{}, ctx context.Context, dec func } func _C2_ReportFile_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(C2Server).ReportFile(&c2ReportFileServer{ServerStream: stream}) + return srv.(C2Server).ReportFile(&grpc.GenericServerStream[ReportFileRequest, ReportFileResponse]{ServerStream: stream}) } -type C2_ReportFileServer interface { - SendAndClose(*ReportFileResponse) error - Recv() (*ReportFileRequest, error) - grpc.ServerStream -} - -type c2ReportFileServer struct { - grpc.ServerStream -} - -func (x *c2ReportFileServer) SendAndClose(m *ReportFileResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *c2ReportFileServer) Recv() (*ReportFileRequest, error) { - m := new(ReportFileRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type C2_ReportFileServer = grpc.ClientStreamingServer[ReportFileRequest, ReportFileResponse] func _C2_ReportProcessList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReportProcessListRequest) @@ -441,56 +349,18 @@ func _C2_ReportOutput_Handler(srv interface{}, ctx context.Context, dec func(int } func _C2_ReverseShell_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(C2Server).ReverseShell(&c2ReverseShellServer{ServerStream: stream}) + return srv.(C2Server).ReverseShell(&grpc.GenericServerStream[ReverseShellRequest, ReverseShellResponse]{ServerStream: stream}) } -type C2_ReverseShellServer interface { - Send(*ReverseShellResponse) error - Recv() (*ReverseShellRequest, error) - grpc.ServerStream -} - -type c2ReverseShellServer struct { - grpc.ServerStream -} - -func (x *c2ReverseShellServer) Send(m *ReverseShellResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *c2ReverseShellServer) Recv() (*ReverseShellRequest, error) { - m := new(ReverseShellRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type C2_ReverseShellServer = grpc.BidiStreamingServer[ReverseShellRequest, ReverseShellResponse] func _C2_CreatePortal_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(C2Server).CreatePortal(&c2CreatePortalServer{ServerStream: stream}) + return srv.(C2Server).CreatePortal(&grpc.GenericServerStream[CreatePortalRequest, CreatePortalResponse]{ServerStream: stream}) } -type C2_CreatePortalServer interface { - Send(*CreatePortalResponse) error - Recv() (*CreatePortalRequest, error) - grpc.ServerStream -} - -type c2CreatePortalServer struct { - grpc.ServerStream -} - -func (x *c2CreatePortalServer) Send(m *CreatePortalResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *c2CreatePortalServer) Recv() (*CreatePortalRequest, error) { - m := new(CreatePortalRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type C2_CreatePortalServer = grpc.BidiStreamingServer[CreatePortalRequest, CreatePortalResponse] // C2_ServiceDesc is the grpc.ServiceDesc for C2 service. // It's only intended for direct use with grpc.RegisterService, diff --git a/tavern/internal/c2/dnspb/dns.pb.go b/tavern/internal/c2/dnspb/dns.pb.go index a23d32d44..b9d97e8be 100644 --- a/tavern/internal/c2/dnspb/dns.pb.go +++ b/tavern/internal/c2/dnspb/dns.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 +// protoc-gen-go v1.36.11 // protoc v3.21.12 // source: dns.proto @@ -415,62 +415,46 @@ func (x *ResponseMetadata) GetChunkSize() uint32 { var File_dns_proto protoreflect.FileDescriptor -var file_dns_proto_rawDesc = string([]byte{ - 0x0a, 0x09, 0x64, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x64, 0x6e, 0x73, - 0x22, 0xf9, 0x01, 0x0a, 0x09, 0x44, 0x4e, 0x53, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x12, 0x23, - 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0f, 0x2e, 0x64, - 0x6e, 0x73, 0x2e, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x65, 0x71, 0x75, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x27, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, - 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, - 0x73, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, - 0x63, 0x72, 0x63, 0x33, 0x32, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x63, 0x72, 0x63, - 0x33, 0x32, 0x12, 0x1f, 0x0a, 0x0b, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x5f, 0x73, 0x69, 0x7a, - 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x53, - 0x69, 0x7a, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x61, 0x63, 0x6b, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x0d, 0x2e, 0x64, 0x6e, 0x73, 0x2e, 0x41, 0x63, 0x6b, 0x52, 0x61, 0x6e, 0x67, 0x65, - 0x52, 0x04, 0x61, 0x63, 0x6b, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x6e, 0x61, 0x63, 0x6b, 0x73, 0x18, - 0x08, 0x20, 0x03, 0x28, 0x0d, 0x52, 0x05, 0x6e, 0x61, 0x63, 0x6b, 0x73, 0x22, 0x40, 0x0a, 0x08, - 0x41, 0x63, 0x6b, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x5f, 0x73, 0x65, 0x71, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x53, 0x65, 0x71, 0x12, 0x17, 0x0a, 0x07, 0x65, 0x6e, 0x64, 0x5f, 0x73, 0x65, 0x71, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x06, 0x65, 0x6e, 0x64, 0x53, 0x65, 0x71, 0x22, 0x8d, - 0x01, 0x0a, 0x0b, 0x49, 0x6e, 0x69, 0x74, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1f, - 0x0a, 0x0b, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x43, 0x6f, 0x64, 0x65, 0x12, - 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x68, 0x75, 0x6e, - 0x6b, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, 0x72, 0x63, 0x33, 0x32, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x64, 0x61, 0x74, 0x61, 0x43, 0x72, 0x63, 0x33, - 0x32, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0d, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x2f, - 0x0a, 0x0c, 0x46, 0x65, 0x74, 0x63, 0x68, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x1f, - 0x0a, 0x0b, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x0d, 0x52, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x22, - 0x73, 0x0a, 0x10, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, - 0x61, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x63, 0x68, 0x75, - 0x6e, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, - 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x63, - 0x72, 0x63, 0x33, 0x32, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x64, 0x61, 0x74, 0x61, - 0x43, 0x72, 0x63, 0x33, 0x32, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x73, - 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x09, 0x63, 0x68, 0x75, 0x6e, 0x6b, - 0x53, 0x69, 0x7a, 0x65, 0x2a, 0x9e, 0x01, 0x0a, 0x0a, 0x50, 0x61, 0x63, 0x6b, 0x65, 0x74, 0x54, - 0x79, 0x70, 0x65, 0x12, 0x1b, 0x0a, 0x17, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x14, 0x0a, 0x10, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x49, 0x4e, 0x49, 0x54, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, - 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x02, 0x12, 0x15, 0x0a, 0x11, - 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x45, 0x54, 0x43, - 0x48, 0x10, 0x03, 0x12, 0x16, 0x0a, 0x12, 0x50, 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x10, 0x04, 0x12, 0x18, 0x0a, 0x14, 0x50, - 0x41, 0x43, 0x4b, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x4d, 0x50, 0x4c, - 0x45, 0x54, 0x45, 0x10, 0x05, 0x42, 0x24, 0x5a, 0x22, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x2e, 0x70, - 0x75, 0x62, 0x2f, 0x74, 0x61, 0x76, 0x65, 0x72, 0x6e, 0x2f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x2f, 0x63, 0x32, 0x2f, 0x64, 0x6e, 0x73, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -}) +const file_dns_proto_rawDesc = "" + + "\n" + + "\tdns.proto\x12\x03dns\"\xf9\x01\n" + + "\tDNSPacket\x12#\n" + + "\x04type\x18\x01 \x01(\x0e2\x0f.dns.PacketTypeR\x04type\x12\x1a\n" + + "\bsequence\x18\x02 \x01(\rR\bsequence\x12'\n" + + "\x0fconversation_id\x18\x03 \x01(\tR\x0econversationId\x12\x12\n" + + "\x04data\x18\x04 \x01(\fR\x04data\x12\x14\n" + + "\x05crc32\x18\x05 \x01(\rR\x05crc32\x12\x1f\n" + + "\vwindow_size\x18\x06 \x01(\rR\n" + + "windowSize\x12!\n" + + "\x04acks\x18\a \x03(\v2\r.dns.AckRangeR\x04acks\x12\x14\n" + + "\x05nacks\x18\b \x03(\rR\x05nacks\"@\n" + + "\bAckRange\x12\x1b\n" + + "\tstart_seq\x18\x01 \x01(\rR\bstartSeq\x12\x17\n" + + "\aend_seq\x18\x02 \x01(\rR\x06endSeq\"\x8d\x01\n" + + "\vInitPayload\x12\x1f\n" + + "\vmethod_code\x18\x01 \x01(\tR\n" + + "methodCode\x12!\n" + + "\ftotal_chunks\x18\x02 \x01(\rR\vtotalChunks\x12\x1d\n" + + "\n" + + "data_crc32\x18\x03 \x01(\rR\tdataCrc32\x12\x1b\n" + + "\tfile_size\x18\x04 \x01(\rR\bfileSize\"/\n" + + "\fFetchPayload\x12\x1f\n" + + "\vchunk_index\x18\x01 \x01(\rR\n" + + "chunkIndex\"s\n" + + "\x10ResponseMetadata\x12!\n" + + "\ftotal_chunks\x18\x01 \x01(\rR\vtotalChunks\x12\x1d\n" + + "\n" + + "data_crc32\x18\x02 \x01(\rR\tdataCrc32\x12\x1d\n" + + "\n" + + "chunk_size\x18\x03 \x01(\rR\tchunkSize*\x9e\x01\n" + + "\n" + + "PacketType\x12\x1b\n" + + "\x17PACKET_TYPE_UNSPECIFIED\x10\x00\x12\x14\n" + + "\x10PACKET_TYPE_INIT\x10\x01\x12\x14\n" + + "\x10PACKET_TYPE_DATA\x10\x02\x12\x15\n" + + "\x11PACKET_TYPE_FETCH\x10\x03\x12\x16\n" + + "\x12PACKET_TYPE_STATUS\x10\x04\x12\x18\n" + + "\x14PACKET_TYPE_COMPLETE\x10\x05B$Z\"realm.pub/tavern/internal/c2/dnspbb\x06proto3" var ( file_dns_proto_rawDescOnce sync.Once diff --git a/tavern/internal/c2/epb/eldritch.pb.go b/tavern/internal/c2/epb/eldritch.pb.go index e42d76e3c..e1a7150d1 100644 --- a/tavern/internal/c2/epb/eldritch.pb.go +++ b/tavern/internal/c2/epb/eldritch.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 +// protoc-gen-go v1.36.11 // protoc v3.21.12 // source: eldritch.proto @@ -579,92 +579,71 @@ func (x *File) GetChunk() []byte { var File_eldritch_proto protoreflect.FileDescriptor -var file_eldritch_proto_rawDesc = string([]byte{ - 0x0a, 0x0e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x08, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x22, 0xc0, 0x01, 0x0a, 0x04, 0x54, - 0x6f, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x12, - 0x3e, 0x0a, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x54, - 0x6f, 0x6d, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x52, 0x0a, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x12, - 0x1d, 0x0a, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x09, 0x52, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x1a, 0x3d, - 0x0a, 0x0f, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x65, 0x74, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xc8, 0x01, - 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x12, 0x1c, 0x0a, 0x09, - 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x09, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, - 0x63, 0x72, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x65, 0x63, 0x72, - 0x65, 0x74, 0x12, 0x2d, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x19, 0x2e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x43, 0x72, 0x65, 0x64, - 0x65, 0x6e, 0x74, 0x69, 0x61, 0x6c, 0x2e, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, - 0x64, 0x22, 0x55, 0x0a, 0x04, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x14, 0x0a, 0x10, 0x4b, 0x49, 0x4e, - 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, - 0x11, 0x0a, 0x0d, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x50, 0x41, 0x53, 0x53, 0x57, 0x4f, 0x52, 0x44, - 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x53, 0x48, 0x5f, 0x4b, - 0x45, 0x59, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x4e, 0x54, 0x4c, - 0x4d, 0x5f, 0x48, 0x41, 0x53, 0x48, 0x10, 0x03, 0x22, 0xaa, 0x04, 0x0a, 0x07, 0x50, 0x72, 0x6f, - 0x63, 0x65, 0x73, 0x73, 0x12, 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x03, 0x70, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x70, 0x69, 0x64, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x70, 0x70, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, - 0x0a, 0x09, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x70, 0x72, 0x69, 0x6e, 0x63, 0x69, 0x70, 0x61, 0x6c, 0x12, 0x12, 0x0a, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x63, - 0x6d, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x65, 0x6e, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x65, 0x6e, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x77, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x03, 0x63, 0x77, 0x64, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, - 0x68, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, - 0x74, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x73, 0x74, - 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x22, 0xab, 0x02, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x53, - 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, - 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x01, 0x12, 0x0f, - 0x0a, 0x0b, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x49, 0x44, 0x4c, 0x45, 0x10, 0x02, 0x12, - 0x0e, 0x0a, 0x0a, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x52, 0x55, 0x4e, 0x10, 0x03, 0x12, - 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53, 0x4c, 0x45, 0x45, 0x50, 0x10, - 0x04, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x53, 0x54, 0x4f, 0x50, - 0x10, 0x05, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x5a, 0x4f, 0x4d, - 0x42, 0x49, 0x45, 0x10, 0x06, 0x12, 0x12, 0x0a, 0x0e, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, - 0x54, 0x52, 0x41, 0x43, 0x49, 0x4e, 0x47, 0x10, 0x07, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x41, - 0x54, 0x55, 0x53, 0x5f, 0x44, 0x45, 0x41, 0x44, 0x10, 0x08, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, - 0x41, 0x54, 0x55, 0x53, 0x5f, 0x57, 0x41, 0x4b, 0x45, 0x5f, 0x4b, 0x49, 0x4c, 0x4c, 0x10, 0x09, - 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x57, 0x41, 0x4b, 0x49, 0x4e, - 0x47, 0x10, 0x0a, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x50, 0x41, - 0x52, 0x4b, 0x45, 0x44, 0x10, 0x0b, 0x12, 0x17, 0x0a, 0x13, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, - 0x5f, 0x4c, 0x4f, 0x43, 0x4b, 0x5f, 0x42, 0x4c, 0x4f, 0x43, 0x4b, 0x45, 0x44, 0x10, 0x0c, 0x12, - 0x24, 0x0a, 0x20, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x49, 0x4e, 0x54, 0x45, - 0x52, 0x55, 0x50, 0x54, 0x49, 0x42, 0x4c, 0x45, 0x5f, 0x44, 0x49, 0x53, 0x4b, 0x5f, 0x53, 0x4c, - 0x45, 0x45, 0x50, 0x10, 0x0d, 0x22, 0x34, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, - 0x4c, 0x69, 0x73, 0x74, 0x12, 0x25, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x50, 0x72, - 0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0xa8, 0x01, 0x0a, 0x0c, - 0x46, 0x69, 0x6c, 0x65, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x12, 0x0a, 0x04, - 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x12, 0x14, 0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x67, 0x72, 0x6f, 0x75, 0x70, 0x12, 0x20, 0x0a, 0x0b, - 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x70, 0x65, 0x72, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x12, - 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x69, - 0x7a, 0x65, 0x12, 0x22, 0x0a, 0x0d, 0x73, 0x68, 0x61, 0x33, 0x5f, 0x32, 0x35, 0x36, 0x5f, 0x68, - 0x61, 0x73, 0x68, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x68, 0x61, 0x33, 0x32, - 0x35, 0x36, 0x48, 0x61, 0x73, 0x68, 0x22, 0x50, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x32, - 0x0a, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x16, 0x2e, 0x65, 0x6c, 0x64, 0x72, 0x69, 0x74, 0x63, 0x68, 0x2e, 0x46, 0x69, 0x6c, 0x65, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x52, 0x08, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x05, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x42, 0x22, 0x5a, 0x20, 0x72, 0x65, 0x61, 0x6c, - 0x6d, 0x2e, 0x70, 0x75, 0x62, 0x2f, 0x74, 0x61, 0x76, 0x65, 0x72, 0x6e, 0x2f, 0x69, 0x6e, 0x74, - 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x63, 0x32, 0x2f, 0x65, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, -}) +const file_eldritch_proto_rawDesc = "" + + "\n" + + "\x0eeldritch.proto\x12\beldritch\"\xc0\x01\n" + + "\x04Tome\x12\x1a\n" + + "\beldritch\x18\x01 \x01(\tR\beldritch\x12>\n" + + "\n" + + "parameters\x18\x02 \x03(\v2\x1e.eldritch.Tome.ParametersEntryR\n" + + "parameters\x12\x1d\n" + + "\n" + + "file_names\x18\x03 \x03(\tR\tfileNames\x1a=\n" + + "\x0fParametersEntry\x12\x10\n" + + "\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" + + "\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\xc8\x01\n" + + "\n" + + "Credential\x12\x1c\n" + + "\tprincipal\x18\x01 \x01(\tR\tprincipal\x12\x16\n" + + "\x06secret\x18\x02 \x01(\tR\x06secret\x12-\n" + + "\x04kind\x18\x03 \x01(\x0e2\x19.eldritch.Credential.KindR\x04kind\"U\n" + + "\x04Kind\x12\x14\n" + + "\x10KIND_UNSPECIFIED\x10\x00\x12\x11\n" + + "\rKIND_PASSWORD\x10\x01\x12\x10\n" + + "\fKIND_SSH_KEY\x10\x02\x12\x12\n" + + "\x0eKIND_NTLM_HASH\x10\x03\"\xaa\x04\n" + + "\aProcess\x12\x10\n" + + "\x03pid\x18\x01 \x01(\x04R\x03pid\x12\x12\n" + + "\x04ppid\x18\x02 \x01(\x04R\x04ppid\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\x12\x1c\n" + + "\tprincipal\x18\x04 \x01(\tR\tprincipal\x12\x12\n" + + "\x04path\x18\x05 \x01(\tR\x04path\x12\x10\n" + + "\x03cmd\x18\x06 \x01(\tR\x03cmd\x12\x10\n" + + "\x03env\x18\a \x01(\tR\x03env\x12\x10\n" + + "\x03cwd\x18\b \x01(\tR\x03cwd\x120\n" + + "\x06status\x18\t \x01(\x0e2\x18.eldritch.Process.StatusR\x06status\x12\x1d\n" + + "\n" + + "start_time\x18\n" + + " \x01(\x04R\tstartTime\"\xab\x02\n" + + "\x06Status\x12\x16\n" + + "\x12STATUS_UNSPECIFIED\x10\x00\x12\x12\n" + + "\x0eSTATUS_UNKNOWN\x10\x01\x12\x0f\n" + + "\vSTATUS_IDLE\x10\x02\x12\x0e\n" + + "\n" + + "STATUS_RUN\x10\x03\x12\x10\n" + + "\fSTATUS_SLEEP\x10\x04\x12\x0f\n" + + "\vSTATUS_STOP\x10\x05\x12\x11\n" + + "\rSTATUS_ZOMBIE\x10\x06\x12\x12\n" + + "\x0eSTATUS_TRACING\x10\a\x12\x0f\n" + + "\vSTATUS_DEAD\x10\b\x12\x14\n" + + "\x10STATUS_WAKE_KILL\x10\t\x12\x11\n" + + "\rSTATUS_WAKING\x10\n" + + "\x12\x11\n" + + "\rSTATUS_PARKED\x10\v\x12\x17\n" + + "\x13STATUS_LOCK_BLOCKED\x10\f\x12$\n" + + " STATUS_UNINTERUPTIBLE_DISK_SLEEP\x10\r\"4\n" + + "\vProcessList\x12%\n" + + "\x04list\x18\x01 \x03(\v2\x11.eldritch.ProcessR\x04list\"\xa8\x01\n" + + "\fFileMetadata\x12\x12\n" + + "\x04path\x18\x01 \x01(\tR\x04path\x12\x14\n" + + "\x05owner\x18\x02 \x01(\tR\x05owner\x12\x14\n" + + "\x05group\x18\x03 \x01(\tR\x05group\x12 \n" + + "\vpermissions\x18\x04 \x01(\tR\vpermissions\x12\x12\n" + + "\x04size\x18\x05 \x01(\x04R\x04size\x12\"\n" + + "\rsha3_256_hash\x18\x06 \x01(\tR\vsha3256Hash\"P\n" + + "\x04File\x122\n" + + "\bmetadata\x18\x01 \x01(\v2\x16.eldritch.FileMetadataR\bmetadata\x12\x14\n" + + "\x05chunk\x18\x02 \x01(\fR\x05chunkB\"Z realm.pub/tavern/internal/c2/epbb\x06proto3" var ( file_eldritch_proto_rawDescOnce sync.Once diff --git a/tavern/internal/ent/client.go b/tavern/internal/ent/client.go index c3039944a..591bbb2c5 100644 --- a/tavern/internal/ent/client.go +++ b/tavern/internal/ent/client.go @@ -3059,6 +3059,22 @@ func (c *ScheduledTaskClient) QueryQuests(st *ScheduledTask) *QuestQuery { return query } +// QueryCreator queries the creator edge of a ScheduledTask. +func (c *ScheduledTaskClient) QueryCreator(st *ScheduledTask) *UserQuery { + query := (&UserClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := st.ID + step := sqlgraph.NewStep( + sqlgraph.From(scheduledtask.Table, scheduledtask.FieldID, id), + sqlgraph.To(user.Table, user.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, scheduledtask.CreatorTable, scheduledtask.CreatorColumn), + ) + fromV = sqlgraph.Neighbors(st.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *ScheduledTaskClient) Hooks() []Hook { return c.hooks.ScheduledTask @@ -4457,6 +4473,22 @@ func (c *UserClient) QueryDeviceAuths(u *User) *DeviceAuthQuery { return query } +// QueryScheduledTasks queries the scheduled_tasks edge of a User. +func (c *UserClient) QueryScheduledTasks(u *User) *ScheduledTaskQuery { + query := (&ScheduledTaskClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := u.ID + step := sqlgraph.NewStep( + sqlgraph.From(user.Table, user.FieldID, id), + sqlgraph.To(scheduledtask.Table, scheduledtask.FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, user.ScheduledTasksTable, user.ScheduledTasksColumn), + ) + fromV = sqlgraph.Neighbors(u.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *UserClient) Hooks() []Hook { return c.hooks.User diff --git a/tavern/internal/ent/gql_collection.go b/tavern/internal/ent/gql_collection.go index 5c5bceea5..29349ffad 100644 --- a/tavern/internal/ent/gql_collection.go +++ b/tavern/internal/ent/gql_collection.go @@ -3592,6 +3592,17 @@ func (st *ScheduledTaskQuery) collectField(ctx context.Context, oneNode bool, op st.WithNamedQuests(alias, func(wq *QuestQuery) { *wq = *query }) + + case "creator": + var ( + alias = field.Alias + path = append(path, alias) + query = (&UserClient{config: st.config}).Query() + ) + if err := query.collectField(ctx, oneNode, opCtx, field, path, mayAddCondition(satisfies, userImplementors)...); err != nil { + return err + } + st.withCreator = query case "createdAt": if _, ok := fieldSeen[scheduledtask.FieldCreatedAt]; !ok { selectedFields = append(selectedFields, scheduledtask.FieldCreatedAt) @@ -5733,6 +5744,95 @@ func (u *UserQuery) collectField(ctx context.Context, oneNode bool, opCtx *graph u.WithNamedDeviceAuths(alias, func(wq *DeviceAuthQuery) { *wq = *query }) + + case "scheduledTasks": + var ( + alias = field.Alias + path = append(path, alias) + query = (&ScheduledTaskClient{config: u.config}).Query() + ) + args := newScheduledTaskPaginateArgs(fieldArgs(ctx, new(ScheduledTaskWhereInput), path...)) + if err := validateFirstLast(args.first, args.last); err != nil { + return fmt.Errorf("validate first and last in path %q: %w", path, err) + } + pager, err := newScheduledTaskPager(args.opts, args.last != nil) + if err != nil { + return fmt.Errorf("create new pager in path %q: %w", path, err) + } + if query, err = pager.applyFilter(query); err != nil { + return err + } + ignoredEdges := !hasCollectedField(ctx, append(path, edgesField)...) + if hasCollectedField(ctx, append(path, totalCountField)...) || hasCollectedField(ctx, append(path, pageInfoField)...) { + hasPagination := args.after != nil || args.first != nil || args.before != nil || args.last != nil + if hasPagination || ignoredEdges { + query := query.Clone() + u.loadTotal = append(u.loadTotal, func(ctx context.Context, nodes []*User) error { + ids := make([]driver.Value, len(nodes)) + for i := range nodes { + ids[i] = nodes[i].ID + } + var v []struct { + NodeID int `sql:"scheduled_task_creator"` + Count int `sql:"count"` + } + query.Where(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(user.ScheduledTasksColumn), ids...)) + }) + if err := query.GroupBy(user.ScheduledTasksColumn).Aggregate(Count()).Scan(ctx, &v); err != nil { + return err + } + m := make(map[int]int, len(v)) + for i := range v { + m[v[i].NodeID] = v[i].Count + } + for i := range nodes { + n := m[nodes[i].ID] + if nodes[i].Edges.totalCount[3] == nil { + nodes[i].Edges.totalCount[3] = make(map[string]int) + } + nodes[i].Edges.totalCount[3][alias] = n + } + return nil + }) + } else { + u.loadTotal = append(u.loadTotal, func(_ context.Context, nodes []*User) error { + for i := range nodes { + n := len(nodes[i].Edges.ScheduledTasks) + if nodes[i].Edges.totalCount[3] == nil { + nodes[i].Edges.totalCount[3] = make(map[string]int) + } + nodes[i].Edges.totalCount[3][alias] = n + } + return nil + }) + } + } + if ignoredEdges || (args.first != nil && *args.first == 0) || (args.last != nil && *args.last == 0) { + continue + } + if query, err = pager.applyCursors(query, args.after, args.before); err != nil { + return err + } + path = append(path, edgesField, nodeField) + if field := collectedField(ctx, path...); field != nil { + if err := query.collectField(ctx, false, opCtx, *field, path, mayAddCondition(satisfies, scheduledtaskImplementors)...); err != nil { + return err + } + } + if limit := paginateLimit(args.first, args.last); limit > 0 { + if oneNode { + pager.applyOrder(query.Limit(limit)) + } else { + modify := entgql.LimitPerRow(user.ScheduledTasksColumn, limit, pager.orderExpr(query)) + query.modifiers = append(query.modifiers, modify) + } + } else { + query = pager.applyOrder(query) + } + u.WithNamedScheduledTasks(alias, func(wq *ScheduledTaskQuery) { + *wq = *query + }) case "name": if _, ok := fieldSeen[user.FieldName]; !ok { selectedFields = append(selectedFields, user.FieldName) diff --git a/tavern/internal/ent/gql_edge.go b/tavern/internal/ent/gql_edge.go index 81e8fff09..5f4a7195e 100644 --- a/tavern/internal/ent/gql_edge.go +++ b/tavern/internal/ent/gql_edge.go @@ -572,6 +572,14 @@ func (st *ScheduledTask) Quests( return st.QueryQuests().Paginate(ctx, after, first, before, last, opts...) } +func (st *ScheduledTask) Creator(ctx context.Context) (*User, error) { + result, err := st.Edges.CreatorOrErr() + if IsNotLoaded(err) { + result, err = st.QueryCreator().Only(ctx) + } + return result, MaskNotFound(err) +} + func (s *Screenshot) Host(ctx context.Context) (*Host, error) { result, err := s.Edges.HostOrErr() if IsNotLoaded(err) { @@ -979,3 +987,24 @@ func (u *User) DeviceAuths( } return u.QueryDeviceAuths().Paginate(ctx, after, first, before, last, opts...) } + +func (u *User) ScheduledTasks( + ctx context.Context, after *Cursor, first *int, before *Cursor, last *int, orderBy []*ScheduledTaskOrder, where *ScheduledTaskWhereInput, +) (*ScheduledTaskConnection, error) { + opts := []ScheduledTaskPaginateOption{ + WithScheduledTaskOrder(orderBy), + WithScheduledTaskFilter(where.Filter), + } + alias := graphql.GetFieldContext(ctx).Field.Alias + totalCount, hasTotalCount := u.Edges.totalCount[3][alias] + if nodes, err := u.NamedScheduledTasks(alias); err == nil || hasTotalCount { + pager, err := newScheduledTaskPager(opts, last != nil) + if err != nil { + return nil, err + } + conn := &ScheduledTaskConnection{Edges: []*ScheduledTaskEdge{}, TotalCount: totalCount} + conn.build(nodes, pager, after, first, before, last) + return conn, nil + } + return u.QueryScheduledTasks().Paginate(ctx, after, first, before, last, opts...) +} diff --git a/tavern/internal/ent/gql_mutation_input.go b/tavern/internal/ent/gql_mutation_input.go index 21429190c..86ea407b0 100644 --- a/tavern/internal/ent/gql_mutation_input.go +++ b/tavern/internal/ent/gql_mutation_input.go @@ -680,19 +680,22 @@ func (c *TomeUpdateOne) SetInput(i UpdateTomeInput) *TomeUpdateOne { // UpdateUserInput represents a mutation input for updating users. type UpdateUserInput struct { - Name *string - PhotoURL *string - IsActivated *bool - IsAdmin *bool - ClearTomes bool - AddTomeIDs []int - RemoveTomeIDs []int - ClearActiveShells bool - AddActiveShellIDs []int - RemoveActiveShellIDs []int - ClearDeviceAuths bool - AddDeviceAuthIDs []int - RemoveDeviceAuthIDs []int + Name *string + PhotoURL *string + IsActivated *bool + IsAdmin *bool + ClearTomes bool + AddTomeIDs []int + RemoveTomeIDs []int + ClearActiveShells bool + AddActiveShellIDs []int + RemoveActiveShellIDs []int + ClearDeviceAuths bool + AddDeviceAuthIDs []int + RemoveDeviceAuthIDs []int + ClearScheduledTasks bool + AddScheduledTaskIDs []int + RemoveScheduledTaskIDs []int } // Mutate applies the UpdateUserInput on the UserMutation builder. @@ -736,6 +739,15 @@ func (i *UpdateUserInput) Mutate(m *UserMutation) { if v := i.RemoveDeviceAuthIDs; len(v) > 0 { m.RemoveDeviceAuthIDs(v...) } + if i.ClearScheduledTasks { + m.ClearScheduledTasks() + } + if v := i.AddScheduledTaskIDs; len(v) > 0 { + m.AddScheduledTaskIDs(v...) + } + if v := i.RemoveScheduledTaskIDs; len(v) > 0 { + m.RemoveScheduledTaskIDs(v...) + } } // SetInput applies the change-set in the UpdateUserInput on the UserUpdate builder. diff --git a/tavern/internal/ent/gql_where_input.go b/tavern/internal/ent/gql_where_input.go index 16eba45da..b196cda54 100644 --- a/tavern/internal/ent/gql_where_input.go +++ b/tavern/internal/ent/gql_where_input.go @@ -7431,6 +7431,10 @@ type ScheduledTaskWhereInput struct { // "quests" edge predicates. HasQuests *bool `json:"hasQuests,omitempty"` HasQuestsWith []*QuestWhereInput `json:"hasQuestsWith,omitempty"` + + // "creator" edge predicates. + HasCreator *bool `json:"hasCreator,omitempty"` + HasCreatorWith []*UserWhereInput `json:"hasCreatorWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -7811,6 +7815,24 @@ func (i *ScheduledTaskWhereInput) P() (predicate.ScheduledTask, error) { } predicates = append(predicates, scheduledtask.HasQuestsWith(with...)) } + if i.HasCreator != nil { + p := scheduledtask.HasCreator() + if !*i.HasCreator { + p = scheduledtask.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasCreatorWith) > 0 { + with := make([]predicate.User, 0, len(i.HasCreatorWith)) + for _, w := range i.HasCreatorWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasCreatorWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, scheduledtask.HasCreatorWith(with...)) + } switch len(predicates) { case 0: return nil, ErrEmptyScheduledTaskWhereInput @@ -10812,6 +10834,10 @@ type UserWhereInput struct { // "device_auths" edge predicates. HasDeviceAuths *bool `json:"hasDeviceAuths,omitempty"` HasDeviceAuthsWith []*DeviceAuthWhereInput `json:"hasDeviceAuthsWith,omitempty"` + + // "scheduled_tasks" edge predicates. + HasScheduledTasks *bool `json:"hasScheduledTasks,omitempty"` + HasScheduledTasksWith []*ScheduledTaskWhereInput `json:"hasScheduledTasksWith,omitempty"` } // AddPredicates adds custom predicates to the where input to be used during the filtering phase. @@ -11093,6 +11119,24 @@ func (i *UserWhereInput) P() (predicate.User, error) { } predicates = append(predicates, user.HasDeviceAuthsWith(with...)) } + if i.HasScheduledTasks != nil { + p := user.HasScheduledTasks() + if !*i.HasScheduledTasks { + p = user.Not(p) + } + predicates = append(predicates, p) + } + if len(i.HasScheduledTasksWith) > 0 { + with := make([]predicate.ScheduledTask, 0, len(i.HasScheduledTasksWith)) + for _, w := range i.HasScheduledTasksWith { + p, err := w.P() + if err != nil { + return nil, fmt.Errorf("%w: field 'HasScheduledTasksWith'", err) + } + with = append(with, p) + } + predicates = append(predicates, user.HasScheduledTasksWith(with...)) + } switch len(predicates) { case 0: return nil, ErrEmptyUserWhereInput diff --git a/tavern/internal/ent/migrate/schema.go b/tavern/internal/ent/migrate/schema.go index 6d3d70e7c..df273e8bc 100644 --- a/tavern/internal/ent/migrate/schema.go +++ b/tavern/internal/ent/migrate/schema.go @@ -507,6 +507,7 @@ var ( {Name: "run_on_schedule", Type: field.TypeString, Default: ""}, {Name: "disabled", Type: field.TypeBool, Default: false}, {Name: "scheduled_task_tome", Type: field.TypeInt}, + {Name: "scheduled_task_creator", Type: field.TypeInt, Nullable: true}, } // ScheduledTasksTable holds the schema information for the "scheduled_tasks" table. ScheduledTasksTable = &schema.Table{ @@ -520,6 +521,12 @@ var ( RefColumns: []*schema.Column{TomesColumns[0]}, OnDelete: schema.NoAction, }, + { + Symbol: "scheduled_tasks_users_creator", + Columns: []*schema.Column{ScheduledTasksColumns[11]}, + RefColumns: []*schema.Column{UsersColumns[0]}, + OnDelete: schema.SetNull, + }, }, } // ScreenshotsColumns holds the columns for the "screenshots" table. @@ -922,6 +929,7 @@ func init() { Collation: "utf8mb4_general_ci", } ScheduledTasksTable.ForeignKeys[0].RefTable = TomesTable + ScheduledTasksTable.ForeignKeys[1].RefTable = UsersTable ScheduledTasksTable.Annotation = &entsql.Annotation{ Collation: "utf8mb4_general_ci", } diff --git a/tavern/internal/ent/mutation.go b/tavern/internal/ent/mutation.go index 7295a4e82..d937db914 100644 --- a/tavern/internal/ent/mutation.go +++ b/tavern/internal/ent/mutation.go @@ -14013,6 +14013,8 @@ type ScheduledTaskMutation struct { quests map[int]struct{} removedquests map[int]struct{} clearedquests bool + creator *int + clearedcreator bool done bool oldValue func(context.Context) (*ScheduledTask, error) predicates []predicate.ScheduledTask @@ -14600,6 +14602,45 @@ func (m *ScheduledTaskMutation) ResetQuests() { m.removedquests = nil } +// SetCreatorID sets the "creator" edge to the User entity by id. +func (m *ScheduledTaskMutation) SetCreatorID(id int) { + m.creator = &id +} + +// ClearCreator clears the "creator" edge to the User entity. +func (m *ScheduledTaskMutation) ClearCreator() { + m.clearedcreator = true +} + +// CreatorCleared reports if the "creator" edge to the User entity was cleared. +func (m *ScheduledTaskMutation) CreatorCleared() bool { + return m.clearedcreator +} + +// CreatorID returns the "creator" edge ID in the mutation. +func (m *ScheduledTaskMutation) CreatorID() (id int, exists bool) { + if m.creator != nil { + return *m.creator, true + } + return +} + +// CreatorIDs returns the "creator" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// CreatorID instead. It exists only for internal usage by the builders. +func (m *ScheduledTaskMutation) CreatorIDs() (ids []int) { + if id := m.creator; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetCreator resets all changes to the "creator" edge. +func (m *ScheduledTaskMutation) ResetCreator() { + m.creator = nil + m.clearedcreator = false +} + // Where appends a list predicates to the ScheduledTaskMutation builder. func (m *ScheduledTaskMutation) Where(ps ...predicate.ScheduledTask) { m.predicates = append(m.predicates, ps...) @@ -14878,7 +14919,7 @@ func (m *ScheduledTaskMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *ScheduledTaskMutation) AddedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.tome != nil { edges = append(edges, scheduledtask.EdgeTome) } @@ -14888,6 +14929,9 @@ func (m *ScheduledTaskMutation) AddedEdges() []string { if m.quests != nil { edges = append(edges, scheduledtask.EdgeQuests) } + if m.creator != nil { + edges = append(edges, scheduledtask.EdgeCreator) + } return edges } @@ -14911,13 +14955,17 @@ func (m *ScheduledTaskMutation) AddedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case scheduledtask.EdgeCreator: + if id := m.creator; id != nil { + return []ent.Value{*id} + } } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *ScheduledTaskMutation) RemovedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.removedscheduled_hosts != nil { edges = append(edges, scheduledtask.EdgeScheduledHosts) } @@ -14949,7 +14997,7 @@ func (m *ScheduledTaskMutation) RemovedIDs(name string) []ent.Value { // ClearedEdges returns all edge names that were cleared in this mutation. func (m *ScheduledTaskMutation) ClearedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.clearedtome { edges = append(edges, scheduledtask.EdgeTome) } @@ -14959,6 +15007,9 @@ func (m *ScheduledTaskMutation) ClearedEdges() []string { if m.clearedquests { edges = append(edges, scheduledtask.EdgeQuests) } + if m.clearedcreator { + edges = append(edges, scheduledtask.EdgeCreator) + } return edges } @@ -14972,6 +15023,8 @@ func (m *ScheduledTaskMutation) EdgeCleared(name string) bool { return m.clearedscheduled_hosts case scheduledtask.EdgeQuests: return m.clearedquests + case scheduledtask.EdgeCreator: + return m.clearedcreator } return false } @@ -14983,6 +15036,9 @@ func (m *ScheduledTaskMutation) ClearEdge(name string) error { case scheduledtask.EdgeTome: m.ClearTome() return nil + case scheduledtask.EdgeCreator: + m.ClearCreator() + return nil } return fmt.Errorf("unknown ScheduledTask unique edge %s", name) } @@ -15000,6 +15056,9 @@ func (m *ScheduledTaskMutation) ResetEdge(name string) error { case scheduledtask.EdgeQuests: m.ResetQuests() return nil + case scheduledtask.EdgeCreator: + m.ResetCreator() + return nil } return fmt.Errorf("unknown ScheduledTask edge %s", name) } @@ -21116,29 +21175,32 @@ func (m *TomeMutation) ResetEdge(name string) error { // UserMutation represents an operation that mutates the User nodes in the graph. type UserMutation struct { config - op Op - typ string - id *int - name *string - oauth_id *string - photo_url *string - session_token *string - access_token *string - is_activated *bool - is_admin *bool - clearedFields map[string]struct{} - tomes map[int]struct{} - removedtomes map[int]struct{} - clearedtomes bool - active_shells map[int]struct{} - removedactive_shells map[int]struct{} - clearedactive_shells bool - device_auths map[int]struct{} - removeddevice_auths map[int]struct{} - cleareddevice_auths bool - done bool - oldValue func(context.Context) (*User, error) - predicates []predicate.User + op Op + typ string + id *int + name *string + oauth_id *string + photo_url *string + session_token *string + access_token *string + is_activated *bool + is_admin *bool + clearedFields map[string]struct{} + tomes map[int]struct{} + removedtomes map[int]struct{} + clearedtomes bool + active_shells map[int]struct{} + removedactive_shells map[int]struct{} + clearedactive_shells bool + device_auths map[int]struct{} + removeddevice_auths map[int]struct{} + cleareddevice_auths bool + scheduled_tasks map[int]struct{} + removedscheduled_tasks map[int]struct{} + clearedscheduled_tasks bool + done bool + oldValue func(context.Context) (*User, error) + predicates []predicate.User } var _ ent.Mutation = (*UserMutation)(nil) @@ -21653,6 +21715,60 @@ func (m *UserMutation) ResetDeviceAuths() { m.removeddevice_auths = nil } +// AddScheduledTaskIDs adds the "scheduled_tasks" edge to the ScheduledTask entity by ids. +func (m *UserMutation) AddScheduledTaskIDs(ids ...int) { + if m.scheduled_tasks == nil { + m.scheduled_tasks = make(map[int]struct{}) + } + for i := range ids { + m.scheduled_tasks[ids[i]] = struct{}{} + } +} + +// ClearScheduledTasks clears the "scheduled_tasks" edge to the ScheduledTask entity. +func (m *UserMutation) ClearScheduledTasks() { + m.clearedscheduled_tasks = true +} + +// ScheduledTasksCleared reports if the "scheduled_tasks" edge to the ScheduledTask entity was cleared. +func (m *UserMutation) ScheduledTasksCleared() bool { + return m.clearedscheduled_tasks +} + +// RemoveScheduledTaskIDs removes the "scheduled_tasks" edge to the ScheduledTask entity by IDs. +func (m *UserMutation) RemoveScheduledTaskIDs(ids ...int) { + if m.removedscheduled_tasks == nil { + m.removedscheduled_tasks = make(map[int]struct{}) + } + for i := range ids { + delete(m.scheduled_tasks, ids[i]) + m.removedscheduled_tasks[ids[i]] = struct{}{} + } +} + +// RemovedScheduledTasks returns the removed IDs of the "scheduled_tasks" edge to the ScheduledTask entity. +func (m *UserMutation) RemovedScheduledTasksIDs() (ids []int) { + for id := range m.removedscheduled_tasks { + ids = append(ids, id) + } + return +} + +// ScheduledTasksIDs returns the "scheduled_tasks" edge IDs in the mutation. +func (m *UserMutation) ScheduledTasksIDs() (ids []int) { + for id := range m.scheduled_tasks { + ids = append(ids, id) + } + return +} + +// ResetScheduledTasks resets all changes to the "scheduled_tasks" edge. +func (m *UserMutation) ResetScheduledTasks() { + m.scheduled_tasks = nil + m.clearedscheduled_tasks = false + m.removedscheduled_tasks = nil +} + // Where appends a list predicates to the UserMutation builder. func (m *UserMutation) Where(ps ...predicate.User) { m.predicates = append(m.predicates, ps...) @@ -21888,7 +22004,7 @@ func (m *UserMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *UserMutation) AddedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.tomes != nil { edges = append(edges, user.EdgeTomes) } @@ -21898,6 +22014,9 @@ func (m *UserMutation) AddedEdges() []string { if m.device_auths != nil { edges = append(edges, user.EdgeDeviceAuths) } + if m.scheduled_tasks != nil { + edges = append(edges, user.EdgeScheduledTasks) + } return edges } @@ -21923,13 +22042,19 @@ func (m *UserMutation) AddedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case user.EdgeScheduledTasks: + ids := make([]ent.Value, 0, len(m.scheduled_tasks)) + for id := range m.scheduled_tasks { + ids = append(ids, id) + } + return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *UserMutation) RemovedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.removedtomes != nil { edges = append(edges, user.EdgeTomes) } @@ -21939,6 +22064,9 @@ func (m *UserMutation) RemovedEdges() []string { if m.removeddevice_auths != nil { edges = append(edges, user.EdgeDeviceAuths) } + if m.removedscheduled_tasks != nil { + edges = append(edges, user.EdgeScheduledTasks) + } return edges } @@ -21964,13 +22092,19 @@ func (m *UserMutation) RemovedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case user.EdgeScheduledTasks: + ids := make([]ent.Value, 0, len(m.removedscheduled_tasks)) + for id := range m.removedscheduled_tasks { + ids = append(ids, id) + } + return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *UserMutation) ClearedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.clearedtomes { edges = append(edges, user.EdgeTomes) } @@ -21980,6 +22114,9 @@ func (m *UserMutation) ClearedEdges() []string { if m.cleareddevice_auths { edges = append(edges, user.EdgeDeviceAuths) } + if m.clearedscheduled_tasks { + edges = append(edges, user.EdgeScheduledTasks) + } return edges } @@ -21993,6 +22130,8 @@ func (m *UserMutation) EdgeCleared(name string) bool { return m.clearedactive_shells case user.EdgeDeviceAuths: return m.cleareddevice_auths + case user.EdgeScheduledTasks: + return m.clearedscheduled_tasks } return false } @@ -22018,6 +22157,9 @@ func (m *UserMutation) ResetEdge(name string) error { case user.EdgeDeviceAuths: m.ResetDeviceAuths() return nil + case user.EdgeScheduledTasks: + m.ResetScheduledTasks() + return nil } return fmt.Errorf("unknown User edge %s", name) } diff --git a/tavern/internal/ent/scheduledtask.go b/tavern/internal/ent/scheduledtask.go index 87239d338..3cd13f016 100644 --- a/tavern/internal/ent/scheduledtask.go +++ b/tavern/internal/ent/scheduledtask.go @@ -11,6 +11,7 @@ import ( "entgo.io/ent/dialect/sql" "realm.pub/tavern/internal/ent/scheduledtask" "realm.pub/tavern/internal/ent/tome" + "realm.pub/tavern/internal/ent/user" ) // ScheduledTask is the model entity for the ScheduledTask schema. @@ -38,9 +39,10 @@ type ScheduledTask struct { Disabled bool `json:"disabled,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the ScheduledTaskQuery when eager-loading is set. - Edges ScheduledTaskEdges `json:"edges"` - scheduled_task_tome *int - selectValues sql.SelectValues + Edges ScheduledTaskEdges `json:"edges"` + scheduled_task_tome *int + scheduled_task_creator *int + selectValues sql.SelectValues } // ScheduledTaskEdges holds the relations/edges for other nodes in the graph. @@ -51,11 +53,13 @@ type ScheduledTaskEdges struct { ScheduledHosts []*Host `json:"scheduled_hosts,omitempty"` // Quests that were created from this scheduled task. Quests []*Quest `json:"quests,omitempty"` + // User that created the scheduled task if available. + Creator *User `json:"creator,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [3]bool + loadedTypes [4]bool // totalCount holds the count of the edges above. - totalCount [3]map[string]int + totalCount [4]map[string]int namedScheduledHosts map[string][]*Host namedQuests map[string][]*Quest @@ -90,6 +94,17 @@ func (e ScheduledTaskEdges) QuestsOrErr() ([]*Quest, error) { return nil, &NotLoadedError{edge: "quests"} } +// CreatorOrErr returns the Creator value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e ScheduledTaskEdges) CreatorOrErr() (*User, error) { + if e.Creator != nil { + return e.Creator, nil + } else if e.loadedTypes[3] { + return nil, &NotFoundError{label: user.Label} + } + return nil, &NotLoadedError{edge: "creator"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*ScheduledTask) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -105,6 +120,8 @@ func (*ScheduledTask) scanValues(columns []string) ([]any, error) { values[i] = new(sql.NullTime) case scheduledtask.ForeignKeys[0]: // scheduled_task_tome values[i] = new(sql.NullInt64) + case scheduledtask.ForeignKeys[1]: // scheduled_task_creator + values[i] = new(sql.NullInt64) default: values[i] = new(sql.UnknownType) } @@ -187,6 +204,13 @@ func (st *ScheduledTask) assignValues(columns []string, values []any) error { st.scheduled_task_tome = new(int) *st.scheduled_task_tome = int(value.Int64) } + case scheduledtask.ForeignKeys[1]: + if value, ok := values[i].(*sql.NullInt64); !ok { + return fmt.Errorf("unexpected type %T for edge-field scheduled_task_creator", value) + } else if value.Valid { + st.scheduled_task_creator = new(int) + *st.scheduled_task_creator = int(value.Int64) + } default: st.selectValues.Set(columns[i], values[i]) } @@ -215,6 +239,11 @@ func (st *ScheduledTask) QueryQuests() *QuestQuery { return NewScheduledTaskClient(st.config).QueryQuests(st) } +// QueryCreator queries the "creator" edge of the ScheduledTask entity. +func (st *ScheduledTask) QueryCreator() *UserQuery { + return NewScheduledTaskClient(st.config).QueryCreator(st) +} + // Update returns a builder for updating this ScheduledTask. // Note that you need to call ScheduledTask.Unwrap() before calling this method if this ScheduledTask // was returned from a transaction, and the transaction was committed or rolled back. diff --git a/tavern/internal/ent/scheduledtask/scheduledtask.go b/tavern/internal/ent/scheduledtask/scheduledtask.go index c83c24f05..cf44a31aa 100644 --- a/tavern/internal/ent/scheduledtask/scheduledtask.go +++ b/tavern/internal/ent/scheduledtask/scheduledtask.go @@ -38,6 +38,8 @@ const ( EdgeScheduledHosts = "scheduled_hosts" // EdgeQuests holds the string denoting the quests edge name in mutations. EdgeQuests = "quests" + // EdgeCreator holds the string denoting the creator edge name in mutations. + EdgeCreator = "creator" // Table holds the table name of the scheduledtask in the database. Table = "scheduled_tasks" // TomeTable is the table that holds the tome relation/edge. @@ -61,6 +63,13 @@ const ( QuestsInverseTable = "quests" // QuestsColumn is the table column denoting the quests relation/edge. QuestsColumn = "scheduled_task_quests" + // CreatorTable is the table that holds the creator relation/edge. + CreatorTable = "scheduled_tasks" + // CreatorInverseTable is the table name for the User entity. + // It exists in this package in order to avoid circular dependency with the "user" package. + CreatorInverseTable = "users" + // CreatorColumn is the table column denoting the creator relation/edge. + CreatorColumn = "scheduled_task_creator" ) // Columns holds all SQL columns for scheduledtask fields. @@ -81,6 +90,7 @@ var Columns = []string{ // table and are not defined as standalone fields in the schema. var ForeignKeys = []string{ "scheduled_task_tome", + "scheduled_task_creator", } // ValidColumn reports if the column name is valid (part of the table columns). @@ -206,6 +216,13 @@ func ByQuests(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { sqlgraph.OrderByNeighborTerms(s, newQuestsStep(), append([]sql.OrderTerm{term}, terms...)...) } } + +// ByCreatorField orders the results by creator field. +func ByCreatorField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newCreatorStep(), sql.OrderByField(field, opts...)) + } +} func newTomeStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -227,3 +244,10 @@ func newQuestsStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.O2M, false, QuestsTable, QuestsColumn), ) } +func newCreatorStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(CreatorInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, CreatorTable, CreatorColumn), + ) +} diff --git a/tavern/internal/ent/scheduledtask/where.go b/tavern/internal/ent/scheduledtask/where.go index 7ebf97ba5..4e2f9ace7 100644 --- a/tavern/internal/ent/scheduledtask/where.go +++ b/tavern/internal/ent/scheduledtask/where.go @@ -549,6 +549,29 @@ func HasQuestsWith(preds ...predicate.Quest) predicate.ScheduledTask { }) } +// HasCreator applies the HasEdge predicate on the "creator" edge. +func HasCreator() predicate.ScheduledTask { + return predicate.ScheduledTask(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, CreatorTable, CreatorColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasCreatorWith applies the HasEdge predicate on the "creator" edge with a given conditions (other predicates). +func HasCreatorWith(preds ...predicate.User) predicate.ScheduledTask { + return predicate.ScheduledTask(func(s *sql.Selector) { + step := newCreatorStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.ScheduledTask) predicate.ScheduledTask { return predicate.ScheduledTask(sql.AndPredicates(predicates...)) diff --git a/tavern/internal/ent/scheduledtask_create.go b/tavern/internal/ent/scheduledtask_create.go index 161b750da..7dfdbfe91 100644 --- a/tavern/internal/ent/scheduledtask_create.go +++ b/tavern/internal/ent/scheduledtask_create.go @@ -15,6 +15,7 @@ import ( "realm.pub/tavern/internal/ent/quest" "realm.pub/tavern/internal/ent/scheduledtask" "realm.pub/tavern/internal/ent/tome" + "realm.pub/tavern/internal/ent/user" ) // ScheduledTaskCreate is the builder for creating a ScheduledTask entity. @@ -176,6 +177,25 @@ func (stc *ScheduledTaskCreate) AddQuests(q ...*Quest) *ScheduledTaskCreate { return stc.AddQuestIDs(ids...) } +// SetCreatorID sets the "creator" edge to the User entity by ID. +func (stc *ScheduledTaskCreate) SetCreatorID(id int) *ScheduledTaskCreate { + stc.mutation.SetCreatorID(id) + return stc +} + +// SetNillableCreatorID sets the "creator" edge to the User entity by ID if the given value is not nil. +func (stc *ScheduledTaskCreate) SetNillableCreatorID(id *int) *ScheduledTaskCreate { + if id != nil { + stc = stc.SetCreatorID(*id) + } + return stc +} + +// SetCreator sets the "creator" edge to the User entity. +func (stc *ScheduledTaskCreate) SetCreator(u *User) *ScheduledTaskCreate { + return stc.SetCreatorID(u.ID) +} + // Mutation returns the ScheduledTaskMutation object of the builder. func (stc *ScheduledTaskCreate) Mutation() *ScheduledTaskMutation { return stc.mutation @@ -388,6 +408,23 @@ func (stc *ScheduledTaskCreate) createSpec() (*ScheduledTask, *sqlgraph.CreateSp } _spec.Edges = append(_spec.Edges, edge) } + if nodes := stc.mutation.CreatorIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: scheduledtask.CreatorTable, + Columns: []string{scheduledtask.CreatorColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.scheduled_task_creator = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } diff --git a/tavern/internal/ent/scheduledtask_query.go b/tavern/internal/ent/scheduledtask_query.go index 6f0f51c87..641a70e3a 100644 --- a/tavern/internal/ent/scheduledtask_query.go +++ b/tavern/internal/ent/scheduledtask_query.go @@ -17,6 +17,7 @@ import ( "realm.pub/tavern/internal/ent/quest" "realm.pub/tavern/internal/ent/scheduledtask" "realm.pub/tavern/internal/ent/tome" + "realm.pub/tavern/internal/ent/user" ) // ScheduledTaskQuery is the builder for querying ScheduledTask entities. @@ -29,6 +30,7 @@ type ScheduledTaskQuery struct { withTome *TomeQuery withScheduledHosts *HostQuery withQuests *QuestQuery + withCreator *UserQuery withFKs bool modifiers []func(*sql.Selector) loadTotal []func(context.Context, []*ScheduledTask) error @@ -136,6 +138,28 @@ func (stq *ScheduledTaskQuery) QueryQuests() *QuestQuery { return query } +// QueryCreator chains the current query on the "creator" edge. +func (stq *ScheduledTaskQuery) QueryCreator() *UserQuery { + query := (&UserClient{config: stq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := stq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := stq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(scheduledtask.Table, scheduledtask.FieldID, selector), + sqlgraph.To(user.Table, user.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, scheduledtask.CreatorTable, scheduledtask.CreatorColumn), + ) + fromU = sqlgraph.SetNeighbors(stq.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first ScheduledTask entity from the query. // Returns a *NotFoundError when no ScheduledTask was found. func (stq *ScheduledTaskQuery) First(ctx context.Context) (*ScheduledTask, error) { @@ -331,6 +355,7 @@ func (stq *ScheduledTaskQuery) Clone() *ScheduledTaskQuery { withTome: stq.withTome.Clone(), withScheduledHosts: stq.withScheduledHosts.Clone(), withQuests: stq.withQuests.Clone(), + withCreator: stq.withCreator.Clone(), // clone intermediate query. sql: stq.sql.Clone(), path: stq.path, @@ -370,6 +395,17 @@ func (stq *ScheduledTaskQuery) WithQuests(opts ...func(*QuestQuery)) *ScheduledT return stq } +// WithCreator tells the query-builder to eager-load the nodes that are connected to +// the "creator" edge. The optional arguments are used to configure the query builder of the edge. +func (stq *ScheduledTaskQuery) WithCreator(opts ...func(*UserQuery)) *ScheduledTaskQuery { + query := (&UserClient{config: stq.config}).Query() + for _, opt := range opts { + opt(query) + } + stq.withCreator = query + return stq +} + // GroupBy is used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -449,13 +485,14 @@ func (stq *ScheduledTaskQuery) sqlAll(ctx context.Context, hooks ...queryHook) ( nodes = []*ScheduledTask{} withFKs = stq.withFKs _spec = stq.querySpec() - loadedTypes = [3]bool{ + loadedTypes = [4]bool{ stq.withTome != nil, stq.withScheduledHosts != nil, stq.withQuests != nil, + stq.withCreator != nil, } ) - if stq.withTome != nil { + if stq.withTome != nil || stq.withCreator != nil { withFKs = true } if withFKs { @@ -502,6 +539,12 @@ func (stq *ScheduledTaskQuery) sqlAll(ctx context.Context, hooks ...queryHook) ( return nil, err } } + if query := stq.withCreator; query != nil { + if err := stq.loadCreator(ctx, query, nodes, nil, + func(n *ScheduledTask, e *User) { n.Edges.Creator = e }); err != nil { + return nil, err + } + } for name, query := range stq.withNamedScheduledHosts { if err := stq.loadScheduledHosts(ctx, query, nodes, func(n *ScheduledTask) { n.appendNamedScheduledHosts(name) }, @@ -618,6 +661,38 @@ func (stq *ScheduledTaskQuery) loadQuests(ctx context.Context, query *QuestQuery } return nil } +func (stq *ScheduledTaskQuery) loadCreator(ctx context.Context, query *UserQuery, nodes []*ScheduledTask, init func(*ScheduledTask), assign func(*ScheduledTask, *User)) error { + ids := make([]int, 0, len(nodes)) + nodeids := make(map[int][]*ScheduledTask) + for i := range nodes { + if nodes[i].scheduled_task_creator == nil { + continue + } + fk := *nodes[i].scheduled_task_creator + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(user.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "scheduled_task_creator" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} func (stq *ScheduledTaskQuery) sqlCount(ctx context.Context) (int, error) { _spec := stq.querySpec() diff --git a/tavern/internal/ent/scheduledtask_update.go b/tavern/internal/ent/scheduledtask_update.go index d4c01761d..bfa497f3b 100644 --- a/tavern/internal/ent/scheduledtask_update.go +++ b/tavern/internal/ent/scheduledtask_update.go @@ -16,6 +16,7 @@ import ( "realm.pub/tavern/internal/ent/quest" "realm.pub/tavern/internal/ent/scheduledtask" "realm.pub/tavern/internal/ent/tome" + "realm.pub/tavern/internal/ent/user" ) // ScheduledTaskUpdate is the builder for updating ScheduledTask entities. @@ -182,6 +183,25 @@ func (stu *ScheduledTaskUpdate) AddQuests(q ...*Quest) *ScheduledTaskUpdate { return stu.AddQuestIDs(ids...) } +// SetCreatorID sets the "creator" edge to the User entity by ID. +func (stu *ScheduledTaskUpdate) SetCreatorID(id int) *ScheduledTaskUpdate { + stu.mutation.SetCreatorID(id) + return stu +} + +// SetNillableCreatorID sets the "creator" edge to the User entity by ID if the given value is not nil. +func (stu *ScheduledTaskUpdate) SetNillableCreatorID(id *int) *ScheduledTaskUpdate { + if id != nil { + stu = stu.SetCreatorID(*id) + } + return stu +} + +// SetCreator sets the "creator" edge to the User entity. +func (stu *ScheduledTaskUpdate) SetCreator(u *User) *ScheduledTaskUpdate { + return stu.SetCreatorID(u.ID) +} + // Mutation returns the ScheduledTaskMutation object of the builder. func (stu *ScheduledTaskUpdate) Mutation() *ScheduledTaskMutation { return stu.mutation @@ -235,6 +255,12 @@ func (stu *ScheduledTaskUpdate) RemoveQuests(q ...*Quest) *ScheduledTaskUpdate { return stu.RemoveQuestIDs(ids...) } +// ClearCreator clears the "creator" edge to the User entity. +func (stu *ScheduledTaskUpdate) ClearCreator() *ScheduledTaskUpdate { + stu.mutation.ClearCreator() + return stu +} + // Save executes the query and returns the number of nodes affected by the update operation. func (stu *ScheduledTaskUpdate) Save(ctx context.Context) (int, error) { stu.defaults() @@ -447,6 +473,35 @@ func (stu *ScheduledTaskUpdate) sqlSave(ctx context.Context) (n int, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if stu.mutation.CreatorCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: scheduledtask.CreatorTable, + Columns: []string{scheduledtask.CreatorColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := stu.mutation.CreatorIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: scheduledtask.CreatorTable, + Columns: []string{scheduledtask.CreatorColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if n, err = sqlgraph.UpdateNodes(ctx, stu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{scheduledtask.Label} @@ -618,6 +673,25 @@ func (stuo *ScheduledTaskUpdateOne) AddQuests(q ...*Quest) *ScheduledTaskUpdateO return stuo.AddQuestIDs(ids...) } +// SetCreatorID sets the "creator" edge to the User entity by ID. +func (stuo *ScheduledTaskUpdateOne) SetCreatorID(id int) *ScheduledTaskUpdateOne { + stuo.mutation.SetCreatorID(id) + return stuo +} + +// SetNillableCreatorID sets the "creator" edge to the User entity by ID if the given value is not nil. +func (stuo *ScheduledTaskUpdateOne) SetNillableCreatorID(id *int) *ScheduledTaskUpdateOne { + if id != nil { + stuo = stuo.SetCreatorID(*id) + } + return stuo +} + +// SetCreator sets the "creator" edge to the User entity. +func (stuo *ScheduledTaskUpdateOne) SetCreator(u *User) *ScheduledTaskUpdateOne { + return stuo.SetCreatorID(u.ID) +} + // Mutation returns the ScheduledTaskMutation object of the builder. func (stuo *ScheduledTaskUpdateOne) Mutation() *ScheduledTaskMutation { return stuo.mutation @@ -671,6 +745,12 @@ func (stuo *ScheduledTaskUpdateOne) RemoveQuests(q ...*Quest) *ScheduledTaskUpda return stuo.RemoveQuestIDs(ids...) } +// ClearCreator clears the "creator" edge to the User entity. +func (stuo *ScheduledTaskUpdateOne) ClearCreator() *ScheduledTaskUpdateOne { + stuo.mutation.ClearCreator() + return stuo +} + // Where appends a list predicates to the ScheduledTaskUpdate builder. func (stuo *ScheduledTaskUpdateOne) Where(ps ...predicate.ScheduledTask) *ScheduledTaskUpdateOne { stuo.mutation.Where(ps...) @@ -913,6 +993,35 @@ func (stuo *ScheduledTaskUpdateOne) sqlSave(ctx context.Context) (_node *Schedul } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if stuo.mutation.CreatorCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: scheduledtask.CreatorTable, + Columns: []string{scheduledtask.CreatorColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := stuo.mutation.CreatorIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: scheduledtask.CreatorTable, + Columns: []string{scheduledtask.CreatorColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(user.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &ScheduledTask{config: stuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/tavern/internal/ent/schema/scheduled_task.go b/tavern/internal/ent/schema/scheduled_task.go index bb392fa2a..b47bd66d5 100644 --- a/tavern/internal/ent/schema/scheduled_task.go +++ b/tavern/internal/ent/schema/scheduled_task.go @@ -73,6 +73,12 @@ func (ScheduledTask) Edges() []ent.Edge { entgql.MultiOrder(), ). Comment("Quests that were created from this scheduled task."), + edge.To("creator", User.Type). + Unique(). + Annotations( + entgql.Skip(entgql.SkipMutationCreateInput, entgql.SkipMutationUpdateInput), + ). + Comment("User that created the scheduled task if available."), } } diff --git a/tavern/internal/ent/schema/user.go b/tavern/internal/ent/schema/user.go index aed881f1b..1fb287eef 100644 --- a/tavern/internal/ent/schema/user.go +++ b/tavern/internal/ent/schema/user.go @@ -89,6 +89,13 @@ func (User) Edges() []ent.Edge { entgql.MultiOrder(), ). Comment("Device auths approved by the user."), + edge.From("scheduled_tasks", ScheduledTask.Type). + Ref("creator"). + Annotations( + entgql.RelayConnection(), + entgql.MultiOrder(), + ). + Comment("Scheduled tasks created by the user"), } } diff --git a/tavern/internal/ent/user.go b/tavern/internal/ent/user.go index 14864b737..7304316bc 100644 --- a/tavern/internal/ent/user.go +++ b/tavern/internal/ent/user.go @@ -45,15 +45,18 @@ type UserEdges struct { ActiveShells []*Shell `json:"active_shells,omitempty"` // Device auths approved by the user. DeviceAuths []*DeviceAuth `json:"device_auths,omitempty"` + // Scheduled tasks created by the user + ScheduledTasks []*ScheduledTask `json:"scheduled_tasks,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [3]bool + loadedTypes [4]bool // totalCount holds the count of the edges above. - totalCount [3]map[string]int + totalCount [4]map[string]int - namedTomes map[string][]*Tome - namedActiveShells map[string][]*Shell - namedDeviceAuths map[string][]*DeviceAuth + namedTomes map[string][]*Tome + namedActiveShells map[string][]*Shell + namedDeviceAuths map[string][]*DeviceAuth + namedScheduledTasks map[string][]*ScheduledTask } // TomesOrErr returns the Tomes value or an error if the edge @@ -83,6 +86,15 @@ func (e UserEdges) DeviceAuthsOrErr() ([]*DeviceAuth, error) { return nil, &NotLoadedError{edge: "device_auths"} } +// ScheduledTasksOrErr returns the ScheduledTasks value or an error if the edge +// was not loaded in eager-loading. +func (e UserEdges) ScheduledTasksOrErr() ([]*ScheduledTask, error) { + if e.loadedTypes[3] { + return e.ScheduledTasks, nil + } + return nil, &NotLoadedError{edge: "scheduled_tasks"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*User) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -194,6 +206,11 @@ func (u *User) QueryDeviceAuths() *DeviceAuthQuery { return NewUserClient(u.config).QueryDeviceAuths(u) } +// QueryScheduledTasks queries the "scheduled_tasks" edge of the User entity. +func (u *User) QueryScheduledTasks() *ScheduledTaskQuery { + return NewUserClient(u.config).QueryScheduledTasks(u) +} + // Update returns a builder for updating this User. // Note that you need to call User.Unwrap() before calling this method if this User // was returned from a transaction, and the transaction was committed or rolled back. @@ -310,5 +327,29 @@ func (u *User) appendNamedDeviceAuths(name string, edges ...*DeviceAuth) { } } +// NamedScheduledTasks returns the ScheduledTasks named value or an error if the edge was not +// loaded in eager-loading with this name. +func (u *User) NamedScheduledTasks(name string) ([]*ScheduledTask, error) { + if u.Edges.namedScheduledTasks == nil { + return nil, &NotLoadedError{edge: name} + } + nodes, ok := u.Edges.namedScheduledTasks[name] + if !ok { + return nil, &NotLoadedError{edge: name} + } + return nodes, nil +} + +func (u *User) appendNamedScheduledTasks(name string, edges ...*ScheduledTask) { + if u.Edges.namedScheduledTasks == nil { + u.Edges.namedScheduledTasks = make(map[string][]*ScheduledTask) + } + if len(edges) == 0 { + u.Edges.namedScheduledTasks[name] = []*ScheduledTask{} + } else { + u.Edges.namedScheduledTasks[name] = append(u.Edges.namedScheduledTasks[name], edges...) + } +} + // Users is a parsable slice of User. type Users []*User diff --git a/tavern/internal/ent/user/user.go b/tavern/internal/ent/user/user.go index 8609a9b53..ebee14b91 100644 --- a/tavern/internal/ent/user/user.go +++ b/tavern/internal/ent/user/user.go @@ -32,6 +32,8 @@ const ( EdgeActiveShells = "active_shells" // EdgeDeviceAuths holds the string denoting the device_auths edge name in mutations. EdgeDeviceAuths = "device_auths" + // EdgeScheduledTasks holds the string denoting the scheduled_tasks edge name in mutations. + EdgeScheduledTasks = "scheduled_tasks" // Table holds the table name of the user in the database. Table = "users" // TomesTable is the table that holds the tomes relation/edge. @@ -53,6 +55,13 @@ const ( DeviceAuthsInverseTable = "device_auths" // DeviceAuthsColumn is the table column denoting the device_auths relation/edge. DeviceAuthsColumn = "device_auth_user" + // ScheduledTasksTable is the table that holds the scheduled_tasks relation/edge. + ScheduledTasksTable = "scheduled_tasks" + // ScheduledTasksInverseTable is the table name for the ScheduledTask entity. + // It exists in this package in order to avoid circular dependency with the "scheduledtask" package. + ScheduledTasksInverseTable = "scheduled_tasks" + // ScheduledTasksColumn is the table column denoting the scheduled_tasks relation/edge. + ScheduledTasksColumn = "scheduled_task_creator" ) // Columns holds all SQL columns for user fields. @@ -195,6 +204,20 @@ func ByDeviceAuths(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { sqlgraph.OrderByNeighborTerms(s, newDeviceAuthsStep(), append([]sql.OrderTerm{term}, terms...)...) } } + +// ByScheduledTasksCount orders the results by scheduled_tasks count. +func ByScheduledTasksCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newScheduledTasksStep(), opts...) + } +} + +// ByScheduledTasks orders the results by scheduled_tasks terms. +func ByScheduledTasks(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newScheduledTasksStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} func newTomesStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -216,3 +239,10 @@ func newDeviceAuthsStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.O2M, true, DeviceAuthsTable, DeviceAuthsColumn), ) } +func newScheduledTasksStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(ScheduledTasksInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, ScheduledTasksTable, ScheduledTasksColumn), + ) +} diff --git a/tavern/internal/ent/user/where.go b/tavern/internal/ent/user/where.go index 25335689f..26e15d2c8 100644 --- a/tavern/internal/ent/user/where.go +++ b/tavern/internal/ent/user/where.go @@ -502,6 +502,29 @@ func HasDeviceAuthsWith(preds ...predicate.DeviceAuth) predicate.User { }) } +// HasScheduledTasks applies the HasEdge predicate on the "scheduled_tasks" edge. +func HasScheduledTasks() predicate.User { + return predicate.User(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, ScheduledTasksTable, ScheduledTasksColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasScheduledTasksWith applies the HasEdge predicate on the "scheduled_tasks" edge with a given conditions (other predicates). +func HasScheduledTasksWith(preds ...predicate.ScheduledTask) predicate.User { + return predicate.User(func(s *sql.Selector) { + step := newScheduledTasksStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.User) predicate.User { return predicate.User(sql.AndPredicates(predicates...)) diff --git a/tavern/internal/ent/user_create.go b/tavern/internal/ent/user_create.go index 7bbf0f5f1..8dbf9f55f 100644 --- a/tavern/internal/ent/user_create.go +++ b/tavern/internal/ent/user_create.go @@ -11,6 +11,7 @@ import ( "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" "realm.pub/tavern/internal/ent/deviceauth" + "realm.pub/tavern/internal/ent/scheduledtask" "realm.pub/tavern/internal/ent/shell" "realm.pub/tavern/internal/ent/tome" "realm.pub/tavern/internal/ent/user" @@ -143,6 +144,21 @@ func (uc *UserCreate) AddDeviceAuths(d ...*DeviceAuth) *UserCreate { return uc.AddDeviceAuthIDs(ids...) } +// AddScheduledTaskIDs adds the "scheduled_tasks" edge to the ScheduledTask entity by IDs. +func (uc *UserCreate) AddScheduledTaskIDs(ids ...int) *UserCreate { + uc.mutation.AddScheduledTaskIDs(ids...) + return uc +} + +// AddScheduledTasks adds the "scheduled_tasks" edges to the ScheduledTask entity. +func (uc *UserCreate) AddScheduledTasks(s ...*ScheduledTask) *UserCreate { + ids := make([]int, len(s)) + for i := range s { + ids[i] = s[i].ID + } + return uc.AddScheduledTaskIDs(ids...) +} + // Mutation returns the UserMutation object of the builder. func (uc *UserCreate) Mutation() *UserMutation { return uc.mutation @@ -337,6 +353,22 @@ func (uc *UserCreate) createSpec() (*User, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } + if nodes := uc.mutation.ScheduledTasksIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: user.ScheduledTasksTable, + Columns: []string{user.ScheduledTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(scheduledtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } diff --git a/tavern/internal/ent/user_query.go b/tavern/internal/ent/user_query.go index 982a625db..72f5b5054 100644 --- a/tavern/internal/ent/user_query.go +++ b/tavern/internal/ent/user_query.go @@ -14,6 +14,7 @@ import ( "entgo.io/ent/schema/field" "realm.pub/tavern/internal/ent/deviceauth" "realm.pub/tavern/internal/ent/predicate" + "realm.pub/tavern/internal/ent/scheduledtask" "realm.pub/tavern/internal/ent/shell" "realm.pub/tavern/internal/ent/tome" "realm.pub/tavern/internal/ent/user" @@ -22,19 +23,21 @@ import ( // UserQuery is the builder for querying User entities. type UserQuery struct { config - ctx *QueryContext - order []user.OrderOption - inters []Interceptor - predicates []predicate.User - withTomes *TomeQuery - withActiveShells *ShellQuery - withDeviceAuths *DeviceAuthQuery - withFKs bool - modifiers []func(*sql.Selector) - loadTotal []func(context.Context, []*User) error - withNamedTomes map[string]*TomeQuery - withNamedActiveShells map[string]*ShellQuery - withNamedDeviceAuths map[string]*DeviceAuthQuery + ctx *QueryContext + order []user.OrderOption + inters []Interceptor + predicates []predicate.User + withTomes *TomeQuery + withActiveShells *ShellQuery + withDeviceAuths *DeviceAuthQuery + withScheduledTasks *ScheduledTaskQuery + withFKs bool + modifiers []func(*sql.Selector) + loadTotal []func(context.Context, []*User) error + withNamedTomes map[string]*TomeQuery + withNamedActiveShells map[string]*ShellQuery + withNamedDeviceAuths map[string]*DeviceAuthQuery + withNamedScheduledTasks map[string]*ScheduledTaskQuery // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -137,6 +140,28 @@ func (uq *UserQuery) QueryDeviceAuths() *DeviceAuthQuery { return query } +// QueryScheduledTasks chains the current query on the "scheduled_tasks" edge. +func (uq *UserQuery) QueryScheduledTasks() *ScheduledTaskQuery { + query := (&ScheduledTaskClient{config: uq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := uq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := uq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(user.Table, user.FieldID, selector), + sqlgraph.To(scheduledtask.Table, scheduledtask.FieldID), + sqlgraph.Edge(sqlgraph.O2M, true, user.ScheduledTasksTable, user.ScheduledTasksColumn), + ) + fromU = sqlgraph.SetNeighbors(uq.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first User entity from the query. // Returns a *NotFoundError when no User was found. func (uq *UserQuery) First(ctx context.Context) (*User, error) { @@ -324,14 +349,15 @@ func (uq *UserQuery) Clone() *UserQuery { return nil } return &UserQuery{ - config: uq.config, - ctx: uq.ctx.Clone(), - order: append([]user.OrderOption{}, uq.order...), - inters: append([]Interceptor{}, uq.inters...), - predicates: append([]predicate.User{}, uq.predicates...), - withTomes: uq.withTomes.Clone(), - withActiveShells: uq.withActiveShells.Clone(), - withDeviceAuths: uq.withDeviceAuths.Clone(), + config: uq.config, + ctx: uq.ctx.Clone(), + order: append([]user.OrderOption{}, uq.order...), + inters: append([]Interceptor{}, uq.inters...), + predicates: append([]predicate.User{}, uq.predicates...), + withTomes: uq.withTomes.Clone(), + withActiveShells: uq.withActiveShells.Clone(), + withDeviceAuths: uq.withDeviceAuths.Clone(), + withScheduledTasks: uq.withScheduledTasks.Clone(), // clone intermediate query. sql: uq.sql.Clone(), path: uq.path, @@ -371,6 +397,17 @@ func (uq *UserQuery) WithDeviceAuths(opts ...func(*DeviceAuthQuery)) *UserQuery return uq } +// WithScheduledTasks tells the query-builder to eager-load the nodes that are connected to +// the "scheduled_tasks" edge. The optional arguments are used to configure the query builder of the edge. +func (uq *UserQuery) WithScheduledTasks(opts ...func(*ScheduledTaskQuery)) *UserQuery { + query := (&ScheduledTaskClient{config: uq.config}).Query() + for _, opt := range opts { + opt(query) + } + uq.withScheduledTasks = query + return uq +} + // GroupBy is used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -450,10 +487,11 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e nodes = []*User{} withFKs = uq.withFKs _spec = uq.querySpec() - loadedTypes = [3]bool{ + loadedTypes = [4]bool{ uq.withTomes != nil, uq.withActiveShells != nil, uq.withDeviceAuths != nil, + uq.withScheduledTasks != nil, } ) if withFKs { @@ -501,6 +539,13 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e return nil, err } } + if query := uq.withScheduledTasks; query != nil { + if err := uq.loadScheduledTasks(ctx, query, nodes, + func(n *User) { n.Edges.ScheduledTasks = []*ScheduledTask{} }, + func(n *User, e *ScheduledTask) { n.Edges.ScheduledTasks = append(n.Edges.ScheduledTasks, e) }); err != nil { + return nil, err + } + } for name, query := range uq.withNamedTomes { if err := uq.loadTomes(ctx, query, nodes, func(n *User) { n.appendNamedTomes(name) }, @@ -522,6 +567,13 @@ func (uq *UserQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*User, e return nil, err } } + for name, query := range uq.withNamedScheduledTasks { + if err := uq.loadScheduledTasks(ctx, query, nodes, + func(n *User) { n.appendNamedScheduledTasks(name) }, + func(n *User, e *ScheduledTask) { n.appendNamedScheduledTasks(name, e) }); err != nil { + return nil, err + } + } for i := range uq.loadTotal { if err := uq.loadTotal[i](ctx, nodes); err != nil { return nil, err @@ -653,6 +705,37 @@ func (uq *UserQuery) loadDeviceAuths(ctx context.Context, query *DeviceAuthQuery } return nil } +func (uq *UserQuery) loadScheduledTasks(ctx context.Context, query *ScheduledTaskQuery, nodes []*User, init func(*User), assign func(*User, *ScheduledTask)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[int]*User) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + query.withFKs = true + query.Where(predicate.ScheduledTask(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(user.ScheduledTasksColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.scheduled_task_creator + if fk == nil { + return fmt.Errorf(`foreign-key "scheduled_task_creator" is nil for node %v`, n.ID) + } + node, ok := nodeids[*fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "scheduled_task_creator" returned %v for node %v`, *fk, n.ID) + } + assign(node, n) + } + return nil +} func (uq *UserQuery) sqlCount(ctx context.Context) (int, error) { _spec := uq.querySpec() @@ -780,6 +863,20 @@ func (uq *UserQuery) WithNamedDeviceAuths(name string, opts ...func(*DeviceAuthQ return uq } +// WithNamedScheduledTasks tells the query-builder to eager-load the nodes that are connected to the "scheduled_tasks" +// edge with the given name. The optional arguments are used to configure the query builder of the edge. +func (uq *UserQuery) WithNamedScheduledTasks(name string, opts ...func(*ScheduledTaskQuery)) *UserQuery { + query := (&ScheduledTaskClient{config: uq.config}).Query() + for _, opt := range opts { + opt(query) + } + if uq.withNamedScheduledTasks == nil { + uq.withNamedScheduledTasks = make(map[string]*ScheduledTaskQuery) + } + uq.withNamedScheduledTasks[name] = query + return uq +} + // UserGroupBy is the group-by builder for User entities. type UserGroupBy struct { selector diff --git a/tavern/internal/ent/user_update.go b/tavern/internal/ent/user_update.go index dd1cc5477..2d302092c 100644 --- a/tavern/internal/ent/user_update.go +++ b/tavern/internal/ent/user_update.go @@ -12,6 +12,7 @@ import ( "entgo.io/ent/schema/field" "realm.pub/tavern/internal/ent/deviceauth" "realm.pub/tavern/internal/ent/predicate" + "realm.pub/tavern/internal/ent/scheduledtask" "realm.pub/tavern/internal/ent/shell" "realm.pub/tavern/internal/ent/tome" "realm.pub/tavern/internal/ent/user" @@ -159,6 +160,21 @@ func (uu *UserUpdate) AddDeviceAuths(d ...*DeviceAuth) *UserUpdate { return uu.AddDeviceAuthIDs(ids...) } +// AddScheduledTaskIDs adds the "scheduled_tasks" edge to the ScheduledTask entity by IDs. +func (uu *UserUpdate) AddScheduledTaskIDs(ids ...int) *UserUpdate { + uu.mutation.AddScheduledTaskIDs(ids...) + return uu +} + +// AddScheduledTasks adds the "scheduled_tasks" edges to the ScheduledTask entity. +func (uu *UserUpdate) AddScheduledTasks(s ...*ScheduledTask) *UserUpdate { + ids := make([]int, len(s)) + for i := range s { + ids[i] = s[i].ID + } + return uu.AddScheduledTaskIDs(ids...) +} + // Mutation returns the UserMutation object of the builder. func (uu *UserUpdate) Mutation() *UserMutation { return uu.mutation @@ -227,6 +243,27 @@ func (uu *UserUpdate) RemoveDeviceAuths(d ...*DeviceAuth) *UserUpdate { return uu.RemoveDeviceAuthIDs(ids...) } +// ClearScheduledTasks clears all "scheduled_tasks" edges to the ScheduledTask entity. +func (uu *UserUpdate) ClearScheduledTasks() *UserUpdate { + uu.mutation.ClearScheduledTasks() + return uu +} + +// RemoveScheduledTaskIDs removes the "scheduled_tasks" edge to ScheduledTask entities by IDs. +func (uu *UserUpdate) RemoveScheduledTaskIDs(ids ...int) *UserUpdate { + uu.mutation.RemoveScheduledTaskIDs(ids...) + return uu +} + +// RemoveScheduledTasks removes "scheduled_tasks" edges to ScheduledTask entities. +func (uu *UserUpdate) RemoveScheduledTasks(s ...*ScheduledTask) *UserUpdate { + ids := make([]int, len(s)) + for i := range s { + ids[i] = s[i].ID + } + return uu.RemoveScheduledTaskIDs(ids...) +} + // Save executes the query and returns the number of nodes affected by the update operation. func (uu *UserUpdate) Save(ctx context.Context) (int, error) { return withHooks(ctx, uu.sqlSave, uu.mutation, uu.hooks) @@ -439,6 +476,51 @@ func (uu *UserUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if uu.mutation.ScheduledTasksCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: user.ScheduledTasksTable, + Columns: []string{user.ScheduledTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(scheduledtask.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := uu.mutation.RemovedScheduledTasksIDs(); len(nodes) > 0 && !uu.mutation.ScheduledTasksCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: user.ScheduledTasksTable, + Columns: []string{user.ScheduledTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(scheduledtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := uu.mutation.ScheduledTasksIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: user.ScheduledTasksTable, + Columns: []string{user.ScheduledTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(scheduledtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if n, err = sqlgraph.UpdateNodes(ctx, uu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{user.Label} @@ -588,6 +670,21 @@ func (uuo *UserUpdateOne) AddDeviceAuths(d ...*DeviceAuth) *UserUpdateOne { return uuo.AddDeviceAuthIDs(ids...) } +// AddScheduledTaskIDs adds the "scheduled_tasks" edge to the ScheduledTask entity by IDs. +func (uuo *UserUpdateOne) AddScheduledTaskIDs(ids ...int) *UserUpdateOne { + uuo.mutation.AddScheduledTaskIDs(ids...) + return uuo +} + +// AddScheduledTasks adds the "scheduled_tasks" edges to the ScheduledTask entity. +func (uuo *UserUpdateOne) AddScheduledTasks(s ...*ScheduledTask) *UserUpdateOne { + ids := make([]int, len(s)) + for i := range s { + ids[i] = s[i].ID + } + return uuo.AddScheduledTaskIDs(ids...) +} + // Mutation returns the UserMutation object of the builder. func (uuo *UserUpdateOne) Mutation() *UserMutation { return uuo.mutation @@ -656,6 +753,27 @@ func (uuo *UserUpdateOne) RemoveDeviceAuths(d ...*DeviceAuth) *UserUpdateOne { return uuo.RemoveDeviceAuthIDs(ids...) } +// ClearScheduledTasks clears all "scheduled_tasks" edges to the ScheduledTask entity. +func (uuo *UserUpdateOne) ClearScheduledTasks() *UserUpdateOne { + uuo.mutation.ClearScheduledTasks() + return uuo +} + +// RemoveScheduledTaskIDs removes the "scheduled_tasks" edge to ScheduledTask entities by IDs. +func (uuo *UserUpdateOne) RemoveScheduledTaskIDs(ids ...int) *UserUpdateOne { + uuo.mutation.RemoveScheduledTaskIDs(ids...) + return uuo +} + +// RemoveScheduledTasks removes "scheduled_tasks" edges to ScheduledTask entities. +func (uuo *UserUpdateOne) RemoveScheduledTasks(s ...*ScheduledTask) *UserUpdateOne { + ids := make([]int, len(s)) + for i := range s { + ids[i] = s[i].ID + } + return uuo.RemoveScheduledTaskIDs(ids...) +} + // Where appends a list predicates to the UserUpdate builder. func (uuo *UserUpdateOne) Where(ps ...predicate.User) *UserUpdateOne { uuo.mutation.Where(ps...) @@ -898,6 +1016,51 @@ func (uuo *UserUpdateOne) sqlSave(ctx context.Context) (_node *User, err error) } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if uuo.mutation.ScheduledTasksCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: user.ScheduledTasksTable, + Columns: []string{user.ScheduledTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(scheduledtask.FieldID, field.TypeInt), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := uuo.mutation.RemovedScheduledTasksIDs(); len(nodes) > 0 && !uuo.mutation.ScheduledTasksCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: user.ScheduledTasksTable, + Columns: []string{user.ScheduledTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(scheduledtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := uuo.mutation.ScheduledTasksIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: true, + Table: user.ScheduledTasksTable, + Columns: []string{user.ScheduledTasksColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(scheduledtask.FieldID, field.TypeInt), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &User{config: uuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/tavern/internal/graphql/generated/ent.generated.go b/tavern/internal/graphql/generated/ent.generated.go index 601de3b2f..233742447 100644 --- a/tavern/internal/graphql/generated/ent.generated.go +++ b/tavern/internal/graphql/generated/ent.generated.go @@ -1615,6 +1615,42 @@ func (ec *executionContext) field_User_deviceAuths_args(ctx context.Context, raw return args, nil } +func (ec *executionContext) field_User_scheduledTasks_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { + var err error + args := map[string]any{} + arg0, err := graphql.ProcessArgField(ctx, rawArgs, "after", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + if err != nil { + return nil, err + } + args["after"] = arg0 + arg1, err := graphql.ProcessArgField(ctx, rawArgs, "first", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["first"] = arg1 + arg2, err := graphql.ProcessArgField(ctx, rawArgs, "before", ec.unmarshalOCursor2ᚖentgoᚗioᚋcontribᚋentgqlᚐCursor) + if err != nil { + return nil, err + } + args["before"] = arg2 + arg3, err := graphql.ProcessArgField(ctx, rawArgs, "last", ec.unmarshalOInt2ᚖint) + if err != nil { + return nil, err + } + args["last"] = arg3 + arg4, err := graphql.ProcessArgField(ctx, rawArgs, "orderBy", ec.unmarshalOScheduledTaskOrder2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐScheduledTaskOrderᚄ) + if err != nil { + return nil, err + } + args["orderBy"] = arg4 + arg5, err := graphql.ProcessArgField(ctx, rawArgs, "where", ec.unmarshalOScheduledTaskWhereInput2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐScheduledTaskWhereInput) + if err != nil { + return nil, err + } + args["where"] = arg5 + return args, nil +} + func (ec *executionContext) field_User_tomes_args(ctx context.Context, rawArgs map[string]any) (map[string]any, error) { var err error args := map[string]any{} @@ -1971,6 +2007,8 @@ func (ec *executionContext) fieldContext_Asset_creator(_ context.Context, field return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -4884,6 +4922,8 @@ func (ec *executionContext) fieldContext_DeviceAuth_user(_ context.Context, fiel return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -8151,6 +8191,8 @@ func (ec *executionContext) fieldContext_Link_creator(_ context.Context, field g return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -8800,6 +8842,8 @@ func (ec *executionContext) fieldContext_Portal_owner(_ context.Context, field g return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -10166,6 +10210,8 @@ func (ec *executionContext) fieldContext_Query_me(_ context.Context, field graph return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -10681,6 +10727,8 @@ func (ec *executionContext) fieldContext_Quest_creator(_ context.Context, field return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -10740,6 +10788,8 @@ func (ec *executionContext) fieldContext_Quest_scheduledTask(_ context.Context, return ec.fieldContext_ScheduledTask_scheduledHosts(ctx, field) case "quests": return ec.fieldContext_ScheduledTask_quests(ctx, field) + case "creator": + return ec.fieldContext_ScheduledTask_creator(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type ScheduledTask", field.Name) }, @@ -11197,6 +11247,8 @@ func (ec *executionContext) fieldContext_Repository_owner(_ context.Context, fie return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -11830,6 +11882,57 @@ func (ec *executionContext) fieldContext_ScheduledTask_quests(ctx context.Contex return fc, nil } +func (ec *executionContext) _ScheduledTask_creator(ctx context.Context, field graphql.CollectedField, obj *ent.ScheduledTask) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_ScheduledTask_creator, + func(ctx context.Context) (any, error) { + return obj.Creator(ctx) + }, + nil, + ec.marshalOUser2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUser, + true, + false, + ) +} + +func (ec *executionContext) fieldContext_ScheduledTask_creator(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "ScheduledTask", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "id": + return ec.fieldContext_User_id(ctx, field) + case "name": + return ec.fieldContext_User_name(ctx, field) + case "photoURL": + return ec.fieldContext_User_photoURL(ctx, field) + case "isActivated": + return ec.fieldContext_User_isActivated(ctx, field) + case "isAdmin": + return ec.fieldContext_User_isAdmin(ctx, field) + case "tomes": + return ec.fieldContext_User_tomes(ctx, field) + case "activeShells": + return ec.fieldContext_User_activeShells(ctx, field) + case "deviceAuths": + return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) + case "apiKey": + return ec.fieldContext_User_apiKey(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type User", field.Name) + }, + } + return fc, nil +} + func (ec *executionContext) _ScheduledTaskConnection_edges(ctx context.Context, field graphql.CollectedField, obj *ent.ScheduledTaskConnection) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -11983,6 +12086,8 @@ func (ec *executionContext) fieldContext_ScheduledTaskEdge_node(_ context.Contex return ec.fieldContext_ScheduledTask_scheduledHosts(ctx, field) case "quests": return ec.fieldContext_ScheduledTask_quests(ctx, field) + case "creator": + return ec.fieldContext_ScheduledTask_creator(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type ScheduledTask", field.Name) }, @@ -12843,6 +12948,8 @@ func (ec *executionContext) fieldContext_Shell_owner(_ context.Context, field gr return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -13592,6 +13699,8 @@ func (ec *executionContext) fieldContext_ShellTask_creator(_ context.Context, fi return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -15519,6 +15628,8 @@ func (ec *executionContext) fieldContext_Tome_uploader(_ context.Context, field return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -16056,6 +16167,55 @@ func (ec *executionContext) fieldContext_User_deviceAuths(ctx context.Context, f return fc, nil } +func (ec *executionContext) _User_scheduledTasks(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { + return graphql.ResolveField( + ctx, + ec.OperationContext, + field, + ec.fieldContext_User_scheduledTasks, + func(ctx context.Context) (any, error) { + fc := graphql.GetFieldContext(ctx) + return obj.ScheduledTasks(ctx, fc.Args["after"].(*entgql.Cursor[int]), fc.Args["first"].(*int), fc.Args["before"].(*entgql.Cursor[int]), fc.Args["last"].(*int), fc.Args["orderBy"].([]*ent.ScheduledTaskOrder), fc.Args["where"].(*ent.ScheduledTaskWhereInput)) + }, + nil, + ec.marshalNScheduledTaskConnection2ᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐScheduledTaskConnection, + true, + true, + ) +} + +func (ec *executionContext) fieldContext_User_scheduledTasks(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { + fc = &graphql.FieldContext{ + Object: "User", + Field: field, + IsMethod: true, + IsResolver: false, + Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { + switch field.Name { + case "edges": + return ec.fieldContext_ScheduledTaskConnection_edges(ctx, field) + case "pageInfo": + return ec.fieldContext_ScheduledTaskConnection_pageInfo(ctx, field) + case "totalCount": + return ec.fieldContext_ScheduledTaskConnection_totalCount(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type ScheduledTaskConnection", field.Name) + }, + } + defer func() { + if r := recover(); r != nil { + err = ec.Recover(ctx, r) + ec.Error(ctx, err) + } + }() + ctx = graphql.WithFieldContext(ctx, fc) + if fc.Args, err = ec.field_User_scheduledTasks_args(ctx, field.ArgumentMap(ec.Variables)); err != nil { + ec.Error(ctx, err) + return fc, err + } + return fc, nil +} + func (ec *executionContext) _User_apiKey(ctx context.Context, field graphql.CollectedField, obj *ent.User) (ret graphql.Marshaler) { return graphql.ResolveField( ctx, @@ -16228,6 +16388,8 @@ func (ec *executionContext) fieldContext_UserEdge_node(_ context.Context, field return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -26931,7 +27093,7 @@ func (ec *executionContext) unmarshalInputScheduledTaskWhereInput(ctx context.Co asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "description", "descriptionNEQ", "descriptionIn", "descriptionNotIn", "descriptionGT", "descriptionGTE", "descriptionLT", "descriptionLTE", "descriptionContains", "descriptionHasPrefix", "descriptionHasSuffix", "descriptionEqualFold", "descriptionContainsFold", "runOnNewBeaconCallback", "runOnNewBeaconCallbackNEQ", "runOnFirstHostCallback", "runOnFirstHostCallbackNEQ", "parameters", "parametersNEQ", "parametersIn", "parametersNotIn", "parametersGT", "parametersGTE", "parametersLT", "parametersLTE", "parametersContains", "parametersHasPrefix", "parametersHasSuffix", "parametersIsNil", "parametersNotNil", "parametersEqualFold", "parametersContainsFold", "runOnSchedule", "runOnScheduleNEQ", "runOnScheduleIn", "runOnScheduleNotIn", "runOnScheduleGT", "runOnScheduleGTE", "runOnScheduleLT", "runOnScheduleLTE", "runOnScheduleContains", "runOnScheduleHasPrefix", "runOnScheduleHasSuffix", "runOnScheduleEqualFold", "runOnScheduleContainsFold", "disabled", "disabledNEQ", "hasTome", "hasTomeWith", "hasScheduledHosts", "hasScheduledHostsWith", "hasQuests", "hasQuestsWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "createdAt", "createdAtNEQ", "createdAtIn", "createdAtNotIn", "createdAtGT", "createdAtGTE", "createdAtLT", "createdAtLTE", "lastModifiedAt", "lastModifiedAtNEQ", "lastModifiedAtIn", "lastModifiedAtNotIn", "lastModifiedAtGT", "lastModifiedAtGTE", "lastModifiedAtLT", "lastModifiedAtLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "description", "descriptionNEQ", "descriptionIn", "descriptionNotIn", "descriptionGT", "descriptionGTE", "descriptionLT", "descriptionLTE", "descriptionContains", "descriptionHasPrefix", "descriptionHasSuffix", "descriptionEqualFold", "descriptionContainsFold", "runOnNewBeaconCallback", "runOnNewBeaconCallbackNEQ", "runOnFirstHostCallback", "runOnFirstHostCallbackNEQ", "parameters", "parametersNEQ", "parametersIn", "parametersNotIn", "parametersGT", "parametersGTE", "parametersLT", "parametersLTE", "parametersContains", "parametersHasPrefix", "parametersHasSuffix", "parametersIsNil", "parametersNotNil", "parametersEqualFold", "parametersContainsFold", "runOnSchedule", "runOnScheduleNEQ", "runOnScheduleIn", "runOnScheduleNotIn", "runOnScheduleGT", "runOnScheduleGTE", "runOnScheduleLT", "runOnScheduleLTE", "runOnScheduleContains", "runOnScheduleHasPrefix", "runOnScheduleHasSuffix", "runOnScheduleEqualFold", "runOnScheduleContainsFold", "disabled", "disabledNEQ", "hasTome", "hasTomeWith", "hasScheduledHosts", "hasScheduledHostsWith", "hasQuests", "hasQuestsWith", "hasCreator", "hasCreatorWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -27589,6 +27751,20 @@ func (ec *executionContext) unmarshalInputScheduledTaskWhereInput(ctx context.Co return it, err } it.HasQuestsWith = data + case "hasCreator": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreator")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasCreator = data + case "hasCreatorWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasCreatorWith")) + data, err := ec.unmarshalOUserWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐUserWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasCreatorWith = data } } @@ -32047,7 +32223,7 @@ func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, o asMap[k] = v } - fieldsInOrder := [...]string{"name", "photoURL", "isActivated", "isAdmin", "addTomeIDs", "removeTomeIDs", "clearTomes", "addActiveShellIDs", "removeActiveShellIDs", "clearActiveShells", "addDeviceAuthIDs", "removeDeviceAuthIDs", "clearDeviceAuths"} + fieldsInOrder := [...]string{"name", "photoURL", "isActivated", "isAdmin", "addTomeIDs", "removeTomeIDs", "clearTomes", "addActiveShellIDs", "removeActiveShellIDs", "clearActiveShells", "addDeviceAuthIDs", "removeDeviceAuthIDs", "clearDeviceAuths", "addScheduledTaskIDs", "removeScheduledTaskIDs", "clearScheduledTasks"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -32145,6 +32321,27 @@ func (ec *executionContext) unmarshalInputUpdateUserInput(ctx context.Context, o return it, err } it.ClearDeviceAuths = data + case "addScheduledTaskIDs": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("addScheduledTaskIDs")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.AddScheduledTaskIDs = data + case "removeScheduledTaskIDs": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("removeScheduledTaskIDs")) + data, err := ec.unmarshalOID2ᚕintᚄ(ctx, v) + if err != nil { + return it, err + } + it.RemoveScheduledTaskIDs = data + case "clearScheduledTasks": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("clearScheduledTasks")) + data, err := ec.unmarshalOBoolean2bool(ctx, v) + if err != nil { + return it, err + } + it.ClearScheduledTasks = data } } @@ -32196,7 +32393,7 @@ func (ec *executionContext) unmarshalInputUserWhereInput(ctx context.Context, ob asMap[k] = v } - fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "photoURL", "photoURLNEQ", "photoURLIn", "photoURLNotIn", "photoURLGT", "photoURLGTE", "photoURLLT", "photoURLLTE", "photoURLContains", "photoURLHasPrefix", "photoURLHasSuffix", "photoURLEqualFold", "photoURLContainsFold", "isActivated", "isActivatedNEQ", "isAdmin", "isAdminNEQ", "hasTomes", "hasTomesWith", "hasActiveShells", "hasActiveShellsWith", "hasDeviceAuths", "hasDeviceAuthsWith"} + fieldsInOrder := [...]string{"not", "and", "or", "id", "idNEQ", "idIn", "idNotIn", "idGT", "idGTE", "idLT", "idLTE", "name", "nameNEQ", "nameIn", "nameNotIn", "nameGT", "nameGTE", "nameLT", "nameLTE", "nameContains", "nameHasPrefix", "nameHasSuffix", "nameEqualFold", "nameContainsFold", "photoURL", "photoURLNEQ", "photoURLIn", "photoURLNotIn", "photoURLGT", "photoURLGTE", "photoURLLT", "photoURLLTE", "photoURLContains", "photoURLHasPrefix", "photoURLHasSuffix", "photoURLEqualFold", "photoURLContainsFold", "isActivated", "isActivatedNEQ", "isAdmin", "isAdminNEQ", "hasTomes", "hasTomesWith", "hasActiveShells", "hasActiveShellsWith", "hasDeviceAuths", "hasDeviceAuthsWith", "hasScheduledTasks", "hasScheduledTasksWith"} for _, k := range fieldsInOrder { v, ok := asMap[k] if !ok { @@ -32532,6 +32729,20 @@ func (ec *executionContext) unmarshalInputUserWhereInput(ctx context.Context, ob return it, err } it.HasDeviceAuthsWith = data + case "hasScheduledTasks": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasScheduledTasks")) + data, err := ec.unmarshalOBoolean2ᚖbool(ctx, v) + if err != nil { + return it, err + } + it.HasScheduledTasks = data + case "hasScheduledTasksWith": + ctx := graphql.WithPathContext(ctx, graphql.NewPathWithField("hasScheduledTasksWith")) + data, err := ec.unmarshalOScheduledTaskWhereInput2ᚕᚖrealmᚗpubᚋtavernᚋinternalᚋentᚐScheduledTaskWhereInputᚄ(ctx, v) + if err != nil { + return it, err + } + it.HasScheduledTasksWith = data } } @@ -36966,6 +37177,39 @@ func (ec *executionContext) _ScheduledTask(ctx context.Context, sel ast.Selectio continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "creator": + field := field + + innerFunc := func(ctx context.Context, _ *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._ScheduledTask_creator(ctx, field, obj) + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) default: panic("unknown field " + strconv.Quote(field.Name)) @@ -39059,6 +39303,42 @@ func (ec *executionContext) _User(ctx context.Context, sel ast.SelectionSet, obj continue } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) + case "scheduledTasks": + field := field + + innerFunc := func(ctx context.Context, fs *graphql.FieldSet) (res graphql.Marshaler) { + defer func() { + if r := recover(); r != nil { + ec.Error(ctx, ec.Recover(ctx, r)) + } + }() + res = ec._User_scheduledTasks(ctx, field, obj) + if res == graphql.Null { + atomic.AddUint32(&fs.Invalids, 1) + } + return res + } + + if field.Deferrable != nil { + dfs, ok := deferred[field.Deferrable.Label] + di := 0 + if ok { + dfs.AddField(field) + di = len(dfs.Values) - 1 + } else { + dfs = graphql.NewFieldSet([]graphql.CollectedField{field}) + deferred[field.Deferrable.Label] = dfs + } + dfs.Concurrently(di, func(ctx context.Context) graphql.Marshaler { + return innerFunc(ctx, dfs) + }) + + // don't run the out.Concurrently() call below + out.Values[i] = graphql.Null + continue + } + out.Concurrently(i, func(ctx context.Context) graphql.Marshaler { return innerFunc(ctx, out) }) case "apiKey": field := field diff --git a/tavern/internal/graphql/generated/mutation.generated.go b/tavern/internal/graphql/generated/mutation.generated.go index 4f38c1f74..d8a219e6b 100644 --- a/tavern/internal/graphql/generated/mutation.generated.go +++ b/tavern/internal/graphql/generated/mutation.generated.go @@ -1304,6 +1304,8 @@ func (ec *executionContext) fieldContext_Mutation_resetUserAPIKey(_ context.Cont return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -1372,6 +1374,8 @@ func (ec *executionContext) fieldContext_Mutation_updateUser(ctx context.Context return ec.fieldContext_User_activeShells(ctx, field) case "deviceAuths": return ec.fieldContext_User_deviceAuths(ctx, field) + case "scheduledTasks": + return ec.fieldContext_User_scheduledTasks(ctx, field) case "apiKey": return ec.fieldContext_User_apiKey(ctx, field) } @@ -2004,6 +2008,8 @@ func (ec *executionContext) fieldContext_Mutation_createScheduledTask(ctx contex return ec.fieldContext_ScheduledTask_scheduledHosts(ctx, field) case "quests": return ec.fieldContext_ScheduledTask_quests(ctx, field) + case "creator": + return ec.fieldContext_ScheduledTask_creator(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type ScheduledTask", field.Name) }, @@ -2091,6 +2097,8 @@ func (ec *executionContext) fieldContext_Mutation_disableScheduledTask(ctx conte return ec.fieldContext_ScheduledTask_scheduledHosts(ctx, field) case "quests": return ec.fieldContext_ScheduledTask_quests(ctx, field) + case "creator": + return ec.fieldContext_ScheduledTask_creator(ctx, field) } return nil, fmt.Errorf("no field named %q was found under type ScheduledTask", field.Name) }, diff --git a/tavern/internal/graphql/generated/root_.generated.go b/tavern/internal/graphql/generated/root_.generated.go index ab68278c1..ca050158a 100644 --- a/tavern/internal/graphql/generated/root_.generated.go +++ b/tavern/internal/graphql/generated/root_.generated.go @@ -480,6 +480,7 @@ type ComplexityRoot struct { ScheduledTask struct { CreatedAt func(childComplexity int) int + Creator func(childComplexity int) int Description func(childComplexity int) int Disabled func(childComplexity int) int ID func(childComplexity int) int @@ -659,15 +660,16 @@ type ComplexityRoot struct { } User struct { - APIKey func(childComplexity int) int - ActiveShells func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ShellOrder, where *ent.ShellWhereInput) int - DeviceAuths func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.DeviceAuthOrder, where *ent.DeviceAuthWhereInput) int - ID func(childComplexity int) int - IsActivated func(childComplexity int) int - IsAdmin func(childComplexity int) int - Name func(childComplexity int) int - PhotoURL func(childComplexity int) int - Tomes func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TomeOrder, where *ent.TomeWhereInput) int + APIKey func(childComplexity int) int + ActiveShells func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ShellOrder, where *ent.ShellWhereInput) int + DeviceAuths func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.DeviceAuthOrder, where *ent.DeviceAuthWhereInput) int + ID func(childComplexity int) int + IsActivated func(childComplexity int) int + IsAdmin func(childComplexity int) int + Name func(childComplexity int) int + PhotoURL func(childComplexity int) int + ScheduledTasks func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.ScheduledTaskOrder, where *ent.ScheduledTaskWhereInput) int + Tomes func(childComplexity int, after *entgql.Cursor[int], first *int, before *entgql.Cursor[int], last *int, orderBy []*ent.TomeOrder, where *ent.TomeWhereInput) int } UserConnection struct { @@ -2970,6 +2972,13 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.ScheduledTask.CreatedAt(childComplexity), true + case "ScheduledTask.creator": + if e.complexity.ScheduledTask.Creator == nil { + break + } + + return e.complexity.ScheduledTask.Creator(childComplexity), true + case "ScheduledTask.description": if e.complexity.ScheduledTask.Description == nil { break @@ -3903,6 +3912,18 @@ func (e *executableSchema) Complexity(ctx context.Context, typeName, field strin return e.complexity.User.PhotoURL(childComplexity), true + case "User.scheduledTasks": + if e.complexity.User.ScheduledTasks == nil { + break + } + + args, err := ec.field_User_scheduledTasks_args(ctx, rawArgs) + if err != nil { + return 0, false + } + + return e.complexity.User.ScheduledTasks(childComplexity, args["after"].(*entgql.Cursor[int]), args["first"].(*int), args["before"].(*entgql.Cursor[int]), args["last"].(*int), args["orderBy"].([]*ent.ScheduledTaskOrder), args["where"].(*ent.ScheduledTaskWhereInput)), true + case "User.tomes": if e.complexity.User.Tomes == nil { break @@ -8204,6 +8225,10 @@ type ScheduledTask implements Node { """ where: QuestWhereInput ): QuestConnection! + """ + User that created the scheduled task if available. + """ + creator: User } """ A connection to a list of items. @@ -8393,6 +8418,11 @@ input ScheduledTaskWhereInput { """ hasQuests: Boolean hasQuestsWith: [QuestWhereInput!] + """ + creator edge predicates + """ + hasCreator: Boolean + hasCreatorWith: [UserWhereInput!] } type Screenshot implements Node { id: ID! @@ -10217,6 +10247,9 @@ input UpdateUserInput { addDeviceAuthIDs: [ID!] removeDeviceAuthIDs: [ID!] clearDeviceAuths: Boolean + addScheduledTaskIDs: [ID!] + removeScheduledTaskIDs: [ID!] + clearScheduledTasks: Boolean } type User implements Node { id: ID! @@ -10329,6 +10362,37 @@ type User implements Node { """ where: DeviceAuthWhereInput ): DeviceAuthConnection! + scheduledTasks( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for ScheduledTasks returned from the connection. + """ + orderBy: [ScheduledTaskOrder!] + + """ + Filtering options for ScheduledTasks returned from the connection. + """ + where: ScheduledTaskWhereInput + ): ScheduledTaskConnection! } """ A connection to a list of items. @@ -10455,6 +10519,11 @@ input UserWhereInput { """ hasDeviceAuths: Boolean hasDeviceAuthsWith: [DeviceAuthWhereInput!] + """ + scheduled_tasks edge predicates + """ + hasScheduledTasks: Boolean + hasScheduledTasksWith: [ScheduledTaskWhereInput!] } `, BuiltIn: false}, {Name: "../schema/scalars.graphql", Input: `scalar Time diff --git a/tavern/internal/graphql/mutation.resolvers.go b/tavern/internal/graphql/mutation.resolvers.go index d38523922..2d0660581 100644 --- a/tavern/internal/graphql/mutation.resolvers.go +++ b/tavern/internal/graphql/mutation.resolvers.go @@ -65,6 +65,9 @@ func (r *mutationResolver) DropAllData(ctx context.Context) (bool, error) { if _, err := client.Quest.Delete().Exec(ctx); err != nil { return false, rollback(tx, fmt.Errorf("failed to delete quests: %w", err)) } + if _, err := client.ScheduledTask.Delete().Exec(ctx); err != nil { + return false, rollback(tx, fmt.Errorf("failed to delete scheduled tasks: %w", err)) + } if _, err := client.Link.Delete().Exec(ctx); err != nil { return false, rollback(tx, fmt.Errorf("failed to delete links: %w", err)) } @@ -514,7 +517,15 @@ func (r *mutationResolver) CreateBuildTask(ctx context.Context, input models.Cre // CreateScheduledTask is the resolver for the createScheduledTask field. func (r *mutationResolver) CreateScheduledTask(ctx context.Context, input ent.CreateScheduledTaskInput) (*ent.ScheduledTask, error) { - return r.client.ScheduledTask.Create().SetInput(input).Save(ctx) + var creatorID *int + if creator := auth.UserFromContext(ctx); creator != nil { + creatorID = &creator.ID + } + + return r.client.ScheduledTask.Create(). + SetNillableCreatorID(creatorID). + SetInput(input). + Save(ctx) } // DisableScheduledTask is the resolver for the disableScheduledTask field. diff --git a/tavern/internal/graphql/schema.graphql b/tavern/internal/graphql/schema.graphql index bec369a6e..d4e999baf 100644 --- a/tavern/internal/graphql/schema.graphql +++ b/tavern/internal/graphql/schema.graphql @@ -4077,6 +4077,10 @@ type ScheduledTask implements Node { """ where: QuestWhereInput ): QuestConnection! + """ + User that created the scheduled task if available. + """ + creator: User } """ A connection to a list of items. @@ -4266,6 +4270,11 @@ input ScheduledTaskWhereInput { """ hasQuests: Boolean hasQuestsWith: [QuestWhereInput!] + """ + creator edge predicates + """ + hasCreator: Boolean + hasCreatorWith: [UserWhereInput!] } type Screenshot implements Node { id: ID! @@ -6090,6 +6099,9 @@ input UpdateUserInput { addDeviceAuthIDs: [ID!] removeDeviceAuthIDs: [ID!] clearDeviceAuths: Boolean + addScheduledTaskIDs: [ID!] + removeScheduledTaskIDs: [ID!] + clearScheduledTasks: Boolean } type User implements Node { id: ID! @@ -6202,6 +6214,37 @@ type User implements Node { """ where: DeviceAuthWhereInput ): DeviceAuthConnection! + scheduledTasks( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for ScheduledTasks returned from the connection. + """ + orderBy: [ScheduledTaskOrder!] + + """ + Filtering options for ScheduledTasks returned from the connection. + """ + where: ScheduledTaskWhereInput + ): ScheduledTaskConnection! } """ A connection to a list of items. @@ -6328,6 +6371,11 @@ input UserWhereInput { """ hasDeviceAuths: Boolean hasDeviceAuthsWith: [DeviceAuthWhereInput!] + """ + scheduled_tasks edge predicates + """ + hasScheduledTasks: Boolean + hasScheduledTasksWith: [ScheduledTaskWhereInput!] } input ClaimTasksInput { """The identity the beacon is authenticated as (e.g. 'root')""" diff --git a/tavern/internal/graphql/schema/ent.graphql b/tavern/internal/graphql/schema/ent.graphql index 0c603a610..6f389b76a 100644 --- a/tavern/internal/graphql/schema/ent.graphql +++ b/tavern/internal/graphql/schema/ent.graphql @@ -4072,6 +4072,10 @@ type ScheduledTask implements Node { """ where: QuestWhereInput ): QuestConnection! + """ + User that created the scheduled task if available. + """ + creator: User } """ A connection to a list of items. @@ -4261,6 +4265,11 @@ input ScheduledTaskWhereInput { """ hasQuests: Boolean hasQuestsWith: [QuestWhereInput!] + """ + creator edge predicates + """ + hasCreator: Boolean + hasCreatorWith: [UserWhereInput!] } type Screenshot implements Node { id: ID! @@ -6085,6 +6094,9 @@ input UpdateUserInput { addDeviceAuthIDs: [ID!] removeDeviceAuthIDs: [ID!] clearDeviceAuths: Boolean + addScheduledTaskIDs: [ID!] + removeScheduledTaskIDs: [ID!] + clearScheduledTasks: Boolean } type User implements Node { id: ID! @@ -6197,6 +6209,37 @@ type User implements Node { """ where: DeviceAuthWhereInput ): DeviceAuthConnection! + scheduledTasks( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for ScheduledTasks returned from the connection. + """ + orderBy: [ScheduledTaskOrder!] + + """ + Filtering options for ScheduledTasks returned from the connection. + """ + where: ScheduledTaskWhereInput + ): ScheduledTaskConnection! } """ A connection to a list of items. @@ -6323,4 +6366,9 @@ input UserWhereInput { """ hasDeviceAuths: Boolean hasDeviceAuthsWith: [DeviceAuthWhereInput!] + """ + scheduled_tasks edge predicates + """ + hasScheduledTasks: Boolean + hasScheduledTasksWith: [ScheduledTaskWhereInput!] } diff --git a/tavern/internal/www/schema.graphql b/tavern/internal/www/schema.graphql index bec369a6e..d4e999baf 100644 --- a/tavern/internal/www/schema.graphql +++ b/tavern/internal/www/schema.graphql @@ -4077,6 +4077,10 @@ type ScheduledTask implements Node { """ where: QuestWhereInput ): QuestConnection! + """ + User that created the scheduled task if available. + """ + creator: User } """ A connection to a list of items. @@ -4266,6 +4270,11 @@ input ScheduledTaskWhereInput { """ hasQuests: Boolean hasQuestsWith: [QuestWhereInput!] + """ + creator edge predicates + """ + hasCreator: Boolean + hasCreatorWith: [UserWhereInput!] } type Screenshot implements Node { id: ID! @@ -6090,6 +6099,9 @@ input UpdateUserInput { addDeviceAuthIDs: [ID!] removeDeviceAuthIDs: [ID!] clearDeviceAuths: Boolean + addScheduledTaskIDs: [ID!] + removeScheduledTaskIDs: [ID!] + clearScheduledTasks: Boolean } type User implements Node { id: ID! @@ -6202,6 +6214,37 @@ type User implements Node { """ where: DeviceAuthWhereInput ): DeviceAuthConnection! + scheduledTasks( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: Cursor + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: Cursor + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for ScheduledTasks returned from the connection. + """ + orderBy: [ScheduledTaskOrder!] + + """ + Filtering options for ScheduledTasks returned from the connection. + """ + where: ScheduledTaskWhereInput + ): ScheduledTaskConnection! } """ A connection to a list of items. @@ -6328,6 +6371,11 @@ input UserWhereInput { """ hasDeviceAuths: Boolean hasDeviceAuthsWith: [DeviceAuthWhereInput!] + """ + scheduled_tasks edge predicates + """ + hasScheduledTasks: Boolean + hasScheduledTasksWith: [ScheduledTaskWhereInput!] } input ClaimTasksInput { """The identity the beacon is authenticated as (e.g. 'root')""" diff --git a/tavern/portals/portalpb/portal.pb.go b/tavern/portals/portalpb/portal.pb.go index 79b1ae209..6d855893a 100644 --- a/tavern/portals/portalpb/portal.pb.go +++ b/tavern/portals/portalpb/portal.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 +// protoc-gen-go v1.36.11 // protoc v3.21.12 // source: portal.proto @@ -551,78 +551,50 @@ func (x *OpenPortalResponse) GetMote() *Mote { var File_portal_proto protoreflect.FileDescriptor -var file_portal_proto_rawDesc = string([]byte{ - 0x0a, 0x0c, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, - 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x22, 0x50, 0x0a, 0x0c, 0x42, 0x79, 0x74, 0x65, 0x73, 0x50, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2c, 0x0a, 0x04, 0x6b, 0x69, - 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, - 0x6c, 0x2e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4b, 0x69, - 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x22, 0x56, 0x0a, 0x0a, 0x54, 0x43, 0x50, 0x50, - 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, - 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x73, - 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x70, 0x6f, 0x72, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x64, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, - 0x22, 0x56, 0x0a, 0x0a, 0x55, 0x44, 0x50, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x12, - 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, - 0x74, 0x61, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x73, 0x74, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x73, 0x74, 0x41, 0x64, 0x64, 0x72, 0x12, 0x19, 0x0a, - 0x08, 0x64, 0x73, 0x74, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x07, 0x64, 0x73, 0x74, 0x50, 0x6f, 0x72, 0x74, 0x22, 0x6d, 0x0a, 0x0c, 0x53, 0x68, 0x65, 0x6c, - 0x6c, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x70, 0x75, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x70, 0x75, 0x74, 0x12, 0x19, - 0x0a, 0x08, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, - 0x52, 0x07, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x75, 0x74, - 0x70, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x75, 0x74, 0x70, 0x75, - 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x22, 0xf1, 0x01, 0x0a, 0x04, 0x4d, 0x6f, 0x74, 0x65, - 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x49, 0x64, 0x12, 0x15, 0x0a, - 0x06, 0x73, 0x65, 0x71, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x73, - 0x65, 0x71, 0x49, 0x64, 0x12, 0x26, 0x0a, 0x03, 0x75, 0x64, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x55, 0x44, 0x50, 0x50, 0x61, - 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x00, 0x52, 0x03, 0x75, 0x64, 0x70, 0x12, 0x26, 0x0a, 0x03, - 0x74, 0x63, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x70, 0x6f, 0x72, 0x74, - 0x61, 0x6c, 0x2e, 0x54, 0x43, 0x50, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x00, 0x52, - 0x03, 0x74, 0x63, 0x70, 0x12, 0x2c, 0x0a, 0x05, 0x62, 0x79, 0x74, 0x65, 0x73, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x42, 0x79, 0x74, - 0x65, 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x00, 0x52, 0x05, 0x62, 0x79, 0x74, - 0x65, 0x73, 0x12, 0x2c, 0x0a, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x6c, 0x18, 0x06, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x14, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x53, 0x68, 0x65, 0x6c, 0x6c, - 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x48, 0x00, 0x52, 0x05, 0x73, 0x68, 0x65, 0x6c, 0x6c, - 0x42, 0x09, 0x0a, 0x07, 0x70, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x52, 0x0a, 0x11, 0x4f, - 0x70, 0x65, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x49, 0x64, 0x12, 0x20, 0x0a, - 0x04, 0x6d, 0x6f, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6f, - 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x4d, 0x6f, 0x74, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x74, 0x65, 0x22, - 0x36, 0x0a, 0x12, 0x4f, 0x70, 0x65, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x04, 0x6d, 0x6f, 0x74, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x4d, 0x6f, 0x74, - 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x74, 0x65, 0x2a, 0xce, 0x01, 0x0a, 0x10, 0x42, 0x79, 0x74, 0x65, - 0x73, 0x50, 0x61, 0x79, 0x6c, 0x6f, 0x61, 0x64, 0x4b, 0x69, 0x6e, 0x64, 0x12, 0x22, 0x0a, 0x1e, - 0x42, 0x59, 0x54, 0x45, 0x53, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x4b, 0x49, - 0x4e, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, - 0x12, 0x1b, 0x0a, 0x17, 0x42, 0x59, 0x54, 0x45, 0x53, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, - 0x44, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x01, 0x12, 0x1b, 0x0a, - 0x17, 0x42, 0x59, 0x54, 0x45, 0x53, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x4b, - 0x49, 0x4e, 0x44, 0x5f, 0x50, 0x49, 0x4e, 0x47, 0x10, 0x02, 0x12, 0x20, 0x0a, 0x1c, 0x42, 0x59, - 0x54, 0x45, 0x53, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x4b, 0x49, 0x4e, 0x44, - 0x5f, 0x4b, 0x45, 0x45, 0x50, 0x41, 0x4c, 0x49, 0x56, 0x45, 0x10, 0x03, 0x12, 0x1c, 0x0a, 0x18, - 0x42, 0x59, 0x54, 0x45, 0x53, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x4b, 0x49, - 0x4e, 0x44, 0x5f, 0x54, 0x52, 0x41, 0x43, 0x45, 0x10, 0x04, 0x12, 0x1c, 0x0a, 0x18, 0x42, 0x59, - 0x54, 0x45, 0x53, 0x5f, 0x50, 0x41, 0x59, 0x4c, 0x4f, 0x41, 0x44, 0x5f, 0x4b, 0x49, 0x4e, 0x44, - 0x5f, 0x43, 0x4c, 0x4f, 0x53, 0x45, 0x10, 0x05, 0x32, 0x53, 0x0a, 0x06, 0x50, 0x6f, 0x72, 0x74, - 0x61, 0x6c, 0x12, 0x49, 0x0a, 0x0a, 0x4f, 0x70, 0x65, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, - 0x12, 0x19, 0x2e, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x50, 0x6f, - 0x72, 0x74, 0x61, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x6f, - 0x72, 0x74, 0x61, 0x6c, 0x2e, 0x4f, 0x70, 0x65, 0x6e, 0x50, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x23, 0x5a, - 0x21, 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x2e, 0x70, 0x75, 0x62, 0x2f, 0x74, 0x61, 0x76, 0x65, 0x72, - 0x6e, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x73, 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, - 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -}) +const file_portal_proto_rawDesc = "" + + "\n" + + "\fportal.proto\x12\x06portal\"P\n" + + "\fBytesPayload\x12\x12\n" + + "\x04data\x18\x01 \x01(\fR\x04data\x12,\n" + + "\x04kind\x18\x02 \x01(\x0e2\x18.portal.BytesPayloadKindR\x04kind\"V\n" + + "\n" + + "TCPPayload\x12\x12\n" + + "\x04data\x18\x01 \x01(\fR\x04data\x12\x19\n" + + "\bdst_addr\x18\x02 \x01(\tR\adstAddr\x12\x19\n" + + "\bdst_port\x18\x03 \x01(\rR\adstPort\"V\n" + + "\n" + + "UDPPayload\x12\x12\n" + + "\x04data\x18\x01 \x01(\fR\x04data\x12\x19\n" + + "\bdst_addr\x18\x02 \x01(\tR\adstAddr\x12\x19\n" + + "\bdst_port\x18\x03 \x01(\rR\adstPort\"m\n" + + "\fShellPayload\x12\x14\n" + + "\x05input\x18\x01 \x01(\tR\x05input\x12\x19\n" + + "\bshell_id\x18\x02 \x01(\x03R\ashellId\x12\x16\n" + + "\x06output\x18\x03 \x01(\tR\x06output\x12\x14\n" + + "\x05error\x18\x04 \x01(\tR\x05error\"\xf1\x01\n" + + "\x04Mote\x12\x1b\n" + + "\tstream_id\x18\x01 \x01(\tR\bstreamId\x12\x15\n" + + "\x06seq_id\x18\x02 \x01(\x04R\x05seqId\x12&\n" + + "\x03udp\x18\x03 \x01(\v2\x12.portal.UDPPayloadH\x00R\x03udp\x12&\n" + + "\x03tcp\x18\x04 \x01(\v2\x12.portal.TCPPayloadH\x00R\x03tcp\x12,\n" + + "\x05bytes\x18\x05 \x01(\v2\x14.portal.BytesPayloadH\x00R\x05bytes\x12,\n" + + "\x05shell\x18\x06 \x01(\v2\x14.portal.ShellPayloadH\x00R\x05shellB\t\n" + + "\apayload\"R\n" + + "\x11OpenPortalRequest\x12\x1b\n" + + "\tportal_id\x18\x01 \x01(\x03R\bportalId\x12 \n" + + "\x04mote\x18\x02 \x01(\v2\f.portal.MoteR\x04mote\"6\n" + + "\x12OpenPortalResponse\x12 \n" + + "\x04mote\x18\x02 \x01(\v2\f.portal.MoteR\x04mote*\xce\x01\n" + + "\x10BytesPayloadKind\x12\"\n" + + "\x1eBYTES_PAYLOAD_KIND_UNSPECIFIED\x10\x00\x12\x1b\n" + + "\x17BYTES_PAYLOAD_KIND_DATA\x10\x01\x12\x1b\n" + + "\x17BYTES_PAYLOAD_KIND_PING\x10\x02\x12 \n" + + "\x1cBYTES_PAYLOAD_KIND_KEEPALIVE\x10\x03\x12\x1c\n" + + "\x18BYTES_PAYLOAD_KIND_TRACE\x10\x04\x12\x1c\n" + + "\x18BYTES_PAYLOAD_KIND_CLOSE\x10\x052S\n" + + "\x06Portal\x12I\n" + + "\n" + + "OpenPortal\x12\x19.portal.OpenPortalRequest\x1a\x1a.portal.OpenPortalResponse\"\x00(\x010\x01B#Z!realm.pub/tavern/portals/portalpbb\x06proto3" var ( file_portal_proto_rawDescOnce sync.Once diff --git a/tavern/portals/portalpb/portal_grpc.pb.go b/tavern/portals/portalpb/portal_grpc.pb.go index 9b0bd90f3..8de9670f2 100644 --- a/tavern/portals/portalpb/portal_grpc.pb.go +++ b/tavern/portals/portalpb/portal_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.3.0 +// - protoc-gen-go-grpc v1.6.1 // - protoc v3.21.12 // source: portal.proto @@ -15,8 +15,8 @@ import ( // This is a compile-time assertion to ensure that this generated file // is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Portal_OpenPortal_FullMethodName = "/portal.Portal/OpenPortal" @@ -26,7 +26,7 @@ const ( // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type PortalClient interface { - OpenPortal(ctx context.Context, opts ...grpc.CallOption) (Portal_OpenPortalClient, error) + OpenPortal(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[OpenPortalRequest, OpenPortalResponse], error) } type portalClient struct { @@ -37,54 +37,39 @@ func NewPortalClient(cc grpc.ClientConnInterface) PortalClient { return &portalClient{cc} } -func (c *portalClient) OpenPortal(ctx context.Context, opts ...grpc.CallOption) (Portal_OpenPortalClient, error) { +func (c *portalClient) OpenPortal(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[OpenPortalRequest, OpenPortalResponse], error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &Portal_ServiceDesc.Streams[0], Portal_OpenPortal_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &portalOpenPortalClient{ClientStream: stream} + x := &grpc.GenericClientStream[OpenPortalRequest, OpenPortalResponse]{ClientStream: stream} return x, nil } -type Portal_OpenPortalClient interface { - Send(*OpenPortalRequest) error - Recv() (*OpenPortalResponse, error) - grpc.ClientStream -} - -type portalOpenPortalClient struct { - grpc.ClientStream -} - -func (x *portalOpenPortalClient) Send(m *OpenPortalRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *portalOpenPortalClient) Recv() (*OpenPortalResponse, error) { - m := new(OpenPortalResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Portal_OpenPortalClient = grpc.BidiStreamingClient[OpenPortalRequest, OpenPortalResponse] // PortalServer is the server API for Portal service. // All implementations must embed UnimplementedPortalServer -// for forward compatibility +// for forward compatibility. type PortalServer interface { - OpenPortal(Portal_OpenPortalServer) error + OpenPortal(grpc.BidiStreamingServer[OpenPortalRequest, OpenPortalResponse]) error mustEmbedUnimplementedPortalServer() } -// UnimplementedPortalServer must be embedded to have forward compatible implementations. -type UnimplementedPortalServer struct { -} +// UnimplementedPortalServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedPortalServer struct{} -func (UnimplementedPortalServer) OpenPortal(Portal_OpenPortalServer) error { - return status.Errorf(codes.Unimplemented, "method OpenPortal not implemented") +func (UnimplementedPortalServer) OpenPortal(grpc.BidiStreamingServer[OpenPortalRequest, OpenPortalResponse]) error { + return status.Error(codes.Unimplemented, "method OpenPortal not implemented") } func (UnimplementedPortalServer) mustEmbedUnimplementedPortalServer() {} +func (UnimplementedPortalServer) testEmbeddedByValue() {} // UnsafePortalServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to PortalServer will @@ -94,34 +79,22 @@ type UnsafePortalServer interface { } func RegisterPortalServer(s grpc.ServiceRegistrar, srv PortalServer) { + // If the following call panics, it indicates UnimplementedPortalServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Portal_ServiceDesc, srv) } func _Portal_OpenPortal_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(PortalServer).OpenPortal(&portalOpenPortalServer{ServerStream: stream}) -} - -type Portal_OpenPortalServer interface { - Send(*OpenPortalResponse) error - Recv() (*OpenPortalRequest, error) - grpc.ServerStream -} - -type portalOpenPortalServer struct { - grpc.ServerStream + return srv.(PortalServer).OpenPortal(&grpc.GenericServerStream[OpenPortalRequest, OpenPortalResponse]{ServerStream: stream}) } -func (x *portalOpenPortalServer) Send(m *OpenPortalResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *portalOpenPortalServer) Recv() (*OpenPortalRequest, error) { - m := new(OpenPortalRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} +// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. +type Portal_OpenPortalServer = grpc.BidiStreamingServer[OpenPortalRequest, OpenPortalResponse] // Portal_ServiceDesc is the grpc.ServiceDesc for Portal service. // It's only intended for direct use with grpc.RegisterService, diff --git a/tavern/portals/tracepb/trace.pb.go b/tavern/portals/tracepb/trace.pb.go index d16c158d5..4a6d657f4 100644 --- a/tavern/portals/tracepb/trace.pb.go +++ b/tavern/portals/tracepb/trace.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.5 +// protoc-gen-go v1.36.11 // protoc v3.21.12 // source: trace.proto @@ -222,57 +222,32 @@ func (x *TraceData) GetEvents() []*TraceEvent { var File_trace_proto protoreflect.FileDescriptor -var file_trace_proto_rawDesc = string([]byte{ - 0x0a, 0x0b, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x74, - 0x72, 0x61, 0x63, 0x65, 0x22, 0x62, 0x0a, 0x0a, 0x54, 0x72, 0x61, 0x63, 0x65, 0x45, 0x76, 0x65, - 0x6e, 0x74, 0x12, 0x29, 0x0a, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, - 0x32, 0x15, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x45, 0x76, - 0x65, 0x6e, 0x74, 0x4b, 0x69, 0x6e, 0x64, 0x52, 0x04, 0x6b, 0x69, 0x6e, 0x64, 0x12, 0x29, 0x0a, - 0x10, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x5f, 0x6d, 0x69, 0x63, 0x72, 0x6f, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, - 0x6d, 0x70, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x22, 0x73, 0x0a, 0x09, 0x54, 0x72, 0x61, 0x63, - 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x6d, - 0x69, 0x63, 0x72, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x73, 0x74, 0x61, - 0x72, 0x74, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x61, 0x64, 0x64, - 0x69, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x61, 0x64, 0x64, 0x69, - 0x6e, 0x67, 0x12, 0x29, 0x0a, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, - 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x73, 0x2a, 0xec, 0x03, - 0x0a, 0x0e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x4b, 0x69, 0x6e, 0x64, - 0x12, 0x20, 0x0a, 0x1c, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, - 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, - 0x10, 0x00, 0x12, 0x1e, 0x0a, 0x1a, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, - 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x4e, 0x44, - 0x10, 0x01, 0x12, 0x25, 0x0a, 0x21, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, - 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x55, 0x53, - 0x45, 0x52, 0x5f, 0x52, 0x45, 0x43, 0x56, 0x10, 0x02, 0x12, 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, - 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, - 0x52, 0x56, 0x45, 0x52, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x50, 0x55, 0x42, 0x10, 0x03, 0x12, - 0x25, 0x0a, 0x21, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, - 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, - 0x5f, 0x53, 0x55, 0x42, 0x10, 0x04, 0x12, 0x26, 0x0a, 0x22, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, - 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, - 0x52, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x10, 0x05, 0x12, 0x1f, - 0x0a, 0x1b, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, 0x49, - 0x4e, 0x44, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x52, 0x45, 0x43, 0x56, 0x10, 0x06, 0x12, - 0x1f, 0x0a, 0x1b, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, - 0x49, 0x4e, 0x44, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x10, 0x07, - 0x12, 0x26, 0x0a, 0x22, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, - 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x41, 0x47, 0x45, 0x4e, - 0x54, 0x5f, 0x52, 0x45, 0x43, 0x56, 0x10, 0x08, 0x12, 0x25, 0x0a, 0x21, 0x54, 0x52, 0x41, 0x43, - 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, - 0x56, 0x45, 0x52, 0x5f, 0x41, 0x47, 0x45, 0x4e, 0x54, 0x5f, 0x50, 0x55, 0x42, 0x10, 0x09, 0x12, - 0x24, 0x0a, 0x20, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, - 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, - 0x53, 0x55, 0x42, 0x10, 0x0a, 0x12, 0x25, 0x0a, 0x21, 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, - 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, 0x5f, 0x53, 0x45, 0x52, 0x56, 0x45, 0x52, - 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x53, 0x45, 0x4e, 0x44, 0x10, 0x0b, 0x12, 0x1e, 0x0a, 0x1a, - 0x54, 0x52, 0x41, 0x43, 0x45, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x5f, 0x4b, 0x49, 0x4e, 0x44, - 0x5f, 0x55, 0x53, 0x45, 0x52, 0x5f, 0x52, 0x45, 0x43, 0x56, 0x10, 0x0c, 0x42, 0x22, 0x5a, 0x20, - 0x72, 0x65, 0x61, 0x6c, 0x6d, 0x2e, 0x70, 0x75, 0x62, 0x2f, 0x74, 0x61, 0x76, 0x65, 0x72, 0x6e, - 0x2f, 0x70, 0x6f, 0x72, 0x74, 0x61, 0x6c, 0x73, 0x2f, 0x74, 0x72, 0x61, 0x63, 0x65, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -}) +const file_trace_proto_rawDesc = "" + + "\n" + + "\vtrace.proto\x12\x05trace\"b\n" + + "\n" + + "TraceEvent\x12)\n" + + "\x04kind\x18\x01 \x01(\x0e2\x15.trace.TraceEventKindR\x04kind\x12)\n" + + "\x10timestamp_micros\x18\x02 \x01(\x03R\x0ftimestampMicros\"s\n" + + "\tTraceData\x12!\n" + + "\fstart_micros\x18\x01 \x01(\x03R\vstartMicros\x12\x18\n" + + "\apadding\x18\x02 \x01(\fR\apadding\x12)\n" + + "\x06events\x18\x03 \x03(\v2\x11.trace.TraceEventR\x06events*\xec\x03\n" + + "\x0eTraceEventKind\x12 \n" + + "\x1cTRACE_EVENT_KIND_UNSPECIFIED\x10\x00\x12\x1e\n" + + "\x1aTRACE_EVENT_KIND_USER_SEND\x10\x01\x12%\n" + + "!TRACE_EVENT_KIND_SERVER_USER_RECV\x10\x02\x12$\n" + + " TRACE_EVENT_KIND_SERVER_USER_PUB\x10\x03\x12%\n" + + "!TRACE_EVENT_KIND_SERVER_AGENT_SUB\x10\x04\x12&\n" + + "\"TRACE_EVENT_KIND_SERVER_AGENT_SEND\x10\x05\x12\x1f\n" + + "\x1bTRACE_EVENT_KIND_AGENT_RECV\x10\x06\x12\x1f\n" + + "\x1bTRACE_EVENT_KIND_AGENT_SEND\x10\a\x12&\n" + + "\"TRACE_EVENT_KIND_SERVER_AGENT_RECV\x10\b\x12%\n" + + "!TRACE_EVENT_KIND_SERVER_AGENT_PUB\x10\t\x12$\n" + + " TRACE_EVENT_KIND_SERVER_USER_SUB\x10\n" + + "\x12%\n" + + "!TRACE_EVENT_KIND_SERVER_USER_SEND\x10\v\x12\x1e\n" + + "\x1aTRACE_EVENT_KIND_USER_RECV\x10\fB\"Z realm.pub/tavern/portals/tracepbb\x06proto3" var ( file_trace_proto_rawDescOnce sync.Once