-
Notifications
You must be signed in to change notification settings - Fork 2
add platform export --service-group flag (for PingOne connectors) #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wesleymccollam
merged 12 commits into
main
from
platform-export-service-group-flag-pingone
Mar 20, 2025
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
7e9e610
add platform export --service-group flag for PingOne connectors, upda…
wesleymccollam e52049f
set export service group properly
wesleymccollam 48daeda
update default viper config for test, correct doc
wesleymccollam 0f7e27d
add PlatformExportServiceGroupOption to options, update list keys test
wesleymccollam 630c31f
fix services multiple same value bug, allow services and service grou…
wesleymccollam 8149454
Merge branch 'main' into platform-export-service-group-flag-pingone
wesleymccollam 61c2105
reinsert export service group, set value properly, ensure no duplicat…
wesleymccollam 82b88ae
rename and move method for retrieving services in group, update equal…
wesleymccollam 46cc4be
remove duplicate default idp population in test as it was a result of…
wesleymccollam f058ec1
correct export service group type in config setvalue
wesleymccollam 48f8846
remove uneeded slice validation case for export service group, update…
wesleymccollam da7b123
edit service group method, update export test to use cobraparamname, …
wesleymccollam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| package customtypes | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "slices" | ||
| "strings" | ||
|
|
||
| "github.com/spf13/pflag" | ||
| ) | ||
|
|
||
| const ( | ||
| ENUM_EXPORT_SERVICE_GROUP_PINGONE string = "pingone" | ||
| ) | ||
|
|
||
| type ExportServiceGroup string | ||
|
|
||
| // Verify that the custom type satisfies the pflag.Value interface | ||
| var _ pflag.Value = (*ExportServiceGroup)(nil) | ||
|
|
||
| func (esg *ExportServiceGroup) Set(serviceGroup string) error { | ||
| if esg == nil { | ||
| return fmt.Errorf("failed to set ExportServiceGroup value: %s. ExportServiceGroup is nil", serviceGroup) | ||
| } | ||
|
|
||
| if serviceGroup == "" { | ||
| return nil | ||
| } | ||
|
|
||
| switch { | ||
| case strings.EqualFold(ENUM_EXPORT_SERVICE_GROUP_PINGONE, serviceGroup): | ||
| *esg = ExportServiceGroup(ENUM_EXPORT_SERVICE_GROUP_PINGONE) | ||
| default: | ||
| return fmt.Errorf("unrecognized service group '%s'. Must be one of: %s", serviceGroup, strings.Join(ExportServiceGroupValidValues(), ", ")) | ||
| } | ||
| return nil | ||
| } | ||
|
|
||
| func (esg ExportServiceGroup) Type() string { | ||
| return "string" | ||
| } | ||
|
|
||
| func (esg ExportServiceGroup) String() string { | ||
| return string(esg) | ||
| } | ||
|
|
||
| func ExportServiceGroupValidValues() []string { | ||
| validServiceGroups := []string{ | ||
| ENUM_EXPORT_SERVICE_GROUP_PINGONE, | ||
| } | ||
|
|
||
| slices.Sort(validServiceGroups) | ||
|
|
||
| return validServiceGroups | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| package customtypes_test | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/pingidentity/pingcli/internal/customtypes" | ||
| "github.com/pingidentity/pingcli/internal/testing/testutils" | ||
| ) | ||
|
|
||
| // Test ExportServiceGroup Set function | ||
| func Test_ExportServiceGroup_Set(t *testing.T) { | ||
| // Create a new ExportServiceGroup | ||
| esg := new(customtypes.ExportServiceGroup) | ||
|
|
||
| err := esg.Set(customtypes.ENUM_EXPORT_SERVICE_GROUP_PINGONE) | ||
| if err != nil { | ||
| t.Errorf("Set returned error: %v", err) | ||
| } | ||
| } | ||
|
|
||
| // Test ExportServiceGroup Set function fails with invalid value | ||
| func Test_ExportServiceGroup_Set_InvalidValue(t *testing.T) { | ||
| // Create a new ExportServiceGroup | ||
| esg := new(customtypes.ExportServiceGroup) | ||
|
|
||
| invalidValue := "invalid" | ||
|
|
||
| expectedErrorPattern := `^unrecognized service group .*\. Must be one of: .*$` | ||
| err := esg.Set(invalidValue) | ||
| testutils.CheckExpectedError(t, err, &expectedErrorPattern) | ||
| } | ||
|
|
||
| // Test ExportServiceGroup Set function fails with nil | ||
| func Test_ExportServiceGroup_Set_Nil(t *testing.T) { | ||
| var esg *customtypes.ExportServiceGroup | ||
|
|
||
| val := customtypes.ENUM_EXPORT_SERVICE_GROUP_PINGONE | ||
|
|
||
| expectedErrorPattern := `^failed to set ExportServiceGroup value: .* ExportServiceGroup is nil$` | ||
| err := esg.Set(val) | ||
| testutils.CheckExpectedError(t, err, &expectedErrorPattern) | ||
| } | ||
|
|
||
| // Test ExportServiceGroup Valid Values returns expected amount | ||
| func Test_ExportServiceGroupValidValues(t *testing.T) { | ||
| serviceGroupEnum := customtypes.ENUM_EXPORT_SERVICE_GROUP_PINGONE | ||
|
|
||
| serviceGroupValidValues := customtypes.ExportServiceGroupValidValues() | ||
| if serviceGroupValidValues[0] != serviceGroupEnum { | ||
| t.Errorf("ExportServiceGroupValidValues returned: %v, expected: %v", serviceGroupValidValues, serviceGroupEnum) | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.