44 Commits

Author SHA1 Message Date
Danny
eca16e4a69
CLI: Contact and Event Flags active (#633)
Contact and Event flags restored
2022-08-23 12:29:19 +00:00
Keepers
3ac05acf64
introduce log-level control (#589)
Introduces the log-level flag, defaulting to info.  Also does
a minor refactor of how Print is called for backup results,
which moves the backup/details imports out of the cli/print,
and instead has thoses packages call a Print func.
2022-08-18 18:30:15 +00:00
Keepers
a1b9f876ae
add final basic cli tests (#578)
Adds the base CLI integration tests for backup, list, details,
and restore.  Also refactors out the global root command
value in favor of a ctx-bound reference so that tests may
control safely overwriting stdout to scrutinize output.
2022-08-17 18:13:55 +00:00
ashmrtn
e76860fd80
Set line length to 120 characters (#506)
* Enable line width linter

Set to 120 which should be long enough to not be annoying but keep
things from getting "too long." Adding to get rid of the subjectiveness
of what is "too long." Tabs count as a single character.
2022-08-12 16:05:46 +00:00
Keepers
5070296e18
add connect cli integration tests (#493) 2022-08-05 12:05:45 -07:00
ashmrtn
9e2e88f5f3
Enable some linters in revive (#486)
* Turn on revive linter, ignore only a few things

* Fix lint errors

Ignore shadowing of 'suite' in tests for now. Also move some constants
that had the same value to tester.
2022-08-04 14:42:51 -07:00
Keepers
342dd2e9f9
set up CLI for integration testing (#478)
Makes the necessary changes, including adding helper
funcs, to bring the CLI up to an integration-testable
state.  The changes made in this commit should be
sufficient for most other CLI tests.  Includes a single
test as verification.
2022-08-04 17:15:13 +00:00
Keepers
88a8e992fd
use StringSlice pflag func to split flag inputs (#468) 2022-08-03 16:32:49 -06:00
Keepers
a785cb5eb4
dedupe cli/print import (#464) 2022-08-02 18:40:49 +00:00
Keepers
b9171d01dc
remove help menu output from non-cli errors (#438)
Cobra's RunE causes every error response to display the
CLI help menu for the current command, after printing the
original error itself.  This made error outputs difficult to
read, and was generally unhelpful in most cases.  The exit
func in Print now prints the error and closes the CLI without
showing the help menu.
2022-07-29 19:47:08 +00:00
Keepers
7e60ec5073
move operation.Options into /pkg/control (#452)
In order for sdk users to build an operation using a repo,
without importing /inernal packages, the operation
options needs to be available via a /pkg package.
2022-07-29 12:52:19 -06:00
Keepers
9ea0409125
print backup details at the end of backup create (#439) 2022-07-28 17:53:49 -06:00
Keepers
4862d5b800
return errors if selectors reduce all entries (#427)
* return errors if selectors reduce all entries

During a `backup details` or `restore` command, if the
selectors produce 0 results, return an error rather than
running a no-op process.
2022-07-28 11:03:30 -06:00
Keepers
1929b2307f
reduce filter selector flags to single strings (#393)
* reduce filter selector flags to single strings

Since it doesn't make sense for many of the filter-type
selector flags to receive multiple input values (ex: what
would --received-after date1,date2 result in?), the filter
flags are getting reduced to single-string values.
2022-07-26 10:31:34 -06:00
Keepers
350d27dcb4
Issue-271-mustfilter: add must-pass filters to selectors (#392)
* add must-pass filters to selectors

Extends the selectors scope set to include Filters.  This
allows users to define all-pass matchers (filters),
separate from any-pass matchers (includes), and global
exclusions.
2022-07-25 22:41:49 +00:00
Keepers
9e7755cfa7
expand restore flags (#382)
* expand restore flags

Adds support for info filter flags to the restore command.
Also adds (hidden) support for event and contact data
types.  Finally, exchnages single-string flag data types for
multi-value string array support.
2022-07-25 09:43:12 -06:00
Keepers
0739ea7e09
add info-based selector flags to backup details (#380)
* filter backup details by flags

`backup details` should have its output filtered by the flags provided by
the user.  In addition, the selector's FilterDetails should maintain
information (esp service info) about the entries, rather than slicing them
down to only the path reference.
2022-07-22 13:23:16 -06:00
ashmrtn
395c7c8525
Add spell check linter and run gofmt in golangci-lint (#396)
* Basic golangci-lint config with gofmt and timeout

Remove corresponding sections from other CI config files.

* Enable comment and string spelling linter

* Fix spelling mistakes for linter

Co-authored-by: Danny <danny@alcion.ai>
2022-07-22 18:28:25 +00:00
Keepers
532922f662
introduce exchange info selector support (#379)
* introduce exchange info selector support

Adds support in selectors/exchange for queries based on
backup.ExchangeInfo entries.  This allows the declaration
of selectors based on non-identifier details such as sender,
subject, or receivedAt time.

Changes Exclude scope matching from being an Any-
match comparator to an All-match.  This keeps exclude
and include behavior identical, hopefully making less
confusion for users.
2022-07-21 15:08:03 -06:00
Keepers
6224a92e7a
filter backup details by flags (#371)
* filter backup details by flags

`backup details` should have its output filtered by the flags provided by
the user.  In addition, the selector's FilterDetails should maintain
information (esp service info) about the entries, rather than slicing them
down to only the path reference.
2022-07-20 16:25:28 -06:00
Keepers
37f2c44dc7
accept backupID flag, not backupDetailsID (#370) 2022-07-20 00:22:25 +00:00
Keepers
43c024f4b2
add per-data type flags to backup details (#355)
* add per-data type flags to backup details

Adds the contacts, contact folders, emails, email folders, events,
and users flag support to `corso backup create exchange`
to enable selector support.
2022-07-19 16:38:48 -06:00
Keepers
746c88a233
refactor selector scopes to accept slices (#352)
* refactor selector scopes to accept slices

Cli flag implementation was showcasing a toil issue: building
selectors required a lot of repetitious code for combining
inputs into sets of scopes.  Since all of these productions
were effectively identical (eg: for each user, then each folder,
create a scope with the ids), the cleaner solution is to pack
that behavior into the scope constructors themselves.
2022-07-19 16:04:07 -06:00
Keepers
625cf744a6
adds the onError option to operations (#347)
* adds the onError option to operations

Adds the OnError option to operations.Options.  OnError tells
corso whether to continue despite concurrent processing
errors, or to exit processing on any error.  Also includes flag
support for setting the option.  Only adds the options, does
not assert error handling behavior in corso.
2022-07-19 14:20:12 -06:00
Keepers
6c22d5c0ce
adds store package for wrapping model_store (#346)
* adds store package for wrapping model_store

Introduces the pkg/store package, which contains funcs
for wrapping the model_store with common requests.
This package choice was made for its combination
of being in an accessible place, centralizing functionality
and not introducing circular dependencies.
2022-07-19 11:54:53 -06:00
Keepers
efaa2da1bb
add --all and --data to backup create (#342)
* add --all and --data to backup create

Adds flags for backing up all exchange data, and
for isolating the data in the backup by data type.
Introduces validation and selector creation in
backup create.  Switches the --user flag variable
type from a string to a []string.
2022-07-15 10:27:20 -06:00
Keepers
39c85e1a84
add output formatting control to cli (#329)
* add output formatting control to cli

Adds the capacity for the CLI to output either a
text table or a json blob to the terminal.  Table is
the default behavior, json is toggled with the --json
flag.
2022-07-13 14:15:08 -06:00
Vaibhav Kamra
efe4319080
Fix for issues caught by go-lint (#327)
Error list visible [here](https://github.com/alcionai/corso/actions/runs/2653381666)
2022-07-12 11:19:32 -06:00
Vaibhav Kamra
fa190da682
Rename restorepoint to backup (#314) 2022-07-11 16:06:04 +00:00
Vaibhav Kamra
acb468d0f6
Implement backup details CLI (#306)
Returns RestorePointDetails

Closes #297
2022-07-08 23:16:34 +00:00
Vaibhav Kamra
0a5aa8ce73
Wire up RestorePoints to backup list (#305)
Currently displays the restorepoints in tablular form. We can add json output in a follow-up using the segment-cli library.

Closes #269
2022-07-08 09:12:43 -06:00
Keepers
c29a4fffe0
wire selectors up through backup handling (#278)
* wire selectors up through backup handling

Selectors are implemented enough to add them end-
to-end in some places.  This starts with backup
creation, since that's the most stable set of code in
the repo at the moment.
2022-07-07 17:02:25 -06:00
Keepers
503fca14f5
use gc status to populate op results (#287)
Exports access to the graphconnector status prop
so that restore and backup ops can track those metrics.
2022-07-07 13:10:45 -06:00
Keepers
2aeafa36bd
add unit tests for cli command addition (#260)
* add unit tests for cli command addition
2022-07-01 08:37:50 -06:00
Keepers
ce52cc5f41
Add the backup list command to the cli (#254)
* Add the backup list command to the cli

Adds `corso backup list <service>` to the cli commands.
Currently does nothing, while we're waiting on
downstream implementation.  e2e hookup will arrive later.
2022-06-30 09:30:37 -06:00
Keepers
108065df75
remove repository.Account (#229)
* remove repository.Account

Now that account.Account exists, we can replace the
deprecated repository.Account struct with the account
version.
2022-06-23 16:02:12 -06:00
Keepers
2b65ff80f2
hook up restore end-to-end (#226)
* hook up restore end-to-end

Now that GC and KW both provide restore operations for a
single message, we can hook up the end-to-end restore
process.  Integration tests for this change will follow in the
next PR.
2022-06-22 18:17:26 -06:00
Keepers
243343c0e9
Replace fmt prints with the logger (#220)
Now that we have the logger in place, we should use it
in place of fmt.Print calls for development and debugging output.
2022-06-17 13:45:22 -06:00
Keepers
fcdb42bc89
add restore and restore exchange cli (#210)
Adds the `corso restore` command to the cli (which only displays
a help menu).  And adds the `corso restore exchange`
command (which also only displays a help menu) to the cli.
Further functionality (like the complete flags) will come later.
2022-06-15 15:46:09 -06:00
Keepers
ffdb469cf6
Issue 193 (#194)
* add integration tests to backupop run
2022-06-13 15:45:07 -06:00
Keepers
340d875579
use config file for backup create (#171)
* use config file for backup create

Now that corso stores its prior connection details in a config
file, that file should get used to retrieve storage details as needed.
2022-06-09 14:28:26 -06:00
Keepers
b0fe422035
add pkg/credentials (#147)
credentials requriements surface in many places thorughout corso:
they can be sourced from many locations (envs, files, manually),
and used in many more (cli, repo, kopia).  This usage could blossom
into all kinds of duplicate structs sharing similar info.  The goal
of this change is to centralize where credentials are declared
and managed, and how they then cascade out to other packages.
2022-06-07 10:59:56 -06:00
Keepers
3be698eab9
return errors in cli handlers (#146)
* return errors in cli handlers

* return the wrapped errors
2022-06-07 09:15:00 -06:00
Keepers
d5d92e707d
add create and exchange backup commands (#145)
Adds the create subcommand for backups.  Adds the exchange
subcommand for backup creation.  Centralizes some
common code on top.
2022-06-06 16:33:04 -06:00