Skip to content

Commit

Permalink
implemented .Update for connector
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfmnk committed Jul 4, 2024
1 parent af71154 commit 5dbe5a1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cloudconnexa/connectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,30 @@ func (c *ConnectorsService) GetByPage(page int, pageSize int) (ConnectorPageResp
return response, nil
}

func (c *ConnectorsService) Update(connector Connector) (*Connector, error) {
connectorJson, err := json.Marshal(connector)
if err != nil {
return nil, err
}

req, err := http.NewRequest(http.MethodPut, fmt.Sprintf("%s/api/beta/connectors/%s", c.client.BaseURL, connector.Id), bytes.NewBuffer(connectorJson))
if err != nil {
return nil, err
}

body, err := c.client.DoRequest(req)
if err != nil {
return nil, err
}

var conn Connector
err = json.Unmarshal(body, &conn)
if err != nil {
return nil, err
}
return &conn, nil
}

func (c *ConnectorsService) List() ([]Connector, error) {
var allConnectors []Connector
page := 0
Expand Down

0 comments on commit 5dbe5a1

Please sign in to comment.