GithubHelp home page GithubHelp logo

cloudsigma / cloudsigma-sdk-go Goto Github PK

View Code? Open in Web Editor NEW
2.0 10.0 3.0 201 KB

CloudSigma SDK for the Go programming language.

Home Page: https://cloudsigma-docs.readthedocs.io

License: BSD 3-Clause "New" or "Revised" License

Go 99.36% Makefile 0.64%
go cloudsigma-sdk cloudsigma

cloudsigma-sdk-go's Introduction

CloudSigma SDK for Go

Build Status Go Report Card GoDoc

cloudsigma-sdk-go is the official CloudSigma SDK for the Go programming language.

Installation

# X.Y.Z is the version you need
go get github.com/cloudsigma/[email protected]


# for non Go modules usage or latest version
go get github.com/cloudsigma/cloudsigma-sdk-go

Usage

import "github.com/cloudsigma/cloudsigma-sdk-go"

Create a new CloudSigma client, then use the exposed services to access different parts of the CloudSigma API.

Authentication

Currently, HTTP Basic Authentication is the only method of authenticating with the API. You can then use your credentials to create a new client:

cred := cloudsigma.NewUsernamePasswordCredentialsProvider("[email protected]", "my-secure-password")
client := cloudsigma.NewClient(cred)

If you want to specify more parameters by client initialization, use With... methods and pass via option pattern:

cred := cloudsigma.NewUsernamePasswordCredentialsProvider("[email protected]", "my-secure-password")
client := cloudsigma.NewClient(cred,
  cloudsigma.WithLocation("fra"),
  cloudsigma.WithHTTPClient(customHTTPClient),
)

Examples

List all servers for the user.

func main() {
  cred := cloudsigma.NewUsernamePasswordCredentialsProvider("[email protected]", "my-secure-password")
  client := cloudsigma.NewClient(cred)

  // list all servers for the authenticated user
  ctx := context.Background()
  servers, _, err := client.Servers.List(ctx)
}

Contributing

We love pull requests! Please see the contribution guidelines.

License

This SDK is distributed under the BSD 3-Clause License, see LICENSE for more information.

cloudsigma-sdk-go's People

Contributors

pavel-github avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudsigma-sdk-go's Issues

Make cloudsigma API URL configurable again

Feature Request

What is the problem that this feature solves?

Trying to update the sdk module to the latest version on terraform-provider-cloudsigma, I've found that the API URL is not configurable anymore. See here. This makes at least for me impossible to use the latest version, as in the terraform provider the URL was always configurable.

Are you planning to change this either here making the URL configurable again or removing the URL configuration on terraform side?

Describe the feature

Notes

RDP

Bug report

Describe the issue

System information

  • cloudsigma-sdk-go version:
  • golang version:
  • OS:

Reproduction instructions

Expected behavior

Notes

Add pagination support for List() methods

Feature Request

Default limit of objects is 20, so we should add a pagination support to be able to iterate over all values.

What is the problem that this feature solves?

Currently there is no way to iterate over all objects without custom logic on consumer side of the SDK.

Describe the feature

  • add ListOption struct and optional parameter to List methods
  • in case it's defined, add query params to the URL string (use RawQuery)
  • add unit tests

Notes

Information about pagination is already in Meta of cloudsigma.Response struct.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.