Skip to content

Commit

Permalink
use async option when specific hidden environment variable is set
Browse files Browse the repository at this point in the history
  • Loading branch information
maratsal committed Jan 16, 2025
1 parent 4d0cab1 commit aa2917c
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions sysdig/internal/client/v2/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"context"
"fmt"
"net/http"
"os"
)

const (
organizationsPath = "%s/api/cloudauth/v1/organizations?async=true"
organizationPath = "%s/api/cloudauth/v1/organizations/%s?async=true"
organizationsPath = "%s/api/cloudauth/v1/organizations"
organizationPath = "%s/api/cloudauth/v1/organizations/%s"
)

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

func (client *Client) organizationsURL() string {
return fmt.Sprintf(organizationsPath, client.config.url)
url := fmt.Sprintf(organizationsPath, client.config.url)
if os.Getenv("SYSDIG_ORG_API_ASYNC") == "true" {
url += "?async=true"
}
return url
}

func (client *Client) organizationURL(orgId string) string {
return fmt.Sprintf(organizationPath, client.config.url, orgId)
url := fmt.Sprintf(organizationPath, client.config.url, orgId)
if os.Getenv("SYSDIG_ORG_API_ASYNC") == "true" {
url += "?async=true"
}
return url
}

0 comments on commit aa2917c

Please sign in to comment.