Skip to content

Commit 7f59ef0

Browse files
committed
fix: types
Signed-off-by: QuentinN42 <quentin@lieumont.fr>
1 parent e45da69 commit 7f59ef0

File tree

3 files changed

+5
-39
lines changed

3 files changed

+5
-39
lines changed

pkg/cli/integrations_akamai.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ var integrationsAkamaiList = &cobra.Command{
2020
if err != nil {
2121
return err
2222
}
23-
integrations, err := client.GetV1IntegrationsAkamaiWithResponse(cmd.Context())
23+
integrations, err := client.GetAkamaiIntegrationsWithResponse(cmd.Context())
2424
if err != nil {
2525
return err
2626
}

pkg/cli/integrations_kubernetes.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ var integrationsKubernetesList = &cobra.Command{
2323
if err != nil {
2424
return err
2525
}
26-
integrations, err := client.GetV1IntegrationsKubernetesWithResponse(cmd.Context())
26+
integrations, err := client.GetKubernetesIntegrationsWithResponse(cmd.Context())
2727
if err != nil {
2828
return err
2929
}
@@ -58,7 +58,7 @@ var integrationsKubernetesDelete = &cobra.Command{
5858
if err != nil {
5959
return err
6060
}
61-
res, err := client.DeleteV1IntegrationsKubernetesIdWithResponse(cmd.Context(), id)
61+
res, err := client.DeleteKubernetesIntegrationWithResponse(cmd.Context(), id)
6262
if err != nil {
6363
return err
6464
}

pkg/locations/private/kube/integration.go

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12,48 +12,13 @@ import (
1212

1313
func UpsertIntegration(ctx context.Context, client *api.ClientWithResponses, locationId *types.UUID, locationName string) error {
1414
log.Info("Upserting location %s", locationName)
15-
location, err := client.UpsertKubernetesIntegrationWithResponse(ctx, api.UpsertKubernetesIntegrationJSONRequestBody{
15+
res, err := client.UpsertKubernetesIntegrationWithResponse(ctx, api.UpsertKubernetesIntegrationJSONRequestBody{
1616
Name: locationName,
1717
LocationId: locationId,
1818
})
1919
if err != nil {
2020
return err
2121
}
22-
if location.JSON200 != nil {
23-
return location.JSON200, func() {
24-
fmt.Println("Location:", *location.JSON200.Name)
25-
fmt.Println("Type:", *location.JSON200.Type)
26-
fmt.Println("Id:", *location.JSON200.Id)
27-
}, nil
28-
} else if location.JSON400 != nil {
29-
return nil, nil, fmt.Errorf("unable to create location: %s", location.JSON400.Message)
30-
} else if location.JSON500 != nil {
31-
return nil, nil, fmt.Errorf("unable to create location: %s", location.JSON500.Message)
32-
} else {
33-
return nil, nil, fmt.Errorf("unable to create location: Unknown error")
34-
}
35-
36-
integrations, err := client.GetV1IntegrationsKubernetesWithResponse(ctx)
37-
if err != nil {
38-
return err
39-
}
40-
41-
for _, integration := range *integrations.JSON200 {
42-
if integration.LocationId == locationId {
43-
log.Info("Integration already exists, skipping")
44-
return nil
45-
}
46-
}
47-
48-
time.Sleep(2 * time.Second)
49-
log.Info("Integration not found, creating")
50-
res, err := client.PostV1IntegrationsKubernetesWithResponse(ctx, api.PostV1IntegrationsKubernetesJSONRequestBody{
51-
LocationId: locationId,
52-
Name: locationName,
53-
})
54-
if err != nil {
55-
return err
56-
}
5722
if res.JSON200 != nil {
5823
log.Info("Integration created successfully")
5924
return nil
@@ -67,4 +32,5 @@ func UpsertIntegration(ctx context.Context, client *api.ClientWithResponses, loc
6732
} else {
6833
return fmt.Errorf("unable to create integration: Unknown error")
6934
}
35+
return nil
7036
}

0 commit comments

Comments
 (0)