scp: add option types

Prior to this commit, many scp functions existed without option structs, which would make extending functionality (adding new options) impossible without breaking changes, or without adding redundant wrapper functions.

This commit adds in new option types for various scp related functions, and changes those functions' signatures to use the new options.

This commit also modifies the `ImageEngine.Scp()` function's interface to use the new opts.

The commit also renames the existing `ImageScpOptions` entity type to `ScpTransferImageOptions`. This is because the previous `ImageScpOptions` was inaccurate, as it is not the actual options for `ImageEngine.Scp()`. `ImageEngine.Scp()` should instead receive `ImageScpOptions`.

This commit should not change any behavior, however it will break the existing functions' signatures.

Signed-off-by: Zachary Hanham <z.hanham00@gmail.com>
This commit is contained in:
Zachary Hanham
2024-10-10 17:48:52 -04:00
parent f311979ec0
commit feb46513f0
10 changed files with 253 additions and 129 deletions

View File

@@ -78,8 +78,8 @@ func TestToURLValues(t *testing.T) {
func TestParseSCPArgs(t *testing.T) {
args := []string{"alpine", "root@localhost::"}
var source *entities.ImageScpOptions
var dest *entities.ImageScpOptions
var source *entities.ScpTransferImageOptions
var dest *entities.ScpTransferImageOptions
var err error
source, _, err = ParseImageSCPArg(args[0])
assert.Nil(t, err)