-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_components.go
105 lines (87 loc) · 2.81 KB
/
install_components.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
package nuon
import (
"context"
"github.com/nuonco/nuon-go/client/operations"
"github.com/nuonco/nuon-go/models"
)
// install components
func (c *client) GetInstallComponents(ctx context.Context, installID string) ([]*models.AppInstallComponent, error) {
resp, err := c.genClient.Operations.GetInstallComponents(&operations.GetInstallComponentsParams{
InstallID: installID,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) GetInstallComponentDeploys(ctx context.Context, installID string, componentID string) ([]*models.AppInstallDeploy, error) {
resp, err := c.genClient.Operations.GetInstallComponentDeploys(&operations.GetInstallComponentDeploysParams{
ComponentID: componentID,
InstallID: installID,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) GetInstallComponentLatestDeploy(ctx context.Context, installID string, componentID string) (*models.AppInstallDeploy, error) {
resp, err := c.genClient.Operations.GetInstallComponentLatestDeploy(&operations.GetInstallComponentLatestDeployParams{
ComponentID: componentID,
InstallID: installID,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) GetInstallDeployPlan(ctx context.Context, installID string, deployID string) (*models.Planv1Plan, error) {
resp, err := c.genClient.Operations.GetInstallDeployPlan(&operations.GetInstallDeployPlanParams{
Context: ctx,
InstallID: installID,
DeployID: deployID,
}, c.getOrgIDAuthInfo())
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) TeardownInstallComponent(ctx context.Context, installID, componentID string) (*models.AppInstallDeploy, error) {
resp, err := c.genClient.Operations.TeardownInstallComponent(&operations.TeardownInstallComponentParams{
InstallID: installID,
ComponentID: componentID,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return nil, err
}
return resp.Payload, nil
}
func (c *client) TeardownInstallComponents(ctx context.Context, installID string) error {
resp, err := c.genClient.Operations.TeardownInstallComponents(&operations.TeardownInstallComponentsParams{
InstallID: installID,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return err
}
if resp.Payload != "ok" {
return statusErr{resp.Payload}
}
return nil
}
func (c *client) DeployInstallComponents(ctx context.Context, installID string) error {
resp, err := c.genClient.Operations.DeployInstallComponents(&operations.DeployInstallComponentsParams{
InstallID: installID,
Context: ctx,
}, c.getOrgIDAuthInfo())
if err != nil {
return err
}
if resp.Payload != "ok" {
return statusErr{resp.Payload}
}
return nil
}