Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
- `core`: [v0.y.z]
- **Feature:** Add package `runtime`, which implements methods to be used when performing API requests
- **Feature:** Add method `WithCaptureHTTPResponse` to package `runtime`, which does the same as `config.WithCaptureHTTPResponse`. Method was moved to avoid confusion due to it not being a configuration option, and will be removed in a later release.
- **Deprecation:** Mark method `config.WithCaptureHTTPResponse` as deprecated, to avoid confusion due to it not being a configuration option. Use `runtime.WithCaptureHTTPResponse` instead.

## Release (2024-02-07)

Expand Down
4 changes: 4 additions & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.9.0 (YYYY-MM-DD)

- **Deprecation:** Mark method `config.WithCaptureHTTPResponse` as deprecated, to avoid confusion due to it not being a configuration option. Use `runtime.WithCaptureHTTPResponse` instead.

## v0.8.0 (2024-02-16)

- **Feature:** Add package `runtime`, which implements methods to be used when performing API requests
Expand Down
2 changes: 2 additions & 0 deletions core/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,8 @@ func WithCustomConfiguration(cfg *Configuration) ConfigurationOption {

// WithCaptureHTTPResponse adds the raw HTTP response retrieval annotation to the parent context.
// The resp parameter will contain the raw HTTP response after the request has completed.
//
// Deprecated: Use runtime.WithCaptureHTTPResponse instead
func WithCaptureHTTPResponse(parent context.Context, resp **http.Response) context.Context {
return context.WithValue(parent, ContextHTTPResponse, resp)
}
Expand Down
4 changes: 2 additions & 2 deletions examples/httpresponse/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/stackitcloud/stackit-sdk-go/examples/httpresponse
go 1.18

require (
github.com/stackitcloud/stackit-sdk-go/core v0.7.7
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.11.0
github.com/stackitcloud/stackit-sdk-go/core v0.8.0
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.1
)

require (
Expand Down
8 changes: 4 additions & 4 deletions examples/httpresponse/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/stackitcloud/stackit-sdk-go/core v0.7.7 h1:w1T8I2ERT5xPHXS+UV9maSseK8tyUJQjzS21hhRSWjU=
github.com/stackitcloud/stackit-sdk-go/core v0.7.7/go.mod h1:nfC2Tbjd73Ivn8wEp3lvG/dmiXHgl6QX+HY2Ih3aGgw=
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.11.0 h1:Ys1WYHlM/5ev5WmM3Qn/FboIlKeXbQSOU2PYlMQ2C9A=
github.com/stackitcloud/stackit-sdk-go/services/mongodbflex v0.11.0/go.mod h1:n9bUnjBIAvpnyC5oNGFZKZ/mmoA9y7CBTFwi1KV62GA=
github.com/stackitcloud/stackit-sdk-go/core v0.8.0 h1:oczQLvaeM3nGMqkWIw1a9sfc7lAzCauFjGQKjpJZpbg=
github.com/stackitcloud/stackit-sdk-go/core v0.8.0/go.mod h1:UQ2I6MucPu7kggBWjlAP8H13sflwPUikuskH9s5SXKc=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.1 h1:41M0IWsHFmt2KvoY/4vwWYNG94Tx3U3diSlYdz0thJE=
github.com/stackitcloud/stackit-sdk-go/services/postgresflex v0.9.1/go.mod h1:bVXMSjQH1eGUF5IoPAD8BjAzhRMunDlnrwLsaCPgRQ4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4=
Expand Down
11 changes: 6 additions & 5 deletions examples/httpresponse/httpresponse.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ import (
"os"

"github.com/stackitcloud/stackit-sdk-go/core/config"
"github.com/stackitcloud/stackit-sdk-go/services/mongodbflex"
"github.com/stackitcloud/stackit-sdk-go/core/runtime"
"github.com/stackitcloud/stackit-sdk-go/services/postgresflex"
)

func main() {
// Specify the project ID
projectId := "PROJECT_ID"

// Create a new API client, that uses default authentication and configuration
mongodbflexClient, err := mongodbflex.NewAPIClient(
postgresflexClient, err := postgresflex.NewAPIClient(
config.WithRegion("eu01"),
)
if err != nil {
Expand All @@ -25,10 +26,10 @@ func main() {

// Get the MongoDB Flex instances for your project and capture the HTTP response using the context
var httpResp *http.Response
ctxWithHTTPResp := config.WithCaptureHTTPResponse(context.Background(), &httpResp)
getInstancesResp, err := mongodbflexClient.ListInstances(ctxWithHTTPResp, projectId).Tag("tag").Execute()
ctxWithHTTPResp := runtime.WithCaptureHTTPResponse(context.Background(), &httpResp)
getInstancesResp, err := postgresflexClient.ListInstances(ctxWithHTTPResp, projectId).Execute()
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `GetInstances`: %v\n", err)
fmt.Fprintf(os.Stderr, "Error when calling `ListInstances`: %v\n", err)
os.Exit(1)
}
fmt.Printf("Number of instances: %v\n\n", len(*getInstancesResp.Items))
Expand Down