Skip to content

Commit

Permalink
Add support for freetext region codes (#304)
Browse files Browse the repository at this point in the history
* Add support for freetext region codes

* regenerate

* update version and changelog

* correct useragent generation
  • Loading branch information
patrickcping authored Jan 12, 2024
1 parent 33de4df commit 8fa6599
Show file tree
Hide file tree
Showing 14 changed files with 253 additions and 20 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release (Unreleased)

* `github.com/patrickcping/pingone-go-sdk-v2` : v0.11.4
* `github.com/patrickcping/pingone-go-sdk-v2` : v0.12.0
* **Note** Upgrade GO to `v1.21` [#306](https://github.com/patrickcping/pingone-go-sdk-v2/pull/306)
* **Enhancement** Add ability to append custom user-agent information to HTTP requests. [#305](https://github.com/patrickcping/pingone-go-sdk-v2/pull/305)
* `github.com/patrickcping/pingone-go-sdk-v2/agreementmanagement` : [v0.3.1](./agreementmanagement/CHANGELOG.md)
Expand Down Expand Up @@ -31,6 +31,8 @@
* **Note** Upgrade GO to `v1.21` [#306](https://github.com/patrickcping/pingone-go-sdk-v2/pull/306)
* **Note** Updated the default UserAgent string format. [#305](https://github.com/patrickcping/pingone-go-sdk-v2/pull/305)
* **Enhancement** Add ability to append custom user-agent information to HTTP requests. [#305](https://github.com/patrickcping/pingone-go-sdk-v2/pull/305)
* `github.com/patrickcping/pingone-go-sdk-v2/management` : [v0.35.0](./management/CHANGELOG.md)
* **Breaking Change** Add ability to use a freetext region code on environment creation for non-production environments. The `Region` parameter on the `Environment` object model now takes a `EnvironmentRegion` object, where one of `EnumRegionCode` or `string`. [#304](https://github.com/patrickcping/pingone-go-sdk-v2/pull/304)

# Release (2023-12-27)

Expand Down
2 changes: 2 additions & 0 deletions management/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ docs/EnumUserVerifyStatus.md
docs/Environment.md
docs/EnvironmentLicense.md
docs/EnvironmentOrganization.md
docs/EnvironmentRegion.md
docs/EnvironmentsApi.md
docs/FlowPoliciesApi.md
docs/FlowPolicy.md
Expand Down Expand Up @@ -847,6 +848,7 @@ model_enum_user_verify_status.go
model_environment.go
model_environment_license.go
model_environment_organization.go
model_environment_region.go
model_flow_policy.go
model_flow_policy_application.go
model_flow_policy_assignment.go
Expand Down
2 changes: 1 addition & 1 deletion management/.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.34.1
0.35.0
3 changes: 2 additions & 1 deletion management/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# v0.34.1 (Unreleased)
# v0.35.0 (Unreleased)

* **Breaking Change** Add ability to use a freetext region code on environment creation for non-production environments. The `Region` parameter on the `Environment` object model now takes a `EnvironmentRegion` object, where one of `EnumRegionCode` or `string`. [#304](https://github.com/patrickcping/pingone-go-sdk-v2/pull/304)
* **Note** Upgrade GO to `v1.21` [#306](https://github.com/patrickcping/pingone-go-sdk-v2/pull/306)
* **Note** Updated the default UserAgent string format. [#305](https://github.com/patrickcping/pingone-go-sdk-v2/pull/305)
* **Enhancement** Add ability to append custom user-agent information to HTTP requests. [#305](https://github.com/patrickcping/pingone-go-sdk-v2/pull/305)
Expand Down
3 changes: 2 additions & 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: 2023-06-29
- Package version: 0.34.1
- Package version: 0.35.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen

## Installation
Expand Down Expand Up @@ -638,6 +638,7 @@ Class | Method | HTTP request | Description
- [Environment](docs/Environment.md)
- [EnvironmentLicense](docs/EnvironmentLicense.md)
- [EnvironmentOrganization](docs/EnvironmentOrganization.md)
- [EnvironmentRegion](docs/EnvironmentRegion.md)
- [FlowPolicy](docs/FlowPolicy.md)
- [FlowPolicyApplication](docs/FlowPolicyApplication.md)
- [FlowPolicyAssignment](docs/FlowPolicyAssignment.md)
Expand Down
6 changes: 5 additions & 1 deletion management/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29582,7 +29582,7 @@ components:
organization:
$ref: '#/components/schemas/Environment_organization'
region:
$ref: '#/components/schemas/EnumRegionCode'
$ref: '#/components/schemas/Environment_region'
type:
$ref: '#/components/schemas/EnumEnvironmentType'
updatedAt:
Expand Down Expand Up @@ -37273,6 +37273,10 @@ components:
identifier associated with the environment.
type: string
type: object
Environment_region:
oneOf:
- $ref: '#/components/schemas/EnumRegionCode'
- type: string
FlowPolicy_application:
description: An object that specifies the application information associated
with the flow policy resource.
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.

10 changes: 5 additions & 5 deletions management/docs/Environment.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ Name | Type | Description | Notes
**License** | [**EnvironmentLicense**](EnvironmentLicense.md) | |
**Name** | **string** | A string that specifies the environment name, which must be provided and must be unique within an organization. |
**Organization** | Pointer to [**EnvironmentOrganization**](EnvironmentOrganization.md) | | [optional]
**Region** | [**EnumRegionCode**](EnumRegionCode.md) | |
**Region** | [**EnvironmentRegion**](EnvironmentRegion.md) | |
**Type** | [**EnumEnvironmentType**](EnumEnvironmentType.md) | |
**UpdatedAt** | Pointer to **string** | The time the resource was last updated. | [optional] [readonly]

## Methods

### NewEnvironment

`func NewEnvironment(license EnvironmentLicense, name string, region EnumRegionCode, type_ EnumEnvironmentType, ) *Environment`
`func NewEnvironment(license EnvironmentLicense, name string, region EnvironmentRegion, type_ EnumEnvironmentType, ) *Environment`

NewEnvironment instantiates a new Environment object
This constructor will assign default values to properties that have it defined,
Expand Down Expand Up @@ -227,20 +227,20 @@ HasOrganization returns a boolean if a field has been set.

### GetRegion

`func (o *Environment) GetRegion() EnumRegionCode`
`func (o *Environment) GetRegion() EnvironmentRegion`

GetRegion returns the Region field if non-nil, zero value otherwise.

### GetRegionOk

`func (o *Environment) GetRegionOk() (*EnumRegionCode, bool)`
`func (o *Environment) GetRegionOk() (*EnvironmentRegion, bool)`

GetRegionOk returns a tuple with the Region field if it's non-nil, zero value otherwise
and a boolean to check if the value has been set.

### SetRegion

`func (o *Environment) SetRegion(v EnumRegionCode)`
`func (o *Environment) SetRegion(v EnvironmentRegion)`

SetRegion sets Region field to given value.

Expand Down
30 changes: 30 additions & 0 deletions management/docs/EnvironmentRegion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# EnvironmentRegion

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------

## Methods

### NewEnvironmentRegion

`func NewEnvironmentRegion() *EnvironmentRegion`

NewEnvironmentRegion instantiates a new EnvironmentRegion object
This constructor will assign default values to properties that have it defined,
and makes sure properties required by API are set, but the set of arguments
will change when the set of required properties is changed

### NewEnvironmentRegionWithDefaults

`func NewEnvironmentRegionWithDefaults() *EnvironmentRegion`

NewEnvironmentRegionWithDefaults instantiates a new EnvironmentRegion object
This constructor will only assign default values to properties that have it defined,
but it doesn't guarantee that properties required by API are set


[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


4 changes: 2 additions & 2 deletions management/docs/EnvironmentsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
)

func main() {
environment := *openapiclient.NewEnvironment(*openapiclient.NewEnvironmentLicense("Id_example"), "Name_example", openapiclient.EnumRegionCode("AP"), openapiclient.EnumEnvironmentType("PRODUCTION")) // Environment | (optional)
environment := *openapiclient.NewEnvironment(*openapiclient.NewEnvironmentLicense("Id_example"), "Name_example", openapiclient.Environment_region{EnumRegionCode: openapiclient.EnumRegionCode("AP")}, openapiclient.EnumEnvironmentType("PRODUCTION")) // Environment | (optional)

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
Expand Down Expand Up @@ -299,7 +299,7 @@ import (

func main() {
environmentID := "environmentID_example" // string |
environment := *openapiclient.NewEnvironment(*openapiclient.NewEnvironmentLicense("Id_example"), "Name_example", openapiclient.EnumRegionCode("AP"), openapiclient.EnumEnvironmentType("PRODUCTION")) // Environment | (optional)
environment := *openapiclient.NewEnvironment(*openapiclient.NewEnvironmentLicense("Id_example"), "Name_example", openapiclient.Environment_region{EnumRegionCode: openapiclient.EnumRegionCode("AP")}, openapiclient.EnumEnvironmentType("PRODUCTION")) // Environment | (optional)

configuration := openapiclient.NewConfiguration()
apiClient := openapiclient.NewAPIClient(configuration)
Expand Down
4 changes: 3 additions & 1 deletion management/generate/pingone-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2095,7 +2095,9 @@ components:
type: string
description: A string that specifies the organization resource’s unique identifier associated with the environment.
region:
$ref: '#/components/schemas/EnumRegionCode'
oneOf:
- $ref: '#/components/schemas/EnumRegionCode'
- type: string
type:
$ref: '#/components/schemas/EnumEnvironmentType'
updatedAt:
Expand Down
46 changes: 46 additions & 0 deletions management/generate/postprocessing/generate-replace-regex.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,52 @@ var (
"math/big"`,
},

// Management: EnvironmentRegion model
{
fileSelectPattern: "model_environment_region.go",
pattern: `(func \(dst \*EnvironmentRegion\) UnmarshalJSON\(data \[\]byte\) error \{\n)((.*)\n)*\}\n\n\/\/ Marshal data from the first non-nil pointers in the struct to JSON`,
repl: `func (dst *EnvironmentRegion) UnmarshalJSON(data []byte) error {
var err error
match := false
// try to unmarshal data into EnumRegionCode
err = newStrictDecoder(data).Decode(&dst.EnumRegionCode)
if err == nil {
jsonEnumRegionCode, _ := json.Marshal(dst.EnumRegionCode)
if string(jsonEnumRegionCode) == "{}" { // empty struct
dst.EnumRegionCode = nil
} else {
match = true
}
} else {
dst.EnumRegionCode = nil
}
if !match {
// try to unmarshal data into String
err = newStrictDecoder(data).Decode(&dst.String)
if err == nil {
jsonString, _ := json.Marshal(dst.String)
if string(jsonString) == "{}" { // empty struct
dst.String = nil
} else {
match = true
}
} else {
dst.String = nil
}
}
if !match { // no match
return fmt.Errorf("data failed to match schemas in oneOf(EnvironmentRegion)")
}
return nil
}
// Marshal data from the first non-nil pointers in the struct to JSON`,
},

// Management: FormField model
{
fileSelectPattern: "model_form_field.go",
Expand Down
12 changes: 6 additions & 6 deletions management/model_environment.go

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

Loading

0 comments on commit 8fa6599

Please sign in to comment.