Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DVX: 318: Added support for file upload and download using presigned URLs #41

Merged
merged 6 commits into from
Jul 9, 2024

Conversation

Aryamanz29
Copy link
Member

@Aryamanz29 Aryamanz29 commented Jun 20, 2024

Todos

  • Add tests.
  • Add docs.
Uploading file to the object store: 100% [==================================================] (20 MB/s) 
Downloading file from the object store: 100% [==================================================] (8.9 MB/s)

Sample snippet:

package main

import (
	"fmt"

	"github.com/atlanhq/atlan-go/atlan/assets"
	"github.com/atlanhq/atlan-go/atlan/model"
)

func main() {

	ctx := assets.NewContext()

	ctx.SetLogger(true, "debug")

	client := assets.NewFileClient(ctx)

	// fileName := "1GB_test_file"
	fileName := "atlan-go.png"
	tenantDir := "presigned-url-sdk-integration-tests"

	// Upload
	request := model.PresignedURLRequest{
		Key:    tenantDir + "/" + fileName,
		Expiry: "10s",
		Method: model.PUT,
	}

	url, _ := client.GeneratePresignedURL(&request)

	res, err := client.UploadFile(url, fileName)

	fmt.Println(res, err)

	/// Download
	request = model.PresignedURLRequest{
		Key:    tenantDir + "/" + fileName,
		Expiry: "10s",
		Method: model.GET,
	}

	url, _ = client.GeneratePresignedURL(&request)

	downloadFilePath := "download.png"

	err = client.DownloadFile(url, downloadFilePath)

	fmt.Println(res, err)
}

@Aryamanz29 Aryamanz29 self-assigned this Jun 20, 2024
@Aryamanz29 Aryamanz29 added the feature Adding this label to PR will put it in Feature section in Github Release Changelog label Jun 20, 2024
@Aryamanz29 Aryamanz29 force-pushed the DVX-318 branch 3 times, most recently from 16a20aa to 029f9a3 Compare June 23, 2024 14:58
@Aryamanz29 Aryamanz29 force-pushed the DVX-318 branch 2 times, most recently from 8f8001e to 9e045d0 Compare June 27, 2024 17:41
@Aryamanz29 Aryamanz29 merged commit 9f376d6 into main Jul 9, 2024
1 check passed
@Aryamanz29 Aryamanz29 deleted the DVX-318 branch July 9, 2024 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding this label to PR will put it in Feature section in Github Release Changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant