feat(sdk): The deploy app example is now working
This commit is contained in:
parent
1bd9105b07
commit
14123cec3d
4 changed files with 17 additions and 13 deletions
|
|
@ -47,7 +47,7 @@ func (c *Client) ShowApp(ctx context.Context, appKey AppKey, region string) (App
|
||||||
url := c.BaseURL + "/api/v1/auth/ctrl/ShowApp"
|
url := c.BaseURL + "/api/v1/auth/ctrl/ShowApp"
|
||||||
|
|
||||||
filter := AppFilter{
|
filter := AppFilter{
|
||||||
AppKey: appKey,
|
App: App{Key: appKey},
|
||||||
Region: region,
|
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"
|
url := c.BaseURL + "/api/v1/auth/ctrl/ShowApp"
|
||||||
|
|
||||||
filter := AppFilter{
|
filter := AppFilter{
|
||||||
AppKey: appKey,
|
App: App{Key: appKey},
|
||||||
Region: region,
|
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"
|
url := c.BaseURL + "/api/v1/auth/ctrl/DeleteApp"
|
||||||
|
|
||||||
filter := AppFilter{
|
filter := AppFilter{
|
||||||
AppKey: appKey,
|
App: App{Key: appKey},
|
||||||
Region: region,
|
Region: region,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ func (e *APIError) Error() string {
|
||||||
|
|
||||||
// AppFilter represents filters for app queries
|
// AppFilter represents filters for app queries
|
||||||
type AppFilter struct {
|
type AppFilter struct {
|
||||||
AppKey AppKey `json:"app"`
|
App App `json:"app"`
|
||||||
Region string `json:"region"`
|
Region string `json:"region"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"edp.buildth.ing/DevFW-CICD/edge-connect-client/sdk/client"
|
"edp.buildth.ing/DevFW-CICD/edge-connect-client/sdk/client"
|
||||||
|
|
@ -55,10 +56,12 @@ func main() {
|
||||||
Name: "my-edge-app",
|
Name: "my-edge-app",
|
||||||
Version: "1.0.0",
|
Version: "1.0.0",
|
||||||
},
|
},
|
||||||
Deployment: "docker",
|
Deployment: "docker",
|
||||||
ImageType: "ImageTypeDocker",
|
ImageType: "ImageTypeDocker",
|
||||||
ImagePath: "nginx:latest",
|
ImagePath: "https://registry-1.docker.io/library/nginx:latest",
|
||||||
DefaultFlavor: client.Flavor{Name: "EU.small"},
|
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...")
|
fmt.Println("\n5. Verifying deletion...")
|
||||||
_, err = edgeClient.ShowApp(ctx, appKey, region)
|
_, err = edgeClient.ShowApp(ctx, appKey, region)
|
||||||
if err != nil {
|
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")
|
fmt.Printf("✅ App successfully deleted (not found)\n")
|
||||||
} else {
|
} else {
|
||||||
return fmt.Errorf("unexpected error verifying deletion: %w", err)
|
return fmt.Errorf("unexpected error verifying deletion: %w", err)
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,9 @@ type Logger interface {
|
||||||
// RetryOptions configures retry behavior
|
// RetryOptions configures retry behavior
|
||||||
type RetryOptions struct {
|
type RetryOptions struct {
|
||||||
MaxRetries int
|
MaxRetries int
|
||||||
InitialDelay time.Duration
|
InitialDelay time.Duration
|
||||||
MaxDelay time.Duration
|
MaxDelay time.Duration
|
||||||
Multiplier float64
|
Multiplier float64
|
||||||
RetryableHTTPStatusCodes []int
|
RetryableHTTPStatusCodes []int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -128,6 +128,7 @@ func (t *Transport) Call(ctx context.Context, method, url string, body interface
|
||||||
// Log request
|
// Log request
|
||||||
if t.logger != nil {
|
if t.logger != nil {
|
||||||
t.logger.Printf("HTTP %s %s", method, url)
|
t.logger.Printf("HTTP %s %s", method, url)
|
||||||
|
t.logger.Printf("BODY %s", reqBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute request
|
// Execute request
|
||||||
|
|
@ -215,4 +216,4 @@ func ParseJSONLines(body io.Reader, callback func([]byte) error) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue