Skip to content

Commit ed92f72

Browse files
authored
api: Removes all platform apis and imports the from cloud-sdk-go (#299)
This patch removes all platform apis and imports the from cloud-sdk-go
1 parent 72362f3 commit ed92f72

File tree

103 files changed

+131
-14582
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+131
-14582
lines changed

cmd/platform/allocator/list.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import (
2222
"path/filepath"
2323
"strconv"
2424

25+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/allocatorapi"
2526
"github.com/spf13/cobra"
2627

2728
"github.com/elastic/ecctl/pkg/ecctl"
28-
"github.com/elastic/ecctl/pkg/platform/allocator"
2929
)
3030

3131
const (
@@ -59,11 +59,11 @@ Filter and query flags can be used in combination.
5959
func listAllocators(cmd *cobra.Command, args []string) error {
6060
var queryString = cmd.Flag("query").Value.String()
6161
if unhealthy, _ := cmd.Flags().GetBool("unhealthy"); unhealthy {
62-
queryString = allocator.UnhealthyQuery
62+
queryString = allocatorapi.UnhealthyQuery
6363
}
6464

6565
allFlag, _ := strconv.ParseBool(cmd.Flag("all").Value.String())
66-
a, err := allocator.List(allocator.ListParams{
66+
a, err := allocatorapi.List(allocatorapi.ListParams{
6767
API: ecctl.Get().API,
6868
Query: queryString,
6969
FilterTags: cmd.Flag("filter").Value.String(),

cmd/platform/allocator/maintenance.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ package cmdallocator
2020
import (
2121
"fmt"
2222

23+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/allocatorapi"
2324
"github.com/spf13/cobra"
2425

2526
"github.com/elastic/ecctl/pkg/ecctl"
26-
"github.com/elastic/ecctl/pkg/platform/allocator"
2727
)
2828

2929
var maintenanceAllocatorCmd = &cobra.Command{
@@ -34,15 +34,15 @@ var maintenanceAllocatorCmd = &cobra.Command{
3434
RunE: func(cmd *cobra.Command, args []string) error {
3535
unset, _ := cmd.Flags().GetBool("unset")
3636
fmt.Printf("Setting allocator %s maintenance to %t\n", args[0], !unset)
37-
var params = allocator.MaintenanceParams{
37+
var params = allocatorapi.MaintenanceParams{
3838
API: ecctl.Get().API,
3939
ID: args[0],
4040
}
4141

4242
if unset {
43-
return allocator.StopMaintenance(params)
43+
return allocatorapi.StopMaintenance(params)
4444
}
45-
return allocator.StartMaintenance(params)
45+
return allocatorapi.StartMaintenance(params)
4646
},
4747
}
4848

cmd/platform/allocator/metadata/command.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ package cmdallocatormetadata
2020
import (
2121
"path/filepath"
2222

23+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/allocatorapi"
2324
"github.com/spf13/cobra"
2425

2526
"github.com/elastic/ecctl/pkg/ecctl"
26-
"github.com/elastic/ecctl/pkg/platform/allocator"
2727
)
2828

2929
// Command represents the allocator metadata command.
@@ -40,13 +40,13 @@ var allocatorMetadataSetCmd = &cobra.Command{
4040
PreRunE: cobra.MinimumNArgs(3),
4141
RunE: func(cmd *cobra.Command, args []string) error {
4242

43-
var params = &allocator.MetadataSetParams{
43+
var params = &allocatorapi.MetadataSetParams{
4444
API: ecctl.Get().API,
4545
ID: args[0],
4646
Key: args[1],
4747
Value: args[2],
4848
}
49-
err := allocator.SetAllocatorMetadataItem(*params)
49+
err := allocatorapi.SetAllocatorMetadataItem(*params)
5050

5151
if err != nil {
5252
return err
@@ -61,12 +61,12 @@ var allocatorMetadataDeleteCmd = &cobra.Command{
6161
PreRunE: cobra.MinimumNArgs(2),
6262
RunE: func(cmd *cobra.Command, args []string) error {
6363

64-
var params = &allocator.MetadataDeleteParams{
64+
var params = &allocatorapi.MetadataDeleteParams{
6565
API: ecctl.Get().API,
6666
ID: args[0],
6767
Key: args[1],
6868
}
69-
err := allocator.DeleteAllocatorMetadataItem(*params)
69+
err := allocatorapi.DeleteAllocatorMetadataItem(*params)
7070

7171
if err != nil {
7272
return err
@@ -80,11 +80,11 @@ var allocatorMetadataShowCmd = &cobra.Command{
8080
Short: "Shows allocator metadata",
8181
PreRunE: cobra.MinimumNArgs(1),
8282
RunE: func(cmd *cobra.Command, args []string) error {
83-
var params = allocator.MetadataGetParams{
83+
var params = allocatorapi.MetadataGetParams{
8484
API: ecctl.Get().API,
8585
ID: args[0],
8686
}
87-
res, err := allocator.GetAllocatorMetadata(params)
87+
res, err := allocatorapi.GetAllocatorMetadata(params)
8888

8989
if err != nil {
9090
return err

cmd/platform/allocator/search.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ import (
2222
"path/filepath"
2323
"strconv"
2424

25+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/allocatorapi"
2526
"github.com/elastic/cloud-sdk-go/pkg/models"
2627
sdkcmdutil "github.com/elastic/cloud-sdk-go/pkg/util/cmdutil"
2728
"github.com/spf13/cobra"
2829

2930
cmdutil "github.com/elastic/ecctl/cmd/util"
3031
"github.com/elastic/ecctl/pkg/ecctl"
31-
"github.com/elastic/ecctl/pkg/platform/allocator"
3232
)
3333

3434
const (
@@ -73,8 +73,8 @@ var searchAllocatorCmd = &cobra.Command{
7373
return err
7474
}
7575

76-
r, err := allocator.Search(
77-
allocator.SearchParams{
76+
r, err := allocatorapi.Search(
77+
allocatorapi.SearchParams{
7878
API: ecctl.Get().API,
7979
Request: sr,
8080
})

cmd/platform/allocator/show.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ package cmdallocator
2020
import (
2121
"path/filepath"
2222

23+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/allocatorapi"
2324
"github.com/spf13/cobra"
2425

2526
"github.com/elastic/ecctl/pkg/ecctl"
26-
"github.com/elastic/ecctl/pkg/platform/allocator"
2727
)
2828

2929
func showAllocator(cmd *cobra.Command, args []string) error {
30-
a, err := allocator.Get(allocator.GetParams{
30+
a, err := allocatorapi.Get(allocatorapi.GetParams{
3131
API: ecctl.Get().API,
3232
ID: args[0],
3333
})

cmd/platform/allocator/vacate.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,10 @@ import (
2828
"github.com/hashicorp/go-multierror"
2929
"github.com/spf13/cobra"
3030

31+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/allocatorapi"
32+
3133
cmdutil "github.com/elastic/ecctl/cmd/util"
3234
"github.com/elastic/ecctl/pkg/ecctl"
33-
"github.com/elastic/ecctl/pkg/platform/allocator"
3435
)
3536

3637
const vacateExamples = ` ecctl platform allocator vacate i-05e245252362f7f1d
@@ -142,11 +143,11 @@ var vacateAllocatorCmd = &cobra.Command{
142143
// Only sets the allocator to maintenance mode when the flag is specified
143144
if setAllocatorMaintenance {
144145
for _, id := range args {
145-
var params = allocator.MaintenanceParams{
146+
var params = allocatorapi.MaintenanceParams{
146147
API: ecctl.Get().API,
147148
ID: id,
148149
}
149-
if err := allocator.StartMaintenance(params); err != nil {
150+
if err := allocatorapi.StartMaintenance(params); err != nil {
150151
merr = multierror.Append(merr, err)
151152
}
152153
}
@@ -157,7 +158,7 @@ var vacateAllocatorCmd = &cobra.Command{
157158
}
158159

159160
maxRetries, pollFrequency := cmdutil.GetTrackSettings(cmd)
160-
var params = &allocator.VacateParams{
161+
var params = &allocatorapi.VacateParams{
161162
API: ecctl.Get().API,
162163
Allocators: args,
163164
PreferredAllocators: target,
@@ -168,7 +169,7 @@ var vacateAllocatorCmd = &cobra.Command{
168169
OutputFormat: ecctl.Get().Config.Output,
169170
MoveOnly: ec.Bool(moveOnly),
170171
SkipTracking: skipTracking,
171-
PlanOverrides: allocator.PlanOverrides{
172+
PlanOverrides: allocatorapi.PlanOverrides{
172173
SkipSnapshot: skipSnapshot,
173174
SkipDataMigration: skipDataMigration,
174175
OverrideFailsafe: ec.Bool(overrideFailsafe),
@@ -180,7 +181,7 @@ var vacateAllocatorCmd = &cobra.Command{
180181
params.AllocatorDown = &allocatorDown
181182
}
182183

183-
return allocator.Vacate(params)
184+
return allocatorapi.Vacate(params)
184185
},
185186
}
186187

cmd/platform/constructor/command.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ import (
2121
"fmt"
2222
"path/filepath"
2323

24+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/constructorapi"
2425
"github.com/spf13/cobra"
2526

2627
cmdutil "github.com/elastic/ecctl/cmd/util"
2728
"github.com/elastic/ecctl/pkg/ecctl"
28-
"github.com/elastic/ecctl/pkg/platform/constructor"
2929
)
3030

3131
const (
@@ -45,7 +45,7 @@ var Command = &cobra.Command{
4545
}
4646

4747
func listConstructors(cmd *cobra.Command, args []string) error {
48-
a, err := constructor.List(constructor.Params{
48+
a, err := constructorapi.List(constructorapi.Params{
4949
API: ecctl.Get().API,
5050
})
5151
if err != nil {
@@ -60,8 +60,8 @@ var showConstructorCmd = &cobra.Command{
6060
Short: constructorShowMessage,
6161
PreRunE: cobra.MinimumNArgs(1),
6262
RunE: func(cmd *cobra.Command, args []string) error {
63-
a, err := constructor.Get(constructor.GetParams{
64-
Params: constructor.Params{
63+
a, err := constructorapi.Get(constructorapi.GetParams{
64+
Params: constructorapi.Params{
6565
API: ecctl.Get().API,
6666
},
6767
ID: args[0],
@@ -81,17 +81,17 @@ var maintenanceConstructorCmd = &cobra.Command{
8181
RunE: func(cmd *cobra.Command, args []string) error {
8282
unset, _ := cmd.Flags().GetBool("unset")
8383
fmt.Printf("Setting contructor %s maintenance to %t\n", args[0], !unset)
84-
var params = constructor.MaintenanceParams{
85-
Params: constructor.Params{
84+
var params = constructorapi.MaintenanceParams{
85+
Params: constructorapi.Params{
8686
API: ecctl.Get().API,
8787
},
8888
ID: args[0],
8989
}
9090

9191
if unset {
92-
return constructor.DisableMaintenance(params)
92+
return constructorapi.DisableMaintenance(params)
9393
}
94-
return constructor.EnableMaintenace(params)
94+
return constructorapi.EnableMaintenace(params)
9595
},
9696
}
9797

cmd/platform/constructor/resync.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ package cmdconstructor
2020
import (
2121
"fmt"
2222

23+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/constructorapi"
2324
"github.com/elastic/cloud-sdk-go/pkg/util/cmdutil"
2425
"github.com/spf13/cobra"
2526

2627
"github.com/elastic/ecctl/pkg/ecctl"
27-
"github.com/elastic/ecctl/pkg/platform/constructor"
2828
)
2929

3030
var resyncConstructorCmd = &cobra.Command{
@@ -36,7 +36,7 @@ var resyncConstructorCmd = &cobra.Command{
3636

3737
if all {
3838
fmt.Println("Resynchronizing all constructors")
39-
res, err := constructor.ResyncAll(constructor.Params{
39+
res, err := constructorapi.ResyncAll(constructorapi.Params{
4040
API: ecctl.Get().API,
4141
})
4242
if err != nil {
@@ -47,7 +47,7 @@ var resyncConstructorCmd = &cobra.Command{
4747
}
4848

4949
fmt.Printf("Resynchronizing constructor: %s\n", args[0])
50-
return constructor.Resync(constructor.ResyncParams{
50+
return constructorapi.Resync(constructorapi.ResyncParams{
5151
API: ecctl.Get().API,
5252
ID: args[0],
5353
})

cmd/platform/deployment-template/command.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"path"
2525
"path/filepath"
2626

27+
"github.com/elastic/cloud-sdk-go/pkg/api/platformapi/configurationtemplateapi"
2728
"github.com/elastic/cloud-sdk-go/pkg/input"
2829
"github.com/elastic/cloud-sdk-go/pkg/models"
2930
sdkcmdutil "github.com/elastic/cloud-sdk-go/pkg/util/cmdutil"
@@ -32,7 +33,6 @@ import (
3233

3334
cmdutil "github.com/elastic/ecctl/cmd/util"
3435
"github.com/elastic/ecctl/pkg/ecctl"
35-
"github.com/elastic/ecctl/pkg/platform/deployment"
3636
)
3737

3838
const (
@@ -60,7 +60,7 @@ var platformDeploymentTemplateListCmd = &cobra.Command{
6060
stackVersion, _ := cmd.Flags().GetString(stackVersion)
6161
metadataFilter, _ := cmd.Flags().GetString(filter)
6262

63-
res, err := deployment.ListTemplates(deployment.ListTemplateParams{
63+
res, err := configurationtemplateapi.ListTemplates(configurationtemplateapi.ListTemplateParams{
6464
API: ecctl.Get().API,
6565
ShowInstanceConfig: showInstanceConfig,
6666
StackVersion: stackVersion,
@@ -81,8 +81,8 @@ var platformDeploymentTemplateShowCmd = &cobra.Command{
8181
PreRunE: cobra.MinimumNArgs(1),
8282
RunE: func(cmd *cobra.Command, args []string) error {
8383
show, _ := cmd.Flags().GetBool("show-instance-configurations")
84-
res, err := deployment.GetTemplate(deployment.GetTemplateParams{
85-
TemplateParams: deployment.TemplateParams{
84+
res, err := configurationtemplateapi.GetTemplate(configurationtemplateapi.GetTemplateParams{
85+
TemplateParams: configurationtemplateapi.TemplateParams{
8686
API: ecctl.Get().API,
8787
ID: args[0],
8888
},
@@ -102,8 +102,8 @@ var platformDeploymentTemplateDeleteCmd = &cobra.Command{
102102
Short: "Deletes a specific platform deployment template",
103103
PreRunE: cobra.MinimumNArgs(1),
104104
RunE: func(cmd *cobra.Command, args []string) error {
105-
err := deployment.DeleteTemplate(deployment.GetTemplateParams{
106-
TemplateParams: deployment.TemplateParams{
105+
err := configurationtemplateapi.DeleteTemplate(configurationtemplateapi.GetTemplateParams{
106+
TemplateParams: configurationtemplateapi.TemplateParams{
107107
API: ecctl.Get().API,
108108
ID: args[0],
109109
},
@@ -136,7 +136,7 @@ var platformDeploymentTemplateCreateCmd = &cobra.Command{
136136
tc.ID = id
137137
}
138138

139-
tid, err := deployment.CreateTemplate(deployment.CreateTemplateParams{
139+
tid, err := configurationtemplateapi.CreateTemplate(configurationtemplateapi.CreateTemplateParams{
140140
DeploymentTemplateInfo: tc,
141141
API: ecctl.Get().API,
142142
})
@@ -163,9 +163,9 @@ var platformDeploymentTemplateUpdateCmd = &cobra.Command{
163163
if err != nil {
164164
return err
165165
}
166-
if err := deployment.UpdateTemplate(
167-
deployment.UpdateTemplateParams{
168-
TemplateParams: deployment.TemplateParams{
166+
if err := configurationtemplateapi.UpdateTemplate(
167+
configurationtemplateapi.UpdateTemplateParams{
168+
TemplateParams: configurationtemplateapi.TemplateParams{
169169
API: ecctl.Get().API,
170170
ID: args[0],
171171
},
@@ -188,8 +188,8 @@ var platformDeploymentTemplatePullCmd = &cobra.Command{
188188
PreRunE: cobra.MaximumNArgs(0),
189189

190190
RunE: func(cmd *cobra.Command, args []string) error {
191-
return deployment.PullToFolder(deployment.PullTemplateToFolderParams{
192-
TemplateToFolderParams: deployment.TemplateToFolderParams{
191+
return configurationtemplateapi.PullToFolder(configurationtemplateapi.PullTemplateToFolderParams{
192+
TemplateToFolderParams: configurationtemplateapi.TemplateToFolderParams{
193193
API: ecctl.Get().API,
194194
Folder: cmd.Flag("path").Value.String(),
195195
},

0 commit comments

Comments
 (0)