(tenantDomain string, accessToken string)
| 33 | } |
| 34 | |
| 35 | func initializeManagementClientV2(tenantDomain string, accessToken string) (*managementv2.Management, error) { |
| 36 | client, err := managementv2.New( |
| 37 | tenantDomain, |
| 38 | option.WithToken(accessToken), |
| 39 | option.WithUserAgent(fmt.Sprintf("%v/%v", userAgent, strings.TrimPrefix(buildinfo.Version, "v"))), |
| 40 | option.WithAuth0ClientEnvEntry("Auth0-CLI", strings.TrimPrefix(buildinfo.Version, "v")), |
| 41 | // If not set, it defaults to 2 as per v2@v2.5.0/management/internal/retrier.go:43. |
| 42 | // Setting it to 1 to avoid retries from `go-auth0` since we have our own retry logic in the custom HTTP client. |
| 43 | // TODO: confirm this assumption, or check if this needs to be excluded like terraform provider. |
| 44 | option.WithMaxAttempts(1), |
| 45 | option.WithHTTPClient(customClientWithRetries()), |
| 46 | ) |
| 47 | return client, err |
| 48 | } |
| 49 | |
| 50 | func customClientWithRetries() *http.Client { |
| 51 | client := &http.Client{ |
no test coverage detected