650 Commits

Author SHA1 Message Date
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
Keepers
80db9a56c7
reduce restore point details to matching refs (#310)
* reduce restore point details to matching refs

A selector should be able to reduce a set of restore point
details to only those that pass its inclusion and
exclusion rules.
2022-07-11 14:44:08 -06:00
Keepers
608d19e821
add filters package (#300)
* add filters package

Filters allow a caller to define some comparator-
ie, a filter- and use that filter to try matching various
inputs.
2022-07-11 10:39:22 -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
Vaibhav Kamra
6e9bd634e4
Create RestorePoint and RestorePointDetails (#290)
Update the backup operation to create RestorePoint and RestorePointDetails models in the repository

Add modelstore to the operation to allow backup/restore operations to update/query for corso models

Closes #268
2022-07-08 01:41:40 +00: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
10f112452a
refactor the selector api to scope factories (#289)
* refactor the selector api to scope factories

Rather than have the service selector offer an api of
include* or exclude* for each of its recognized
data scopes, instead expose a set of factory funcs
for each datat scope and a smaller api of functions
that can consume those scopes.
2022-07-07 15:41:29 -06:00
Keepers
4e7c9bd1e8
refine None selector and scope population (#285)
Selectors.None is changed to the empty string so that
zero valued properties within the map default to None
rather than an unrecognized value.
2022-07-06 16:32:10 -06:00
ashmrtn
70e7a1e2d3
Split KopiaWrapper into handle and backup/restore logic (#281)
* Split KopiaWrapper into repo handle and logic

With ModelStore, multiple structs need a reference to the kopia repo.
Make a small wrapper class (conn) that can open and initialize a repo. The
wrapper handles concurrent closes and opens and does ref counting to
ensure it only drops the kopia handle when the last reference is closed.

Rename KopiaWrapper to Wrapper and keep backup/restore functionality
in it.
2022-07-06 11:09:35 -07:00
Vaibhav Kamra
233aa43f4c
RestorePoint and RestorePointDetails models (#279)
RestorePoint and RestorePointDetails models.

Refs #268
2022-07-06 11:03:39 -07:00
Keepers
22ecfba402
implement exchange selector include/exclude funcs (#276) 2022-07-06 10:29:42 -06:00
Keepers
25a1e972e6
update selector to match current design (#266)
* update selector to match current design

The selector design is progressing in the Showdown doc.
This updates the existing structs to match the expectations in that doc.
2022-07-05 10:20:19 -06:00
Keepers
ae778df5ae
rename scope to selector (#257)
* rename scope to selector

per design changes, source is being renamed to selector
for better readability and clarity.
2022-06-30 09:50:24 -06:00
Keepers
abc8b44718
add operation results structs (#253)
* add operation results structs

Operations, both backup and restore, need to hold the
results of their operation, and be able to marshal the struct
to json for output.
2022-06-29 13:56:13 -06:00
Keepers
60eb8eec08
refactor cli/config for better local testing (#245) 2022-06-27 15:25:06 -06:00
Keepers
689c5cc1e9
separate tenantID from m365 creds (#231)
* separate tenantID from m365 creds

Now that account.Account is in place, tenant id needs
to get removed from the credential set (it isn't actually
a secret) and placed in the account configuration instead.
2022-06-27 13:54: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
ashmrtn
902294b70d
S3 test prefix naming (#228)
* Update how S3 storage structs are generated

  * fix bug in printing year of date
  * use the name of the test instead of trying to pull name from runtime
  * always log the time when making the storage struct
  * don't allow user to specify prefix

* Fixup tests for new test storage API

* Update function name and comment
2022-06-23 11:55:26 -07:00
Keepers
0bd23ab2ab
move config unions to common code (#224)
* move config unions to common code

The configuration union handlers in Storage and Account
overlapped significantly in behavior.  Moving those helpers into
a common code folder was requested.  Although the behavior
was similar across the files, the types were not, requiring
the addition of generics to solve the need.
2022-06-23 12:16:20 -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
0e261fb96a
add /pkg/source skeleton (#198)
* add /pkg/source skeleton

Source acts as an intermediary between the
client and internal packages (GraphConnector, Kopia) to
specify the scope of data in a Backup or Restore
operation request.
2022-06-21 18:26:39 -06:00
Keepers
3a3303a817
add Account pattern to mimic storage (#221)
* add Account pattern to mimic storage

Introduces /pkg/account, which produces a generic Account
struct that can be configured from specific provider
details (such as m365 credentials), and serialized back to
those details as needed.

Next steps include replacing repository.Account with the
new account.  After that, tenantID should get removed from
the m365 credentials handling and placed into the Account
configuration instead.
2022-06-21 16:43:18 -06:00
Keepers
ccb3fa46a3
hook up restore cli to repository restore runner (#219)
Introduces a NewRestore method to the Repository struct.
cli/restore/exchange now generates a restoreOperation
and kicks off a Run() when `corso restore exchange` is called.
The restore operation still only accepts the placeholder
Target string slice.
2022-06-17 09:24:44 -06:00
Keepers
f39d0ecfc4
add repo connect s3 integration test (#192)
* add repo connect s3 integration test
2022-06-13 08:19:03 -06:00
Keepers
f03432e303
read test config from local file (#179)
* read test config from local file

Allows local configuration of the test environment by reading from
a .toml config file.  If no file exists, the file read is a no-op.  Value
prioritization is specified in the readTestConfig() func.
2022-06-10 13:21:03 -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
9abfb486d8
remove unused repo provider consts (#176) 2022-06-09 13:49:34 -06:00
Keepers
f3866b7283
add pkg/log with zap log library (#155)
Adds a logger pkg using the zap log library.  Generally straight-
forward, though we'll have to watch out for gotchas with the
flush requirements.
2022-06-09 13:17:01 -06:00
Keepers
2104e66fea
add graph connector to backupOp (#165)
Adds graph connector to the backup operation implementation.
This includes feeding the account credentials into the
backup as well.
2022-06-08 17:32:14 -06:00
Vaibhav Kamra
cbbd5ed0bb
Fix AWS access key override logic (#159) 2022-06-08 08:51:32 -06:00
Keepers
21bf1d8b39
make consts camelCase (#153) 2022-06-07 11:44:14 -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
39a9e0945d
add backup to operations (#132)
* add backup to operations

Extend the operations set with a backupOperation.  New backup
operations are created through an existing repository and, once
created, can be Run synchronously.

Integration tests have a skeleton, but the meat of them is on hold
while dependencies undergo implementation.

* remove operation progress
2022-06-06 14:11:54 -06:00
Keepers
44392ab8b2
adds env-based integration test controls (#128)
* adds env-based integration test controls

Some integration tests were running locally without being told
to do so via env variables.  This adds some controllers for validating
if and when those tests should run, and for ensuring the env
variables necessary to run the test are available.

* testing helper comments, func name change

* add testing timeOf log, skip gc ci tests

* corrected the test skip in GC_test

* update kopia_test with helpers

* rename /testing files to *_test.go

This will ensure these files do not compile into the release binary.

* Revert "rename /testing files to *_test.go"

This reverts commit 04fd2046cc6d11bf3e3eb98d98a3e84b1bba6366.
2022-06-06 13:17:40 -06:00
ashmrtn
f68a4e3f46
Fix pointer receivers for KopiaWrapper handles (#131)
* Fix pointer receivers

* Some basic tests about closing KopiaWrapper

* Return pointers to structs
2022-06-03 16:15:51 -07:00
Keepers
6e71e44024
introduce operations (#114) (#122)
* introduce operations (#114)

Adds the /internal/operations package.  This is a starting point
which only includes the base operation struct and handling.
Per-process (backup/restore) operations to come at a later time.

* adding comments for clarity in op_progress
2022-06-03 15:50:13 -06:00
ashmrtn
f1550c967b
Add function to open kopia (#111)
* Add function to open kopia and keep handle

* Add kopia handle in Repository

* Have Repository manage lifetime of KopiaWrapper

* Have CLI manage lifetime of Repository
2022-06-03 10:34:28 -07:00
ashmrtn
04d11503a9
Factor out helper functions for testing (#115)
Helper functions do simple validation and initialization for S3 storage
objects.
2022-06-02 16:57:13 -07:00
Keepers
cc3306e5e0
validate required storage props (#85) (#108)
* validate required storage props (#85)

Centralizes validation of required storage config properties within
the storage package.  Requiremens are checked eagerly at
configuration creation, and lazily at config retrieval.

Additionally, updates /pkg/storage tests to use suites
and assert funcs.

* add validation failure tests to storage
2022-06-02 15:33:19 -06:00
Keepers
535cb9e1f5
add common config and encryption passwd (#74) (#99)
* add common config and encryption passwd

Adds a provider-independent configuration handler, and the
the encryption password config property.  The password is used
to encrypt and decrypt the kopia repository properties file.

* fix corso_password in ci.yml

* actually use the corso password in testing

* replace passwd in ci.yml with a secret

* ci.yml secret typo fix
2022-06-01 16:00:41 -06:00
Keepers
596a4cc37b
initial repo init integration test (#90) (#96)
Implements an integration test in the repository that runs an end-
to-end test of an s3 repo initialization through kopia.
2022-05-31 18:32:26 -06:00
Keepers
eaf6018996
add prefix flag for s3 (#94)
* add prefix flag for s3

Adds the flag --prefix for s3 repo init and creation.

* fix missing prefix flag in repo s3 cli
2022-05-27 17:22:50 -06:00
Vaibhav Kamra
d34175bd19
Use testify for repository tests (#88) 2022-05-27 10:25:24 -07:00
Keepers
d923c4072b
expose s3 endpoint as flag (#87)
Exposes the s3 endpoint option as a cli flag and storage config
property.  Uses the kopia default s3.amazonaws.com as a fallback.
2022-05-27 09:11:26 -06:00
Keepers
e6663fd0f1
changes requried for manual repo init (#25) (#80)
A small collection of changes and code cleanup to successfully run
'corso repo init s3' manually.  Adds a default s3 url (might want
this configurable for local testing) and aws session token support.
2022-05-25 17:27:23 -06:00
Keepers
548eb1be72
add e2e wiring of cli to kopia (#77)
* add e2e wiring of cli to kopia

Now that pkg/storage and internal/kopia are in place, we
can wire up the init flow from the cli all the way to kopia.  Testing
harness for this functionality still needs investigation afterward.

* factor out awsVars struct for s3Cfg
2022-05-25 14:06:05 -06:00
Keepers
99358c5d6e
introduces storage pkg (#25) (#73)
* introduces storage pkg (#25)

Adds a new package /pkg/storage.  Storage is used to
communicate storage provider information throughout the corso
app.  In particular, it allows per-provider data to cross interface
boundaries without slicing their details.

* use consts for s3 config keys
2022-05-25 09:50:52 -06:00
Keepers
2ae4f4cdcb
introduce repository api scaffold with s3 (#6) (#54)
* introduce repository api scaffold with s3 (#6)

introduces the public repository package in /pkg, with a
skeleton implementation for generating the s3 provider config
and boilerplate for where that usage gets centralized.

* condense init/connect to single action

A double-pass NewRepo() && Connect() allows Repository structs
to exist independent guarantees that their usage will be successful.
This hides the struct generation within the Connect and Initialize
funcs so that the construction and guarantees can occur as
a single process.
2022-05-19 16:05:33 -06:00