{"id":28578281,"url":"https://github.com/digitalocean/sample-functions-golang-presigned-url","last_synced_at":"2025-06-11T01:09:25.037Z","repository":{"id":53268852,"uuid":"511617634","full_name":"digitalocean/sample-functions-golang-presigned-url","owner":"digitalocean","description":"Creating a presigned url for DO's Spaces","archived":false,"fork":false,"pushed_at":"2022-08-04T22:38:49.000Z","size":26,"stargazers_count":12,"open_issues_count":0,"forks_count":9,"subscribers_count":99,"default_branch":"main","last_synced_at":"2025-01-15T00:20:19.352Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalocean.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-07T17:27:34.000Z","updated_at":"2024-11-19T09:49:49.000Z","dependencies_parsed_at":"2022-08-27T07:01:33.583Z","dependency_job_id":null,"html_url":"https://github.com/digitalocean/sample-functions-golang-presigned-url","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-presigned-url","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-presigned-url/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-presigned-url/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-presigned-url/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalocean","download_url":"https://codeload.github.com/digitalocean/sample-functions-golang-presigned-url/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalocean%2Fsample-functions-golang-presigned-url/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259178542,"owners_count":22817388,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-11T01:09:24.253Z","updated_at":"2025-06-11T01:09:25.020Z","avatar_url":"https://github.com/digitalocean.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sample Function: Go \"Presigned URL\"\n\n## Introduction\n\nThis repository contains a sample presigned URL function written in Go. You are able to choose to get a presigned URL to upload a file to a DigitalOcean Space or to download a file from a DigitalOcean Space. You can deploy it on DigitalOcean's App Platform as a Serverless Function component.\nDocumentation is available at https://docs.digitalocean.com/products/functions.\n\n### Requirements\n\n* You need a DigitalOcean account. If you don't already have one, you can sign up at [https://cloud.digitalocean.com/registrations/new](https://cloud.digitalocean.com/registrations/new).\n* You need a DigitalOcean Space. If you don't have one, you can create one at https://www.digitalocean.com/products/spaces.\n* You need to add your `SPACES_KEY`, `SPACES_SECRET`, `BUCKET`, and `REGION` to the `.env` file to connect to Spaces API as well as your bucket.\n* To deploy from the command line, you will need the [DigitalOcean `doctl` CLI](https://github.com/digitalocean/doctl/releases).\n\n## Deploying the Function\n\n```bash\n# clone this repo\ngit clone https://github.com/digitalocean/sample-functions-golang-presigned-url\n```\n\n```\n# deploy the project, using a remote build so that compiled executable matched runtime environment\n\u003e doctl serverless deploy sample-functions-golang-presigned-url --remote-build\nDeploying 'sample-functions-golang-presigned-url'\n  to namespace 'fn-...'\n  on host 'https://faas-...'\nSubmitted action 'url' for remote building and deployment in runtime go:default (id: ...)\n\nDeployed functions ('doctl sls fn get \u003cfuncName\u003e --url' for URL):\n  - presign/url\n```\n\n## Using the Function\n\n```bash\ndoctl serverless functions invoke presign/url -p filename:new-file.txt type:GET\n```\n```json\n{\n  \"body\": \"{presigned url}\"\n}\n```\n\n### To get a presigned url using curl:\n```\ncurl -X PUT -H 'Content-Type: application/json' {your-DO-app-url} -d '{\"filename\":\"{filename}\", \"type\":\"GET or PUT\"}'\n```\n\n### To Upload or Download a file using curl:\n```\ncurl -X PUT -d 'The contents of the file.' \"{url}\"\n```\n\n### Learn More\n\nYou can learn more about Functions and App Platform integration in [the official App Platform Documentation](https://www.digitalocean.com/docs/app-platform/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fsample-functions-golang-presigned-url","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalocean%2Fsample-functions-golang-presigned-url","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalocean%2Fsample-functions-golang-presigned-url/lists"}