(ctx context.Context, r repo.Repository)
| 53 | } |
| 54 | |
| 55 | func (c *commandRepositoryStatus) outputJSON(ctx context.Context, r repo.Repository) error { |
| 56 | s := RepositoryStatus{ |
| 57 | ConfigFile: c.svc.repositoryConfigFileName(), |
| 58 | ClientOptions: r.ClientOptions(), |
| 59 | } |
| 60 | |
| 61 | dr, ok := r.(repo.DirectRepository) |
| 62 | if ok { |
| 63 | ci := dr.BlobReader().ConnectionInfo() |
| 64 | s.UniqueIDHex = hex.EncodeToString(dr.UniqueID()) |
| 65 | s.ObjectFormat = dr.ObjectFormat() |
| 66 | s.BlobRetention, _ = dr.FormatManager().BlobCfgBlob(ctx) |
| 67 | s.Storage = scrubber.ScrubSensitiveData(reflect.ValueOf(ci)).Interface().(blob.ConnectionInfo) //nolint:forcetypeassert |
| 68 | s.ContentFormat = dr.FormatManager().ScrubbedContentFormat() |
| 69 | |
| 70 | switch cp, err := dr.BlobVolume().GetCapacity(ctx); { |
| 71 | case err == nil: |
| 72 | s.Capacity = &cp |
| 73 | case errors.Is(err, blob.ErrNotAVolume): |
| 74 | // This is okay, we will just not populate the result. |
| 75 | default: |
| 76 | return errors.Wrap(err, "unable to get storage volume capacity") |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | c.out.printStdout("%s\n", c.jo.jsonBytes(s)) |
| 81 | |
| 82 | return nil |
| 83 | } |
| 84 | |
| 85 | func (c *commandRepositoryStatus) dumpUpgradeStatus(ctx context.Context, dr repo.DirectRepository) error { |
| 86 | drw, isDr := dr.(repo.DirectRepositoryWriter) |
no test coverage detected