Skip to content

Commit f3a7da2

Browse files
wtrockiGustavo Bazan
andauthored
CLOUDP-240738: use digest documentation (#304)
Co-authored-by: Gustavo Bazan <[email protected]>
1 parent 88da2e5 commit f3a7da2

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

admin/atlas_client.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ func NewClient(modifiers ...ClientModifier) (*APIClient, error) {
4444
// ClientModifiers lets you create function that controls configuration before creating client.
4545
type ClientModifier func(*Configuration) error
4646

47+
// UseDigestAuth provides Digest authentication for Go SDK.
48+
// UseDigestAuth is provided as helper to create a default HTTP client that supports HTTP Digest authentication.
49+
// Warning: any previously set httpClient will be overwritten. To fully customize HttpClient use UseHTTPClient method.
4750
func UseDigestAuth(apiKey, apiSecret string) ClientModifier {
4851
return func(c *Configuration) error {
4952
transport := digest.NewTransport(apiKey, apiSecret)
@@ -59,6 +62,12 @@ func UseDigestAuth(apiKey, apiSecret string) ClientModifier {
5962
// Advanced modifiers.
6063

6164
// UseHTTPClient set custom http client implementation.
65+
//
66+
// Warning: UseHTTPClient overrides any previously set httpClient including the one set by UseDigestAuth.
67+
// To set a custom http client with HTTP diggest support use:
68+
//
69+
// transport := digest.NewTransportWithHTTPRoundTripper(apiKey, apiSecret, yourHttpTransport)
70+
// client := UseHTTPClient(transport.Client())
6271
func UseHTTPClient(client *http.Client) ClientModifier {
6372
return func(c *Configuration) error {
6473
c.HTTPClient = client

tools/config/go-templates/atlas_client.mustache

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ func NewClient(modifiers ...ClientModifier) (*APIClient, error) {
4444
// ClientModifiers lets you create function that controls configuration before creating client.
4545
type ClientModifier func(*Configuration) error
4646

47+
48+
// UseDigestAuth provides Digest authentication for Go SDK.
49+
// UseDigestAuth is provided as helper to create a default HTTP client that supports HTTP Digest authentication.
50+
// Warning: any previously set httpClient will be overwritten. To fully customize HttpClient use UseHTTPClient method.
4751
func UseDigestAuth(apiKey, apiSecret string) ClientModifier {
4852
return func(c *Configuration) error {
4953
transport := digest.NewTransport(apiKey, apiSecret)
@@ -58,7 +62,14 @@ func UseDigestAuth(apiKey, apiSecret string) ClientModifier {
5862

5963
// Advanced modifiers.
6064

61-
// UseHTTPClient set custom http client implementation.
65+
66+
// UseHTTPClient set custom http client implementation.
67+
//
68+
// Warning: UseHTTPClient overrides any previously set httpClient including the one set by UseDigestAuth.
69+
// To set a custom http client with HTTP diggest support use:
70+
//
71+
// transport := digest.NewTransportWithHTTPRoundTripper(apiKey, apiSecret, yourHttpTransport)
72+
// client := UseHTTPClient(transport.Client())
6273
func UseHTTPClient(client *http.Client) ClientModifier {
6374
return func(c *Configuration) error {
6475
c.HTTPClient = client

0 commit comments

Comments
 (0)