Skip to content

Commit

Permalink
Fix retry PingOne model (#157)
Browse files Browse the repository at this point in the history
* remove unnecessary log output from the client

* correct object dereferencing for application retry conditions

* version uplift and changelog
  • Loading branch information
patrickcping authored Apr 28, 2023
1 parent c45eaee commit 4e0f617
Show file tree
Hide file tree
Showing 44 changed files with 76 additions and 56 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Release (Unreleased)

* `github.com/patrickcping/pingone-go-sdk-v2` : v0.6.4
* **Note** Remove unnecessary log output. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)
* `github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement` : [v0.1.3](./agreementmanagement/CHANGELOG.md)
* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)
* `github.com/patrickcping/pingone-go-sdk-v2/authorize` : [v0.1.6](./authorize/CHANGELOG.md)
* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)
* `github.com/patrickcping/pingone-go-sdk-v2/management` : [v0.19.1](./management/CHANGELOG.md)
* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)
* `github.com/patrickcping/pingone-go-sdk-v2/mfa` : [v0.9.3](./mfa/CHANGELOG.md)
* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)
* `github.com/patrickcping/pingone-go-sdk-v2/risk` : [v0.5.1](./risk/CHANGELOG.md)
* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)

# Release (2023-04-24)

* `github.com/patrickcping/pingone-go-sdk-v2` : v0.6.3
Expand Down
2 changes: 1 addition & 1 deletion agreementmanagement/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
6.5.0
2 changes: 1 addition & 1 deletion agreementmanagement/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.2
0.1.3
4 changes: 4 additions & 0 deletions agreementmanagement/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.1.3 (Unreleased)

* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)

# v0.1.2 (2023-04-24)

* **Note** Add retry logic for retryable HTTP status codes. [#147](https://github.com/patrickcping/pingone-go-sdk-v2/pull/147)
Expand Down
2 changes: 1 addition & 1 deletion agreementmanagement/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The PingOne Platform API covering the PingOne Agreement Management service
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 2022-09-23
- Package version: 0.1.2
- Package version: 0.1.3
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation
Expand Down
2 changes: 1 addition & 1 deletion agreementmanagement/client_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func testForRetryable(r *http.Response, err error, currentBackoff time.Duration)
}

if err != nil {
if genericOAError, ok := err.(GenericOpenAPIError); ok && genericOAError.Model() != nil {
if genericOAError, ok := err.(*GenericOpenAPIError); ok && genericOAError.Model() != nil {
// We have an application level error

if modelError, ok := genericOAError.Model().(P1Error); ok {
Expand Down
2 changes: 1 addition & 1 deletion agreementmanagement/configuration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion agreementmanagement/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement

go 1.18

require golang.org/x/exp v0.0.0-20230420155640-133eef4313cb
require golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
4 changes: 2 additions & 2 deletions agreementmanagement/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb h1:rhjz/8Mbfa8xROFiH+MQphmAmgqRM0bOMnytznhWEXk=
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
2 changes: 1 addition & 1 deletion authorize/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
6.5.0
2 changes: 1 addition & 1 deletion authorize/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.5
0.1.6
4 changes: 4 additions & 0 deletions authorize/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.1.6 (Unreleased)

* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)

# v0.1.5 (2023-04-24)

* **Note** Add retry logic for retryable HTTP status codes. [#147](https://github.com/patrickcping/pingone-go-sdk-v2/pull/147)
Expand Down
2 changes: 1 addition & 1 deletion authorize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The PingOne Platform API covering the PingOne Authorize service
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 2022-09-23
- Package version: 0.1.5
- Package version: 0.1.6
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation
Expand Down
2 changes: 1 addition & 1 deletion authorize/client_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func testForRetryable(r *http.Response, err error, currentBackoff time.Duration)
}

if err != nil {
if genericOAError, ok := err.(GenericOpenAPIError); ok && genericOAError.Model() != nil {
if genericOAError, ok := err.(*GenericOpenAPIError); ok && genericOAError.Model() != nil {
// We have an application level error

if modelError, ok := genericOAError.Model().(P1Error); ok {
Expand Down
2 changes: 1 addition & 1 deletion authorize/configuration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion authorize/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/patrickcping/pingone-go-sdk-v2/authorize

go 1.18

require golang.org/x/exp v0.0.0-20230420155640-133eef4313cb
require golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
4 changes: 2 additions & 2 deletions authorize/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb h1:rhjz/8Mbfa8xROFiH+MQphmAmgqRM0bOMnytznhWEXk=
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
2 changes: 1 addition & 1 deletion management/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
6.5.0
2 changes: 1 addition & 1 deletion management/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.19.0
0.19.1
4 changes: 4 additions & 0 deletions management/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.19.1 (Unreleased)

* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)

# v0.19.0 (2023-04-24)

* **Note** Add retry logic for retryable HTTP status codes. [#147](https://github.com/patrickcping/pingone-go-sdk-v2/pull/147)
Expand Down
2 changes: 1 addition & 1 deletion management/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The PingOne Platform API covering the base and SSO services (otherwise known as
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 2022-08-02
- Package version: 0.19.0
- Package version: 0.19.1
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation
Expand Down
2 changes: 1 addition & 1 deletion management/client_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func testForRetryable(r *http.Response, err error, currentBackoff time.Duration)
}

if err != nil {
if genericOAError, ok := err.(GenericOpenAPIError); ok && genericOAError.Model() != nil {
if genericOAError, ok := err.(*GenericOpenAPIError); ok && genericOAError.Model() != nil {
// We have an application level error

if modelError, ok := genericOAError.Model().(P1Error); ok {
Expand Down
2 changes: 1 addition & 1 deletion management/configuration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion management/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/patrickcping/pingone-go-sdk-v2/management

go 1.18

require golang.org/x/exp v0.0.0-20230420155640-133eef4313cb
require golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
4 changes: 2 additions & 2 deletions management/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb h1:rhjz/8Mbfa8xROFiH+MQphmAmgqRM0bOMnytznhWEXk=
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
2 changes: 1 addition & 1 deletion mfa/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
6.5.0
2 changes: 1 addition & 1 deletion mfa/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.9.2
0.9.3
4 changes: 4 additions & 0 deletions mfa/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.9.3 (Unreleased)

* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)

# v0.9.2 (2023-04-24)

* **Note** Add retry logic for retryable HTTP status codes. [#147](https://github.com/patrickcping/pingone-go-sdk-v2/pull/147)
Expand Down
2 changes: 1 addition & 1 deletion mfa/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The PingOne Platform API covering the PingOne MFA service
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 2021-10-17
- Package version: 0.9.2
- Package version: 0.9.3
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation
Expand Down
2 changes: 1 addition & 1 deletion mfa/client_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func testForRetryable(r *http.Response, err error, currentBackoff time.Duration)
}

if err != nil {
if genericOAError, ok := err.(GenericOpenAPIError); ok && genericOAError.Model() != nil {
if genericOAError, ok := err.(*GenericOpenAPIError); ok && genericOAError.Model() != nil {
// We have an application level error

if modelError, ok := genericOAError.Model().(P1Error); ok {
Expand Down
2 changes: 1 addition & 1 deletion mfa/configuration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mfa/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/patrickcping/pingone-go-sdk-v2/mfa

go 1.18

require golang.org/x/exp v0.0.0-20230420155640-133eef4313cb
require golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
4 changes: 2 additions & 2 deletions mfa/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb h1:rhjz/8Mbfa8xROFiH+MQphmAmgqRM0bOMnytznhWEXk=
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
13 changes: 0 additions & 13 deletions pingone/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ func (c *Config) APIClient(ctx context.Context) (*Client, error) {
Region: model.FindRegionByName(c.Region),
}

log.Printf("[INFO] PingOne Client configured")
return apiClient, nil
}

Expand All @@ -74,8 +73,6 @@ func AgreementManagementAPIClient(token *oauth2.Token) (*agreementmanagement.API
return nil, fmt.Errorf("Cannot initialise PingOne Agreement Management client")
}

log.Printf("[INFO] PingOne Agreement Management Client initialised")

return client, nil

}
Expand All @@ -92,8 +89,6 @@ func AuthorizeAPIClient(token *oauth2.Token) (*authorize.APIClient, error) {
return nil, fmt.Errorf("Cannot initialise PingOne Authorize client")
}

log.Printf("[INFO] PingOne Authorize Client initialised")

return client, nil

}
Expand All @@ -110,8 +105,6 @@ func ManagementAPIClient(token *oauth2.Token) (*management.APIClient, error) {
return nil, fmt.Errorf("Cannot initialise PingOne Management client")
}

log.Printf("[INFO] PingOne Management Client initialised")

return client, nil

}
Expand All @@ -128,8 +121,6 @@ func MFAAPIClient(token *oauth2.Token) (*mfa.APIClient, error) {
return nil, fmt.Errorf("Cannot initialise PingOne MFA client")
}

log.Printf("[INFO] PingOne MFA Client initialised")

return client, nil

}
Expand All @@ -146,8 +137,6 @@ func RiskAPIClient(token *oauth2.Token) (*risk.APIClient, error) {
return nil, fmt.Errorf("Cannot initialise PingOne Risk client")
}

log.Printf("[INFO] PingOne Risk Client initialised")

return client, nil

}
Expand All @@ -164,7 +153,6 @@ func getToken(ctx context.Context, c *Config) (*oauth2.Token, error) {

//Get URL from SDK
authURL := fmt.Sprintf("https://auth.pingone.%s", regionSuffix)
log.Printf("[INFO] Getting token from %s", authURL)

//OAuth 2.0 config for client creds
config := clientcredentials.Config{
Expand All @@ -180,7 +168,6 @@ func getToken(ctx context.Context, c *Config) (*oauth2.Token, error) {
if err != nil {
return nil, err
}
log.Printf("[INFO] Token retrieved")

return token, nil

Expand Down
2 changes: 1 addition & 1 deletion risk/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.4.0
6.5.0
2 changes: 1 addition & 1 deletion risk/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.5.1
4 changes: 4 additions & 0 deletions risk/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# v0.5.1 (Unreleased)

* **Bug** Fix for retry for conditions based on PingOne error response object. [#157](https://github.com/patrickcping/pingone-go-sdk-v2/pull/157)

# v0.5.0 (2023-04-24)

* **Breaking change** `RiskPredictor` model changed to `RiskPredictorCommon`, replaced with the predictor type model. [#151](https://github.com/patrickcping/pingone-go-sdk-v2/pull/151)
Expand Down
2 changes: 1 addition & 1 deletion risk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ The PingOne Platform API covering the PingOne Risk service
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 2021-10-17
- Package version: 0.5.0
- Package version: 0.5.1
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation
Expand Down
2 changes: 0 additions & 2 deletions risk/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2890,7 +2890,6 @@ components:
- list
- type
type: object
example: null
RiskPredictorCompositeCondition_oneOf_1:
properties:
equals:
Expand All @@ -2913,7 +2912,6 @@ components:
required:
- value
type: object
example: null
RiskPredictorCustom_allOf_map:
description: An object that defines the mapping of risk levels for the list
of all results.
Expand Down
2 changes: 1 addition & 1 deletion risk/client_ext.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func testForRetryable(r *http.Response, err error, currentBackoff time.Duration)
}

if err != nil {
if genericOAError, ok := err.(GenericOpenAPIError); ok && genericOAError.Model() != nil {
if genericOAError, ok := err.(*GenericOpenAPIError); ok && genericOAError.Model() != nil {
// We have an application level error

if modelError, ok := genericOAError.Model().(P1Error); ok {
Expand Down
2 changes: 1 addition & 1 deletion risk/configuration.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion risk/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/patrickcping/pingone-go-sdk-v2/risk

go 1.18

require golang.org/x/exp v0.0.0-20230420155640-133eef4313cb
require golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
4 changes: 2 additions & 2 deletions risk/go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb h1:rhjz/8Mbfa8xROFiH+MQphmAmgqRM0bOMnytznhWEXk=
golang.org/x/exp v0.0.0-20230420155640-133eef4313cb/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
2 changes: 1 addition & 1 deletion scripts/client_ext.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func testForRetryable(r *http.Response, err error, currentBackoff time.Duration)
}

if err != nil {
if genericOAError, ok := err.(GenericOpenAPIError); ok && genericOAError.Model() != nil {
if genericOAError, ok := err.(*GenericOpenAPIError); ok && genericOAError.Model() != nil {
// We have an application level error

if modelError, ok := genericOAError.Model().(P1Error); ok {
Expand Down

0 comments on commit 4e0f617

Please sign in to comment.