aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/xanzy/go-gitlab/deploy_keys.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/deploy_keys.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/deploy_keys.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/deploy_keys.go b/vendor/github.com/xanzy/go-gitlab/deploy_keys.go
index adb50bdbff..9d71bffe5e 100644
--- a/vendor/github.com/xanzy/go-gitlab/deploy_keys.go
+++ b/vendor/github.com/xanzy/go-gitlab/deploy_keys.go
@@ -198,3 +198,37 @@ func (s *DeployKeysService) EnableDeployKey(pid interface{}, deployKey int, opti
return k, resp, err
}
+
+// UpdateDeployKeyOptions represents the available UpdateDeployKey() options.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ce/api/deploy_keys.html#update-deploy-key
+type UpdateDeployKeyOptions struct {
+ Title *string `url:"title,omitempty" json:"title,omitempty"`
+ CanPush *bool `url:"can_push,omitempty" json:"can_push,omitempty"`
+}
+
+// UpdateDeployKey updates a deploy key for a project.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ce/api/deploy_keys.html#update-deploy-key
+func (s *DeployKeysService) UpdateDeployKey(pid interface{}, deployKey int, opt *UpdateDeployKeyOptions, options ...RequestOptionFunc) (*DeployKey, *Response, error) {
+ project, err := parseID(pid)
+ if err != nil {
+ return nil, nil, err
+ }
+ u := fmt.Sprintf("projects/%s/deploy_keys/%d", pathEscape(project), deployKey)
+
+ req, err := s.client.NewRequest("PUT", u, opt, options)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ k := new(DeployKey)
+ resp, err := s.client.Do(req, k)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return k, resp, err
+}