Skip to content

Commit aa2917c

Browse files
committed
use async option when specific hidden environment variable is set
1 parent 4d0cab1 commit aa2917c

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

sysdig/internal/client/v2/organization.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import (
44
"context"
55
"fmt"
66
"net/http"
7+
"os"
78
)
89

910
const (
10-
organizationsPath = "%s/api/cloudauth/v1/organizations?async=true"
11-
organizationPath = "%s/api/cloudauth/v1/organizations/%s?async=true"
11+
organizationsPath = "%s/api/cloudauth/v1/organizations"
12+
organizationPath = "%s/api/cloudauth/v1/organizations/%s"
1213
)
1314

1415
type OrganizationSecureInterface interface {
@@ -104,9 +105,17 @@ func (client *Client) UpdateOrganizationSecure(ctx context.Context, orgID string
104105
}
105106

106107
func (client *Client) organizationsURL() string {
107-
return fmt.Sprintf(organizationsPath, client.config.url)
108+
url := fmt.Sprintf(organizationsPath, client.config.url)
109+
if os.Getenv("SYSDIG_ORG_API_ASYNC") == "true" {
110+
url += "?async=true"
111+
}
112+
return url
108113
}
109114

110115
func (client *Client) organizationURL(orgId string) string {
111-
return fmt.Sprintf(organizationPath, client.config.url, orgId)
116+
url := fmt.Sprintf(organizationPath, client.config.url, orgId)
117+
if os.Getenv("SYSDIG_ORG_API_ASYNC") == "true" {
118+
url += "?async=true"
119+
}
120+
return url
112121
}

0 commit comments

Comments
 (0)