AWS SDK - Go (Golang)
Please read the following to understand how to use the AWS SDK - Go with the 4EVERLAND Bucket. Combine the AWS SDK API for the Go language with the 4EVERLAND Bucket to achieve file uploads to the IPFS or Arweave storage networks.
Preparation
In your development environment, download and install Go.
Download and install the AWS SDK for Go.
Register a free 4EVERLAND account.
If you need to use Arweave storage, you need to create an Arweave bucket. Click to learn more.
To obtain the corresponding API key in the bucket, click to learn more.
Development Examples
Install the S3 client
The following code example defines an S3 client and does not return any output. Replace the values in the code below to complete your configuration:
Endpoint:https://endpoint.4everland.co
4EVERLAND-Bucket-APIKey: Bucket-Access Keys-API key
4EVERLAND-Bucket-APISecret: Bucket-Access Keys-API Secret
Region: Default filled in with "4everland"
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/service/s3"
)
func main() {
s3Config := aws.Config{
Credentials: credentials.NewStaticCredentials("4EVERLAND-Bucket-APIKey", "4EVERLAND-Bucket-APISecret", ""),
Endpoint: aws.String("https://endpoint.4everland.co"),
Region: aws.String("4everland"),
}Create a bucket
bucket:The desired name for creating the bucket
Upload a file
bucket: Your bucket name
/path/to/4everland/4ever.png: The file path for upload
Key: The file name for upload
To retrieve the bucket and file list
Requesting IPFS CID and Arweave Hash
bucket:The bucket name where the target file is stored
objectKey: The path of the target file
Last updated