1166 Commits

Author SHA1 Message Date
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
Danny
128e9274e9
GraphConnector Status support module (#222)
Issue #214: Status of Connector
- Support package contains errors module
- status is updated after backup operation
- test suite added for new features.
2022-06-22 17:17:36 -04:00
ashmrtn
756b429362
Add public kopia function to restore a single item (#225)
Returns a DataCollection to the caller on success. Also update tests to
use new public function where appropriate.
2022-06-22 13:14:00 -07:00
ashmrtn
622e8eab95
kopia code to translate single item to DataCollection (#216)
* DataCollection and DataStream structs for kopia

* Helper function to get a single item of data

Returns a DataCollection with a single item.

* Test for backing up and restoring a single item
2022-06-22 09:50:17 -07: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
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
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
64477712c5
add flags to restore exchange (#213)
* add flags to restore exchange

Adds the user, mail, and folder flags to corso restore exchange.
2022-06-16 17:24:10 -06:00
Danny
81bdc69c5a
Attach retry (#202)
Merge of Attach retry branch adds inline retry for attachments. Appropriate tests included.
2022-06-16 07:05:29 -04:00
Keepers
15e7c102a4
add RestoreOperation (#211)
Adds the RestoreOperation to the /internal/operations pkg.
restoreOp.Run() is a no-op at this time since data layer
packages are not prepared to hook up e2e.
2022-06-15 16:10:11 -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
ashmrtn
bf267a5478
Return io.ReadCloser from interface (#209)
Kopia returns io.ReadCloser which implies that some objects may need to
reclaim resources. Expose that functionality here.
2022-06-15 14:38:28 -07:00
ashmrtn
0e4e9e8fd6
Use upstream kopia as our import (#205)
Still need to use a pseudo-version because no tagged version of kopia
has the features we need.
2022-06-15 12:00:43 -07:00
ashmrtn
4f2ab23fbd
Add "mail" as part of FullPath for dir structure (#201)
* Add "mail" as part of FullPath for dir structure

* Update restore code for new dir structure
2022-06-15 11:59:38 -07:00
Keepers
8272227895
add cron action to purge s3 test bucket weekly (#200)
* add cron action to purge s3 test bucket weekly
2022-06-15 12:46:28 -06:00
Danny
e0199b6b26
Issue 184 Full Path added to DataCollection (#199)
Merge of Branch adds FullPath to the DataCollection() where each DataCollection is based on the folder. Thus, returning a [] DataCollection
2022-06-14 17:09:02 -04:00
Danny
88bc374208
Issue 181: GC Implement restore (#197)
Addition of restoreMessages(dc DataCollection) error for GraphConnector
Merge completes Issue #181. Test suites updated
2022-06-14 14:57:38 -04:00
Keepers
ffdb469cf6
Issue 193 (#194)
* add integration tests to backupop run
2022-06-13 15:45:07 -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
Danny
1957de09d2
GraphConnector testing expanded (#180)
* GraphConnector testing expanded
setTenantUsers covered and switched the test account for an account with fewer corner cases.
2022-06-10 15:31:20 -04: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
Danny
f713047f95
Testing expansion (#177)
Incremental tests added to project
Functional test added to test package to showcase usage and streamline on GraphConnector test suite.
2022-06-10 10:41:45 -04:00
Danny
8a450c07b5
Error package graph connector (#173)
Merge of this package removes the `errorList` from the Query workflow. Some variable names changed to comply with industry standards.
2022-06-09 17:20:04 -04: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
ashmrtn
d00f9c856f
Add remainder of BackupCollections code (#170)
Fill in BackupCollection logic for kopia dirs and test

"Rehydrate" the given DataCollections into a hierarchy of kopia
virtualfs directories, allowing kopia to make a single snapshot of them.
Directory structure is extracted from the information returned by
DataCollection.FullPath().
2022-06-09 10:33:00 -07:00
Keepers
875e3cb517
call backup on exchange collection (#172)
Wires up the backupOperation to graphConnector and kopia to
fully run an end-to-end backup.
2022-06-09 00:07:04 -07:00
Vaibhav Kamra
0da0c786b5
Mock ExchangeDataCollection (#166)
Implements a mock exchange data collection that can be used to test without connecting to graph.

Currently returns a "fixed message" but we can extend this to return anything that implements io.Reader
e.g. a file that contains a serialized message.
2022-06-08 16:33:59 -07: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
9043351716
Implement ExchangeDataCollection iteration (#162)
DataCollection Feature added
In this merge, the DataCollection interface is defined for the GraphConnector. ExchangeDataCollection implements this interface. The subsequent definitions and test suites are included.
2022-06-08 17:59:03 -04:00
Vaibhav Kamra
a91a739d0e
Only run CI once for pull requests (#169)
Currently CI is triggered twice when a PR is updated (the second
run being triggered by the branch push). This removes that
trigger.
2022-06-08 15:45:06 -06:00
ashmrtn
53c7b4a149
Fix kopia test panics if repo is nil (#168) 2022-06-08 13:28:32 -07:00
ashmrtn
042f3eaaee
Add FullPath() to DataCollection interface (#164)
* Add FullPath() to interface

* Simple test for FullPath
2022-06-08 16:24:57 -04:00
Vaibhav Kamra
5dcb2b7579
Unit tests for config file helpers (#160)
Adds unit tests for the config file read/write helpers.

It also uncovered a bug in how viper handles writing a config file when a config file path is set
directly. This required a workaround in our init logic when we are using a custom config file name.

This commit does the following:
- Refactors the init logic into a InitConfig helper
- Adds a unit test to validate basic ReadRepoConfig behavior
- Adds a unit test that uses WriteReadConfig to write config and ReadRepoConfig to read it
2022-06-08 11:13:25 -07:00
Vaibhav Kamra
13ca33fae0
Implement ToReader for ExchangeData (#161) 2022-06-08 13:28:33 -04:00
ashmrtn
33e8e978ba
Use version of kopia with StreamingDirectory (#156)
* Use pseudo-version to pull fork of kopia

Directs to local fork of kopia that has support for
StreamingDirectories.
2022-06-08 09:49:10 -07:00
Niraj Tolia
301e7bd10e
Add minimal S3 configuration for Corso (#158) 2022-06-08 09:47:55 -07:00
Vaibhav Kamra
cbbd5ed0bb
Fix AWS access key override logic (#159) 2022-06-08 08:51:32 -06:00
Danny
ddc9cd2c25
Issue #144 Commit adds ability to add message id to errors (#151)
* Issue #144 Commit adds ability to add message id to errors
Commit related to Issue #140 to find cascading errors associated with
the failures GraphConnector queries.

* Issue 144: Update to go libraries to import multierror

* Reduced error package to include certain multierror interface.

* Issue #144: Added format interface for append. Added additional testing for multiple wrapping of error.
2022-06-08 08:59:59 -04:00
Vaibhav Kamra
ebae1ed037
Utility methods to write and read local config file (#149)
Adds rudimentary support for writing/reading a local config file.
2022-06-07 17:25:14 -07:00
Danny
ed1f444b89
133 implement exchangedatacollection populator (#139)
* Issue 133: Tests Failing.
Unable to troubleshoot the iteration error. Reflecting on an object that
is nil. Fundamentally, the code works in so far as the workflow. Initial
query finds the amount of emails, returns... This is where
DataCollection would be created, then the goroutine would have the
information it would need to run asynchronously.

* Issue #133: Populate DataCollection
Bug fix on NewPageIterator: Incorrect MailDiscriminatorValue.
DataCollection implemented. Brute force. However, this does not use the
populate method. The populate method to be added in the next step.

Test Suite: TestMailCount is an end-to-end test. Tests to see if the
amount of values in a mailbox are the amount of messages that are
retrieved. This is false at present. There are several errors from
ParseNodePackage: `unsupported AdditionalData type:
map[string]*jsonserialization.JsonParseNode`. Will have to determine how
errors are to be sent to the DataCollection. Issue #137. Upon
inspection, there are 59 messages on the test account. 7 of them receive
a parsing error and 2 are unaccounted for. Issue #138

* Issue #133: Collection passed into Serialize Message method.

* Issue #133: Changes for PR
Comments have been updated as requested. Additionally, input params have
been updated for clarity.

* Issue #133: Input structure for Options changed to string literal.

* Update src/internal/connector/graph_connector.go

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>

* Update src/internal/connector/graph_connector.go

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>

* Update src/internal/connector/graph_connector.go

Internal helper function populateCollection() removed as it was commented out anyway.

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>

* Update src/internal/connector/graph_connector.go according to suggestion

Consolidate line 193 response.GetValue() into to for loop over folders

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>

* Issue #133: Expected item removed
Expected Item can could change between the time that the DataCollection is created. Therefore, the channel will stay open until the object is filled. Definition updated.

* Issue #133: Updates made to graph_connector packages
- Test package updated to test private functions. Results in import
  changes and calls to package level items. All tests verified as
  operational prior to upload.
- GraphConnector removal of GetCount() for Mail objects.
  ExchangeDataCollection call updated in response to definition change.
  Small changes to call stack to remove troubleshooting stubs.

* Gofmt applied to exchange_data_collection.go

* Issue #133: Merge resolution
These changese resolves the issues with the merge that caused the testing to fail. Tests all passing and now merging back into trunk.

* PR Suggestion Get Length -> Length()

Co-authored-by: Vaibhav Kamra <vkamra@alcion.ai>
2022-06-07 16:04:47 -04: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
3be698eab9
return errors in cli handlers (#146)
* return errors in cli handlers

* return the wrapped errors
2022-06-07 09:15:00 -06:00
Vaibhav Kamra
dbb778c569
Initialize a config file for the CLI (#148)
Initialize a config file
2022-06-07 08:53:58 -06:00