Skip to content

Commit 8ee9995

Browse files
committed
api: update drafts bindings
Signed-off-by: Stoyan Zhelyazkov <[email protected]>
1 parent 37dd0c8 commit 8ee9995

File tree

1 file changed

+13
-7
lines changed
  • vapi/esx/settings/clusters/configuration/drafts

1 file changed

+13
-7
lines changed

vapi/esx/settings/clusters/configuration/drafts/drafts.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ type ImportSpec struct {
8181
Host string `json:"host"`
8282
}
8383

84+
type ApplyResult struct {
85+
Commit string `json:"commit"`
86+
ApplyTask string `json:"apply_task"`
87+
}
88+
8489
// ListDrafts returns all active drafts
8590
// https://developer.broadcom.com/xapis/vsphere-automation-api/latest/api/esx/settings/clusters/cluster/configuration/drafts
8691
func (c *Manager) ListDrafts(clusterId string) (map[string]Draft, error) {
@@ -101,27 +106,28 @@ func (c *Manager) GetDraft(clusterId, draftId string) (Draft, error) {
101106

102107
// DeleteDraft deletes a draft
103108
// https://developer.broadcom.com/xapis/vsphere-automation-api/latest/api/esx/settings/clusters/cluster/configuration/drafts
104-
func (c *Manager) DeleteDraft(clusterId, draftId string) (Draft, error) {
109+
func (c *Manager) DeleteDraft(clusterId, draftId string) error {
105110
path := c.Resource(fmt.Sprintf(DraftPath, clusterId, draftId))
106111
req := path.Request(http.MethodDelete)
107-
var res Draft
108-
return res, c.Do(context.Background(), req, &res)
112+
return c.Do(context.Background(), req, nil)
109113
}
110114

111115
// CreateDraft creates a draft with the provided configuration
112116
// https://developer.broadcom.com/xapis/vsphere-automation-api/latest/api/esx/settings/clusters/cluster/configuration/drafts
113-
func (c *Manager) CreateDraft(clusterId string, spec CreateSpec) error {
117+
func (c *Manager) CreateDraft(clusterId string, spec CreateSpec) (string, error) {
114118
path := c.Resource(fmt.Sprintf(BasePath, clusterId))
115119
req := path.Request(http.MethodPost, spec)
116-
return c.Do(context.Background(), req, nil)
120+
var res string
121+
return res, c.Do(context.Background(), req, &res)
117122
}
118123

119124
// ApplyDraft commits the draft with the specified ID
120125
// https://developer.broadcom.com/xapis/vsphere-automation-api/latest/api/esx/settings/clusters/cluster/configuration/drafts
121-
func (c *Manager) ApplyDraft(clusterId, draftId string) error {
126+
func (c *Manager) ApplyDraft(clusterId, draftId string) (ApplyResult, error) {
122127
path := c.Resource(fmt.Sprintf(DraftPath, clusterId, draftId)).WithAction("apply")
123128
req := path.Request(http.MethodPost)
124-
return c.Do(context.Background(), req, nil)
129+
var res ApplyResult
130+
return res, c.Do(context.Background(), req, &res)
125131
}
126132

127133
// UpdateDraft updates the configuration of the draft with the specified ID

0 commit comments

Comments
 (0)