aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/xanzy/go-gitlab/environments.go
diff options
context:
space:
mode:
authorAmine Hilaly <hilalyamine@gmail.com>2019-07-14 15:53:31 +0200
committerAmine Hilaly <hilalyamine@gmail.com>2019-07-23 17:18:04 +0200
commit1c23c736e9b2ad85fb69330f62dd9da9ceeba823 (patch)
treed56171b38bb760d86ab3bc06799f78dbe1a09758 /vendor/github.com/xanzy/go-gitlab/environments.go
parent612264a00f352a12620bab3c72cd0b11b304f5e2 (diff)
downloadgit-bug-1c23c736e9b2ad85fb69330f62dd9da9ceeba823.tar.gz
vendor: update github.com/xanzy/go-gitlab to version 0.19.0
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/environments.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/environments.go34
1 files changed, 30 insertions, 4 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/environments.go b/vendor/github.com/xanzy/go-gitlab/environments.go
index f7c81f09..ee773074 100644
--- a/vendor/github.com/xanzy/go-gitlab/environments.go
+++ b/vendor/github.com/xanzy/go-gitlab/environments.go
@@ -32,10 +32,11 @@ type EnvironmentsService struct {
//
// GitLab API docs: https://docs.gitlab.com/ce/api/environments.html
type Environment struct {
- ID int `json:"id"`
- Name string `json:"name"`
- Slug string `json:"slug"`
- ExternalURL string `json:"external_url"`
+ ID int `json:"id"`
+ Name string `json:"name"`
+ Slug string `json:"slug"`
+ ExternalURL string `json:"external_url"`
+ LastDeployment *Deployment `json:"last_deployment"`
}
func (env Environment) String() string {
@@ -74,6 +75,31 @@ func (s *EnvironmentsService) ListEnvironments(pid interface{}, opts *ListEnviro
return envs, resp, err
}
+// GetEnvironment gets a specific environment from a project.
+//
+// GitLab API docs:
+// https://docs.gitlab.com/ee/api/environments.html#get-a-specific-environment
+func (s *EnvironmentsService) GetEnvironment(pid interface{}, environment int, options ...OptionFunc) (*Environment, *Response, error) {
+ project, err := parseID(pid)
+ if err != nil {
+ return nil, nil, err
+ }
+ u := fmt.Sprintf("projects/%s/environments/%d", pathEscape(project), environment)
+
+ req, err := s.client.NewRequest("GET", u, nil, options)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ env := new(Environment)
+ resp, err := s.client.Do(req, env)
+ if err != nil {
+ return nil, resp, err
+ }
+
+ return env, resp, err
+}
+
// CreateEnvironmentOptions represents the available CreateEnvironment() options.
//
// GitLab API docs: