Skip to content

Commit

Permalink
Merge pull request #182 from theganyo/optimize
Browse files Browse the repository at this point in the history
optimize get deployments
  • Loading branch information
theganyo authored Apr 3, 2023
2 parents 4749230 + 2001278 commit 9834c27
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cmd/registry-connect/discover/apigee/edge/deployments_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

package edge

import (
"net/url"
)

const deploymentsPath = "deployments"

// https://apidocs.apigee.com/docs/deployments/1/routes/organizations/%7Borg_name%7D/deployments/get
Expand All @@ -33,10 +37,10 @@ type DeploymentProxy struct {
}

type DeploymentRevision struct {
Configuration interface{} `json:"configuration,omitempty"`
Name string `json:"name,omitempty"`
Servers []DeploymentServer `json:"server,omitempty"`
State string `json:"state,omitempty"`
// Configuration interface{} `json:"configuration,omitempty"` // includeApiConfig = false, so this is not included
Name string `json:"name,omitempty"`
// Servers []DeploymentServer `json:"server,omitempty"` // includeServerStatus = false, so this is not include
State string `json:"state,omitempty"`
}

type DeploymentConfiguration struct {
Expand Down Expand Up @@ -71,7 +75,11 @@ var _ DeploymentsService = &DeploymentsServiceOp{}

func (s *DeploymentsServiceOp) OrganizationDeployments() (*OrganizationDeployments, *Response, error) {
deployments := &OrganizationDeployments{}
req, e := s.client.NewRequestNoEnv("GET", deploymentsPath, deployments)
q := url.Values{}
q.Set("includeServerStatus", "false")
q.Set("includeApiConfig", "false")
urlString := deploymentsPath + "?" + q.Encode()
req, e := s.client.NewRequestNoEnv("GET", urlString, deployments)
if e != nil {
return nil, nil, e
}
Expand Down

0 comments on commit 9834c27

Please sign in to comment.