aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/xanzy/go-gitlab/environments.go
diff options
context:
space:
mode:
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: