diff options
Diffstat (limited to 'proto')
-rw-r--r-- | proto/cleanup.proto | 39 | ||||
-rw-r--r-- | proto/go/gitalypb/cleanup.pb.go | 218 | ||||
-rw-r--r-- | proto/go/gitalypb/cleanup_grpc.pb.go | 98 |
3 files changed, 324 insertions, 31 deletions
diff --git a/proto/cleanup.proto b/proto/cleanup.proto index 511bbff46..77cf6c6a3 100644 --- a/proto/cleanup.proto +++ b/proto/cleanup.proto @@ -17,6 +17,26 @@ service CleanupService { }; } + // RewriteHistory redacts targeted strings and deletes requested blobs in a + // repository and updates all references to point to the rewritten commit + // history. This is useful for removing inadvertently pushed secrets from your + // repository and purging large blobs. This is a dangerous operation. + // + // The following known error conditions may happen: + // + // - `InvalidArgument` in the following situations: + // - The provided repository can't be validated. + // - The repository field is set on any request other than the initial one. + // - Any request, including the initial one, does not contain either blobs to + // remove or redaction patterns to redact. + // - A blob object ID is invalid. + // - A redaction pattern contains a newline character. + rpc RewriteHistory(stream RewriteHistoryRequest) returns (RewriteHistoryResponse) { + option (op_type) = { + op : MUTATOR + }; + } + } // ApplyBfgObjectMapStreamRequest ... @@ -47,3 +67,22 @@ message ApplyBfgObjectMapStreamResponse { // entries ... repeated Entry entries = 1; } + +// RewriteHistoryRequest is a request for the RewriteHistory RPC. +// Each request must contain blobs, redactions, or both. +message RewriteHistoryRequest { + // repository is the repository that shall be rewritten. + // Must be sent on the first request only. + Repository repository = 1 [(target_repository)=true]; + // blobs is the list of blob object ids that will be removed from history. + repeated string blobs = 2; + // redactions is the list of literals or patterns that will be replaced + // with "***REMOVED***". Items cannot contain newline characters. + // See https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html + // for a full explanation of what patterns are supported. + repeated bytes redactions = 3; +} + +// RewriteHistoryResponse a response for the RewriteHistory RPC. +message RewriteHistoryResponse { +} diff --git a/proto/go/gitalypb/cleanup.pb.go b/proto/go/gitalypb/cleanup.pb.go index b54d5d1e2..028f0f8cc 100644 --- a/proto/go/gitalypb/cleanup.pb.go +++ b/proto/go/gitalypb/cleanup.pb.go @@ -130,6 +130,117 @@ func (x *ApplyBfgObjectMapStreamResponse) GetEntries() []*ApplyBfgObjectMapStrea return nil } +// RewriteHistoryRequest is a request for the RewriteHistory RPC. +// Each request must contain blobs, redactions, or both. +type RewriteHistoryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // repository is the repository that shall be rewritten. + // Must be sent on the first request only. + Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"` + // blobs is the list of blob object ids that will be removed from history. + Blobs []string `protobuf:"bytes,2,rep,name=blobs,proto3" json:"blobs,omitempty"` + // redactions is the list of literals or patterns that will be replaced + // with "***REMOVED***". Items cannot contain newline characters. + // See https://htmlpreview.github.io/?https://github.com/newren/git-filter-repo/blob/docs/html/git-filter-repo.html + // for a full explanation of what patterns are supported. + Redactions [][]byte `protobuf:"bytes,3,rep,name=redactions,proto3" json:"redactions,omitempty"` +} + +func (x *RewriteHistoryRequest) Reset() { + *x = RewriteHistoryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_cleanup_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RewriteHistoryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewriteHistoryRequest) ProtoMessage() {} + +func (x *RewriteHistoryRequest) ProtoReflect() protoreflect.Message { + mi := &file_cleanup_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RewriteHistoryRequest.ProtoReflect.Descriptor instead. +func (*RewriteHistoryRequest) Descriptor() ([]byte, []int) { + return file_cleanup_proto_rawDescGZIP(), []int{2} +} + +func (x *RewriteHistoryRequest) GetRepository() *Repository { + if x != nil { + return x.Repository + } + return nil +} + +func (x *RewriteHistoryRequest) GetBlobs() []string { + if x != nil { + return x.Blobs + } + return nil +} + +func (x *RewriteHistoryRequest) GetRedactions() [][]byte { + if x != nil { + return x.Redactions + } + return nil +} + +// RewriteHistoryResponse a response for the RewriteHistory RPC. +type RewriteHistoryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RewriteHistoryResponse) Reset() { + *x = RewriteHistoryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_cleanup_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RewriteHistoryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RewriteHistoryResponse) ProtoMessage() {} + +func (x *RewriteHistoryResponse) ProtoReflect() protoreflect.Message { + mi := &file_cleanup_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use RewriteHistoryResponse.ProtoReflect.Descriptor instead. +func (*RewriteHistoryResponse) Descriptor() ([]byte, []int) { + return file_cleanup_proto_rawDescGZIP(), []int{3} +} + // Entry refers to each parsed entry in the request's object map so the client // can take action. type ApplyBfgObjectMapStreamResponse_Entry struct { @@ -148,7 +259,7 @@ type ApplyBfgObjectMapStreamResponse_Entry struct { func (x *ApplyBfgObjectMapStreamResponse_Entry) Reset() { *x = ApplyBfgObjectMapStreamResponse_Entry{} if protoimpl.UnsafeEnabled { - mi := &file_cleanup_proto_msgTypes[2] + mi := &file_cleanup_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -161,7 +272,7 @@ func (x *ApplyBfgObjectMapStreamResponse_Entry) String() string { func (*ApplyBfgObjectMapStreamResponse_Entry) ProtoMessage() {} func (x *ApplyBfgObjectMapStreamResponse_Entry) ProtoReflect() protoreflect.Message { - mi := &file_cleanup_proto_msgTypes[2] + mi := &file_cleanup_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -224,20 +335,36 @@ var file_cleanup_proto_rawDesc = []byte{ 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x6f, 0x6c, 0x64, 0x5f, 0x6f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x6c, 0x64, 0x4f, 0x69, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x65, 0x77, 0x5f, 0x6f, 0x69, 0x64, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x65, 0x77, 0x4f, 0x69, 0x64, 0x32, 0x88, 0x01, 0x0a, - 0x0e, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x75, 0x70, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x76, 0x0a, 0x17, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x42, 0x66, 0x67, 0x4f, 0x62, 0x6a, 0x65, 0x63, - 0x74, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x26, 0x2e, 0x67, 0x69, 0x74, - 0x61, 0x6c, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x42, 0x66, 0x67, 0x4f, 0x62, 0x6a, 0x65, - 0x63, 0x74, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x6c, - 0x79, 0x42, 0x66, 0x67, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, - 0x02, 0x08, 0x01, 0x28, 0x01, 0x30, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, - 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, - 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x65, 0x77, 0x4f, 0x69, 0x64, 0x22, 0x87, 0x01, 0x0a, + 0x15, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, + 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, + 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x42, 0x04, + 0x98, 0xc6, 0x2c, 0x01, 0x52, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, + 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x05, 0x62, 0x6c, 0x6f, 0x62, 0x73, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0c, 0x52, 0x0a, 0x72, 0x65, 0x64, 0x61, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x18, 0x0a, 0x16, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, + 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0xe3, 0x01, 0x0a, 0x0e, 0x43, 0x6c, 0x65, 0x61, 0x6e, 0x75, 0x70, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x76, 0x0a, 0x17, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x42, 0x66, 0x67, 0x4f, + 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x12, 0x26, + 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x42, 0x66, 0x67, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, + 0x41, 0x70, 0x70, 0x6c, 0x79, 0x42, 0x66, 0x67, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x4d, 0x61, + 0x70, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x28, 0x01, 0x30, 0x01, 0x12, 0x59, 0x0a, 0x0e, 0x52, + 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x1d, 0x2e, + 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x48, 0x69, + 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1e, 0x2e, 0x67, + 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x77, 0x72, 0x69, 0x74, 0x65, 0x48, 0x69, 0x73, + 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, + 0x28, 0x02, 0x08, 0x01, 0x28, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, + 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, + 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -252,25 +379,30 @@ func file_cleanup_proto_rawDescGZIP() []byte { return file_cleanup_proto_rawDescData } -var file_cleanup_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_cleanup_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_cleanup_proto_goTypes = []interface{}{ (*ApplyBfgObjectMapStreamRequest)(nil), // 0: gitaly.ApplyBfgObjectMapStreamRequest (*ApplyBfgObjectMapStreamResponse)(nil), // 1: gitaly.ApplyBfgObjectMapStreamResponse - (*ApplyBfgObjectMapStreamResponse_Entry)(nil), // 2: gitaly.ApplyBfgObjectMapStreamResponse.Entry - (*Repository)(nil), // 3: gitaly.Repository - (ObjectType)(0), // 4: gitaly.ObjectType + (*RewriteHistoryRequest)(nil), // 2: gitaly.RewriteHistoryRequest + (*RewriteHistoryResponse)(nil), // 3: gitaly.RewriteHistoryResponse + (*ApplyBfgObjectMapStreamResponse_Entry)(nil), // 4: gitaly.ApplyBfgObjectMapStreamResponse.Entry + (*Repository)(nil), // 5: gitaly.Repository + (ObjectType)(0), // 6: gitaly.ObjectType } var file_cleanup_proto_depIdxs = []int32{ - 3, // 0: gitaly.ApplyBfgObjectMapStreamRequest.repository:type_name -> gitaly.Repository - 2, // 1: gitaly.ApplyBfgObjectMapStreamResponse.entries:type_name -> gitaly.ApplyBfgObjectMapStreamResponse.Entry - 4, // 2: gitaly.ApplyBfgObjectMapStreamResponse.Entry.type:type_name -> gitaly.ObjectType - 0, // 3: gitaly.CleanupService.ApplyBfgObjectMapStream:input_type -> gitaly.ApplyBfgObjectMapStreamRequest - 1, // 4: gitaly.CleanupService.ApplyBfgObjectMapStream:output_type -> gitaly.ApplyBfgObjectMapStreamResponse - 4, // [4:5] is the sub-list for method output_type - 3, // [3:4] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 5, // 0: gitaly.ApplyBfgObjectMapStreamRequest.repository:type_name -> gitaly.Repository + 4, // 1: gitaly.ApplyBfgObjectMapStreamResponse.entries:type_name -> gitaly.ApplyBfgObjectMapStreamResponse.Entry + 5, // 2: gitaly.RewriteHistoryRequest.repository:type_name -> gitaly.Repository + 6, // 3: gitaly.ApplyBfgObjectMapStreamResponse.Entry.type:type_name -> gitaly.ObjectType + 0, // 4: gitaly.CleanupService.ApplyBfgObjectMapStream:input_type -> gitaly.ApplyBfgObjectMapStreamRequest + 2, // 5: gitaly.CleanupService.RewriteHistory:input_type -> gitaly.RewriteHistoryRequest + 1, // 6: gitaly.CleanupService.ApplyBfgObjectMapStream:output_type -> gitaly.ApplyBfgObjectMapStreamResponse + 3, // 7: gitaly.CleanupService.RewriteHistory:output_type -> gitaly.RewriteHistoryResponse + 6, // [6:8] is the sub-list for method output_type + 4, // [4:6] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_cleanup_proto_init() } @@ -306,6 +438,30 @@ func file_cleanup_proto_init() { } } file_cleanup_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RewriteHistoryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cleanup_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RewriteHistoryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cleanup_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ApplyBfgObjectMapStreamResponse_Entry); i { case 0: return &v.state @@ -324,7 +480,7 @@ func file_cleanup_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cleanup_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 5, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/go/gitalypb/cleanup_grpc.pb.go b/proto/go/gitalypb/cleanup_grpc.pb.go index 4d42e293e..a9b1d2c62 100644 --- a/proto/go/gitalypb/cleanup_grpc.pb.go +++ b/proto/go/gitalypb/cleanup_grpc.pb.go @@ -24,6 +24,21 @@ const _ = grpc.SupportPackageIsVersion7 type CleanupServiceClient interface { // ApplyBfgObjectMapStream ... ApplyBfgObjectMapStream(ctx context.Context, opts ...grpc.CallOption) (CleanupService_ApplyBfgObjectMapStreamClient, error) + // RewriteHistory redacts targeted strings and deletes requested blobs in a + // repository and updates all references to point to the rewritten commit + // history. This is useful for removing inadvertently pushed secrets from your + // repository and purging large blobs. This is a dangerous operation. + // + // The following known error conditions may happen: + // + // - `InvalidArgument` in the following situations: + // - The provided repository can't be validated. + // - The repository field is set on any request other than the initial one. + // - Any request, including the initial one, does not contain either blobs to + // remove or redaction patterns to redact. + // - A blob object ID is invalid. + // - A redaction pattern contains a newline character. + RewriteHistory(ctx context.Context, opts ...grpc.CallOption) (CleanupService_RewriteHistoryClient, error) } type cleanupServiceClient struct { @@ -65,12 +80,61 @@ func (x *cleanupServiceApplyBfgObjectMapStreamClient) Recv() (*ApplyBfgObjectMap return m, nil } +func (c *cleanupServiceClient) RewriteHistory(ctx context.Context, opts ...grpc.CallOption) (CleanupService_RewriteHistoryClient, error) { + stream, err := c.cc.NewStream(ctx, &CleanupService_ServiceDesc.Streams[1], "/gitaly.CleanupService/RewriteHistory", opts...) + if err != nil { + return nil, err + } + x := &cleanupServiceRewriteHistoryClient{stream} + return x, nil +} + +type CleanupService_RewriteHistoryClient interface { + Send(*RewriteHistoryRequest) error + CloseAndRecv() (*RewriteHistoryResponse, error) + grpc.ClientStream +} + +type cleanupServiceRewriteHistoryClient struct { + grpc.ClientStream +} + +func (x *cleanupServiceRewriteHistoryClient) Send(m *RewriteHistoryRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *cleanupServiceRewriteHistoryClient) CloseAndRecv() (*RewriteHistoryResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(RewriteHistoryResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // CleanupServiceServer is the server API for CleanupService service. // All implementations must embed UnimplementedCleanupServiceServer // for forward compatibility type CleanupServiceServer interface { // ApplyBfgObjectMapStream ... ApplyBfgObjectMapStream(CleanupService_ApplyBfgObjectMapStreamServer) error + // RewriteHistory redacts targeted strings and deletes requested blobs in a + // repository and updates all references to point to the rewritten commit + // history. This is useful for removing inadvertently pushed secrets from your + // repository and purging large blobs. This is a dangerous operation. + // + // The following known error conditions may happen: + // + // - `InvalidArgument` in the following situations: + // - The provided repository can't be validated. + // - The repository field is set on any request other than the initial one. + // - Any request, including the initial one, does not contain either blobs to + // remove or redaction patterns to redact. + // - A blob object ID is invalid. + // - A redaction pattern contains a newline character. + RewriteHistory(CleanupService_RewriteHistoryServer) error mustEmbedUnimplementedCleanupServiceServer() } @@ -81,6 +145,9 @@ type UnimplementedCleanupServiceServer struct { func (UnimplementedCleanupServiceServer) ApplyBfgObjectMapStream(CleanupService_ApplyBfgObjectMapStreamServer) error { return status.Errorf(codes.Unimplemented, "method ApplyBfgObjectMapStream not implemented") } +func (UnimplementedCleanupServiceServer) RewriteHistory(CleanupService_RewriteHistoryServer) error { + return status.Errorf(codes.Unimplemented, "method RewriteHistory not implemented") +} func (UnimplementedCleanupServiceServer) mustEmbedUnimplementedCleanupServiceServer() {} // UnsafeCleanupServiceServer may be embedded to opt out of forward compatibility for this service. @@ -120,6 +187,32 @@ func (x *cleanupServiceApplyBfgObjectMapStreamServer) Recv() (*ApplyBfgObjectMap return m, nil } +func _CleanupService_RewriteHistory_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(CleanupServiceServer).RewriteHistory(&cleanupServiceRewriteHistoryServer{stream}) +} + +type CleanupService_RewriteHistoryServer interface { + SendAndClose(*RewriteHistoryResponse) error + Recv() (*RewriteHistoryRequest, error) + grpc.ServerStream +} + +type cleanupServiceRewriteHistoryServer struct { + grpc.ServerStream +} + +func (x *cleanupServiceRewriteHistoryServer) SendAndClose(m *RewriteHistoryResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *cleanupServiceRewriteHistoryServer) Recv() (*RewriteHistoryRequest, error) { + m := new(RewriteHistoryRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + // CleanupService_ServiceDesc is the grpc.ServiceDesc for CleanupService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -134,6 +227,11 @@ var CleanupService_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, ClientStreams: true, }, + { + StreamName: "RewriteHistory", + Handler: _CleanupService_RewriteHistory_Handler, + ClientStreams: true, + }, }, Metadata: "cleanup.proto", } |