diff --git a/CHANGELOG.md b/CHANGELOG.md index 42a2e86..176096f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [5.0.32] - 2024-08-06 +### Added +- Set User-Agent header in API client + ## [5.0.31] - 2024-07-17 ### Changed - Method `SetDNACWaitTimeToManyRequest` update for update wait time from minutes to seconds. @@ -642,4 +646,5 @@ Services removed on Cisco DNA Center 2.3.3.0's API: [5.0.29]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.28...v5.0.29 [5.0.30]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.29...v5.0.30 [5.0.31]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.30...v5.0.31 -[Unreleased]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.31...main +[5.0.32]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.31...v5.0.32 +[Unreleased]: https://github.com/cisco-en-programmability/dnacenter-go-sdk/compare/v5.0.32...main diff --git a/sdk/api_client.go b/sdk/api_client.go index a486663..d6b0f5b 100644 --- a/sdk/api_client.go +++ b/sdk/api_client.go @@ -24,6 +24,8 @@ const DNAC_PASSWORD = "DNAC_PASSWORD" const DNAC_DEBUG = "DNAC_DEBUG" const DNAC_SSL_VERIFY = "DNAC_SSL_VERIFY" const DNAC_WAIT_TIME = "DNAC_WAIT_TIME" +const VERSION = "2.3.5.3" +const USER_AGENT = "go-cisco-dnacsdk/" + VERSION type FileDownload struct { FileName string @@ -167,6 +169,7 @@ func NewClientNoAuth() (*Client, error) { var err error client := resty.New() + client.SetHeader("User-Agent", USER_AGENT) c := &Client{} c.common.client = client waitTimeToManyRequest := 0 @@ -198,6 +201,7 @@ func NewClientNoAuth() (*Client, error) { retry := false if r.StatusCode() == http.StatusUnauthorized { cl := resty.New() + cl.SetHeader("User-Agent", USER_AGENT) username := os.Getenv("DNAC_USERNAME") password := os.Getenv("DNAC_PASSWORD") @@ -339,6 +343,7 @@ func (s *Client) AuthClient() error { // RestyClient returns the resty.Client used by the sdk func (s *Client) RestyClient() *resty.Client { + s.common.client.SetHeader("User-Agent", USER_AGENT) return s.common.client }