doc.go raw

   1  // Package ycsdk is the official Yandex Cloud SDK v2 for the Go programming language.
   2  //
   3  // go-sdk-v2 is the the v2 of the Yandex Cloud 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/yandex-cloud/go-sdk-v2
  11  //	go get github.com/yandex-cloud/go-sdk-v2/services/compute
  12  //
  13  // # Hello Yandex Cloud
  14  //
  15  // This example shows how you can use the v2 SDK to make an API request using the
  16  // SDK's Yandex Compute client.
  17  //
  18  //      package main
  19  //
  20  //      import (
  21  //          "context"
  22  //          "fmt"
  23  //          "log"
  24  //          "os"
  25  //
  26  //          computeapi "github.com/yandex-cloud/go-genproto/yandex/cloud/compute/v1"
  27  //          "github.com/yandex-cloud/go-sdk-v2"
  28  //          "github.com/yandex-cloud/go-sdk-v2/credentials"
  29  //          computesdk "github.com/yandex-cloud/go-sdk-v2/services/compute/v1"
  30  //      )
  31  //
  32  //      func main() {
  33  //          ctx := context.Background()
  34  //          sdk, err := ycsdk.Build(ctx,
  35  //              ycsdk.WithCredentials(credentials.IAMToken(os.Getenv("YC_IAM_TOKEN"))))
  36  //          if err != nil {
  37  //              log.Fatalf("failed to build SDK: %v", err)
  38  //          }
  39  //
  40  //          imageClient := computesdk.NewImageClient(sdk)
  41  //          resp, err := imageClient.GetLatestByFamily(ctx, &computeapi.GetImageLatestByFamilyRequest{
  42  //              FolderId: os.Getenv("YC_FOLDER_ID"),
  43  //              Family:   "debian-9",
  44  //          })
  45  //          if err != nil {
  46  //              log.Fatalf("failed to get image: %v", err)
  47  //          }
  48  //
  49  //          fmt.Println(resp)
  50  //
  51  //      }
  52  
  53  package ycsdk
  54