func (kc *KopiaClient) SnapshotDelete(ctx context.Context, key string) error {
	r, err := repo.Open(ctx, kc.configPath, kc.pw, &repo.Options{})
	if err != nil {
		return errors.Wrap(err, "cannot open repository")
	}

	ctx, rw, err := r.NewWriter(ctx, repo.WriteSessionOptions{})
	if err != nil {
		return errors.Wrap(err, "cannot get new repository writer")
	}

	mans, err := kc.getSnapshotsFromKey(ctx, r, key)
	if err != nil {
		return errors.Wrap(err, "cannot get snapshots from key")
	}

	for _, man := range mans {
		if err := rw.DeleteManifest(ctx, man.ID); err != nil {
			return errors.Wrap(err, "cannot delete manifest")
		}
	}

	if err := rw.Flush(ctx); err != nil {
		return err
	}

	return r.Close(ctx)
}
// SnapshotDelete deletes all snapshots for a given path.
SnapshotDelete deletes all snapshots for a given path.
// SnapshotDelete deletes all snapshots for a given path .
func (kc *KopiaClient) SnapshotDelete(ctx context.Context, key string) error {
	r, err := repo.Open(ctx, kc.configPath, kc.pw, &repo.Options{})
	if err != nil {
		return errors.Wrap(err, "cannot open repository")
	}
	ctx, rw, err := r.NewWriter(ctx, repo.WriteSessionOptions{})
	if err != nil {
		return errors.Wrap(err, "cannot get new repository writer")
	}
	mans, err := kc.getSnapshotsFromKey(ctx, r, key)
	if err != nil {
		return errors.Wrap(err, "cannot get snapshots from key")
	}
	for _, man := range mans {
		if err := rw.DeleteManifest(ctx, man.ID); err != nil {
			return errors.Wrap(err, "cannot delete manifest")
		}
	}
	if err := rw.Flush(ctx); err != nil {
		return err
	}
	return r.Close(ctx)
}
func ( kc * KopiaClient ) SnapshotDelete ( ctx context . Context , key string ) error { r , err := repo . Open ( ctx , kc . configPath , kc . pw , & repo . Options { } ) if err != nil { return errors . Wrap ( err , " " ) } ctx , rw , err := r . NewWriter ( ctx , repo . WriteSessionOptions { } ) if err != nil { return errors . Wrap ( err , " " ) } mans , err := kc . getSnapshotsFromKey ( ctx , r , key ) if err != nil { return errors . Wrap ( err , " " ) } for _ , man := range mans { if err := rw . DeleteManifest ( ctx , man . ID ) ; err != nil { return errors . Wrap ( err , " " ) } } if err := rw . Flush ( ctx ) ; err != nil { return err } return r . Close ( ctx ) }
SnapshotDelete deletes all snapshots for a given path.
SnapshotDelete deletes all snapshots for a given path .