-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add support to manipulate cluster name
GetClusterName() to fetch cluster name SetClusterName() to rename the cluster
- Loading branch information
1 parent
e4c5f41
commit 21a9e87
Showing
5 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package rabbithole | ||
|
||
import ( | ||
"encoding/json" | ||
"net/http" | ||
) | ||
|
||
type ClusterName struct { | ||
Name string `json:"name"` | ||
} | ||
|
||
func (c *Client) GetClusterName() (rec *ClusterName, err error) { | ||
req, err := newGETRequest(c, "cluster-name/") | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if err = executeAndParseRequest(c, req, &rec); err != nil { | ||
return nil, err | ||
} | ||
|
||
return rec, nil | ||
} | ||
|
||
func (c *Client) SetClusterName(cn ClusterName) (res *http.Response, err error) { | ||
body, err := json.Marshal(cn) | ||
if err != nil { | ||
return nil, err | ||
} | ||
req, err := newRequestWithBody(c, "PUT", "cluster-name", body) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
res, err = executeRequest(c, req) | ||
|
||
return res, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters