From 2e8416df8bcdbb2a652a3c07e25453e0da7da465 Mon Sep 17 00:00:00 2001 From: Patrick Cowland <44225864+patrickcping@users.noreply.github.com> Date: Thu, 6 Jul 2023 15:10:31 +0100 Subject: [PATCH] Make useragent configurable in service modules (#217) * Make useragent configurable in service modules * changelogs --- CHANGELOG.md | 7 +++++++ agreementmanagement/CHANGELOG.md | 1 + agreementmanagement/configuration.go | 6 +++++- .../generate/postprocessing/generate-replace-regex.go | 8 +++++++- authorize/CHANGELOG.md | 1 + authorize/configuration.go | 6 +++++- .../generate/postprocessing/generate-replace-regex.go | 8 +++++++- credentials/CHANGELOG.md | 1 + credentials/configuration.go | 6 +++++- .../generate/postprocessing/generate-replace-regex.go | 6 ++++++ management/CHANGELOG.md | 1 + management/configuration.go | 6 +++++- .../generate/postprocessing/generate-replace-regex.go | 6 ++++++ mfa/CHANGELOG.md | 1 + mfa/configuration.go | 6 +++++- mfa/generate/postprocessing/generate-replace-regex.go | 6 ++++++ risk/CHANGELOG.md | 1 + risk/configuration.go | 6 +++++- risk/generate/postprocessing/generate-replace-regex.go | 6 ++++++ scripts/generate-replace-regex.go | 10 ++++------ verify/CHANGELOG.md | 1 + verify/configuration.go | 6 +++++- .../generate/postprocessing/generate-replace-regex.go | 8 +++++++- 23 files changed, 98 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d1652ab..22221d37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,19 +2,26 @@ * `github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement` : [v0.2.1](./agreementmanagement/CHANGELOG.md) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) + * **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) * `github.com/patrickcping/pingone-go-sdk-v2/authorize` : [v0.2.1](./authorize/CHANGELOG.md) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) + * **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) * `github.com/patrickcping/pingone-go-sdk-v2/credentials` : [v0.2.1](./credentials/CHANGELOG.md) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) + * **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) * `github.com/patrickcping/pingone-go-sdk-v2/management` : [v0.23.1](./management/CHANGELOG.md) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) + * **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) * `github.com/patrickcping/pingone-go-sdk-v2/mfa` : [v0.15.0](./mfa/CHANGELOG.md) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) + * **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) * **Enhancement** Add optional ENUM attribute `NewDeviceNotification` to the `DeviceAuthenticationPolicy` model. [#215](https://github.com/patrickcping/pingone-go-sdk-v2/pull/215) * `github.com/patrickcping/pingone-go-sdk-v2/risk` : [v0.8.1](./risk/CHANGELOG.md) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) + * **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) * `github.com/patrickcping/pingone-go-sdk-v2/verify` : [v0.2.1](./verify/CHANGELOG.md) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) + * **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) # Release (2023-07-04) diff --git a/agreementmanagement/CHANGELOG.md b/agreementmanagement/CHANGELOG.md index 153db3c9..270635aa 100644 --- a/agreementmanagement/CHANGELOG.md +++ b/agreementmanagement/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.2.1 (Unreleased) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) +* **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) # v0.2.0 (2023-07-04) diff --git a/agreementmanagement/configuration.go b/agreementmanagement/configuration.go index af60de59..4ea681f0 100644 --- a/agreementmanagement/configuration.go +++ b/agreementmanagement/configuration.go @@ -90,7 +90,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "PingOne-GOLANG-SDK/0.2.1/go", + UserAgent: "PingOne-GOLANG-SDK/agreementmanagement/0.2.1/go", Debug: false, DefaultServerIndex: 0, Servers: ServerConfigurations{ @@ -142,6 +142,10 @@ func NewConfiguration() *Configuration { func (c *Configuration) SetDebug(debug bool) { c.Debug = debug } + +func (c *Configuration) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} func (c *Configuration) SetDefaultServerIndex(defaultServerIndex int) { c.DefaultServerIndex = defaultServerIndex diff --git a/agreementmanagement/generate/postprocessing/generate-replace-regex.go b/agreementmanagement/generate/postprocessing/generate-replace-regex.go index da47b2aa..35f48ed5 100644 --- a/agreementmanagement/generate/postprocessing/generate-replace-regex.go +++ b/agreementmanagement/generate/postprocessing/generate-replace-regex.go @@ -48,5 +48,11 @@ var ( fileSelectPattern string pattern string repl string - }{} + }{ + { + fileSelectPattern: "configuration.go", + pattern: `"OpenAPI-Generator/([0-9]+\.[0-9]+\.[0-9]+)/go",`, + repl: `"PingOne-GOLANG-SDK/agreementmanagement/$1/go",`, + }, + } ) diff --git a/authorize/CHANGELOG.md b/authorize/CHANGELOG.md index 031728db..c0171f63 100644 --- a/authorize/CHANGELOG.md +++ b/authorize/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.2.1 (Unreleased) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) +* **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) # v0.2.0 (2023-07-04) diff --git a/authorize/configuration.go b/authorize/configuration.go index 2ef06638..98983290 100644 --- a/authorize/configuration.go +++ b/authorize/configuration.go @@ -90,7 +90,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "PingOne-GOLANG-SDK/0.2.1/go", + UserAgent: "PingOne-GOLANG-SDK/authorize/0.2.1/go", Debug: false, DefaultServerIndex: 0, Servers: ServerConfigurations{ @@ -142,6 +142,10 @@ func NewConfiguration() *Configuration { func (c *Configuration) SetDebug(debug bool) { c.Debug = debug } + +func (c *Configuration) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} func (c *Configuration) SetDefaultServerIndex(defaultServerIndex int) { c.DefaultServerIndex = defaultServerIndex diff --git a/authorize/generate/postprocessing/generate-replace-regex.go b/authorize/generate/postprocessing/generate-replace-regex.go index da47b2aa..86929476 100644 --- a/authorize/generate/postprocessing/generate-replace-regex.go +++ b/authorize/generate/postprocessing/generate-replace-regex.go @@ -48,5 +48,11 @@ var ( fileSelectPattern string pattern string repl string - }{} + }{ + { + fileSelectPattern: "configuration.go", + pattern: `"OpenAPI-Generator/([0-9]+\.[0-9]+\.[0-9]+)/go",`, + repl: `"PingOne-GOLANG-SDK/authorize/$1/go",`, + }, + } ) diff --git a/credentials/CHANGELOG.md b/credentials/CHANGELOG.md index 53724396..520ab072 100644 --- a/credentials/CHANGELOG.md +++ b/credentials/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.2.1 (Unreleased) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) +* **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) # v0.2.0 (2023-07-04) diff --git a/credentials/configuration.go b/credentials/configuration.go index 0ceb8b01..7a6602e0 100644 --- a/credentials/configuration.go +++ b/credentials/configuration.go @@ -90,7 +90,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "PingOne-GOLANG-SDK/0.2.1/go", + UserAgent: "PingOne-GOLANG-SDK/credentials/0.2.1/go", Debug: false, DefaultServerIndex: 0, Servers: ServerConfigurations{ @@ -142,6 +142,10 @@ func NewConfiguration() *Configuration { func (c *Configuration) SetDebug(debug bool) { c.Debug = debug } + +func (c *Configuration) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} func (c *Configuration) SetDefaultServerIndex(defaultServerIndex int) { c.DefaultServerIndex = defaultServerIndex diff --git a/credentials/generate/postprocessing/generate-replace-regex.go b/credentials/generate/postprocessing/generate-replace-regex.go index 83a90b15..d84515c2 100644 --- a/credentials/generate/postprocessing/generate-replace-regex.go +++ b/credentials/generate/postprocessing/generate-replace-regex.go @@ -50,6 +50,12 @@ var ( repl string }{ + { + fileSelectPattern: "configuration.go", + pattern: `"OpenAPI-Generator/([0-9]+\.[0-9]+\.[0-9]+)/go",`, + repl: `"PingOne-GOLANG-SDK/credentials/$1/go",`, + }, + // EntityArrayEmbeddedItemsInner model { fileSelectPattern: "model_entity_array__embedded_items_inner.go", diff --git a/management/CHANGELOG.md b/management/CHANGELOG.md index 7aaec05b..53cefb6c 100644 --- a/management/CHANGELOG.md +++ b/management/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.23.1 (Unreleased) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) +* **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) # v0.23.0 (2023-07-04) diff --git a/management/configuration.go b/management/configuration.go index 41318438..7afcc78e 100644 --- a/management/configuration.go +++ b/management/configuration.go @@ -90,7 +90,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "PingOne-GOLANG-SDK/0.23.1/go", + UserAgent: "PingOne-GOLANG-SDK/management/0.23.1/go", Debug: false, DefaultServerIndex: 0, Servers: ServerConfigurations{ @@ -142,6 +142,10 @@ func NewConfiguration() *Configuration { func (c *Configuration) SetDebug(debug bool) { c.Debug = debug } + +func (c *Configuration) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} func (c *Configuration) SetDefaultServerIndex(defaultServerIndex int) { c.DefaultServerIndex = defaultServerIndex diff --git a/management/generate/postprocessing/generate-replace-regex.go b/management/generate/postprocessing/generate-replace-regex.go index 52b7bce3..70d1034c 100644 --- a/management/generate/postprocessing/generate-replace-regex.go +++ b/management/generate/postprocessing/generate-replace-regex.go @@ -50,6 +50,12 @@ var ( repl string }{ + { + fileSelectPattern: "configuration.go", + pattern: `"OpenAPI-Generator/([0-9]+\.[0-9]+\.[0-9]+)/go",`, + repl: `"PingOne-GOLANG-SDK/management/$1/go",`, + }, + // Password policy model { fileSelectPattern: "model_password_policy_min_characters.go", diff --git a/mfa/CHANGELOG.md b/mfa/CHANGELOG.md index 07c96bda..d82bd518 100644 --- a/mfa/CHANGELOG.md +++ b/mfa/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.15.0 (Unreleased) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) +* **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) * **Enhancement** Add optional ENUM attribute `NewDeviceNotification` to the `DeviceAuthenticationPolicy` model. [#215](https://github.com/patrickcping/pingone-go-sdk-v2/pull/215) # v0.14.0 (2023-07-04) diff --git a/mfa/configuration.go b/mfa/configuration.go index 43312a40..e255aba9 100644 --- a/mfa/configuration.go +++ b/mfa/configuration.go @@ -90,7 +90,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "PingOne-GOLANG-SDK/0.15.0/go", + UserAgent: "PingOne-GOLANG-SDK/mfa/0.15.0/go", Debug: false, DefaultServerIndex: 0, Servers: ServerConfigurations{ @@ -142,6 +142,10 @@ func NewConfiguration() *Configuration { func (c *Configuration) SetDebug(debug bool) { c.Debug = debug } + +func (c *Configuration) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} func (c *Configuration) SetDefaultServerIndex(defaultServerIndex int) { c.DefaultServerIndex = defaultServerIndex diff --git a/mfa/generate/postprocessing/generate-replace-regex.go b/mfa/generate/postprocessing/generate-replace-regex.go index fa5b8498..c15ed930 100644 --- a/mfa/generate/postprocessing/generate-replace-regex.go +++ b/mfa/generate/postprocessing/generate-replace-regex.go @@ -50,6 +50,12 @@ var ( repl string }{ + { + fileSelectPattern: "configuration.go", + pattern: `"OpenAPI-Generator/([0-9]+\.[0-9]+\.[0-9]+)/go",`, + repl: `"PingOne-GOLANG-SDK/mfa/$1/go",`, + }, + // MFAPushCredentialRequest model { fileSelectPattern: "model_mfa_push_credential_request.go", diff --git a/risk/CHANGELOG.md b/risk/CHANGELOG.md index 869d9fa8..674d961e 100644 --- a/risk/CHANGELOG.md +++ b/risk/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.8.1 (Unreleased) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) +* **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) # v0.8.0 (2023-07-04) diff --git a/risk/configuration.go b/risk/configuration.go index 87845de3..1b35b844 100644 --- a/risk/configuration.go +++ b/risk/configuration.go @@ -90,7 +90,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "PingOne-GOLANG-SDK/0.8.1/go", + UserAgent: "PingOne-GOLANG-SDK/risk/0.8.1/go", Debug: false, DefaultServerIndex: 0, Servers: ServerConfigurations{ @@ -142,6 +142,10 @@ func NewConfiguration() *Configuration { func (c *Configuration) SetDebug(debug bool) { c.Debug = debug } + +func (c *Configuration) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} func (c *Configuration) SetDefaultServerIndex(defaultServerIndex int) { c.DefaultServerIndex = defaultServerIndex diff --git a/risk/generate/postprocessing/generate-replace-regex.go b/risk/generate/postprocessing/generate-replace-regex.go index d6b6eea8..70f9037e 100644 --- a/risk/generate/postprocessing/generate-replace-regex.go +++ b/risk/generate/postprocessing/generate-replace-regex.go @@ -50,6 +50,12 @@ var ( repl string }{ + { + fileSelectPattern: "configuration.go", + pattern: `"OpenAPI-Generator/([0-9]+\.[0-9]+\.[0-9]+)/go",`, + repl: `"PingOne-GOLANG-SDK/risk/$1/go",`, + }, + // RiskPredictor model { fileSelectPattern: "model_risk_predictor.go", diff --git a/scripts/generate-replace-regex.go b/scripts/generate-replace-regex.go index 194e8763..a7a3814f 100644 --- a/scripts/generate-replace-regex.go +++ b/scripts/generate-replace-regex.go @@ -54,18 +54,16 @@ var ( // ALL configuration.go ///////////////////////// - { - fileSelectPattern: "configuration.go", - pattern: `"OpenAPI-Generator/([0-9]+\.[0-9]+\.[0-9]+)/go",`, - repl: `"PingOne-GOLANG-SDK/$1/go",`, - }, - { fileSelectPattern: "configuration.go", pattern: `\/\/ AddDefaultHeader adds a new HTTP header to the default header in the request`, repl: `func (c *Configuration) SetDebug(debug bool) { c.Debug = debug } + +func (c *Configuration) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} func (c *Configuration) SetDefaultServerIndex(defaultServerIndex int) { c.DefaultServerIndex = defaultServerIndex diff --git a/verify/CHANGELOG.md b/verify/CHANGELOG.md index 68a652b1..6bc697fa 100644 --- a/verify/CHANGELOG.md +++ b/verify/CHANGELOG.md @@ -1,6 +1,7 @@ # v0.2.1 (Unreleased) * **Note** Code optimisation for API response processing. [#216](https://github.com/patrickcping/pingone-go-sdk-v2/pull/216) +* **Note** Allow user-defined values for the `UserAgent` configuration parameter. [#217](https://github.com/patrickcping/pingone-go-sdk-v2/pull/217) # v0.2.0 (2023-07-04) diff --git a/verify/configuration.go b/verify/configuration.go index 0dd1e412..ab5c413b 100644 --- a/verify/configuration.go +++ b/verify/configuration.go @@ -90,7 +90,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "PingOne-GOLANG-SDK/0.2.1/go", + UserAgent: "PingOne-GOLANG-SDK/verify/0.2.1/go", Debug: false, DefaultServerIndex: 0, Servers: ServerConfigurations{ @@ -142,6 +142,10 @@ func NewConfiguration() *Configuration { func (c *Configuration) SetDebug(debug bool) { c.Debug = debug } + +func (c *Configuration) SetUserAgent(userAgent string) { + c.UserAgent = userAgent +} func (c *Configuration) SetDefaultServerIndex(defaultServerIndex int) { c.DefaultServerIndex = defaultServerIndex diff --git a/verify/generate/postprocessing/generate-replace-regex.go b/verify/generate/postprocessing/generate-replace-regex.go index da47b2aa..171e7476 100644 --- a/verify/generate/postprocessing/generate-replace-regex.go +++ b/verify/generate/postprocessing/generate-replace-regex.go @@ -48,5 +48,11 @@ var ( fileSelectPattern string pattern string repl string - }{} + }{ + { + fileSelectPattern: "configuration.go", + pattern: `"OpenAPI-Generator/([0-9]+\.[0-9]+\.[0-9]+)/go",`, + repl: `"PingOne-GOLANG-SDK/verify/$1/go",`, + }, + } )