Read handles the reading of bundles.
(ctx context.Context, request *v1.BundleReadRequest)
| 74 | |
| 75 | // Read handles the reading of bundles. |
| 76 | func (r *BundleServer) Read(ctx context.Context, request *v1.BundleReadRequest) (*v1.BundleReadResponse, error) { |
| 77 | ctx, span := internal.Tracer.Start(ctx, "bundle.read") |
| 78 | defer span.End() |
| 79 | |
| 80 | v := request.Validate() |
| 81 | if v != nil { |
| 82 | return nil, status.Error(GetStatus(v), v.Error()) // Return validation error |
| 83 | } |
| 84 | |
| 85 | bundle, err := r.br.Read(ctx, request.GetTenantId(), request.GetName()) |
| 86 | if err != nil { |
| 87 | span.RecordError(err) |
| 88 | span.SetStatus(otelCodes.Error, err.Error()) |
| 89 | slog.ErrorContext(ctx, err.Error()) |
| 90 | return nil, status.Error(GetStatus(err), err.Error()) |
| 91 | } |
| 92 | |
| 93 | return &v1.BundleReadResponse{ |
| 94 | Bundle: bundle, |
| 95 | }, nil |
| 96 | } |
| 97 | |
| 98 | // Delete handles the deletion of bundles. |
| 99 | func (r *BundleServer) Delete(ctx context.Context, request *v1.BundleDeleteRequest) (*v1.BundleDeleteResponse, error) { |
nothing calls this directly
no test coverage detected