From a02bb96c71e2b5a2b9a16c5ab3b0dfa65ee0691e Mon Sep 17 00:00:00 2001 From: Patrick Cowland <44225864+patrickcping@users.noreply.github.com> Date: Tue, 4 Jun 2024 14:15:48 +0100 Subject: [PATCH] Retract the `agreementmanagement` module (#352) * Retract the agreementmanagement module * changelog * removal of agreement managemnt from config, tests, CI and docs * version uplift --- .github/workflows/acceptance-test.yml | 1 - .github/workflows/code-check.yml | 1 - .github/workflows/unit-test.yml | 1 - CHANGELOG.md | 4 + GNUmakefile | 2 +- README.md | 5 +- agreementmanagement/.openapi-generator-ignore | 34 --- agreementmanagement/.openapi-generator/FILES | 17 -- .../.openapi-generator/VERSION | 1 - agreementmanagement/.version | 2 +- agreementmanagement/CHANGELOG.md | 4 + agreementmanagement/GNUmakefile | 49 ---- agreementmanagement/README.md | 126 +-------- agreementmanagement/api/openapi.yaml | 259 ------------------ agreementmanagement/configuration.go | 2 +- .../generate/pingone-agreementmanagement.yml | 198 ------------- .../postprocessing/generate-replace-regex.go | 52 ---- agreementmanagement/go.mod | 14 + go.mod | 1 - go.sum | 2 - pingone/client.go | 110 +------- pingone/client_test.go | 4 - pingone/config.go | 47 +--- pingone/config_test.go | 52 ---- scripts/build-all.sh | 2 +- scripts/generate-all.sh | 2 +- scripts/lint-all.sh | 2 +- 27 files changed, 60 insertions(+), 934 deletions(-) delete mode 100644 agreementmanagement/.openapi-generator-ignore delete mode 100644 agreementmanagement/.openapi-generator/FILES delete mode 100644 agreementmanagement/.openapi-generator/VERSION delete mode 100644 agreementmanagement/GNUmakefile delete mode 100644 agreementmanagement/api/openapi.yaml delete mode 100644 agreementmanagement/generate/pingone-agreementmanagement.yml delete mode 100644 agreementmanagement/generate/postprocessing/generate-replace-regex.go diff --git a/.github/workflows/acceptance-test.yml b/.github/workflows/acceptance-test.yml index e8bab84d..46ba495d 100644 --- a/.github/workflows/acceptance-test.yml +++ b/.github/workflows/acceptance-test.yml @@ -64,7 +64,6 @@ jobs: # Dummy values follow to test the env var defaulting behaviours PINGONE_REGION_TESTACC: Europe PINGONE_API_ACCESS_TOKEN: DummyAccessToken - PINGONE_AGREEMENT_MGMT_SERVICE_HOSTNAME: agreement-mgmt.ping-eng.com PINGONE_API_SERVICE_HOSTNAME: api.ping-eng.com PINGONE_AUTH_SERVICE_HOSTNAME: auth.ping-eng.com PINGONE_CLIENT_ID: 7682a4d9-15d6-405a-9fd2-d9e08d3adfbe diff --git a/.github/workflows/code-check.yml b/.github/workflows/code-check.yml index 4e13c37b..c6718051 100644 --- a/.github/workflows/code-check.yml +++ b/.github/workflows/code-check.yml @@ -61,7 +61,6 @@ jobs: matrix: module: - '.' - - 'agreementmanagement' - 'authorize' - 'credentials' - 'management' diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index c9208e91..3037d7f6 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -70,7 +70,6 @@ jobs: PINGONE_ENVIRONMENT_ID_TESTACC: ${{ secrets.EU_PINGONE_ENVIRONMENT_ID }} PINGONE_REGION_TESTACC: Europe PINGONE_API_ACCESS_TOKEN: testtest - PINGONE_AGREEMENT_MGMT_SERVICE_HOSTNAME: agreement-mgmt.ping-eng.com PINGONE_API_SERVICE_HOSTNAME: api.ping-eng.com PINGONE_AUTH_SERVICE_HOSTNAME: auth.ping-eng.com PINGONE_CLIENT_ID: 9c052a8a-14be-44e4-8f07-2662569994ce diff --git a/CHANGELOG.md b/CHANGELOG.md index 87344187..b49b19fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Release (Unreleased) +* `github.com/patrickcping/pingone-go-sdk-v2` : v0.12.0 + * **Note** Removal of retracted module `github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement`. [#352](https://github.com/patrickcping/pingone-go-sdk-v2/pull/352) +* `github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement` : [v0.3.2](./agreementmanagement/CHANGELOG.md) + * **MODULE RETRACTION** The API endpoint in this module suffers major loss of function. The module has been retracted but is retained in the source repo for the purpose of retration. [#352](https://github.com/patrickcping/pingone-go-sdk-v2/pull/352) * `github.com/patrickcping/pingone-go-sdk-v2/authorize` : [v0.5.0](./authorize/CHANGELOG.md) * **Feature** Add support for Application Resource Permissions API. [#344](https://github.com/patrickcping/pingone-go-sdk-v2/pull/344) * **Feature** Add support for Application Resources API. [#344](https://github.com/patrickcping/pingone-go-sdk-v2/pull/344) diff --git a/GNUmakefile b/GNUmakefile index 6fea1217..17f1b3e4 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -2,7 +2,7 @@ TEST?=$$(go list ./...) OWNER=patrickcping REPO=pingone-go-sdk-v2 -VERSION=0.11.9 +VERSION=0.12.0 default: build diff --git a/README.md b/README.md index 719ccf6d..b65d94bf 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ Code for each service is generated with the help of the [OpenAPI Generator](http The SDK provides a core package, and a package per PingOne service, each with their own directory off the root of the project: -* **agreementmanagement** - [Documentation](https://pkg.go.dev/github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement) - for the PingOne end-user agreements managements service * **authorize** - [Documentation](https://pkg.go.dev/github.com/patrickcping/pingone-go-sdk-v2/authorize) - for the PingOne Authorize service * **credentials** - [Documentation](https://pkg.go.dev/github.com/patrickcping/pingone-go-sdk-v2/credentials) - for the PingOne Credentials service, part of PingOne Neo * **management** - [Documentation](https://pkg.go.dev/github.com/patrickcping/pingone-go-sdk-v2/management) - for the PingOne platform common and SSO services @@ -49,7 +48,6 @@ if err != nil { ``` The result is an object with clients initialised for each service: -* `client.AgreementManagementAPIClient` * `client.AuthorizeAPIClient` * `client.CredentialsAPIClient` * `client.ManagementAPIClient` @@ -59,7 +57,7 @@ The result is an object with clients initialised for each service: In the above, if an `AccessToken` is provided, this will be verified and used. If the `AccessToken` is not provided, the SDK will retrieve an access token from the provided `ClientID`, `ClientSecret`, `EnvironmentID` and `Region` parameters. -The client SDK defaults to production hostnames, and the `Region` is used to add the relevant suffix to the hostname. For example, `Europe` as a `Region` value with suffix the service hostname with `.eu`. Hostnames can be overridden with the optional `APIHostnameOverride`, `AgreementMgmtHostnameOverride`, and `AuthHostnameOverride` parameters. +The client SDK defaults to production hostnames, and the `Region` is used to add the relevant suffix to the hostname. For example, `Europe` as a `Region` value with suffix the service hostname with `.eu`. Hostnames can be overridden with the optional `APIHostnameOverride`, and `AuthHostnameOverride` parameters. An API call can be made against the API objects, as in the following example to get all environments in a tenant: @@ -77,7 +75,6 @@ if err != nil { Each package is generated from an underlying OpenAPI 3 specification. Currently the OpenAPI 3 specification is stored in the `./<>/generate/pingone-<>.yml` file, although this will be subject to change in the future. -* [**agreementmanagement** OpenAPI 3 Specification file](./authorize/generate/pingone-authorize.yml) * [**authorize** OpenAPI 3 Specification file](./authorize/generate/pingone-authorize.yml) * [**credentials** OpenAPI 3 Specification file](./credentials/generate/pingone-credentials.yml) * [**management** OpenAPI 3 Specification file](./management/generate/pingone-management.yml) diff --git a/agreementmanagement/.openapi-generator-ignore b/agreementmanagement/.openapi-generator-ignore deleted file mode 100644 index ae925a27..00000000 --- a/agreementmanagement/.openapi-generator-ignore +++ /dev/null @@ -1,34 +0,0 @@ -# OpenAPI Generator Ignore -# Generated by openapi-generator https://github.com/openapitools/openapi-generator - -# Use this file to prevent files from being overwritten by the generator. -# The patterns follow closely to .gitignore or .dockerignore. - -# As an example, the C# client generator defines ApiClient.cs. -# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: -#ApiClient.cs - -# You can match any string of characters against a directory, file or extension with a single asterisk (*): -#foo/*/qux -# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux - -# You can recursively match patterns against a directory, file or extension with a double asterisk (**): -#foo/**/qux -# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux - -# You can also negate patterns with an exclamation (!). -# For example, you can ignore all files in a docs folder with the file extension .md: -#docs/*.md -# Then explicitly reverse the ignore rule for a single file: -#!docs/README.md - -.travis.yml -git_push.sh -.gitignore -CHANGELOG.md -GNUmakefile -.version -test/* -generate/ - -client.go \ No newline at end of file diff --git a/agreementmanagement/.openapi-generator/FILES b/agreementmanagement/.openapi-generator/FILES deleted file mode 100644 index a00231e2..00000000 --- a/agreementmanagement/.openapi-generator/FILES +++ /dev/null @@ -1,17 +0,0 @@ -README.md -api/openapi.yaml -api_agreement_revisions_resources.go -configuration.go -docs/AgreementRevisionText.md -docs/AgreementRevisionsResourcesApi.md -docs/P1Error.md -docs/P1ErrorDetailsInner.md -docs/P1ErrorDetailsInnerInnerError.md -go.mod -go.sum -model_agreement_revision_text.go -model_p1_error.go -model_p1_error_details_inner.go -model_p1_error_details_inner_inner_error.go -response.go -utils.go diff --git a/agreementmanagement/.openapi-generator/VERSION b/agreementmanagement/.openapi-generator/VERSION deleted file mode 100644 index 73a86b19..00000000 --- a/agreementmanagement/.openapi-generator/VERSION +++ /dev/null @@ -1 +0,0 @@ -7.0.1 \ No newline at end of file diff --git a/agreementmanagement/.version b/agreementmanagement/.version index a2268e2d..9fc80f93 100644 --- a/agreementmanagement/.version +++ b/agreementmanagement/.version @@ -1 +1 @@ -0.3.1 \ No newline at end of file +0.3.2 \ No newline at end of file diff --git a/agreementmanagement/CHANGELOG.md b/agreementmanagement/CHANGELOG.md index 8d6d02f8..a0cfd789 100644 --- a/agreementmanagement/CHANGELOG.md +++ b/agreementmanagement/CHANGELOG.md @@ -1,3 +1,7 @@ +# v0.3.2 (Unreleased) + +* **MODULE RETRACTION** The API endpoint in this module suffers major loss of function. The module has been retracted but is retained in the source repo for the purpose of retration. [#352](https://github.com/patrickcping/pingone-go-sdk-v2/pull/352) + # v0.3.1 (2024-01-12) * **Note** Upgrade GO to `v1.21` [#306](https://github.com/patrickcping/pingone-go-sdk-v2/pull/306) diff --git a/agreementmanagement/GNUmakefile b/agreementmanagement/GNUmakefile deleted file mode 100644 index 7cfcbd73..00000000 --- a/agreementmanagement/GNUmakefile +++ /dev/null @@ -1,49 +0,0 @@ -TEST?=$$(go list ./...) -OWNER=patrickcping -REPO=pingone-go-sdk-v2 -MODULE=agreementmanagement - -default: build - -build: fmtcheck - @go mod tidy - @go mod vendor - @go build ./... - -test: fmtcheck - go test $(TEST) $(TESTARGS) -timeout=5m - -testacc: fmtcheck - TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m - -vet: - @echo "==> Running go vet..." - @go vet ./... ; if [ $$? -ne 0 ]; then \ - echo ""; \ - echo "Vet found suspicious constructs. Please check the reported constructs"; \ - echo "and fix them if necessary before submitting the code for review."; \ - exit 1; \ - fi - -depscheck: - @echo "==> Checking source code with go mod tidy..." - @go mod tidy - @git diff --exit-code -- go.mod go.sum || \ - (echo; echo "Unexpected difference in go.mod/go.sum files. Run 'go mod tidy' command or revert any go.mod/go.sum changes and commit."; exit 1) - -lint: golangci-lint - -golangci-lint: - @echo "==> Checking source code with golangci-lint..." - @golangci-lint run ./... - -gosec: - @gosec -exclude-generated ./... - -generate: - @echo "==> Running generate for $(MODULE)..." - @./../scripts/generate-module.sh $(OWNER) $(REPO) $(MODULE) - -devcheck: build vet lint gosec test testacc - -.PHONY: build test testacc vet fmtcheck depscheck lint gosec golangci-lint generate \ No newline at end of file diff --git a/agreementmanagement/README.md b/agreementmanagement/README.md index dab7bd10..c7f91285 100644 --- a/agreementmanagement/README.md +++ b/agreementmanagement/README.md @@ -1,126 +1,6 @@ +|![](https://upload.wikimedia.org/wikipedia/commons/thumb/1/17/Warning.svg/156px-Warning.svg.png) | This module contains major loss of function and has been retracted. +|---|---| + # Go API client for agreementmanagement The PingOne Platform API covering the PingOne Agreement Management service - -## Overview -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: 2023-06-29 -- Package version: 0.3.1 -- Build package: org.openapitools.codegen.languages.GoClientCodegen - -## Installation - -Install the following dependencies: - -```shell -go get github.com/stretchr/testify/assert -go get golang.org/x/net/context -``` - -Put the package under your project folder and add the following in import: - -```golang -import agreementmanagement "github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement" -``` - -To use a proxy, set the environment variable `HTTP_PROXY`: - -```golang -os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") -``` - -## Configuration of Server URL - -Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. - -### Select Server Configuration - -For using other server than the one defined on index 0 set context value `sw.ContextServerIndex` of type `int`. - -```golang -ctx := context.WithValue(context.Background(), agreementmanagement.ContextServerIndex, 1) -``` - -### Templated Server URL - -Templated server URL is formatted using default variables from configuration or from context value `sw.ContextServerVariables` of type `map[string]string`. - -```golang -ctx := context.WithValue(context.Background(), agreementmanagement.ContextServerVariables, map[string]string{ - "basePath": "v2", -}) -``` - -Note, enum values are always validated and all unused variables are silently ignored. - -### URLs Configuration per Operation - -Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. -An operation is uniquely identified by `"{classname}Service.{nickname}"` string. -Similar rules for overriding default operation server index and variables applies by using `sw.ContextOperationServerIndices` and `sw.ContextOperationServerVariables` context maps. - -```golang -ctx := context.WithValue(context.Background(), agreementmanagement.ContextOperationServerIndices, map[string]int{ - "{classname}Service.{nickname}": 2, -}) -ctx = context.WithValue(context.Background(), agreementmanagement.ContextOperationServerVariables, map[string]map[string]string{ - "{classname}Service.{nickname}": { - "port": "8443", - }, -}) -``` - -## Documentation for API Endpoints - -All URIs are relative to *https://agreement-mgmt.pingone.com* - -Class | Method | HTTP request | Description ------------- | ------------- | ------------- | ------------- -*AgreementRevisionsResourcesApi* | [**ReadOneAgreementLanguageRevision**](docs/AgreementRevisionsResourcesApi.md#readoneagreementlanguagerevision) | **Get** /environments/{environmentID}/agreements/{agreementID}/languages/{languageID}/revisions/{revisionID}.json | READ One Agreement Language Revision - - -## Documentation For Models - - - [AgreementRevisionText](docs/AgreementRevisionText.md) - - [P1Error](docs/P1Error.md) - - [P1ErrorDetailsInner](docs/P1ErrorDetailsInner.md) - - [P1ErrorDetailsInnerInnerError](docs/P1ErrorDetailsInnerInnerError.md) - - -## Documentation For Authorization - - -Authentication schemes defined for the API: -### bearer - -- **Type**: HTTP Bearer token authentication - -Example - -```golang -auth := context.WithValue(context.Background(), sw.ContextAccessToken, "BEARER_TOKEN_STRING") -r, err := client.Service.Operation(auth, args) -``` - - -## Documentation for Utility Methods - -Due to the fact that model structure members are all pointers, this package contains -a number of utility functions to easily obtain pointers to values of basic types. -Each of these functions takes a value of the given basic type and returns a pointer to it: - -* `PtrBool` -* `PtrInt` -* `PtrInt32` -* `PtrInt64` -* `PtrFloat` -* `PtrFloat32` -* `PtrFloat64` -* `PtrString` -* `PtrTime` - -## Author - - - diff --git a/agreementmanagement/api/openapi.yaml b/agreementmanagement/api/openapi.yaml deleted file mode 100644 index b056efda..00000000 --- a/agreementmanagement/api/openapi.yaml +++ /dev/null @@ -1,259 +0,0 @@ -openapi: 3.0.0 -info: - description: The PingOne Platform API covering the PingOne Agreement Management - service - title: PingOne Platform API - Agreement Management - version: 2023-06-29 -servers: -- description: PingOne Platform API Endpoint - url: "{protocol}://{baseDomain}.{suffix}" - variables: - suffix: - default: com - enum: - - eu - - com - - asia - - ca - baseDomain: - default: agreement-mgmt.pingone - protocol: - default: https -- description: PingOne Platform API Endpoint - url: "{protocol}://{baseHostname}" - variables: - baseHostname: - default: agreement-mgmt.pingone.com - protocol: - default: https -security: -- bearer: [] -tags: -- name: Agreement Revisions Resources -paths: - /environments/{environmentID}/agreements/{agreementID}/languages/{languageID}/revisions/{revisionID}.json: - get: - operationId: readOneAgreementLanguageRevision - parameters: - - explode: false - in: path - name: environmentID - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: agreementID - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: languageID - required: true - schema: - type: string - style: simple - - explode: false - in: path - name: revisionID - required: true - schema: - type: string - style: simple - responses: - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: "Invalid request received. Malformed JSON, malformed HTTP\ - \ request." - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Request failed due to authorization issue. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Request failed due to authorization issue. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Not found. - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Conflict. - "429": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Request was rate limited - "500": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Uncaught error occurred. Platform outage - "200": - content: - application/json: - schema: - $ref: '#/components/schemas/AgreementRevisionText' - description: Successful response - summary: READ One Agreement Language Revision - tags: - - Agreement Revisions Resources -components: - responses: - "400": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: "Invalid request received. Malformed JSON, malformed HTTP request." - "401": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Request failed due to authorization issue. - "403": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Request failed due to authorization issue. - "404": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Not found. - "405": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: "Invalid request received. Malformed JSON, malformed HTTP request." - "409": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Conflict. - "429": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Request was rate limited - "500": - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - description: Uncaught error occurred. Platform outage - schemas: - AgreementRevisionText: - example: - data: data - resourcePath: resourcePath - dataType: dataType - properties: - resourcePath: - type: string - data: - type: string - dataType: - type: string - type: object - P1Error: - properties: - id: - description: "A unique identifier that is stored in log files and always\ - \ included in an error response. This value can be used to track the error\ - \ received by the client, with server-side activity included for troubleshooting\ - \ purposes." - type: string - code: - description: A general fault code which the client must handle to provide - all exception handling routines and to localize messages for users. This - code is common across all PingOne services and is human readable (such - as a defined constant rather than a number). - type: string - message: - description: A short description of the error. This message is intended - to assist with debugging and is returned in English only. - type: string - details: - description: Additional details about the error. Optional information to - help resolve the error and to display to users. - items: - $ref: '#/components/schemas/P1Error_details_inner' - type: array - type: object - P1Error_details_inner_innerError: - description: Additional details to help the client developer resolve the fault - (primarily for UI validation reasons). - properties: - rangeMinimumValue: - description: Errors that failed due to range violation. This attribute represents - the minimum value of the range. - type: integer - rangeMaximumValue: - description: The maximum range or value of an attribute. - type: integer - allowedPattern: - description: A regex pattern describing an acceptable input pattern. - type: string - allowedValues: - description: A list describing acceptable values. - items: - type: string - type: array - maximumValue: - description: The maximum value allowed for the request. - type: integer - referencedValues: - items: - type: string - type: array - type: object - P1Error_details_inner: - properties: - code: - description: A general fault code which the client must handle to provide - all exception handling routines and to localize messages for users. This - code is common across all PingOne services and is human readable (such - as a defined constant rather than a number). - type: string - target: - description: The item that caused the error (such as a form field ID or - an attribute inside a JSON object). - type: string - message: - description: A short description of the error. This message is intended - to assist with debugging and is returned in English only. - type: string - innerError: - $ref: '#/components/schemas/P1Error_details_inner_innerError' - type: object - securitySchemes: - bearer: - bearerFormat: JWT - description: OAuth bearer token (see documentation) - scheme: bearer - type: http diff --git a/agreementmanagement/configuration.go b/agreementmanagement/configuration.go index aa8eba47..3ebccc39 100644 --- a/agreementmanagement/configuration.go +++ b/agreementmanagement/configuration.go @@ -91,7 +91,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ DefaultHeader: make(map[string]string), - UserAgent: "pingtools PingOne-GOLANG-SDK-agreementmanagement/0.3.1", + UserAgent: "pingtools PingOne-GOLANG-SDK-agreementmanagement/0.3.2", Debug: false, DefaultServerIndex: 0, Servers: ServerConfigurations{ diff --git a/agreementmanagement/generate/pingone-agreementmanagement.yml b/agreementmanagement/generate/pingone-agreementmanagement.yml deleted file mode 100644 index d0e2d6fc..00000000 --- a/agreementmanagement/generate/pingone-agreementmanagement.yml +++ /dev/null @@ -1,198 +0,0 @@ -openapi: 3.0.0 -info: - title: PingOne Platform API - Agreement Management - description: The PingOne Platform API covering the PingOne Agreement Management service - version: '2023-06-29' -servers: - - url: '{protocol}://{baseDomain}.{suffix}' - description: PingOne Platform API Endpoint - variables: - suffix: - enum: - - 'eu' - - 'com' - - 'asia' - - 'ca' - default: 'com' - baseDomain: - default: 'agreement-mgmt.pingone' - protocol: - default: 'https' - - url: '{protocol}://{baseHostname}' - description: PingOne Platform API Endpoint - variables: - baseHostname: - default: 'agreement-mgmt.pingone.com' - protocol: - default: 'https' -components: - securitySchemes: - bearer: - type: http - scheme: bearer - bearerFormat: JWT - description: OAuth bearer token (see documentation) - schemas: - AgreementRevisionText: - type: object - properties: - resourcePath: - type: string - data: - type: string - dataType: - type: string - P1Error: - type: object - properties: - id: - description: A unique identifier that is stored in log files and always included in an error response. This value can be used to track the error received by the client, with server-side activity included for troubleshooting purposes. - type: string - code: - description: A general fault code which the client must handle to provide all exception handling routines and to localize messages for users. This code is common across all PingOne services and is human readable (such as a defined constant rather than a number). - type: string - message: - description: A short description of the error. This message is intended to assist with debugging and is returned in English only. - type: string - details: - description: Additional details about the error. Optional information to help resolve the error and to display to users. - type: array - items: - type: object - properties: - code: - description: A general fault code which the client must handle to provide all exception handling routines and to localize messages for users. This code is common across all PingOne services and is human readable (such as a defined constant rather than a number). - type: string - target: - description: The item that caused the error (such as a form field ID or an attribute inside a JSON object). - type: string - message: - description: A short description of the error. This message is intended to assist with debugging and is returned in English only. - type: string - innerError: - description: Additional details to help the client developer resolve the fault (primarily for UI validation reasons). - type: object - properties: - rangeMinimumValue: - description: Errors that failed due to range violation. This attribute represents the minimum value of the range. - type: integer - rangeMaximumValue: - description: The maximum range or value of an attribute. - type: integer - allowedPattern: - description: A regex pattern describing an acceptable input pattern. - type: string - allowedValues: - description: A list describing acceptable values. - type: array - items: - type: string - maximumValue: - description: The maximum value allowed for the request. - type: integer - referencedValues: - type: array - items: - type: string - responses: - '400': - description: Invalid request received. Malformed JSON, malformed HTTP request. - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - '401': - description: Request failed due to authorization issue. - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - '403': - description: Request failed due to authorization issue. - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - '404': - description: Not found. - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - '405': - description: Invalid request received. Malformed JSON, malformed HTTP request. - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - '409': - description: Conflict. - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - '429': - description: Request was rate limited - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' - '500': - description: Uncaught error occurred. Platform outage - content: - application/json: - schema: - $ref: '#/components/schemas/P1Error' -security: - - bearer: [] -tags: - - name: Agreement Revisions Resources -paths: - /environments/{environmentID}/agreements/{agreementID}/languages/{languageID}/revisions/{revisionID}.json: - get: - tags: - - Agreement Revisions Resources - summary: READ One Agreement Language Revision - operationId: readOneAgreementLanguageRevision - parameters: - - name: environmentID - in: path - schema: - type: string - required: true - - name: agreementID - in: path - schema: - type: string - required: true - - name: languageID - in: path - schema: - type: string - required: true - - name: revisionID - in: path - schema: - type: string - required: true - responses: - '400': - $ref: '#/components/responses/400' - '401': - $ref: '#/components/responses/401' - '403': - $ref: '#/components/responses/403' - '404': - $ref: '#/components/responses/404' - '409': - $ref: '#/components/responses/409' - '429': - $ref: '#/components/responses/429' - '500': - $ref: '#/components/responses/500' - '200': - description: Successful response - content: - application/json: - schema: - $ref: '#/components/schemas/AgreementRevisionText' diff --git a/agreementmanagement/generate/postprocessing/generate-replace-regex.go b/agreementmanagement/generate/postprocessing/generate-replace-regex.go deleted file mode 100644 index f2ab21b9..00000000 --- a/agreementmanagement/generate/postprocessing/generate-replace-regex.go +++ /dev/null @@ -1,52 +0,0 @@ -package main - -import ( - "os" - "path/filepath" - "regexp" -) - -func main() { - // Get the target directory from the command line argument - if len(os.Args) < 2 { - println("Usage: go run script.go ") - return - } - dir := os.Args[1] - - for _, rule := range replaceRules { - // Get a list of all files with the given extension in the directory - files, err := filepath.Glob(filepath.Join(dir, rule.fileSelectPattern)) - if err != nil { - panic(err) - } - - // Iterate over the files and apply the regex replacement rules - for _, file := range files { - // Read the file contents - content, err := os.ReadFile(filepath.Clean(file)) - if err != nil { - panic(err) - } - - // Apply the regex replacement rule - re := regexp.MustCompile(rule.pattern) - content = re.ReplaceAll(content, []byte(rule.repl)) - - // Write the updated file contents - err = os.WriteFile(file, content, os.ModeAppend) - if err != nil { - panic(err) - } - } - } -} - -var ( - // Define the full list of regex replacement rules - replaceRules = []struct { - fileSelectPattern string - pattern string - repl string - }{} -) diff --git a/agreementmanagement/go.mod b/agreementmanagement/go.mod index 2f522f71..c3d17935 100644 --- a/agreementmanagement/go.mod +++ b/agreementmanagement/go.mod @@ -1,3 +1,17 @@ module github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement go 1.21 + +retract ( + v0.1.0 // Major loss of function + v0.1.1 // Major loss of function + v0.1.2 // Major loss of function + v0.1.3 // Major loss of function + v0.1.4 // Major loss of function + v0.2.0 // Major loss of function + v0.2.1 // Major loss of function + v0.2.2 // Major loss of function + v0.3.0 // Major loss of function + v0.3.1 // Major loss of function + v0.3.2 // Contains retractions only. +) diff --git a/go.mod b/go.mod index ac04a26e..d84d2a7c 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/patrickcping/pingone-go-sdk-v2 go 1.21 require ( - github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement v0.3.1 github.com/patrickcping/pingone-go-sdk-v2/authorize v0.4.1 github.com/patrickcping/pingone-go-sdk-v2/credentials v0.7.0 github.com/patrickcping/pingone-go-sdk-v2/management v0.39.0 diff --git a/go.sum b/go.sum index 397fa95e..f96a9d55 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,5 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement v0.3.1 h1:ewKD35ooojS/RDKfmtW20GDhYIeD5x/RnlcI4v2BFZs= -github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement v0.3.1/go.mod h1:x/gbus62MUvvd7nBJo3Aprm2LTirRak6ZHwZXe8IW9s= github.com/patrickcping/pingone-go-sdk-v2/authorize v0.4.1 h1:6IM378rHWbrgr57bh0voVaglFti2ijAsply0JxZ7M38= github.com/patrickcping/pingone-go-sdk-v2/authorize v0.4.1/go.mod h1:D+vbECm13P8SkyvcWN9hjw90Qw9sbqdJTUezb+CRt3o= github.com/patrickcping/pingone-go-sdk-v2/credentials v0.7.0 h1:27tlGFrs31pXlC2EgmreN+WtnconZh2lW7BO70V+dBc= diff --git a/pingone/client.go b/pingone/client.go index 13b5d0d7..52fdea24 100644 --- a/pingone/client.go +++ b/pingone/client.go @@ -9,7 +9,6 @@ import ( "regexp" "time" - "github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement" "github.com/patrickcping/pingone-go-sdk-v2/authorize" "github.com/patrickcping/pingone-go-sdk-v2/credentials" "github.com/patrickcping/pingone-go-sdk-v2/management" @@ -22,25 +21,19 @@ import ( ) type Client struct { - AgreementManagementAPIClient *agreementmanagement.APIClient - AuthorizeAPIClient *authorize.APIClient - CredentialsAPIClient *credentials.APIClient - ManagementAPIClient *management.APIClient - MFAAPIClient *mfa.APIClient - RiskAPIClient *risk.APIClient - VerifyAPIClient *verify.APIClient - Region model.RegionMapping + AuthorizeAPIClient *authorize.APIClient + CredentialsAPIClient *credentials.APIClient + ManagementAPIClient *management.APIClient + MFAAPIClient *mfa.APIClient + RiskAPIClient *risk.APIClient + VerifyAPIClient *verify.APIClient + Region model.RegionMapping } -var version = "0.11.9" +var version = "0.12.0" func (c *Config) APIClient(ctx context.Context) (*Client, error) { - agreementManagementClient, err := c.AgreementManagementAPIClient(ctx) - if err != nil { - return nil, err - } - authorizeClient, err := c.AuthorizeAPIClient(ctx) if err != nil { return nil, err @@ -72,91 +65,18 @@ func (c *Config) APIClient(ctx context.Context) (*Client, error) { } apiClient := &Client{ - AgreementManagementAPIClient: agreementManagementClient, - AuthorizeAPIClient: authorizeClient, - CredentialsAPIClient: credentialsClient, - ManagementAPIClient: managementClient, - MFAAPIClient: mfaClient, - RiskAPIClient: riskClient, - VerifyAPIClient: verifyClient, - Region: model.FindRegionByName(c.Region), + AuthorizeAPIClient: authorizeClient, + CredentialsAPIClient: credentialsClient, + ManagementAPIClient: managementClient, + MFAAPIClient: mfaClient, + RiskAPIClient: riskClient, + VerifyAPIClient: verifyClient, + Region: model.FindRegionByName(c.Region), } return apiClient, nil } -// Deprecated: Use (c *Config).AgreementManagementAPIClient() instead -func AgreementManagementAPIClient(token *oauth2.Token) (*agreementmanagement.APIClient, error) { - - var client *agreementmanagement.APIClient - - clientcfg := agreementmanagement.NewConfiguration() - clientcfg.AddDefaultHeader("Authorization", fmt.Sprintf("Bearer %s", token.AccessToken)) - client = agreementmanagement.NewAPIClient(clientcfg) - - if client == nil { - return nil, fmt.Errorf("Cannot initialise PingOne Agreement Management client") - } - - return client, nil - -} - -func (c *Config) AgreementManagementAPIClient(ctx context.Context) (*agreementmanagement.APIClient, error) { - - if err := c.Validate(); err != nil { - return nil, fmt.Errorf("Client validation error: %s", err) - } - - if !c.accessTokenObject.Valid() { - err := c.getToken(ctx) - if err != nil { - return nil, err - } - } - - var client *agreementmanagement.APIClient - - clientcfg := agreementmanagement.NewConfiguration() - clientcfg.AddDefaultHeader("Authorization", fmt.Sprintf("Bearer %s", c.accessTokenObject.AccessToken)) - - if checkForValue(c.AgreementMgmtHostnameOverride) { - clientcfg.SetDefaultServerIndex(1) - err := clientcfg.SetDefaultServerVariableDefaultValue("baseHostname", *c.AgreementMgmtHostnameOverride) - if err != nil { - return nil, err - } - } else { - clientcfg.SetDefaultServerIndex(0) - err := clientcfg.SetDefaultServerVariableDefaultValue("suffix", model.FindRegionByName(c.Region).URLSuffix) - if err != nil { - return nil, err - } - } - - if checkForValue(c.UserAgentOverride) { - clientcfg.SetUserAgent(*c.UserAgentOverride) - } else { - clientcfg.AppendUserAgent(fmt.Sprintf("PingOne-GOLANG-SDK/%s", version)) - } - - if checkForValue(c.UserAgentSuffix) { - clientcfg.AppendUserAgent(*c.UserAgentSuffix) - } - - if checkForValue(c.ProxyURL) { - clientcfg.ProxyURL = c.ProxyURL - } - - client = agreementmanagement.NewAPIClient(clientcfg) - - if client == nil { - return nil, fmt.Errorf("Cannot initialise PingOne Agreement Management client") - } - - return client, nil -} - // Deprecated: Use (c *Config).AuthorizeAPIClient() instead func AuthorizeAPIClient(token *oauth2.Token) (*authorize.APIClient, error) { diff --git a/pingone/client_test.go b/pingone/client_test.go index bf1844db..05ba5f9a 100644 --- a/pingone/client_test.go +++ b/pingone/client_test.go @@ -22,10 +22,6 @@ func TestAccAPIClient_Success(t *testing.T) { t.Fatalf("Client not successfully retrieved: %s", err) } - if err := os.Setenv("PINGONE_AGREEMENT_MGMT_SERVICE_HOSTNAME", ""); err != nil { - t.Fatalf("Client not successfully retrieved: %s", err) - } - if err := os.Setenv("PINGONE_API_SERVICE_HOSTNAME", ""); err != nil { t.Fatalf("Client not successfully retrieved: %s", err) } diff --git a/pingone/config.go b/pingone/config.go index 473a9ca0..cc6a3091 100644 --- a/pingone/config.go +++ b/pingone/config.go @@ -12,19 +12,18 @@ import ( ) type Config struct { - AccessToken *string - accessTokenObject *oauth2.Token - AgreementMgmtHostnameOverride *string - APIHostnameOverride *string - AuthHostnameOverride *string - ClientID *string - ClientSecret *string - EnvironmentID *string - ProxyURL *string - Region string - UserAgentOverride *string - UserAgentSuffix *string - validated bool + AccessToken *string + accessTokenObject *oauth2.Token + APIHostnameOverride *string + AuthHostnameOverride *string + ClientID *string + ClientSecret *string + EnvironmentID *string + ProxyURL *string + Region string + UserAgentOverride *string + UserAgentSuffix *string + validated bool } var p1ResourceIDRegexp = regexp.MustCompile(`^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$`) @@ -40,22 +39,6 @@ func (c *Config) validateAccessToken() error { return nil } -func (c *Config) validateAgreementMgmtHostnameOverride() error { - if !checkForValue(c.AgreementMgmtHostnameOverride) { - if v := envVar("PINGONE_AGREEMENT_MGMT_SERVICE_HOSTNAME"); v != "" { - c.AgreementMgmtHostnameOverride = &v - } - } - - if checkForValue(c.AgreementMgmtHostnameOverride) { - if !isHostname.MatchString(*c.AgreementMgmtHostnameOverride) { - return fmt.Errorf("Invalid parameter format. Expected hostname format, got: %s", *c.AgreementMgmtHostnameOverride) - } - } - - return nil -} - func (c *Config) validateAPIHostnameOverride() error { if !checkForValue(c.APIHostnameOverride) { if v := envVar("PINGONE_API_SERVICE_HOSTNAME"); v != "" { @@ -163,10 +146,6 @@ func (c *Config) Validate() error { return err } - if err := c.validateAgreementMgmtHostnameOverride(); err != nil { - return err - } - if err := c.validateAPIHostnameOverride(); err != nil { return err } @@ -210,7 +189,7 @@ func (c *Config) Validate() error { } // Service overrides - if servicesOverridden := checkForValue(c.APIHostnameOverride) || checkForValue(c.AuthHostnameOverride) || checkForValue(c.AgreementMgmtHostnameOverride); servicesOverridden { + if servicesOverridden := checkForValue(c.APIHostnameOverride) || checkForValue(c.AuthHostnameOverride); servicesOverridden { if servicesOverridden && (!checkForValue(c.APIHostnameOverride) || !checkForValue(c.AuthHostnameOverride)) { return fmt.Errorf("Required service endpoints not configured. When overriding service endpoints, both auth (e.g. auth.pingone.com) and api service (e.g. api.pingone.com) endpoints must be set.") diff --git a/pingone/config_test.go b/pingone/config_test.go index 7448e6a6..8fd96cf1 100644 --- a/pingone/config_test.go +++ b/pingone/config_test.go @@ -46,58 +46,6 @@ func TestValidateAccessToken_InvalidFormat(t *testing.T) { t.Skip() } -func TestValidateAgreementMgmtHostnameOverride_ConfigSuccess(t *testing.T) { - - value := "agreement-mgmt.ping-devops.com" - - config := &Config{ - AgreementMgmtHostnameOverride: &value, - } - - if err := config.validateAgreementMgmtHostnameOverride(); err != nil { - t.Fatalf("Parameter not successfully verified: %s", err) - } - - if *config.AgreementMgmtHostnameOverride != value { - t.Fatalf("Parameter unexpectedly overwritten") - } -} - -func TestValidateAgreementMgmtHostnameOverride_EnvSuccess(t *testing.T) { - - value := os.Getenv("PINGONE_AGREEMENT_MGMT_SERVICE_HOSTNAME") - - if value == "" { - t.Fatalf("Required environment variable PINGONE_AGREEMENT_MGMT_SERVICE_HOSTNAME not set") - } - - config := &Config{} - - if err := config.validateAgreementMgmtHostnameOverride(); err != nil { - t.Fatalf("Parameter not successfully verified: %s", err) - } - - if *config.AgreementMgmtHostnameOverride != value { - t.Fatalf("Parameter default not taken from environment") - } -} - -func TestValidateAgreementMgmtHostnameOverride_InvalidFormat(t *testing.T) { - value := "https://dummyhostname" - - config := &Config{ - AgreementMgmtHostnameOverride: &value, - } - - if err := config.validateAgreementMgmtHostnameOverride(); err == nil { - t.Fatalf("Invalid Parameter format not successfully verified") - } - - if err := config.validateAgreementMgmtHostnameOverride(); !strings.HasPrefix(err.Error(), "Invalid parameter format") { - t.Fatalf("Invalid Parameter format not successfully verified: %s", err.Error()) - } -} - func TestValidateAPIHostnameOverride_ConfigSuccess(t *testing.T) { value := "api.ping-devops.com" diff --git a/scripts/build-all.sh b/scripts/build-all.sh index 6b79446b..24a6f332 100755 --- a/scripts/build-all.sh +++ b/scripts/build-all.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash ## declare an array variable -declare -a arr=("agreementmanagement" "authorize" "credentials" "davinci" "management" "mfa" "risk" "verify") +declare -a arr=("authorize" "credentials" "davinci" "management" "mfa" "risk" "verify") ## now loop through the above array for i in "${arr[@]}" diff --git a/scripts/generate-all.sh b/scripts/generate-all.sh index 8ef35b72..17ef73de 100755 --- a/scripts/generate-all.sh +++ b/scripts/generate-all.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash ## declare an array variable -declare -a arr=("agreementmanagement" "authorize" "credentials" "davinci" "management" "mfa" "risk" "verify") +declare -a arr=("authorize" "credentials" "davinci" "management" "mfa" "risk" "verify") ## now loop through the above array for i in "${arr[@]}" diff --git a/scripts/lint-all.sh b/scripts/lint-all.sh index 5dda9e73..b325a1e6 100755 --- a/scripts/lint-all.sh +++ b/scripts/lint-all.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash ## declare an array variable -declare -a arr=("agreementmanagement" "authorize" "credentials" "davinci" "management" "mfa" "risk" "verify") +declare -a arr=("authorize" "credentials" "davinci" "management" "mfa" "risk" "verify") ## now loop through the above array for i in "${arr[@]}"