Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This file is a supplement for AI agents working on the cloudscale SDK (cloudscal
## What this is

A Go client library for the cloudscale.ch API, imported as
`github.com/cloudscale-ch/cloudscale-go-sdk/v9`. It is source-only: there is no `main` package and nothing to build or
`github.com/cloudscale-ch/cloudscale-go-sdk/v10`. It is source-only: there is no `main` package and nothing to build or
ship, so consumers just `go get` it.

## What to run after a change
Expand Down Expand Up @@ -73,4 +73,4 @@ Releasing is a manual process. Consult the README's "Releasing" section for inst
## References

- `README.md` — usage, instrumentation, testing, and release steps.
- API docs: <https://pkg.go.dev/github.com/cloudscale-ch/cloudscale-go-sdk/v9>
- API docs: <https://pkg.go.dev/github.com/cloudscale-ch/cloudscale-go-sdk/v10>
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cloudscale.ch Go API SDK

[![Go Reference](https://pkg.go.dev/badge/github.com/cloudscale-ch/cloudscale-go-sdk.svg)](https://pkg.go.dev/github.com/cloudscale-ch/cloudscale-go-sdk/v9)
[![Go Reference](https://pkg.go.dev/badge/github.com/cloudscale-ch/cloudscale-go-sdk.svg)](https://pkg.go.dev/github.com/cloudscale-ch/cloudscale-go-sdk/v10)
[![Tests](https://github.com/cloudscale-ch/cloudscale-go-sdk/actions/workflows/test.yaml/badge.svg)](https://github.com/cloudscale-ch/cloudscale-go-sdk/actions/workflows/test.yaml)

If you want to manage your cloudscale.ch server resources with Go, you are at
Expand All @@ -15,7 +15,7 @@ To use the `cloudscale-go-sdk` for managing your cloudscale.ch resources, follow

```console
go mod init example.com/m
go get github.com/cloudscale-ch/cloudscale-go-sdk/v9
go get github.com/cloudscale-ch/cloudscale-go-sdk/v10
```

1. **Create a File**:\
Expand All @@ -28,7 +28,7 @@ To use the `cloudscale-go-sdk` for managing your cloudscale.ch resources, follow
"context"
"fmt"
"github.com/cenkalti/backoff/v5"
"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10"
"golang.org/x/oauth2"
"log"
"os"
Expand Down Expand Up @@ -91,12 +91,12 @@ To use the `cloudscale-go-sdk` for managing your cloudscale.ch resources, follow
go run main.go
```

That's it! The code will create a server and leverage the `WaitFor` helper to wait until the server status changes to `running`. For more advanced options, check the [documentation](https://pkg.go.dev/github.com/cloudscale-ch/cloudscale-go-sdk/v9).
That's it! The code will create a server and leverage the `WaitFor` helper to wait until the server status changes to `running`. For more advanced options, check the [documentation](https://pkg.go.dev/github.com/cloudscale-ch/cloudscale-go-sdk/v10).

## Instrumentation

The SDK ships a transport wrapper in
`github.com/cloudscale-ch/cloudscale-go-sdk/v9/instrumentation` that adds
`github.com/cloudscale-ch/cloudscale-go-sdk/v10/instrumentation` that adds
Prometheus metrics and/or OpenTelemetry spans to every API call. Both signals
are independent — set only the fields you need on `Options`, and leaving both
unset returns the transport unchanged.
Expand All @@ -109,8 +109,8 @@ import (
"context"
"os"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
"github.com/cloudscale-ch/cloudscale-go-sdk/v9/instrumentation"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10/instrumentation"
"github.com/prometheus/client_golang/prometheus"
"go.opentelemetry.io/otel"
"golang.org/x/oauth2"
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/cloudscale-ch/cloudscale-go-sdk/v9
module github.com/cloudscale-ch/cloudscale-go-sdk/v10

go 1.26.5

Expand Down
2 changes: 0 additions & 2 deletions instrumentation/instrumentation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import (
"go.opentelemetry.io/otel/sdk/trace/tracetest"
"go.opentelemetry.io/otel/trace"
"go.opentelemetry.io/otel/trace/noop"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func newTestServer(t *testing.T, handler http.HandlerFunc) *httptest.Server {
Expand Down
2 changes: 0 additions & 2 deletions instrumentation/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"time"

"github.com/prometheus/client_golang/prometheus"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

// metricsCollector holds the Prometheus metrics for cloudscale API calls.
Expand Down
2 changes: 0 additions & 2 deletions instrumentation/tracing.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"go.opentelemetry.io/otel/propagation"
semconv "go.opentelemetry.io/otel/semconv/v1.26.0"
"go.opentelemetry.io/otel/trace"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

// tracingTransport wraps an http.RoundTripper with OpenTelemetry spans.
Expand Down
2 changes: 1 addition & 1 deletion test/integration/cloudscale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (

"golang.org/x/oauth2"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10"
)

var (
Expand Down
2 changes: 0 additions & 2 deletions test/integration/custom_images_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"strings"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

const testImageURL = "https://at-images.objects.lpg.cloudscale.ch/prod/alpine.raw"
Expand Down
2 changes: 1 addition & 1 deletion test/integration/flavors_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"context"
"testing"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10"
)

func TestListFlavors(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions test/integration/floating_ips_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"reflect"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

const pubKey string = "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFEepRNW5hDct4AdJ8oYsb4lNP5E9XY5fnz3ZvgNCEv7m48+bhUjJXUPuamWix3zigp2lgJHC6SChI/okJ41GUY="
Expand Down Expand Up @@ -281,7 +279,7 @@
}
}

func createFloatingIPInRegionAndAssert(t *testing.T, region cloudscale.Region) {

Check failure on line 282 in test/integration/floating_ips_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
t.Helper()

createServerRequest := &cloudscale.ServerRequest{
Expand Down
2 changes: 1 addition & 1 deletion test/integration/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"reflect"
"testing"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10"
)

func getAllZones() ([]cloudscale.ZoneStub, error) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"reflect"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationLoadBalancerHealthMonitor_CRUD(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions test/integration/load_balancer_listeners_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"reflect"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationLoadBalancerListener_CRUD(t *testing.T) {
Expand Down Expand Up @@ -206,7 +204,7 @@
}
}

func createPoolOnLB(lb *cloudscale.LoadBalancer) (*cloudscale.LoadBalancerPool, error) {

Check failure on line 207 in test/integration/load_balancer_listeners_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
createLoadBalancerPoolRequest := &cloudscale.LoadBalancerPoolRequest{
Name: testRunPrefix,
Algorithm: "round_robin",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"reflect"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationLoadBalancerPoolMember_CRUD(t *testing.T) {
Expand Down Expand Up @@ -317,7 +315,7 @@
)
}

func createNetworkAndSubnet() (*cloudscale.Network, *cloudscale.Subnet, error) {

Check failure on line 318 in test/integration/load_balancer_pool_members_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
autoCreateSubnet := false

network, err := client.Networks.Create(context.TODO(), &cloudscale.NetworkCreateRequest{
Expand Down
2 changes: 0 additions & 2 deletions test/integration/load_balancer_pools_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"reflect"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationLoadBalancerPool_CRUD(t *testing.T) {
Expand Down Expand Up @@ -126,7 +124,7 @@
}
}

func createLoadBalancer() (*cloudscale.LoadBalancer, error) {

Check failure on line 127 in test/integration/load_balancer_pools_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
createRequest := &cloudscale.LoadBalancerRequest{
Name: testRunPrefix,
Flavor: "lb-standard",
Expand Down
2 changes: 0 additions & 2 deletions test/integration/load_balancers_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
"reflect"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationLoadBalancer_CRUD(t *testing.T) {
Expand Down Expand Up @@ -175,7 +173,7 @@
}
}

func waitUntilLB(t *testing.T, uuid string) *cloudscale.LoadBalancer {

Check failure on line 176 in test/integration/load_balancers_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
t.Helper()

lb, err := client.LoadBalancers.WaitFor(context.Background(), uuid, cloudscale.LoadBalancerIsRunning)
Expand Down
2 changes: 0 additions & 2 deletions test/integration/metrics_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"context"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationMetrics_GetBucketMetrics(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions test/integration/networks_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"regexp"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationNetwork_CRUD(t *testing.T) {
Expand Down Expand Up @@ -457,7 +455,7 @@
}
}

func createNetworkInZoneAndAssert(t *testing.T, zone cloudscale.ZoneStub) {

Check failure on line 458 in test/integration/networks_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
t.Helper()

createNetworkRequest := &cloudscale.NetworkCreateRequest{
Expand Down
2 changes: 1 addition & 1 deletion test/integration/objects_users_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"fmt"
"testing"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10"
)

func TestIntegrationObjectsUser_CRUD(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion test/integration/server_groups_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"context"
"testing"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10"
)

func TestIntegrationServerGroup_CRUD(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions test/integration/servers_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
"strings"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

const DefaultImageSlug = "debian-11"

func createServer(t *testing.T, createRequest *cloudscale.ServerRequest) (*cloudscale.Server, error) {

Check failure on line 17 in test/integration/servers_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
t.Helper()

server, err := client.Servers.Create(context.Background(), createRequest)
Expand Down Expand Up @@ -156,7 +154,7 @@
}
}

func getDefaultServerRequest() cloudscale.ServerRequest {

Check failure on line 157 in test/integration/servers_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
return cloudscale.ServerRequest{
Name: testRunPrefix,
Zone: testZone,
Expand Down Expand Up @@ -406,7 +404,7 @@
}
}

func createServerInZoneAndAssert(t *testing.T, zone cloudscale.ZoneStub) {

Check failure on line 407 in test/integration/servers_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
t.Helper()

createRequest := getDefaultServerRequest()
Expand Down
2 changes: 1 addition & 1 deletion test/integration/subnets_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"reflect"
"testing"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
"github.com/cloudscale-ch/cloudscale-go-sdk/v10"
)

const numberOfDefaultEntries = 2
Expand Down
2 changes: 0 additions & 2 deletions test/integration/tags_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
"reflect"
"strings"
"testing"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func getInitialTags(testName string) cloudscale.TagMap {

Check failure on line 13 in test/integration/tags_integration_test.go

View workflow job for this annotation

GitHub Actions / Run on Ubuntu

undefined: cloudscale
return cloudscale.TagMap{
fmt.Sprintf("yin-%s-%s", testRunPrefix, testName): "yang",
}
Expand Down
2 changes: 0 additions & 2 deletions test/integration/volume_snapshots_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import (
"net/http"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationVolumeSnapshot_CRUD(t *testing.T) {
Expand Down
2 changes: 0 additions & 2 deletions test/integration/volumes_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"strings"
"testing"
"time"

"github.com/cloudscale-ch/cloudscale-go-sdk/v9"
)

func TestIntegrationVolume_CreateAttached(t *testing.T) {
Expand Down
Loading