Skip to content

nifcloud/nifcloud-sdk-go

Repository files navigation

NIFCLOUD SDK for Go

build Github stars Github top language Github license

nifcloud-sdk-go is data-driven SDK for the Go programming language. It works by feeding AWS-SDK-compatible model JSONs to github.com/aws/aws-sdk-go-v2.

Features

  • ✔️ Support for NIFCLOUD Computing / RDB / NAS / ESS / DNS / ObjectStorageService / ServiceActivity / DevOps with GitLab APIs
  • ✔️ AWS-SDK-compatible data-driven architecture

Getting started

Requirements

  • Go 1.17 or later.

Installing

go get -u github.com/nifcloud/nifcloud-sdk-go

Example

This example shows DescribeInstances.

package main

import (
        "fmt"
        "context"

        "github.com/nifcloud/nifcloud-sdk-go/nifcloud"
        "github.com/nifcloud/nifcloud-sdk-go/service/computing"
)

func main() {
    // Create config with credentials and region.
    cfg := nifcloud.NewConfig(
            "YOUR_ACCESS_KEY_ID",
            "YOUR_SECRET_ACCESS_KEY",
            "jp-east-1",
    )

    // Create the Computing client with Config value.
    svc := computing.NewFromConfig(cfg)

    // Send the request
    resp, err := svc.DescribeInstances(context.TODO(), nil)
    if err != nil {
            panic(err)
    }
    
    fmt.Println("Instances:")
    for _, reservationSet := range resp.ReservationSet {
        for _, instancesSet := range reservationSet.InstancesSet {
            fmt.Println(nifcloud.ToString(instancesSet.InstanceId))
        }
    }
}

Resources

LICENCES

See LICENSE.