code.dwrz.net

Go monorepo.
Log | Files | Refs

doc.go (1781B)


      1 // Package sdk is the official AWS SDK v2 for the Go programming language.
      2 //
      3 // aws-sdk-go-v2 is the the v2 of the AWS SDK for the Go programming language.
      4 //
      5 // # Getting started
      6 //
      7 // The best way to get started working with the SDK is to use `go get` to add the
      8 // SDK and desired service clients to your Go dependencies explicitly.
      9 //
     10 //	go get github.com/aws/aws-sdk-go-v2
     11 //	go get github.com/aws/aws-sdk-go-v2/config
     12 //	go get github.com/aws/aws-sdk-go-v2/service/dynamodb
     13 //
     14 // # Hello AWS
     15 //
     16 // This example shows how you can use the v2 SDK to make an API request using the
     17 // SDK's Amazon DynamoDB client.
     18 //
     19 //	package main
     20 //
     21 //	import (
     22 //	    "context"
     23 //	    "fmt"
     24 //	    "log"
     25 //
     26 //	    "github.com/aws/aws-sdk-go-v2/aws"
     27 //	    "github.com/aws/aws-sdk-go-v2/config"
     28 //	    "github.com/aws/aws-sdk-go-v2/service/dynamodb"
     29 //	)
     30 //
     31 //	func main() {
     32 //	    // Using the SDK's default configuration, loading additional config
     33 //	    // and credentials values from the environment variables, shared
     34 //	    // credentials, and shared configuration files
     35 //	    cfg, err := config.LoadDefaultConfig(context.TODO(),
     36 //	   		config.WithRegion("us-west-2"),
     37 //	   	)
     38 //	    if err != nil {
     39 //	        log.Fatalf("unable to load SDK config, %v", err)
     40 //	    }
     41 //
     42 //	    // Using the Config value, create the DynamoDB client
     43 //	    svc := dynamodb.NewFromConfig(cfg)
     44 //
     45 //	    // Build the request with its input parameters
     46 //	    resp, err := svc.ListTables(context.TODO(), &dynamodb.ListTablesInput{
     47 //	        Limit: aws.Int32(5),
     48 //	    })
     49 //	    if err != nil {
     50 //	        log.Fatalf("failed to list tables, %v", err)
     51 //	    }
     52 //
     53 //	    fmt.Println("Tables:")
     54 //	    for _, tableName := range resp.TableNames {
     55 //	        fmt.Println(tableName)
     56 //	    }
     57 //	}
     58 package sdk