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

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:

  1. Endpoint:https://endpoint.4everland.co

  2. 4EVERLAND-Bucket-APIKey: Bucket-Access Keys-API key

  3. 4EVERLAND-Bucket-APISecret: Bucket-Access Keys-API Secret

  4. 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

If you have any questions, please join our Discord server, or send us an email at [email protected].

Last updated