From d6ea5a0c4da42a3d7ab1234870b92221f36f053f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 13:15:56 +0000 Subject: [PATCH] fix(deps): update module github.com/ibm/go-sdk-core/v5 to v5.17.5 --- go.mod | 2 +- go.sum | 4 +- .../v5/core/authenticator_factory.go | 7 +- .../IBM/go-sdk-core/v5/core/base_service.go | 77 ++++++++++++++++--- .../v5/core/basic_authenticator.go | 15 ++-- .../v5/core/bearer_token_authenticator.go | 9 ++- .../IBM/go-sdk-core/v5/core/config_utils.go | 4 + .../v5/core/container_authenticator.go | 1 + .../go-sdk-core/v5/core/cp4d_authenticator.go | 5 ++ .../go-sdk-core/v5/core/iam_authenticator.go | 9 ++- .../go-sdk-core/v5/core/mcsp_authenticator.go | 5 ++ .../go-sdk-core/v5/core/parameterized_url.go | 2 + .../IBM/go-sdk-core/v5/core/version.go | 2 +- .../v5/core/vpc_instance_authenticator.go | 1 + vendor/modules.txt | 2 +- 15 files changed, 115 insertions(+), 30 deletions(-) diff --git a/go.mod b/go.mod index 8e182e132a66c..bb43f79ae45a2 100644 --- a/go.mod +++ b/go.mod @@ -113,7 +113,7 @@ require ( github.com/Azure/go-autorest/autorest v0.11.29 github.com/DataDog/sketches-go v1.4.6 github.com/DmitriyVTitov/size v1.5.0 - github.com/IBM/go-sdk-core/v5 v5.17.4 + github.com/IBM/go-sdk-core/v5 v5.17.5 github.com/IBM/ibm-cos-sdk-go v1.11.0 github.com/axiomhq/hyperloglog v0.0.0-20240507144631-af9851f82b27 github.com/buger/jsonparser v1.1.1 diff --git a/go.sum b/go.sum index 708c68ec565e8..c23dbe323fccb 100644 --- a/go.sum +++ b/go.sum @@ -253,8 +253,8 @@ github.com/DmitriyVTitov/size v1.5.0 h1:/PzqxYrOyOUX1BXj6J9OuVRVGe+66VL4D9FlUaW5 github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0= github.com/HdrHistogram/hdrhistogram-go v1.1.2 h1:5IcZpTvzydCQeHzK4Ef/D5rrSqwxob0t8PQPMybUNFM= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= -github.com/IBM/go-sdk-core/v5 v5.17.4 h1:VGb9+mRrnS2HpHZFM5hy4J6ppIWnwNrw0G+tLSgcJLc= -github.com/IBM/go-sdk-core/v5 v5.17.4/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns= +github.com/IBM/go-sdk-core/v5 v5.17.5 h1:AjGC7xNee5tgDIjndekBDW5AbypdERHSgib3EZ1KNsA= +github.com/IBM/go-sdk-core/v5 v5.17.5/go.mod h1:KsAAI7eStAWwQa4F96MLy+whYSh39JzNjklZRbN/8ns= github.com/IBM/ibm-cos-sdk-go v1.11.0 h1:Jp55NLN3OvBwucMGpP5wNybyjncsmTZ9+GPHai/1cE8= github.com/IBM/ibm-cos-sdk-go v1.11.0/go.mod h1:FnWOym0CvrPM0nHoXvceClOEvGVXecPpmVIO5RFjlFk= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator_factory.go b/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator_factory.go index 455fba064cb8e..cd1a63c905b90 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator_factory.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/authenticator_factory.go @@ -1,6 +1,6 @@ package core -// (C) Copyright IBM Corp. 2019, 2023. +// (C) Copyright IBM Corp. 2019, 2024. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import ( // GetAuthenticatorFromEnvironment instantiates an Authenticator using service properties // retrieved from external config sources. func GetAuthenticatorFromEnvironment(credentialKey string) (authenticator Authenticator, err error) { + GetLogger().Debug("Get authenticator from environment, key=%s\n", credentialKey) properties, err := getServiceProperties(credentialKey) if len(properties) == 0 { return @@ -71,5 +72,9 @@ func GetAuthenticatorFromEnvironment(credentialKey string) (authenticator Authen ) } + if authenticator != nil { + GetLogger().Debug("Returning authenticator, type=%s\n", authenticator.AuthenticationType()) + } + return } diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/base_service.go b/vendor/github.com/IBM/go-sdk-core/v5/core/base_service.go index 6a9f85a72bf8e..62e362d4103c4 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/base_service.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/base_service.go @@ -1,6 +1,6 @@ package core -// (C) Copyright IBM Corp. 2019, 2022. +// (C) Copyright IBM Corp. 2019, 2024. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -18,7 +18,6 @@ import ( "bytes" "context" "crypto/tls" - "crypto/x509" "encoding/json" "errors" "fmt" @@ -131,6 +130,8 @@ func (service *BaseService) Clone() *BaseService { // ConfigureService updates the service with external configuration values. func (service *BaseService) ConfigureService(serviceName string) error { + GetLogger().Debug("Configuring BaseService instance with service name: %s\n", serviceName) + // Try to load service properties from external config. serviceProps, err := getServiceProperties(serviceName) if err != nil { @@ -144,7 +145,7 @@ func (service *BaseService) ConfigureService(serviceName string) error { // URL if url, ok := serviceProps[PROPNAME_SVC_URL]; ok && url != "" { - err := service.SetURL(url) + err := service.SetServiceURL(url) if err != nil { err = RepurposeSDKProblem(err, "set-url-fail") return err @@ -221,6 +222,7 @@ func (service *BaseService) SetServiceURL(url string) error { } service.Options.URL = url + GetLogger().Debug("Set service URL: %s\n", url) return nil } @@ -289,6 +291,7 @@ func (service *BaseService) DisableSSLVerification() { // Disable server ssl cert & hostname verification. tr.TLSClientConfig.InsecureSkipVerify = true // #nosec G402 } + GetLogger().Debug("Disabled SSL verification in HTTP client") } // IsSSLDisabled returns true if and only if the service's http.Client instance @@ -332,11 +335,12 @@ func (service *BaseService) buildUserAgent() string { } // SetUserAgent sets the user agent value. -func (service *BaseService) SetUserAgent(userAgentString string) { - if userAgentString == "" { - userAgentString = service.buildUserAgent() +func (service *BaseService) SetUserAgent(userAgent string) { + if userAgent == "" { + userAgent = service.buildUserAgent() } - service.UserAgent = userAgentString + service.UserAgent = userAgent + GetLogger().Debug("Set User-Agent: %s\n", userAgent) } // Request invokes the specified HTTP request and returns the response. @@ -414,9 +418,9 @@ func (service *BaseService) Request(req *http.Request, result interface{}) (deta } // Invoke the request, then check for errors during the invocation. + GetLogger().Debug("Sending HTTP request message...") var httpResponse *http.Response httpResponse, err = service.Client.Do(req) - if err != nil { if strings.Contains(err.Error(), SSL_CERTIFICATION_ERROR) { err = fmt.Errorf(ERRORMSG_SSL_VERIFICATION_FAILED + "\n" + err.Error()) @@ -424,6 +428,7 @@ func (service *BaseService) Request(req *http.Request, result interface{}) (deta err = SDKErrorf(err, "", "no-connection-made", getComponentInfo()) return } + GetLogger().Debug("Received HTTP response message, status code %d", httpResponse.StatusCode) // If debug is enabled, then dump the response. if GetLogger().IsLogLevelEnabled(LevelDebug) { @@ -754,6 +759,7 @@ func (service *BaseService) EnableRetries(maxRetries int, maxRetryInterval time. // Hang the retryable client off the base service via the "shim" client. service.Client = client.StandardClient() } + GetLogger().Debug("Enabled retries; maxRetries=%d, maxRetryInterval=%s\n", maxRetries, maxRetryInterval.String()) } // DisableRetries will disable automatic retries in the service. @@ -765,6 +771,8 @@ func (service *BaseService) DisableRetries() { // the retryable client instance. tr := service.Client.Transport.(*retryablehttp.RoundTripper) service.Client = tr.Client.HTTPClient + + GetLogger().Debug("Disabled retries\n") } } @@ -826,16 +834,46 @@ var ( // scheme specified in the URL is invalid. This error isn't typed // specifically so we resort to matching on the error string. schemeErrorRe = regexp.MustCompile(`unsupported protocol scheme`) + + // A regular expression to match the error returned by net/http when a + // request header or value is invalid. This error isn't typed + // specifically so we resort to matching on the error string. + invalidHeaderErrorRe = regexp.MustCompile(`invalid header`) + + // A regular expression to match the error returned by net/http when the + // TLS certificate is not trusted. This error isn't typed + // specifically so we resort to matching on the error string. + notTrustedErrorRe = regexp.MustCompile(`certificate is not trusted|certificate is signed by unknown authority`) ) // IBMCloudSDKRetryPolicy provides a default implementation of the CheckRetry interface // associated with a retryablehttp.Client. // This function will return true if the specified request/response should be retried. func IBMCloudSDKRetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error) { - // This logic was adapted from go-relyablehttp.ErrorPropagatedRetryPolicy(). + // This logic was adapted from go-retryablehttp.ErrorPropagatedRetryPolicy(). + + if GetLogger().IsLogLevelEnabled(LevelDebug) { + // Compile the details to be included in the debug message. + var details []string + if resp != nil { + details = append(details, fmt.Sprintf("status_code=%d", resp.StatusCode)) + if resp.Request != nil { + details = append(details, fmt.Sprintf("method=%s", resp.Request.Method)) + details = append(details, fmt.Sprintf("url=%s", resp.Request.URL.Redacted())) + } + } + if err != nil { + details = append(details, fmt.Sprintf("error=%s", err.Error())) + } else { + details = append(details, "error=nil") + } + + GetLogger().Debug("Considering retry attempt; %s\n", strings.Join(details, ", ")) + } // Do not retry on a Context-related error (Canceled or DeadlineExceeded). if ctx.Err() != nil { + GetLogger().Debug("No retry, Context error: %s\n", ctx.Err().Error()) return false, ctx.Err() } @@ -844,21 +882,35 @@ func IBMCloudSDKRetryPolicy(ctx context.Context, resp *http.Response, err error) if v, ok := err.(*url.Error); ok { // Don't retry if the error was due to too many redirects. if redirectsErrorRe.MatchString(v.Error()) { + GetLogger().Debug("No retry, too many redirects: %s\n", v.Error()) return false, SDKErrorf(v, "", "too-many-redirects", getComponentInfo()) } // Don't retry if the error was due to an invalid protocol scheme. if schemeErrorRe.MatchString(v.Error()) { + GetLogger().Debug("No retry, invalid protocol scheme: %s\n", v.Error()) return false, SDKErrorf(v, "", "invalid-scheme", getComponentInfo()) } + // Don't retry if the error was due to an invalid header. + if invalidHeaderErrorRe.MatchString(v.Error()) { + GetLogger().Debug("No retry, invalid header: %s\n", v.Error()) + return false, SDKErrorf(v, "", "invalid-header", getComponentInfo()) + } + // Don't retry if the error was due to TLS cert verification failure. - if _, ok := v.Err.(x509.UnknownAuthorityError); ok { + if notTrustedErrorRe.MatchString(v.Error()) { + GetLogger().Debug("No retry, TLS certificate is not trusted: %s\n", v.Error()) + return false, SDKErrorf(v, "", "cert-not-trusted", getComponentInfo()) + } + if _, ok := v.Err.(*tls.CertificateVerificationError); ok { + GetLogger().Debug("No retry, TLS certificate validation error: %s\n", v.Error()) return false, SDKErrorf(v, "", "cert-failure", getComponentInfo()) } } // The error is likely recoverable so retry. + GetLogger().Debug("Retry will be attempted...") return true, nil } @@ -867,9 +919,11 @@ func IBMCloudSDKRetryPolicy(ctx context.Context, resp *http.Response, err error) // A 429 should be retryable. // All codes in the 500's range except for 501 (Not Implemented) should be retryable. if resp.StatusCode == 429 || (resp.StatusCode >= 500 && resp.StatusCode <= 599 && resp.StatusCode != 501) { + GetLogger().Debug("Retry will be attempted") return true, nil } + GetLogger().Debug("No retry for status code: %d\n") return false, nil } @@ -880,6 +934,8 @@ func IBMCloudSDKBackoffPolicy(min, max time.Duration, attemptNum int, resp *http // Check for a Retry-After header. if resp != nil { if s, ok := resp.Header["Retry-After"]; ok { + GetLogger().Debug("Found Retry-After header: %s\n", s) + // First, try to parse the value as an integer (number of seconds to wait) if sleep, err := strconv.ParseInt(s[0], 10, 64); err == nil { return time.Second * time.Duration(sleep) @@ -893,7 +949,6 @@ func IBMCloudSDKBackoffPolicy(min, max time.Duration, attemptNum int, resp *http } return sleep } - } } diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/basic_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/basic_authenticator.go index b0c12eb9bf9db..4506eb1847ba7 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/basic_authenticator.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/basic_authenticator.go @@ -64,8 +64,9 @@ func (BasicAuthenticator) AuthenticationType() string { // Basic Authorization will be added to the request's headers in the form: // // Authorization: Basic -func (this *BasicAuthenticator) Authenticate(request *http.Request) error { - request.SetBasicAuth(this.Username, this.Password) +func (authenticator *BasicAuthenticator) Authenticate(request *http.Request) error { + request.SetBasicAuth(authenticator.Username, authenticator.Password) + GetLogger().Debug("Authenticated outbound request (type=%s)\n", authenticator.AuthenticationType()) return nil } @@ -73,23 +74,23 @@ func (this *BasicAuthenticator) Authenticate(request *http.Request) error { // // Ensures the username and password are not Nil. Additionally, ensures // they do not contain invalid characters. -func (this BasicAuthenticator) Validate() error { - if this.Username == "" { +func (authenticator BasicAuthenticator) Validate() error { + if authenticator.Username == "" { err := fmt.Errorf(ERRORMSG_PROP_MISSING, "Username") return SDKErrorf(err, "", "no-user", getComponentInfo()) } - if this.Password == "" { + if authenticator.Password == "" { err := fmt.Errorf(ERRORMSG_PROP_MISSING, "Password") return SDKErrorf(err, "", "no-pass", getComponentInfo()) } - if HasBadFirstOrLastChar(this.Username) { + if HasBadFirstOrLastChar(authenticator.Username) { err := fmt.Errorf(ERRORMSG_PROP_INVALID, "Username") return SDKErrorf(err, "", "bad-user", getComponentInfo()) } - if HasBadFirstOrLastChar(this.Password) { + if HasBadFirstOrLastChar(authenticator.Password) { err := fmt.Errorf(ERRORMSG_PROP_INVALID, "Password") return SDKErrorf(err, "", "bad-pass", getComponentInfo()) } diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/bearer_token_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/bearer_token_authenticator.go index ab26448da144e..ce37cb9d678d2 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/bearer_token_authenticator.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/bearer_token_authenticator.go @@ -61,16 +61,17 @@ func (BearerTokenAuthenticator) AuthenticationType() string { // The bearer token will be added to the request's headers in the form: // // Authorization: Bearer -func (this *BearerTokenAuthenticator) Authenticate(request *http.Request) error { - request.Header.Set("Authorization", fmt.Sprintf(`Bearer %s`, this.BearerToken)) +func (authenticator *BearerTokenAuthenticator) Authenticate(request *http.Request) error { + request.Header.Set("Authorization", fmt.Sprintf(`Bearer %s`, authenticator.BearerToken)) + GetLogger().Debug("Authenticated outbound request (type=%s)\n", authenticator.AuthenticationType()) return nil } // Validate the authenticator's configuration. // // Ensures the bearer token is not Nil. -func (this BearerTokenAuthenticator) Validate() error { - if this.BearerToken == "" { +func (authenticator BearerTokenAuthenticator) Validate() error { + if authenticator.BearerToken == "" { err := fmt.Errorf(ERRORMSG_PROP_MISSING, "BearerToken") return SDKErrorf(err, "", "no-token", getComponentInfo()) } diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/config_utils.go b/vendor/github.com/IBM/go-sdk-core/v5/core/config_utils.go index 24d535dd966b5..39e720701191d 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/config_utils.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/config_utils.go @@ -63,6 +63,8 @@ func getServiceProperties(serviceName string) (serviceProps map[string]string, e return } + GetLogger().Debug("Retrieving config properties for service '%s'\n", serviceName) + // First try to retrieve service properties from a credential file. serviceProps = getServicePropertiesFromCredentialFile(serviceName) @@ -76,6 +78,8 @@ func getServiceProperties(serviceName string) (serviceProps map[string]string, e serviceProps = getServicePropertiesFromVCAP(serviceName) } + GetLogger().Debug("Retrieved %d properties\n", len(serviceProps)) + return } diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/container_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/container_authenticator.go index 2d7c3f561713d..5919889c073f3 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/container_authenticator.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/container_authenticator.go @@ -255,6 +255,7 @@ func (authenticator *ContainerAuthenticator) Authenticate(request *http.Request) } request.Header.Set("Authorization", "Bearer "+token) + GetLogger().Debug("Authenticated outbound request (type=%s)\n", authenticator.AuthenticationType()) return nil } diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/cp4d_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/cp4d_authenticator.go index 8f9a8117e7c34..66c1f1037bc77 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/cp4d_authenticator.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/cp4d_authenticator.go @@ -207,6 +207,7 @@ func (authenticator *CloudPakForDataAuthenticator) Authenticate(request *http.Re } request.Header.Set("Authorization", fmt.Sprintf(`Bearer %s`, token)) + GetLogger().Debug("Authenticated outbound request (type=%s)\n", authenticator.AuthenticationType()) return nil } @@ -231,15 +232,19 @@ func (authenticator *CloudPakForDataAuthenticator) setTokenData(tokenData *cp4dT // or the existing token has expired), a new access token is fetched from the token server. func (authenticator *CloudPakForDataAuthenticator) GetToken() (string, error) { if authenticator.getTokenData() == nil || !authenticator.getTokenData().isTokenValid() { + GetLogger().Debug("Performing synchronous token fetch...") // synchronously request the token err := authenticator.synchronizedRequestToken() if err != nil { return "", RepurposeSDKProblem(err, "request-token-fail") } } else if authenticator.getTokenData().needsRefresh() { + GetLogger().Debug("Performing background asynchronous token fetch...") // If refresh needed, kick off a go routine in the background to get a new token //nolint: errcheck go authenticator.invokeRequestTokenData() + } else { + GetLogger().Debug("Using cached access token...") } // return an error if the access token is not valid or was not fetched diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/iam_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/iam_authenticator.go index da9feb6014480..ff73a693962a1 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/iam_authenticator.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/iam_authenticator.go @@ -249,9 +249,9 @@ func (*IamAuthenticator) AuthenticationType() string { // Authenticate adds IAM authentication information to the request. // -// The IAM bearer token will be added to the request's headers in the form: +// The IAM access token will be added to the request's headers in the form: // -// Authorization: Bearer +// Authorization: Bearer func (authenticator *IamAuthenticator) Authenticate(request *http.Request) error { token, err := authenticator.GetToken() if err != nil { @@ -259,6 +259,7 @@ func (authenticator *IamAuthenticator) Authenticate(request *http.Request) error } request.Header.Set("Authorization", "Bearer "+token) + GetLogger().Debug("Authenticated outbound request (type=%s)\n", authenticator.AuthenticationType()) return nil } @@ -362,15 +363,19 @@ func (authenticator *IamAuthenticator) Validate() error { // or the existing token has expired), a new access token is fetched from the token server. func (authenticator *IamAuthenticator) GetToken() (string, error) { if authenticator.getTokenData() == nil || !authenticator.getTokenData().isTokenValid() { + GetLogger().Debug("Performing synchronous token fetch...") // synchronously request the token err := authenticator.synchronizedRequestToken() if err != nil { return "", RepurposeSDKProblem(err, "request-token-fail") } } else if authenticator.getTokenData().needsRefresh() { + GetLogger().Debug("Performing background asynchronous token fetch...") // If refresh needed, kick off a go routine in the background to get a new token //nolint: errcheck go authenticator.invokeRequestTokenData() + } else { + GetLogger().Debug("Using cached access token...") } // return an error if the access token is not valid or was not fetched diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/mcsp_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/mcsp_authenticator.go index 3bd2a2f4f0166..38845074af0fb 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/mcsp_authenticator.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/mcsp_authenticator.go @@ -183,6 +183,7 @@ func (authenticator *MCSPAuthenticator) Authenticate(request *http.Request) erro } request.Header.Set("Authorization", "Bearer "+token) + GetLogger().Debug("Authenticated outbound request (type=%s)\n", authenticator.AuthenticationType()) return nil } @@ -227,15 +228,19 @@ func (authenticator *MCSPAuthenticator) Validate() error { // or the existing token has expired), a new access token is fetched from the token server. func (authenticator *MCSPAuthenticator) GetToken() (string, error) { if authenticator.getTokenData() == nil || !authenticator.getTokenData().isTokenValid() { + GetLogger().Debug("Performing synchronous token fetch...") // synchronously request the token err := authenticator.synchronizedRequestToken() if err != nil { return "", RepurposeSDKProblem(err, "request-token-fail") } } else if authenticator.getTokenData().needsRefresh() { + GetLogger().Debug("Performing background asynchronous token fetch...") // If refresh needed, kick off a go routine in the background to get a new token. //nolint: errcheck go authenticator.invokeRequestTokenData() + } else { + GetLogger().Debug("Using cached access token...") } // return an error if the access token is not valid or was not fetched diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/parameterized_url.go b/vendor/github.com/IBM/go-sdk-core/v5/core/parameterized_url.go index 849dad66a3fd8..81b650615c9a0 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/parameterized_url.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/parameterized_url.go @@ -39,6 +39,7 @@ func ConstructServiceURL( defaultUrlVariables map[string]string, providedUrlVariables map[string]string, ) (string, error) { + GetLogger().Debug("Constructing service URL from parameterized URL: %s\n", parameterizedUrl) // Verify the provided variable names. for providedName := range providedUrlVariables { @@ -70,5 +71,6 @@ func ConstructServiceURL( } formattedUrl = strings.Replace(formattedUrl, "{"+name+"}", providedValue, 1) } + GetLogger().Debug("Returning service URL: %s\n", formattedUrl) return formattedUrl, nil } diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/version.go b/vendor/github.com/IBM/go-sdk-core/v5/core/version.go index b7869180380f2..3921e502e8614 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/version.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/version.go @@ -15,4 +15,4 @@ package core // limitations under the License. // Version of the SDK -const __VERSION__ = "5.17.4" +const __VERSION__ = "5.17.5" diff --git a/vendor/github.com/IBM/go-sdk-core/v5/core/vpc_instance_authenticator.go b/vendor/github.com/IBM/go-sdk-core/v5/core/vpc_instance_authenticator.go index 562318b2ceb47..4c60ee721773c 100644 --- a/vendor/github.com/IBM/go-sdk-core/v5/core/vpc_instance_authenticator.go +++ b/vendor/github.com/IBM/go-sdk-core/v5/core/vpc_instance_authenticator.go @@ -189,6 +189,7 @@ func (authenticator *VpcInstanceAuthenticator) Authenticate(request *http.Reques } request.Header.Set("Authorization", "Bearer "+token) + GetLogger().Debug("Authenticated outbound request (type=%s)\n", authenticator.AuthenticationType()) return nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index b58b006c69c95..00579fbb2a189 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -206,7 +206,7 @@ github.com/DataDog/sketches-go/ddsketch/store # github.com/DmitriyVTitov/size v1.5.0 ## explicit; go 1.14 github.com/DmitriyVTitov/size -# github.com/IBM/go-sdk-core/v5 v5.17.4 +# github.com/IBM/go-sdk-core/v5 v5.17.5 ## explicit; go 1.20 github.com/IBM/go-sdk-core/v5/core # github.com/IBM/ibm-cos-sdk-go v1.11.0