diff --git a/sdk/client/apps.go b/sdk/client/apps.go index cc2af93..8efcc8e 100644 --- a/sdk/client/apps.go +++ b/sdk/client/apps.go @@ -47,7 +47,7 @@ func (c *Client) ShowApp(ctx context.Context, appKey AppKey, region string) (App url := c.BaseURL + "/api/v1/auth/ctrl/ShowApp" filter := AppFilter{ - AppKey: appKey, + App: App{Key: appKey}, Region: region, } @@ -87,7 +87,7 @@ func (c *Client) ShowApps(ctx context.Context, appKey AppKey, region string) ([] url := c.BaseURL + "/api/v1/auth/ctrl/ShowApp" filter := AppFilter{ - AppKey: appKey, + App: App{Key: appKey}, Region: region, } @@ -121,7 +121,7 @@ func (c *Client) DeleteApp(ctx context.Context, appKey AppKey, region string) er url := c.BaseURL + "/api/v1/auth/ctrl/DeleteApp" filter := AppFilter{ - AppKey: appKey, + App: App{Key: appKey}, Region: region, } diff --git a/sdk/client/types.go b/sdk/client/types.go index 1a9e44c..0604c48 100644 --- a/sdk/client/types.go +++ b/sdk/client/types.go @@ -196,7 +196,7 @@ func (e *APIError) Error() string { // AppFilter represents filters for app queries type AppFilter struct { - AppKey AppKey `json:"app"` + App App `json:"app"` Region string `json:"region"` } diff --git a/sdk/examples/deploy_app.go b/sdk/examples/deploy_app.go index 861f6d3..f68063e 100644 --- a/sdk/examples/deploy_app.go +++ b/sdk/examples/deploy_app.go @@ -9,6 +9,7 @@ import ( "log" "net/http" "os" + "strings" "time" "edp.buildth.ing/DevFW-CICD/edge-connect-client/sdk/client" @@ -55,10 +56,12 @@ func main() { Name: "my-edge-app", Version: "1.0.0", }, - Deployment: "docker", - ImageType: "ImageTypeDocker", - ImagePath: "nginx:latest", - DefaultFlavor: client.Flavor{Name: "EU.small"}, + Deployment: "docker", + ImageType: "ImageTypeDocker", + ImagePath: "https://registry-1.docker.io/library/nginx:latest", + DefaultFlavor: client.Flavor{Name: "EU.small"}, + ServerlessConfig: struct{}{}, + AllowServerless: false, }, } @@ -113,7 +116,7 @@ func demonstrateAppLifecycle(ctx context.Context, edgeClient *client.Client, inp fmt.Println("\n5. Verifying deletion...") _, err = edgeClient.ShowApp(ctx, appKey, region) if err != nil { - if fmt.Sprintf("%v", err) == client.ErrResourceNotFound.Error() { + if strings.Contains(fmt.Sprintf("%v", err), client.ErrResourceNotFound.Error()) { fmt.Printf("✅ App successfully deleted (not found)\n") } else { return fmt.Errorf("unexpected error verifying deletion: %w", err) diff --git a/sdk/internal/http/transport.go b/sdk/internal/http/transport.go index 5766d7d..54e853c 100644 --- a/sdk/internal/http/transport.go +++ b/sdk/internal/http/transport.go @@ -37,9 +37,9 @@ type Logger interface { // RetryOptions configures retry behavior type RetryOptions struct { MaxRetries int - InitialDelay time.Duration - MaxDelay time.Duration - Multiplier float64 + InitialDelay time.Duration + MaxDelay time.Duration + Multiplier float64 RetryableHTTPStatusCodes []int } @@ -128,6 +128,7 @@ func (t *Transport) Call(ctx context.Context, method, url string, body interface // Log request if t.logger != nil { t.logger.Printf("HTTP %s %s", method, url) + t.logger.Printf("BODY %s", reqBody) } // Execute request @@ -215,4 +216,4 @@ func ParseJSONLines(body io.Reader, callback func([]byte) error) error { } return nil -} \ No newline at end of file +}