chore(http-timeout): removed timeout functionality when calling the API as it was not needed and malfunctional
All checks were successful
ci / goreleaser (push) Successful in 59s

This commit is contained in:
Stephan Lo 2025-10-17 12:01:47 +02:00
parent 5f54082813
commit dbf7ccb0d6
5 changed files with 20 additions and 43 deletions

View file

@ -15,14 +15,11 @@ import (
// CreateAppInstance creates a new application instance in the specified region
// Maps to POST /auth/ctrl/CreateAppInst
func (c *Client) CreateAppInstance(ctx context.Context, input *NewAppInstanceInput) error {
// Apply CreateAppInstance-specific timeout
timeoutCtx, cancel := context.WithTimeout(ctx, c.CreateAppInstanceTimeout)
defer cancel()
transport := c.getTransport()
url := c.BaseURL + "/api/v1/auth/ctrl/CreateAppInst"
resp, err := transport.Call(timeoutCtx, "POST", url, input)
resp, err := transport.Call(ctx, "POST", url, input)
if err != nil {
return fmt.Errorf("CreateAppInstance failed: %w", err)
}

View file

@ -11,12 +11,11 @@ import (
// Client represents the EdgeXR Master Controller SDK client
type Client struct {
BaseURL string
HTTPClient *http.Client
AuthProvider AuthProvider
RetryOpts RetryOptions
Logger Logger
CreateAppInstanceTimeout time.Duration
BaseURL string
HTTPClient *http.Client
AuthProvider AuthProvider
RetryOpts RetryOptions
Logger Logger
}
// RetryOptions configures retry behavior for API calls
@ -82,21 +81,13 @@ func WithLogger(logger Logger) Option {
}
}
// WithCreateAppInstanceTimeout sets the timeout for CreateAppInstance operations
func WithCreateAppInstanceTimeout(timeout time.Duration) Option {
return func(c *Client) {
c.CreateAppInstanceTimeout = timeout
}
}
// NewClient creates a new EdgeXR SDK client
func NewClient(baseURL string, options ...Option) *Client {
client := &Client{
BaseURL: strings.TrimRight(baseURL, "/"),
HTTPClient: &http.Client{Timeout: 30 * time.Second},
AuthProvider: NewNoAuthProvider(),
RetryOpts: DefaultRetryOptions(),
CreateAppInstanceTimeout: 10 * time.Minute,
BaseURL: strings.TrimRight(baseURL, "/"),
HTTPClient: &http.Client{Timeout: 30 * time.Second},
AuthProvider: NewNoAuthProvider(),
RetryOpts: DefaultRetryOptions(),
}
for _, opt := range options {
@ -110,11 +101,10 @@ func NewClient(baseURL string, options ...Option) *Client {
// This matches the existing client pattern from client/client.go
func NewClientWithCredentials(baseURL, username, password string, options ...Option) *Client {
client := &Client{
BaseURL: strings.TrimRight(baseURL, "/"),
HTTPClient: &http.Client{Timeout: 30 * time.Second},
AuthProvider: NewUsernamePasswordProvider(baseURL, username, password, nil),
RetryOpts: DefaultRetryOptions(),
CreateAppInstanceTimeout: 10 * time.Minute,
BaseURL: strings.TrimRight(baseURL, "/"),
HTTPClient: &http.Client{Timeout: 30 * time.Second},
AuthProvider: NewUsernamePasswordProvider(baseURL, username, password, nil),
RetryOpts: DefaultRetryOptions(),
}
for _, opt := range options {

View file

@ -2,7 +2,7 @@
# How does it differ from the EdgeXR API?
kind: edgeconnect-deployment
metadata:
name: "edge-app-test" # name could be used for appName
name: "edge-app-demo" # name could be used for appName
appVersion: "1.0.0"
organization: "edp2"
spec:
@ -15,7 +15,7 @@ spec:
infraTemplate:
- region: "EU"
cloudletOrg: "TelekomOP"
cloudletName: "Hamburg"
cloudletName: "Munich"
flavorName: "EU.small"
network:
outboundConnections: