From 251f1121354c46831e3b206773ab0b891dc054cb Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Fri, 31 Jan 2025 14:57:51 -0700 Subject: [PATCH 01/18] CDI-355: Favor Export Failure Warnings Over Errors - Update WriteFiles() to warn on fail ExportAll() for a resource, and continue processing remaing resources for the service connector. --- internal/connector/common/common_utils.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/connector/common/common_utils.go b/internal/connector/common/common_utils.go index b54012a7..10fd8871 100644 --- a/internal/connector/common/common_utils.go +++ b/internal/connector/common/common_utils.go @@ -12,6 +12,7 @@ import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/customtypes" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/output" ) func WriteFiles(exportableResources []connector.ExportableResource, format, outputDir string, overwriteExport bool) error { @@ -26,7 +27,8 @@ func WriteFiles(exportableResources []connector.ExportableResource, format, outp for _, exportableResource := range exportableResources { importBlocks, err := exportableResource.ExportAll() if err != nil { - return fmt.Errorf("failed to export resource %s. err: %s", exportableResource.ResourceType(), err.Error()) + output.Warn(fmt.Sprintf("Failed to export resource %s. err: %v", exportableResource.ResourceType(), err), nil) + continue } if len(*importBlocks) == 0 { From 49b164616cded8ecdda2f42d190bbd3f609fb873 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Fri, 31 Jan 2025 15:15:06 -0700 Subject: [PATCH 02/18] Use option configuration environment variables for PF provider initialization --- .../testutils_terraform/terraform_utils.go | 30 +++++++++---------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/internal/testing/testutils_terraform/terraform_utils.go b/internal/testing/testutils_terraform/terraform_utils.go index 4010a5db..fe5e3d64 100644 --- a/internal/testing/testutils_terraform/terraform_utils.go +++ b/internal/testing/testutils_terraform/terraform_utils.go @@ -11,6 +11,7 @@ import ( "strings" "testing" + "github.com/pingidentity/pingcli/internal/configuration/options" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/customtypes" @@ -199,23 +200,20 @@ func InitPingFederateTerraform(t *testing.T) { } provider "pingfederate" { - client_id = "%s" - client_secret = "%s" - scopes = ["%s"] - token_url = "%s" - https_host = "%s" - admin_api_path = "%s" - product_version = "12.2" - insecure_trust_all_tls = true - x_bypass_external_validation_header = true + username = "%s" + password = "%s" + https_host = "%s" + admin_api_path = "%s" + product_version = "12.2" + insecure_trust_all_tls = true + x_bypass_external_validation_header = true } -`, os.Getenv("PINGCLI_PINGFEDERATE_PROVIDER_VERSION"), - os.Getenv("PINGCLI_PINGFEDERATE_CLIENT_ID"), - os.Getenv("PINGCLI_PINGFEDERATE_CLIENT_SECRET"), - os.Getenv("PINGCLI_PINGFEDERATE_SCOPES"), - os.Getenv("PINGCLI_PINGFEDERATE_TOKEN_URL"), - os.Getenv("PINGCLI_PINGFEDERATE_HTTPS_HOST"), - os.Getenv("PINGCLI_PINGFEDERATE_ADMIN_API_PATH")) +`, + os.Getenv("PINGCLI_PINGFEDERATE_PROVIDER_VERSION"), + os.Getenv(options.PingFederateBasicAuthUsernameOption.EnvVar), + os.Getenv(options.PingFederateBasicAuthPasswordOption.EnvVar), + os.Getenv(options.PingFederateHTTPSHostOption.EnvVar), + os.Getenv(options.PingFederateAdminAPIPathOption.EnvVar)) // Write main.tf to testing directory mainTFFilepath := filepath.Join(exportDir, "main.tf") From c74d38126715f6f1e150bc34042bc93288deeef6 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Wed, 5 Feb 2025 16:51:12 -0700 Subject: [PATCH 03/18] Update HandleClientResponse to warn on client error and 403 forbidden responses. --- Makefile | 2 +- go.mod | 4 +- go.sum | 8 +- internal/commands/platform/export_internal.go | 5 +- internal/connector/common/common_utils.go | 4 +- internal/connector/common/resources_common.go | 39 +- ...federate_authentication_api_application.go | 5 +- ...derate_authentication_policies_fragment.go | 5 +- ...federate_authentication_policy_contract.go | 5 +- .../pingfederate_authentication_selector.go | 5 +- .../pingfederate_captcha_provider.go | 5 +- .../resources/pingfederate_certificate_ca.go | 5 +- ...ertificates_revocation_ocsp_certificate.go | 5 +- .../resources/pingfederate_data_store.go | 5 +- ...pingfederate_identity_store_provisioner.go | 5 +- .../resources/pingfederate_idp_adapter.go | 5 +- .../pingfederate_idp_sp_connection.go | 5 +- ...ate_idp_sts_request_parameters_contract.go | 5 +- .../pingfederate_idp_to_sp_adapter_mapping.go | 5 +- .../pingfederate_idp_token_processor.go | 5 +- .../resources/pingfederate_kerberos_realm.go | 5 +- ...oauth_openid_connect_additional_key_set.go | 5 +- ..._keypairs_signing_key_rotation_settings.go | 5 +- .../pingfederate_local_identity_profile.go | 5 +- .../resources/pingfederate_metadata_url.go | 5 +- .../pingfederate_notification_publisher.go | 5 +- ...pingfederate_oauth_access_token_manager.go | 5 +- ...pingfederate_oauth_access_token_mapping.go | 5 +- ..._authentication_policy_contract_mapping.go | 5 +- ...oauth_ciba_server_policy_request_policy.go | 5 +- .../resources/pingfederate_oauth_client.go | 5 +- ...derate_oauth_client_registration_policy.go | 5 +- .../pingfederate_oauth_idp_adapter_mapping.go | 5 +- .../resources/pingfederate_oauth_issuer.go | 5 +- ..._token_exchange_token_generator_mapping.go | 5 +- .../pingfederate_openid_connect_policy.go | 5 +- ...gfederate_password_credential_validator.go | 5 +- .../pingfederate_pingone_connection.go | 5 +- .../resources/pingfederate_secret_manager.go | 5 +- ...s_trust_sts_settings_issuer_certificate.go | 5 +- ...gfederate_session_authentication_policy.go | 5 +- .../resources/pingfederate_sp_adapter.go | 5 +- ..._authentication_policy_contract_mapping.go | 5 +- .../pingfederate_sp_idp_connection.go | 5 +- ...en_processor_to_token_generator_mapping.go | 5 +- ...pingone_mfa_application_push_credential.go | 10 +- .../resources/pingone_mfa_device_policy.go | 5 +- .../mfa/resources/pingone_mfa_fido2_policy.go | 5 +- .../mfa/resources/pingone_mfa_settings.go | 5 +- .../platform/resources/pingone_agreement.go | 5 +- .../pingone_agreement_localization.go | 10 +- ...pingone_agreement_localization_revision.go | 15 +- .../resources/pingone_branding_settings.go | 5 +- .../resources/pingone_branding_theme.go | 5 +- .../pingone_branding_theme_default.go | 5 +- .../platform/resources/pingone_certificate.go | 5 +- .../resources/pingone_custom_domain.go | 5 +- .../platform/resources/pingone_environment.go | 5 +- .../platform/resources/pingone_form.go | 5 +- .../resources/pingone_forms_recaptcha_v2.go | 5 +- .../platform/resources/pingone_gateway.go | 5 +- .../resources/pingone_gateway_credential.go | 10 +- .../pingone_gateway_role_assignment.go | 15 +- .../pingone_identity_propagation_plan.go | 5 +- .../pingone/platform/resources/pingone_key.go | 5 +- .../resources/pingone_key_rotation_policy.go | 5 +- .../platform/resources/pingone_language.go | 5 +- .../resources/pingone_language_update.go | 5 +- .../resources/pingone_notification_policy.go | 5 +- .../pingone_notification_settings.go | 5 +- .../pingone_notification_settings_email.go | 5 +- .../pingone_notification_template_content.go | 15 +- .../pingone_phone_delivery_settings.go | 5 +- .../resources/pingone_system_application.go | 5 +- .../pingone_trusted_email_address.go | 10 +- .../resources/pingone_trusted_email_domain.go | 5 +- .../platform/resources/pingone_webhook.go | 5 +- .../protect/resources/pingone_risk_policy.go | 5 +- .../resources/pingone_risk_predictor.go | 5 +- .../sso/resources/pingone_application.go | 5 +- .../pingone_application_attribute_mapping.go | 10 +- ...gone_application_flow_policy_assignment.go | 15 +- .../pingone_application_resource_grant.go | 15 +- .../pingone_application_role_assignment.go | 15 +- .../resources/pingone_application_secret.go | 5 +- ...e_application_sign_on_policy_assignment.go | 15 +- .../pingone/sso/resources/pingone_group.go | 5 +- .../sso/resources/pingone_group_nesting.go | 10 +- .../pingone_group_role_assignment.go | 15 +- .../resources/pingone_identity_provider.go | 5 +- .../pingone_identity_provider_attribute.go | 10 +- .../sso/resources/pingone_password_policy.go | 5 +- .../sso/resources/pingone_population.go | 5 +- .../resources/pingone_population_default.go | 5 +- .../pingone/sso/resources/pingone_resource.go | 5 +- .../resources/pingone_resource_attribute.go | 10 +- .../sso/resources/pingone_resource_scope.go | 10 +- .../pingone_resource_scope_openid.go | 10 +- .../pingone_resource_scope_pingone_api.go | 10 +- .../sso/resources/pingone_schema_attribute.go | 10 +- .../sso/resources/pingone_sign_on_policy.go | 5 +- .../pingone_sign_on_policy_action.go | 10 +- .../testutils_terraform/terraform_utils.go | 14 +- server-profiles/12.2/data.json | 4748 +++++++++++++++++ 104 files changed, 5296 insertions(+), 153 deletions(-) create mode 100644 server-profiles/12.2/data.json diff --git a/Makefile b/Makefile index e3cb2c6c..3d3e4fc1 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ starttestcontainer: -p 9999:9999 \ --env-file "${HOME}/.pingidentity/config" \ -v $$(pwd)/server-profiles/shared-profile:/opt/in \ - -v $$(pwd)/server-profiles/12.1/data.json:/opt/in/instance/bulk-config/data.json \ + -v $$(pwd)/server-profiles/12.2/data.json:/opt/in/instance/bulk-config/data.json \ pingidentity/pingfederate:latest # Wait for the instance to become ready sleep 1 diff --git a/go.mod b/go.mod index b8ef9225..c9fff6cf 100644 --- a/go.mod +++ b/go.mod @@ -7,8 +7,8 @@ require ( github.com/golangci/golangci-lint v1.63.4 github.com/hashicorp/go-uuid v1.0.3 github.com/manifoldco/promptui v0.9.0 - github.com/patrickcping/pingone-go-sdk-v2 v0.12.7 - github.com/patrickcping/pingone-go-sdk-v2/management v0.47.0 + github.com/patrickcping/pingone-go-sdk-v2 v0.12.8 + github.com/patrickcping/pingone-go-sdk-v2/management v0.48.0 github.com/patrickcping/pingone-go-sdk-v2/risk v0.18.0 github.com/pavius/impi v0.0.3 github.com/pingidentity/pingfederate-go-client/v1210 v1210.0.5 diff --git a/go.sum b/go.sum index d311715d..4d5ce69a 100644 --- a/go.sum +++ b/go.sum @@ -429,14 +429,14 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/patrickcping/pingone-go-sdk-v2 v0.12.7 h1:WLf3SlHOe4dVk1L19WPPH0FImiDFclq0JDfLxPsDpeo= -github.com/patrickcping/pingone-go-sdk-v2 v0.12.7/go.mod h1:y5z08CFU/XWhIk4iNvb/7Zy2QrESliqF3wE5LgYbVOc= +github.com/patrickcping/pingone-go-sdk-v2 v0.12.8 h1:H2Ao3AnTcZy6sVIM1EsUxxI9Jcp68CUtRD++wM0YEoU= +github.com/patrickcping/pingone-go-sdk-v2 v0.12.8/go.mod h1:2/daXohYVj3lkcVI+OHoFyp7pePbcDSibNHFNIA/vmo= github.com/patrickcping/pingone-go-sdk-v2/authorize v0.7.0 h1:e36HmxvHy3zmt9oKHlTTgImSt1Q71RT05i6Kp4EwxWU= github.com/patrickcping/pingone-go-sdk-v2/authorize v0.7.0/go.mod h1:2PDrgC1ufXk2IDIk4JQHx6r34r2xpkbnzKIpXFv8gYs= github.com/patrickcping/pingone-go-sdk-v2/credentials v0.10.0 h1:NziAU4J3b18hw/4L+4TpCOBS+kd9srQR2R3xP0aEbNw= github.com/patrickcping/pingone-go-sdk-v2/credentials v0.10.0/go.mod h1:yRGf7+tsB3/AQYsNjIIs4ScJhR885mvDYMgwHiQeMl0= -github.com/patrickcping/pingone-go-sdk-v2/management v0.47.0 h1:1QFj4aVGinQKl9XRda3eke4SUUqOguNyj+4rj0bGxHM= -github.com/patrickcping/pingone-go-sdk-v2/management v0.47.0/go.mod h1:oLB/jjAkn4oEA60nC5/0KAobvcNJbflOWnVaS6lKxv8= +github.com/patrickcping/pingone-go-sdk-v2/management v0.48.0 h1:bbgLieYsigArtPUmT80sfxaZkG660+NhuFnOkA2vxU4= +github.com/patrickcping/pingone-go-sdk-v2/management v0.48.0/go.mod h1:oLB/jjAkn4oEA60nC5/0KAobvcNJbflOWnVaS6lKxv8= github.com/patrickcping/pingone-go-sdk-v2/mfa v0.22.0 h1:ldFQInE64TGiJp61ApCJ+NtUGV3Z3VneYpomZHJbyo0= github.com/patrickcping/pingone-go-sdk-v2/mfa v0.22.0/go.mod h1:Q+Ym6kktv5Y6VnVhDt//lWoOhmIKfyjo6ejRx5mLttY= github.com/patrickcping/pingone-go-sdk-v2/risk v0.18.0 h1:+Ogq2g0s0i+SU/NoJg9+pL5+3iPyK9tFUWrDC3scHR8= diff --git a/internal/commands/platform/export_internal.go b/internal/commands/platform/export_internal.go index d90a21f0..9df593cf 100644 --- a/internal/commands/platform/export_internal.go +++ b/internal/commands/platform/export_internal.go @@ -430,10 +430,13 @@ func validatePingOneExportEnvID(ctx context.Context) (err error) { } environment, response, err := pingoneApiClient.ManagementAPIClient.EnvironmentsApi.ReadOneEnvironment(ctx, pingoneExportEnvID).Execute() - err = common.HandleClientResponse(response, err, "ReadOneEnvironment", "pingone_environment") + ok, err := common.HandleClientResponse(response, err, "ReadOneEnvironment", "pingone_environment") if err != nil { return err } + if !ok { + return fmt.Errorf("failed to validate pingone environment ID '%s'.", pingoneExportEnvID) + } if environment == nil { return fmt.Errorf("failed to validate pingone environment ID '%s'. environment matching ID does not exist", pingoneExportEnvID) diff --git a/internal/connector/common/common_utils.go b/internal/connector/common/common_utils.go index 10fd8871..b54012a7 100644 --- a/internal/connector/common/common_utils.go +++ b/internal/connector/common/common_utils.go @@ -12,7 +12,6 @@ import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/customtypes" "github.com/pingidentity/pingcli/internal/logger" - "github.com/pingidentity/pingcli/internal/output" ) func WriteFiles(exportableResources []connector.ExportableResource, format, outputDir string, overwriteExport bool) error { @@ -27,8 +26,7 @@ func WriteFiles(exportableResources []connector.ExportableResource, format, outp for _, exportableResource := range exportableResources { importBlocks, err := exportableResource.ExportAll() if err != nil { - output.Warn(fmt.Sprintf("Failed to export resource %s. err: %v", exportableResource.ResourceType(), err), nil) - continue + return fmt.Errorf("failed to export resource %s. err: %s", exportableResource.ResourceType(), err.Error()) } if len(*importBlocks) == 0 { diff --git a/internal/connector/common/resources_common.go b/internal/connector/common/resources_common.go index f01bb25c..ff9d5b15 100644 --- a/internal/connector/common/resources_common.go +++ b/internal/connector/common/resources_common.go @@ -6,29 +6,48 @@ import ( "net/http" "slices" - "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/output" ) const ( SINGLETON_ID_COMMENT_DATA = "This resource is a singleton, so the value of 'ID' in the import block does not matter - it is just a placeholder and required by terraform." ) -func HandleClientResponse(response *http.Response, err error, apiFunctionName string, resourceType string) error { - l := logger.Get() +func HandleClientResponse(response *http.Response, err error, apiFunctionName string, resourceType string) (bool, error) { + if err != nil { + // Only warn the user on client error and skip export of resource + output.Warn("Service API client error.", map[string]interface{}{ + "api_function": apiFunctionName, + "error": err, + "resource": resourceType, + }) - if response == nil { - l.Error().Err(err).Msgf("%s Request for resource '%s' was not successful. Response is nil.", apiFunctionName, resourceType) - return fmt.Errorf("%s Request for resource '%s' was not successful. Response is nil. Error: %v", apiFunctionName, resourceType, err) + return false, nil } + if response == nil { + return false, fmt.Errorf("%s Request for resource '%s' was not successful. Response is nil.", apiFunctionName, resourceType) + } defer response.Body.Close() - if err != nil || response.StatusCode >= 300 || response.StatusCode < 200 { - l.Error().Err(err).Msgf("%s Request for resource '%s' was not successful. \nResponse Code: %s\nResponse Body: %s", apiFunctionName, resourceType, response.Status, response.Body) - return fmt.Errorf("%s Request for resource '%s' was not successful. \nResponse Code: %s\nResponse Body: %s\n Error: %v", apiFunctionName, resourceType, response.Status, response.Body, err) + // When the client returns forbidden, warn user and skip export of resource + if response.StatusCode == 403 { + output.Warn("Service API client 403 forbidden response.", map[string]interface{}{ + "api_function": apiFunctionName, + "resource": resourceType, + "response_code": response.StatusCode, + "response_body": response.Body, + }) + + return false, nil + } + + // Error on any other non-200 response + if response.StatusCode >= 300 || response.StatusCode < 200 { + return false, fmt.Errorf("%s Request for resource '%s' was not successful. \nResponse Code: %s\nResponse Body: %s", apiFunctionName, resourceType, response.Status, response.Body) } - return nil + return true, nil } func DataNilError(resourceType string, response *http.Response) error { diff --git a/internal/connector/pingfederate/resources/pingfederate_authentication_api_application.go b/internal/connector/pingfederate/resources/pingfederate_authentication_api_application.go index 49ab9b5e..b2a3140f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_authentication_api_application.go +++ b/internal/connector/pingfederate/resources/pingfederate_authentication_api_application.go @@ -61,10 +61,13 @@ func (r *PingFederateAuthenticationApiApplicationResource) getApplicationData() applicationData := make(map[string]string) authnApiApplications, response, err := r.clientInfo.ApiClient.AuthenticationApiAPI.GetAuthenticationApiApplications(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetAuthenticationApiApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetAuthenticationApiApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if authnApiApplications == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_authentication_policies_fragment.go b/internal/connector/pingfederate/resources/pingfederate_authentication_policies_fragment.go index 89ab1416..8f65dc1b 100644 --- a/internal/connector/pingfederate/resources/pingfederate_authentication_policies_fragment.go +++ b/internal/connector/pingfederate/resources/pingfederate_authentication_policies_fragment.go @@ -61,10 +61,13 @@ func (r *PingFederateAuthenticationPoliciesFragmentResource) getFragmentData() ( fragmentData := make(map[string]string) authnPoliciesFragments, response, err := r.clientInfo.ApiClient.AuthenticationPoliciesAPI.GetFragments(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetFragments", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetFragments", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if authnPoliciesFragments == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_authentication_policy_contract.go b/internal/connector/pingfederate/resources/pingfederate_authentication_policy_contract.go index 819f0f08..cbf24c2f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_authentication_policy_contract.go +++ b/internal/connector/pingfederate/resources/pingfederate_authentication_policy_contract.go @@ -61,10 +61,13 @@ func (r *PingFederateAuthenticationPolicyContractResource) getAuthenticationPoli authenticationPolicyContractData := make(map[string]string) authnPolicyContracts, response, err := r.clientInfo.ApiClient.AuthenticationPolicyContractsAPI.GetAuthenticationPolicyContracts(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetAuthenticationPolicyContracts", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetAuthenticationPolicyContracts", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if authnPolicyContracts == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_authentication_selector.go b/internal/connector/pingfederate/resources/pingfederate_authentication_selector.go index 9fb02cd5..1efca450 100644 --- a/internal/connector/pingfederate/resources/pingfederate_authentication_selector.go +++ b/internal/connector/pingfederate/resources/pingfederate_authentication_selector.go @@ -61,10 +61,13 @@ func (r *PingFederateAuthenticationSelectorResource) getAuthenticationSelectorDa authenticationSelectorData := make(map[string]string) authnSelectors, response, err := r.clientInfo.ApiClient.AuthenticationSelectorsAPI.GetAuthenticationSelectors(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetAuthenticationSelectors", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetAuthenticationSelectors", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if authnSelectors == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_captcha_provider.go b/internal/connector/pingfederate/resources/pingfederate_captcha_provider.go index 2c355d63..9dc64b44 100644 --- a/internal/connector/pingfederate/resources/pingfederate_captcha_provider.go +++ b/internal/connector/pingfederate/resources/pingfederate_captcha_provider.go @@ -61,10 +61,13 @@ func (r *PingFederateCaptchaProviderResource) getCaptchaProviderData() (*map[str captchaProviderData := make(map[string]string) captchaProviders, response, err := r.clientInfo.ApiClient.CaptchaProvidersAPI.GetCaptchaProviders(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetCaptchaProviders", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetCaptchaProviders", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if captchaProviders == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_certificate_ca.go b/internal/connector/pingfederate/resources/pingfederate_certificate_ca.go index 27c6329b..d7018fe5 100644 --- a/internal/connector/pingfederate/resources/pingfederate_certificate_ca.go +++ b/internal/connector/pingfederate/resources/pingfederate_certificate_ca.go @@ -67,10 +67,13 @@ func (r *PingFederateCertificateCAResource) getTrustedCAData() (*map[string][]st trustedCAData := make(map[string][]string) certViews, response, err := r.clientInfo.ApiClient.CertificatesCaAPI.GetTrustedCAs(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetTrustedCAs", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetTrustedCAs", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if certViews == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_certificates_revocation_ocsp_certificate.go b/internal/connector/pingfederate/resources/pingfederate_certificates_revocation_ocsp_certificate.go index 832e19c1..fc41319a 100644 --- a/internal/connector/pingfederate/resources/pingfederate_certificates_revocation_ocsp_certificate.go +++ b/internal/connector/pingfederate/resources/pingfederate_certificates_revocation_ocsp_certificate.go @@ -67,10 +67,13 @@ func (r *PingFederateCertificatesRevocationOCSPCertificateResource) getOcspCerti ocspCertificateData := make(map[string][]string) ocspCertificates, response, err := r.clientInfo.ApiClient.CertificatesRevocationAPI.GetOcspCertificates(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetOcspCertificates", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetOcspCertificates", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if ocspCertificates == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_data_store.go b/internal/connector/pingfederate/resources/pingfederate_data_store.go index 2de8e196..c0e9b225 100644 --- a/internal/connector/pingfederate/resources/pingfederate_data_store.go +++ b/internal/connector/pingfederate/resources/pingfederate_data_store.go @@ -63,10 +63,13 @@ func (r *PingFederateDataStoreResource) getDataStoreData() (*map[string]string, dataStoreData := make(map[string]string) dataStores, response, err := r.clientInfo.ApiClient.DataStoresAPI.GetDataStores(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetDataStores", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetDataStores", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if dataStores == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_identity_store_provisioner.go b/internal/connector/pingfederate/resources/pingfederate_identity_store_provisioner.go index 0552db4e..6bef5746 100644 --- a/internal/connector/pingfederate/resources/pingfederate_identity_store_provisioner.go +++ b/internal/connector/pingfederate/resources/pingfederate_identity_store_provisioner.go @@ -61,10 +61,13 @@ func (r *PingFederateIdentityStoreProvisionerResource) getIdentityStoreProvision identityStoreProvisionerData := make(map[string]string) identityStoreProvisioners, response, err := r.clientInfo.ApiClient.IdentityStoreProvisionersAPI.GetIdentityStoreProvisioners(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetIdentityStoreProvisioners", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetIdentityStoreProvisioners", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if identityStoreProvisioners == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_adapter.go b/internal/connector/pingfederate/resources/pingfederate_idp_adapter.go index 92799094..fab1e2f1 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_adapter.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_adapter.go @@ -61,10 +61,13 @@ func (r *PingFederateIDPAdapterResource) getIDPAdapterData() (*map[string]string idpAdapterData := make(map[string]string) idpAdapters, response, err := r.clientInfo.ApiClient.IdpAdaptersAPI.GetIdpAdapters(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetIdpAdapters", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetIdpAdapters", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if idpAdapters == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_sp_connection.go b/internal/connector/pingfederate/resources/pingfederate_idp_sp_connection.go index eca20af7..761d3e92 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_sp_connection.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_sp_connection.go @@ -61,10 +61,13 @@ func (r *PingFederateIDPSPConnectionResource) getSpConnectionData() (*map[string spConnectionData := make(map[string]string) spConnections, response, err := r.clientInfo.ApiClient.IdpSpConnectionsAPI.GetSpConnections(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetSpConnections", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetSpConnections", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if spConnections == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_sts_request_parameters_contract.go b/internal/connector/pingfederate/resources/pingfederate_idp_sts_request_parameters_contract.go index 512c8d97..582c7b96 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_sts_request_parameters_contract.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_sts_request_parameters_contract.go @@ -61,10 +61,13 @@ func (r *PingFederateIdpStsRequestParametersContractResource) getStsRequestParam stsRequestParamContractData := make(map[string]string) stsRequestParamContracts, response, err := r.clientInfo.ApiClient.IdpStsRequestParametersContractsAPI.GetStsRequestParamContracts(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetStsRequestParamContracts", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetStsRequestParamContracts", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if stsRequestParamContracts == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_to_sp_adapter_mapping.go b/internal/connector/pingfederate/resources/pingfederate_idp_to_sp_adapter_mapping.go index 209c71c0..bb68046e 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_to_sp_adapter_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_to_sp_adapter_mapping.go @@ -63,10 +63,13 @@ func (r *PingFederateIdpToSpAdapterMappingResource) getIdpToSpAdapterMappingData idpToSpAdapterMappingData := make(map[string]string) idpToSpAdapterMappings, response, err := r.clientInfo.ApiClient.IdpToSpAdapterMappingAPI.GetIdpToSpAdapterMappings(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetIdpToSpAdapterMappings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetIdpToSpAdapterMappings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if idpToSpAdapterMappings == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_token_processor.go b/internal/connector/pingfederate/resources/pingfederate_idp_token_processor.go index a40a0faa..b1118f76 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_token_processor.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_token_processor.go @@ -61,10 +61,13 @@ func (r *PingFederateIdpTokenProcessorResource) getTokenProcessorData() (*map[st tokenProcessorData := make(map[string]string) tokenProcessors, response, err := r.clientInfo.ApiClient.IdpTokenProcessorsAPI.GetTokenProcessors(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetTokenProcessors", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetTokenProcessors", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if tokenProcessors == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_kerberos_realm.go b/internal/connector/pingfederate/resources/pingfederate_kerberos_realm.go index e5218c09..b2d48d09 100644 --- a/internal/connector/pingfederate/resources/pingfederate_kerberos_realm.go +++ b/internal/connector/pingfederate/resources/pingfederate_kerberos_realm.go @@ -61,10 +61,13 @@ func (r *PingFederateKerberosRealmResource) getKerberosRealmData() (*map[string] kerberosRealmData := make(map[string]string) kerberosRealms, response, err := r.clientInfo.ApiClient.KerberosRealmsAPI.GetKerberosRealms(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetKerberosRealms", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetKerberosRealms", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if kerberosRealms == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_keypairs_oauth_openid_connect_additional_key_set.go b/internal/connector/pingfederate/resources/pingfederate_keypairs_oauth_openid_connect_additional_key_set.go index 46554a33..4d290b95 100644 --- a/internal/connector/pingfederate/resources/pingfederate_keypairs_oauth_openid_connect_additional_key_set.go +++ b/internal/connector/pingfederate/resources/pingfederate_keypairs_oauth_openid_connect_additional_key_set.go @@ -61,10 +61,13 @@ func (r *PingFederateKeypairsOauthOpenidConnectAdditionalKeySetResource) getKeyS keySetData := make(map[string]string) keySets, response, err := r.clientInfo.ApiClient.KeyPairsOauthOpenIdConnectAPI.GetKeySets(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetKeySets", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetKeySets", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if keySets == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_keypairs_signing_key_rotation_settings.go b/internal/connector/pingfederate/resources/pingfederate_keypairs_signing_key_rotation_settings.go index b9adfe93..673ff4d2 100644 --- a/internal/connector/pingfederate/resources/pingfederate_keypairs_signing_key_rotation_settings.go +++ b/internal/connector/pingfederate/resources/pingfederate_keypairs_signing_key_rotation_settings.go @@ -67,10 +67,13 @@ func (r *PingFederateKeypairsSigningKeyRotationSettingsResource) getSigningKeyPa signingKeyPairData := make(map[string][]string) signingKeyPairs, response, err := r.clientInfo.ApiClient.KeyPairsSigningAPI.GetSigningKeyPairs(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetSigningKeyPairs", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetSigningKeyPairs", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if signingKeyPairs == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_local_identity_profile.go b/internal/connector/pingfederate/resources/pingfederate_local_identity_profile.go index d0ebe8ae..39212b08 100644 --- a/internal/connector/pingfederate/resources/pingfederate_local_identity_profile.go +++ b/internal/connector/pingfederate/resources/pingfederate_local_identity_profile.go @@ -61,10 +61,13 @@ func (r *PingFederateLocalIdentityProfileResource) getIdentityProfileData() (*ma identityProfileData := make(map[string]string) identityProfiles, response, err := r.clientInfo.ApiClient.LocalIdentityIdentityProfilesAPI.GetIdentityProfiles(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetIdentityProfiles", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetIdentityProfiles", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if identityProfiles == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_metadata_url.go b/internal/connector/pingfederate/resources/pingfederate_metadata_url.go index e60b343f..765506ae 100644 --- a/internal/connector/pingfederate/resources/pingfederate_metadata_url.go +++ b/internal/connector/pingfederate/resources/pingfederate_metadata_url.go @@ -61,10 +61,13 @@ func (r *PingFederateMetadataUrlResource) getMetadataUrlData() (*map[string]stri metadataUrlData := make(map[string]string) metadataUrls, response, err := r.clientInfo.ApiClient.MetadataUrlsAPI.GetMetadataUrls(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetMetadataUrls", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetMetadataUrls", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if metadataUrls == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_notification_publisher.go b/internal/connector/pingfederate/resources/pingfederate_notification_publisher.go index 3167ab09..3ba3cdca 100644 --- a/internal/connector/pingfederate/resources/pingfederate_notification_publisher.go +++ b/internal/connector/pingfederate/resources/pingfederate_notification_publisher.go @@ -61,10 +61,13 @@ func (r *PingFederateNotificationPublisherResource) getNotificationPublisherData notificationPublisherData := make(map[string]string) notificationPublishers, response, err := r.clientInfo.ApiClient.NotificationPublishersAPI.GetNotificationPublishers(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetNotificationPublishers", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetNotificationPublishers", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if notificationPublishers == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_manager.go b/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_manager.go index e3eeec22..43826155 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_manager.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_manager.go @@ -61,10 +61,13 @@ func (r *PingFederateOAuthAccessTokenManagerResource) getTokenManagerData() (*ma tokenManagerData := make(map[string]string) tokenManagers, response, err := r.clientInfo.ApiClient.OauthAccessTokenManagersAPI.GetTokenManagers(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetTokenManagers", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetTokenManagers", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if tokenManagers == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_mapping.go b/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_mapping.go index efe6b9a7..e345a2ff 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_mapping.go @@ -63,10 +63,13 @@ func (r *PingFederateOAuthAccessTokenMappingResource) getMappingData() (*map[str mappingData := make(map[string]string) mappings, response, err := r.clientInfo.ApiClient.OauthAccessTokenMappingsAPI.GetMappings(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetMappings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetMappings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } for _, mapping := range mappings { mappingId, mappingIdOk := mapping.GetIdOk() diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_authentication_policy_contract_mapping.go b/internal/connector/pingfederate/resources/pingfederate_oauth_authentication_policy_contract_mapping.go index d51f20c4..84480963 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_authentication_policy_contract_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_authentication_policy_contract_mapping.go @@ -62,10 +62,13 @@ func (r *PingFederateOAuthAuthenticationPolicyContractMappingResource) getApcToP apcToPersistentGrantMappingData := []string{} apcToPersistentGrantMappings, response, err := r.clientInfo.ApiClient.OauthAuthenticationPolicyContractMappingsAPI.GetApcMappings(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetApcMappings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetApcMappings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if apcToPersistentGrantMappings == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_ciba_server_policy_request_policy.go b/internal/connector/pingfederate/resources/pingfederate_oauth_ciba_server_policy_request_policy.go index dbde5ba9..9e3701db 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_ciba_server_policy_request_policy.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_ciba_server_policy_request_policy.go @@ -61,10 +61,13 @@ func (r *PingFederateOAuthCibaServerPolicyRequestPolicyResource) getRequestPolic requestPolicyData := make(map[string]string) requestPolicies, response, err := r.clientInfo.ApiClient.OauthCibaServerPolicyAPI.GetCibaServerPolicies(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetCibaServerPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetCibaServerPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if requestPolicies == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_client.go b/internal/connector/pingfederate/resources/pingfederate_oauth_client.go index 93390a07..8ae27378 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_client.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_client.go @@ -61,10 +61,13 @@ func (r *PingFederateOAuthClientResource) getOAuthClientData() (*map[string]stri oauthClientData := make(map[string]string) clients, response, err := r.clientInfo.ApiClient.OauthClientsAPI.GetOauthClients(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetOauthClients", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetOauthClients", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if clients == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_client_registration_policy.go b/internal/connector/pingfederate/resources/pingfederate_oauth_client_registration_policy.go index 1fa09d58..3e35883e 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_client_registration_policy.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_client_registration_policy.go @@ -61,10 +61,13 @@ func (r *PingFederateOAuthClientRegistrationPolicyResource) getClientRegistratio clientRegistrationPolicyData := make(map[string]string) clientRegistrationPolicies, response, err := r.clientInfo.ApiClient.OauthClientRegistrationPoliciesAPI.GetDynamicClientRegistrationPolicies(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetDynamicClientRegistrationPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetDynamicClientRegistrationPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if clientRegistrationPolicies == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_idp_adapter_mapping.go b/internal/connector/pingfederate/resources/pingfederate_oauth_idp_adapter_mapping.go index 5b0bf769..5accc77f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_idp_adapter_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_idp_adapter_mapping.go @@ -62,10 +62,13 @@ func (r *PingFederateOAuthIdpAdapterMappingResource) getIdpAdapterMappingData() idpAdapterMappingData := []string{} idpAdapterMappings, response, err := r.clientInfo.ApiClient.OauthIdpAdapterMappingsAPI.GetIdpAdapterMappings(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetIdpAdapterMappings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetIdpAdapterMappings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if idpAdapterMappings == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_issuer.go b/internal/connector/pingfederate/resources/pingfederate_oauth_issuer.go index 5b99c889..28ed3f8f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_issuer.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_issuer.go @@ -61,10 +61,13 @@ func (r *PingFederateOAuthIssuerResource) getOAuthIssuerData() (*map[string]stri issuerData := make(map[string]string) issuers, response, err := r.clientInfo.ApiClient.OauthIssuersAPI.GetOauthIssuers(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetOauthIssuers", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetOauthIssuers", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if issuers == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_token_generator_mapping.go b/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_token_generator_mapping.go index 1bcba128..0c9248be 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_token_generator_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_token_generator_mapping.go @@ -67,10 +67,13 @@ func (r *PingFederateOAuthTokenExchangeTokenGeneratorMappingResource) getProcess processorPolicyToGeneratorMappingData := make(map[string][]string) processorPolicyToGeneratorMappings, response, err := r.clientInfo.ApiClient.OauthTokenExchangeTokenGeneratorMappingsAPI.GetTokenGeneratorMappings(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetTokenGeneratorMappings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetTokenGeneratorMappings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if processorPolicyToGeneratorMappings == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_openid_connect_policy.go b/internal/connector/pingfederate/resources/pingfederate_openid_connect_policy.go index b4855664..2e4d0772 100644 --- a/internal/connector/pingfederate/resources/pingfederate_openid_connect_policy.go +++ b/internal/connector/pingfederate/resources/pingfederate_openid_connect_policy.go @@ -61,10 +61,13 @@ func (r *PingFederateOpenIDConnectPolicyResource) getOIDCPolicyData() (*map[stri oidcPolicyData := make(map[string]string) oidcPolicies, response, err := r.clientInfo.ApiClient.OauthOpenIdConnectAPI.GetOIDCPolicies(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetOIDCPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetOIDCPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if oidcPolicies == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_password_credential_validator.go b/internal/connector/pingfederate/resources/pingfederate_password_credential_validator.go index 806841e1..db143878 100644 --- a/internal/connector/pingfederate/resources/pingfederate_password_credential_validator.go +++ b/internal/connector/pingfederate/resources/pingfederate_password_credential_validator.go @@ -61,10 +61,13 @@ func (r *PingFederatePasswordCredentialValidatorResource) getPasswordCredentialV passwordCredentialValidatorData := make(map[string]string) passwordCredentialValidators, response, err := r.clientInfo.ApiClient.PasswordCredentialValidatorsAPI.GetPasswordCredentialValidators(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetPasswordCredentialValidators", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetPasswordCredentialValidators", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if passwordCredentialValidators == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_pingone_connection.go b/internal/connector/pingfederate/resources/pingfederate_pingone_connection.go index b88888eb..cd21cef2 100644 --- a/internal/connector/pingfederate/resources/pingfederate_pingone_connection.go +++ b/internal/connector/pingfederate/resources/pingfederate_pingone_connection.go @@ -61,10 +61,13 @@ func (r *PingFederatePingOneConnectionResource) getPingOneConnectionData() (*map pingoneConnectionData := make(map[string]string) pingoneConnections, response, err := r.clientInfo.ApiClient.PingOneConnectionsAPI.GetPingOneConnections(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetPingOneConnections", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetPingOneConnections", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if pingoneConnections == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_secret_manager.go b/internal/connector/pingfederate/resources/pingfederate_secret_manager.go index cc3d630b..efab1640 100644 --- a/internal/connector/pingfederate/resources/pingfederate_secret_manager.go +++ b/internal/connector/pingfederate/resources/pingfederate_secret_manager.go @@ -61,10 +61,13 @@ func (r *PingFederateSecretManagerResource) getSecretManagerData() (*map[string] secretManagerData := make(map[string]string) secretManagers, response, err := r.clientInfo.ApiClient.SecretManagersAPI.GetSecretManagers(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetSecretManagers", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetSecretManagers", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if secretManagers == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_server_settings_ws_trust_sts_settings_issuer_certificate.go b/internal/connector/pingfederate/resources/pingfederate_server_settings_ws_trust_sts_settings_issuer_certificate.go index 47a3eb2a..696ee8fa 100644 --- a/internal/connector/pingfederate/resources/pingfederate_server_settings_ws_trust_sts_settings_issuer_certificate.go +++ b/internal/connector/pingfederate/resources/pingfederate_server_settings_ws_trust_sts_settings_issuer_certificate.go @@ -67,10 +67,13 @@ func (r *PingFederateServerSettingsWsTrustStsSettingsIssuerCertificateResource) issuerCertsData := make(map[string][]string) issuerCerts, response, err := r.clientInfo.ApiClient.ServerSettingsAPI.GetCerts(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetCerts", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetCerts", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if issuerCerts == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_session_authentication_policy.go b/internal/connector/pingfederate/resources/pingfederate_session_authentication_policy.go index 6203b8e0..32cf7834 100644 --- a/internal/connector/pingfederate/resources/pingfederate_session_authentication_policy.go +++ b/internal/connector/pingfederate/resources/pingfederate_session_authentication_policy.go @@ -67,10 +67,13 @@ func (r *PingFederateSessionAuthenticationPolicyResource) getAuthenticationSessi authenticationSessionPolicyData := make(map[string][]string) authenticationSessionPolicies, response, err := r.clientInfo.ApiClient.SessionAPI.GetSourcePolicies(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetSourcePolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetSourcePolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if authenticationSessionPolicies == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_sp_adapter.go b/internal/connector/pingfederate/resources/pingfederate_sp_adapter.go index 09a21a7e..2dd6687e 100644 --- a/internal/connector/pingfederate/resources/pingfederate_sp_adapter.go +++ b/internal/connector/pingfederate/resources/pingfederate_sp_adapter.go @@ -61,10 +61,13 @@ func (r *PingFederateSpAdapterResource) getSpAdaptersData() (*map[string]string, spAdaptersData := make(map[string]string) spAdapters, response, err := r.clientInfo.ApiClient.SpAdaptersAPI.GetSpAdapters(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetSpAdapters", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetSpAdapters", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if spAdapters == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_sp_authentication_policy_contract_mapping.go b/internal/connector/pingfederate/resources/pingfederate_sp_authentication_policy_contract_mapping.go index dc39afce..9e9209ab 100644 --- a/internal/connector/pingfederate/resources/pingfederate_sp_authentication_policy_contract_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_sp_authentication_policy_contract_mapping.go @@ -67,10 +67,13 @@ func (r *PingFederateSPAuthenticationPolicyContractMappingResource) getApcToSpAd apcToSpAdapterMappingData := make(map[string][]string) apcToSpAdapterMappings, response, err := r.clientInfo.ApiClient.SpAuthenticationPolicyContractMappingsAPI.GetApcToSpAdapterMappings(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetApcToSpAdapterMappings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetApcToSpAdapterMappings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if apcToSpAdapterMappings == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_sp_idp_connection.go b/internal/connector/pingfederate/resources/pingfederate_sp_idp_connection.go index dc277678..8ad209c2 100644 --- a/internal/connector/pingfederate/resources/pingfederate_sp_idp_connection.go +++ b/internal/connector/pingfederate/resources/pingfederate_sp_idp_connection.go @@ -61,10 +61,13 @@ func (r *PingFederateSpIdpConnectionResource) getIdpConnectionData() (*map[strin idpConnectionData := make(map[string]string) idpConnections, response, err := r.clientInfo.ApiClient.SpIdpConnectionsAPI.GetConnections(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetConnections", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetConnections", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if idpConnections == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingfederate/resources/pingfederate_token_processor_to_token_generator_mapping.go b/internal/connector/pingfederate/resources/pingfederate_token_processor_to_token_generator_mapping.go index 1371598f..5aec4c8f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_token_processor_to_token_generator_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_token_processor_to_token_generator_mapping.go @@ -67,10 +67,13 @@ func (r *PingFederateTokenProcessorToTokenGeneratorMappingResource) getTokenToTo tokenToTokenMappingsData := make(map[string][]string) tokenToTokenMappings, response, err := r.clientInfo.ApiClient.TokenProcessorToTokenGeneratorMappingsAPI.GetTokenToTokenMappings(r.clientInfo.Context).Execute() - err = common.HandleClientResponse(response, err, "GetTokenToTokenMappings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetTokenToTokenMappings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if tokenToTokenMappings == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go b/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go index 0e39440e..b64b8fb0 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go @@ -77,10 +77,13 @@ func (r *PingOneMFAApplicationPushCredentialResource) getApplicationData() (*map iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", "pingone_application") + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", "pingone_application") if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -116,10 +119,13 @@ func (r *PingOneMFAApplicationPushCredentialResource) getPushCredentialData(appI iter := r.clientInfo.ApiClient.MFAAPIClient.ApplicationsApplicationMFAPushCredentialsApi.ReadAllMFAPushCredentials(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllMFAPushCredentials", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllMFAPushCredentials", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go b/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go index 19088299..e4f0f3f5 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go @@ -66,10 +66,13 @@ func (r *PingOneMFADevicePolicyResource) getDeviceAuthPolicyData() (*map[string] iter := r.clientInfo.ApiClient.MFAAPIClient.DeviceAuthenticationPolicyApi.ReadDeviceAuthenticationPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadDeviceAuthenticationPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadDeviceAuthenticationPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go b/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go index 2b0b47b2..f52c7b11 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go @@ -66,10 +66,13 @@ func (r *PingOneMFAFido2PolicyResource) getFido2PolicyData() (*map[string]string iter := r.clientInfo.ApiClient.MFAAPIClient.FIDO2PolicyApi.ReadFIDO2Policies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadFIDO2Policies", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadFIDO2Policies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go b/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go index 7218c35d..366aade3 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go @@ -56,10 +56,13 @@ func (r *PingOneMFASettingsResource) ExportAll() (*[]connector.ImportBlock, erro func (r *PingOneMFASettingsResource) checkMFASettingsData() error { _, response, err := r.clientInfo.ApiClient.MFAAPIClient.MFASettingsApi.ReadMFASettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - err = common.HandleClientResponse(response, err, "ReadMFASettings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadMFASettings", r.ResourceType()) if err != nil { return err } + if !ok { + return nil + } if response.StatusCode == 204 { return common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingone/platform/resources/pingone_agreement.go b/internal/connector/pingone/platform/resources/pingone_agreement.go index bee948ef..a38765e4 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement.go @@ -66,10 +66,13 @@ func (r *PingOneAgreementResource) getAgreementData() (*map[string]string, error iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_agreement_localization.go b/internal/connector/pingone/platform/resources/pingone_agreement_localization.go index 7c5ae9f7..a3594ef2 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement_localization.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement_localization.go @@ -74,10 +74,13 @@ func (r *PingOneAgreementLocalizationResource) getAgreementData() (*map[string]s iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -107,10 +110,13 @@ func (r *PingOneAgreementLocalizationResource) getAgreementLanguageData(agreemen iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguages", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguages", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go b/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go index b16e83f3..30e46fa5 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go @@ -83,10 +83,13 @@ func (r *PingOneAgreementLocalizationRevisionResource) getAgreementData() (*map[ iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -116,10 +119,13 @@ func (r *PingOneAgreementLocalizationRevisionResource) getAgreementLanguageData( iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguages", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguages", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -151,10 +157,13 @@ func (r *PingOneAgreementLocalizationRevisionResource) getAgreementLanguageRevis iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementRevisionsResourcesApi.ReadAllAgreementLanguageRevisions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId, agreementLanguageId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguageRevisions", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguageRevisions", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_branding_settings.go b/internal/connector/pingone/platform/resources/pingone_branding_settings.go index 9ae6e031..fbc39b11 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_settings.go @@ -56,10 +56,13 @@ func (r *PingOneBrandingSettingsResource) ExportAll() (*[]connector.ImportBlock, func (r *PingOneBrandingSettingsResource) checkBrandingSettingsData() error { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.BrandingSettingsApi.ReadBrandingSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - err = common.HandleClientResponse(response, err, "ReadBrandingSettings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadBrandingSettings", r.ResourceType()) if err != nil { return err } + if !ok { + return nil + } if response.StatusCode == 204 { return common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme.go b/internal/connector/pingone/platform/resources/pingone_branding_theme.go index 4d3d7e04..df07571c 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme.go @@ -66,10 +66,13 @@ func (r *PingOneBrandingThemeResource) getBrandingThemeData() (*map[string]strin iter := r.clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadBrandingThemes", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadBrandingThemes", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go index 3264c912..ecc4b44f 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go @@ -61,10 +61,13 @@ func (r *PingOneBrandingThemeDefaultResource) getDefaultBrandingThemeName() (*st iter := r.clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadBrandingThemes", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadBrandingThemes", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_certificate.go b/internal/connector/pingone/platform/resources/pingone_certificate.go index b86499ff..3356831b 100644 --- a/internal/connector/pingone/platform/resources/pingone_certificate.go +++ b/internal/connector/pingone/platform/resources/pingone_certificate.go @@ -65,10 +65,13 @@ func (r *PingOneCertificateResource) getCertificateData() (*map[string]string, e // TODO: Implement pagination once supported in the PingOne Go Client SDK entityArray, response, err := r.clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetCertificates(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - err = common.HandleClientResponse(response, err, "GetCertificates", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetCertificates", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if entityArray == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingone/platform/resources/pingone_custom_domain.go b/internal/connector/pingone/platform/resources/pingone_custom_domain.go index 871ddce0..03903daf 100644 --- a/internal/connector/pingone/platform/resources/pingone_custom_domain.go +++ b/internal/connector/pingone/platform/resources/pingone_custom_domain.go @@ -66,10 +66,13 @@ func (r *PingOneCustomDomainResource) getCustomDomainData() (*map[string]string, iter := r.clientInfo.ApiClient.ManagementAPIClient.CustomDomainsApi.ReadAllDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllDomains", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllDomains", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_environment.go b/internal/connector/pingone/platform/resources/pingone_environment.go index f1520170..8774b030 100644 --- a/internal/connector/pingone/platform/resources/pingone_environment.go +++ b/internal/connector/pingone/platform/resources/pingone_environment.go @@ -57,10 +57,13 @@ func (r *PingOneEnvironmentResource) ExportAll() (*[]connector.ImportBlock, erro func (r *PingOneEnvironmentResource) checkEnvironmentData() error { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.EnvironmentsApi.ReadOneEnvironment(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - err = common.HandleClientResponse(response, err, "ReadOneEnvironment", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadOneEnvironment", r.ResourceType()) if err != nil { return err } + if !ok { + return nil + } return nil } diff --git a/internal/connector/pingone/platform/resources/pingone_form.go b/internal/connector/pingone/platform/resources/pingone_form.go index 7ac724b1..d966d6ea 100644 --- a/internal/connector/pingone/platform/resources/pingone_form.go +++ b/internal/connector/pingone/platform/resources/pingone_form.go @@ -66,10 +66,13 @@ func (r *PingOneFormResource) getFormData() (*map[string]string, error) { iter := r.clientInfo.ApiClient.ManagementAPIClient.FormManagementApi.ReadAllForms(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllForms", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllForms", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go b/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go index 8e108d81..b039aab1 100644 --- a/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go +++ b/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go @@ -61,10 +61,13 @@ func (r *PingOneFormRecaptchaV2Resource) ExportAll() (*[]connector.ImportBlock, func (r *PingOneFormRecaptchaV2Resource) checkFormRecaptchaV2Data() (bool, error) { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.RecaptchaConfigurationApi.ReadRecaptchaConfiguration(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - err = common.HandleClientResponse(response, err, "ReadRecaptchaConfiguration", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadRecaptchaConfiguration", r.ResourceType()) if err != nil { return false, err } + if !ok { + return false, nil + } if response.StatusCode == 204 { return false, nil diff --git a/internal/connector/pingone/platform/resources/pingone_gateway.go b/internal/connector/pingone/platform/resources/pingone_gateway.go index 2eb41423..0bdd1202 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway.go @@ -66,10 +66,13 @@ func (r *PingOneGatewayResource) getGatewayData() (*map[string]string, error) { iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go index ca10a779..c9d361b9 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go @@ -74,10 +74,13 @@ func (r *PingOneGatewayCredentialResource) getGatewayData() (*map[string]string, iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -125,10 +128,13 @@ func (r *PingOneGatewayCredentialResource) getGatewayCredentialData(gatewayId st iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewayCredentialsApi.ReadAllGatewayCredentials(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, gatewayId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGatewayCredentials", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGatewayCredentials", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go index 3b8fac4f..5ea1df24 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go @@ -81,10 +81,13 @@ func (r *PingOneGatewayRoleAssignmentResource) getGatewayData() (*map[string]str iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -121,10 +124,13 @@ func (r *PingOneGatewayRoleAssignmentResource) getGatewayRoleAssignmentData(gate iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewayRoleAssignmentsApi.ReadGatewayRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, gatewayId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGatewayRoleAssignments", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGatewayRoleAssignments", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -153,10 +159,13 @@ func (r *PingOneGatewayRoleAssignmentResource) getGatewayRoleAssignmentData(gate func (r *PingOneGatewayRoleAssignmentResource) getRoleAssignmentRoleName(roleId string) (*management.EnumRoleName, error) { role, resp, err := r.clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(r.clientInfo.Context, roleId).Execute() - err = common.HandleClientResponse(resp, err, "ReadOneRole", r.ResourceType()) + ok, err := common.HandleClientResponse(resp, err, "ReadOneRole", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if role != nil { roleName, roleNameOk := role.GetNameOk() diff --git a/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go b/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go index a711a535..5688b9ea 100644 --- a/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go +++ b/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go @@ -66,10 +66,13 @@ func (r *PingOneIdentityPropagationPlanResource) getIdentityPropagationPlanData( iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityPropagationPlansApi.ReadAllPlans(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPlans", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPlans", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_key.go b/internal/connector/pingone/platform/resources/pingone_key.go index 8bc78252..db1d436e 100644 --- a/internal/connector/pingone/platform/resources/pingone_key.go +++ b/internal/connector/pingone/platform/resources/pingone_key.go @@ -70,10 +70,13 @@ func (r *PingOneKeyResource) getKeyData() (*map[string][]string, error) { // TODO: Implement pagination once supported in the PingOne Go Client SDK entityArray, response, err := r.clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetKeys(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - err = common.HandleClientResponse(response, err, "GetKeys", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetKeys", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if entityArray == nil { return nil, common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go b/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go index 05272f6e..ab13f360 100644 --- a/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go +++ b/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go @@ -66,10 +66,13 @@ func (r *PingOneKeyRotationPolicyResource) getKeyRotationPolicyData() (*map[stri iter := r.clientInfo.ApiClient.ManagementAPIClient.KeyRotationPoliciesApi.GetKeyRotationPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "GetKeyRotationPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "GetKeyRotationPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_language.go b/internal/connector/pingone/platform/resources/pingone_language.go index a15d90b8..92fcd5c8 100644 --- a/internal/connector/pingone/platform/resources/pingone_language.go +++ b/internal/connector/pingone/platform/resources/pingone_language.go @@ -66,10 +66,13 @@ func (r *PingOneLanguageResource) getLanguageData() (*map[string]string, error) iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_language_update.go b/internal/connector/pingone/platform/resources/pingone_language_update.go index fac44ead..92f83084 100644 --- a/internal/connector/pingone/platform/resources/pingone_language_update.go +++ b/internal/connector/pingone/platform/resources/pingone_language_update.go @@ -66,10 +66,13 @@ func (r *PingOneLanguageUpdateResource) getLanguageData() (*map[string]string, e iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_notification_policy.go b/internal/connector/pingone/platform/resources/pingone_notification_policy.go index 08bdb071..3fc4d048 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_policy.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_policy.go @@ -66,10 +66,13 @@ func (r *PingOneNotificationPolicyResource) getNotificationPolicyData() (*map[st iter := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsPoliciesApi.ReadAllNotificationsPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllNotificationsPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllNotificationsPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_notification_settings.go b/internal/connector/pingone/platform/resources/pingone_notification_settings.go index 001b8885..1b5e645b 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_settings.go @@ -56,10 +56,13 @@ func (r *PingOneNotificationSettingsResource) ExportAll() (*[]connector.ImportBl func (r *PingOneNotificationSettingsResource) checkNotificationSettingsData() error { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsApi.ReadNotificationsSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - err = common.HandleClientResponse(response, err, "ReadNotificationsSettings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadNotificationsSettings", r.ResourceType()) if err != nil { return err } + if !ok { + return nil + } if response.StatusCode == 204 { return common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go b/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go index f1c36b70..a754e3a0 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go @@ -56,10 +56,13 @@ func (r *PingOneNotificationSettingsEmailResource) ExportAll() (*[]connector.Imp func (r *PingOneNotificationSettingsEmailResource) checkNotificationSettingsEmailData() error { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsSMTPApi.ReadEmailNotificationsSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - err = common.HandleClientResponse(response, err, "ReadEmailNotificationsSettings", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadEmailNotificationsSettings", r.ResourceType()) if err != nil { return err } + if !ok { + return nil + } if response.StatusCode == 204 { return common.DataNilError(r.ResourceType(), response) diff --git a/internal/connector/pingone/platform/resources/pingone_notification_template_content.go b/internal/connector/pingone/platform/resources/pingone_notification_template_content.go index 3a05e4ec..6786aba8 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_template_content.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_template_content.go @@ -103,10 +103,13 @@ func (r *PingOneNotificationTemplateContentResource) getEnabledLocales() (*map[s iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -153,10 +156,13 @@ func (r *PingOneNotificationTemplateContentResource) getTemplateNames() (*[]mana } // Handle all other errors or bad responses - err = common.HandleClientResponse(response, err, "ReadOneTemplate", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadOneTemplate", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } templateNames = append(templateNames, templateName) } @@ -171,10 +177,13 @@ func (r *PingOneNotificationTemplateContentResource) getTemplateContentData(temp iter := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadAllTemplateContents(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, templateName).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTemplateContents", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTemplateContents", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go b/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go index f2ee8262..42309330 100644 --- a/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go @@ -67,10 +67,13 @@ func (r *PingOnePhoneDeliverySettingsResource) getPhoneDeliverySettingsData() (* iter := r.clientInfo.ApiClient.ManagementAPIClient.PhoneDeliverySettingsApi.ReadAllPhoneDeliverySettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPhoneDeliverySettings", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPhoneDeliverySettings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_system_application.go b/internal/connector/pingone/platform/resources/pingone_system_application.go index a9901a5b..1a416c4c 100644 --- a/internal/connector/pingone/platform/resources/pingone_system_application.go +++ b/internal/connector/pingone/platform/resources/pingone_system_application.go @@ -66,10 +66,13 @@ func (r *PingOneSystemApplicationResource) getSystemApplicationData() (*map[stri iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go b/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go index 0f115b49..0939eb6d 100644 --- a/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go +++ b/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go @@ -75,10 +75,13 @@ func (r *PingOneTrustedEmailAddressResource) getTrustedEmailDomainData() (*map[s iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailDomains", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailDomains", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -108,10 +111,13 @@ func (r *PingOneTrustedEmailAddressResource) getTrustedEmailAddressData(trustedE iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailAddressesApi.ReadAllTrustedEmailAddresses(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, trustedEmailDomainId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailAddresses", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailAddresses", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go b/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go index f0debf8b..8bc0a169 100644 --- a/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go +++ b/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go @@ -66,10 +66,13 @@ func (r *PingOneTrustedEmailDomainResource) getTrustedEmailDomainData() (*map[st iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailDomains", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailDomains", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/platform/resources/pingone_webhook.go b/internal/connector/pingone/platform/resources/pingone_webhook.go index e3b94815..e58db1b2 100644 --- a/internal/connector/pingone/platform/resources/pingone_webhook.go +++ b/internal/connector/pingone/platform/resources/pingone_webhook.go @@ -66,10 +66,13 @@ func (r *PingOneWebhookResource) getSubscriptionData() (*map[string]string, erro iter := r.clientInfo.ApiClient.ManagementAPIClient.SubscriptionsWebhooksApi.ReadAllSubscriptions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSubscriptions", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSubscriptions", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/protect/resources/pingone_risk_policy.go b/internal/connector/pingone/protect/resources/pingone_risk_policy.go index 14327882..94ba40ed 100644 --- a/internal/connector/pingone/protect/resources/pingone_risk_policy.go +++ b/internal/connector/pingone/protect/resources/pingone_risk_policy.go @@ -66,10 +66,13 @@ func (r *PingOneRiskPolicyResource) getRiskPolicySetData() (*map[string]string, iter := r.clientInfo.ApiClient.RiskAPIClient.RiskPoliciesApi.ReadRiskPolicySets(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadRiskPolicySets", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadRiskPolicySets", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/protect/resources/pingone_risk_predictor.go b/internal/connector/pingone/protect/resources/pingone_risk_predictor.go index 9eb7f85f..741eaeb8 100644 --- a/internal/connector/pingone/protect/resources/pingone_risk_predictor.go +++ b/internal/connector/pingone/protect/resources/pingone_risk_predictor.go @@ -71,10 +71,13 @@ func (r *PingOneRiskPredictorResource) getRiskPredictorData() (*map[string][]str iter := r.clientInfo.ApiClient.RiskAPIClient.RiskAdvancedPredictorsApi.ReadAllRiskPredictors(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllRiskPredictors", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllRiskPredictors", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_application.go b/internal/connector/pingone/sso/resources/pingone_application.go index 1b94f1e9..306faa66 100644 --- a/internal/connector/pingone/sso/resources/pingone_application.go +++ b/internal/connector/pingone/sso/resources/pingone_application.go @@ -66,10 +66,13 @@ func (r *PingOneApplicationResource) getApplicationData() (*map[string]string, e iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go b/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go index deb5050b..7a561784 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go +++ b/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go @@ -75,10 +75,13 @@ func (r *PingOneApplicationAttributeMappingResource) getApplicationData() (*map[ iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -123,10 +126,13 @@ func (r *PingOneApplicationAttributeMappingResource) getApplicationAttributeMapp iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationAttributeMappingApi.ReadAllApplicationAttributeMappings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplicationAttributeMappings", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplicationAttributeMappings", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go index 280dd9f6..0324d277 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go @@ -80,10 +80,13 @@ func (r *PingOneApplicationFlowPolicyAssignmentResource) getApplicationData() (* iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -131,10 +134,13 @@ func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyAssignment iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationFlowPolicyAssignmentsApi.ReadAllFlowPolicyAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllFlowPolicyAssignments", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllFlowPolicyAssignments", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -165,10 +171,13 @@ func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyAssignment func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyName(flowPolicyId string) (*string, error) { flowPolicy, response, err := r.clientInfo.ApiClient.ManagementAPIClient.FlowPoliciesApi.ReadOneFlowPolicy(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, flowPolicyId).Execute() - err = common.HandleClientResponse(response, err, "ReadOneFlowPolicy", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadOneFlowPolicy", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if flowPolicy != nil { flowPolicyName, flowPolicyNameOk := flowPolicy.GetNameOk() diff --git a/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go b/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go index 9a3b77d8..e4bed0fc 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go +++ b/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go @@ -80,10 +80,13 @@ func (r *PingOneApplicationResourceGrantResource) getApplicationData() (*map[str iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -131,10 +134,13 @@ func (r *PingOneApplicationResourceGrantResource) getApplicationGrantData(appId iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationResourceGrantsApi.ReadAllApplicationGrants(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplicationGrants", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplicationGrants", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -164,10 +170,13 @@ func (r *PingOneApplicationResourceGrantResource) getApplicationGrantData(appId func (r *PingOneApplicationResourceGrantResource) getGrantResourceName(grantResourceId string) (*string, error) { resource, response, err := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadOneResource(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, grantResourceId).Execute() - err = common.HandleClientResponse(response, err, "ReadOneResource", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadOneResource", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if resource != nil { resourceName, resourceNameOk := resource.GetNameOk() diff --git a/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go index 3e6fd0a2..bf08c6ab 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go @@ -81,10 +81,13 @@ func (r *PingOneApplicationRoleAssignmentResource) getApplicationData() (*map[st iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -147,10 +150,13 @@ func (r *PingOneApplicationRoleAssignmentResource) getApplicationRoleAssignmentD iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationRoleAssignmentsApi.ReadApplicationRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadApplicationRoleAssignments", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadApplicationRoleAssignments", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -180,10 +186,13 @@ func (r *PingOneApplicationRoleAssignmentResource) getApplicationRoleAssignmentD func (r *PingOneApplicationRoleAssignmentResource) getRoleName(roleId string) (*management.EnumRoleName, error) { apiRole, resp, err := r.clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(r.clientInfo.Context, roleId).Execute() - err = common.HandleClientResponse(resp, err, "ReadOneRole", r.ResourceType()) + ok, err := common.HandleClientResponse(resp, err, "ReadOneRole", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if apiRole != nil { apiRoleName, apiRoleNameOk := apiRole.GetNameOk() diff --git a/internal/connector/pingone/sso/resources/pingone_application_secret.go b/internal/connector/pingone/sso/resources/pingone_application_secret.go index 6b7ee911..d773b0a1 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_secret.go +++ b/internal/connector/pingone/sso/resources/pingone_application_secret.go @@ -75,10 +75,13 @@ func (r *PingOneApplicationSecretResource) getApplicationData() (*map[string]str iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go index aa25d523..27827f4a 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go @@ -80,10 +80,13 @@ func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationData() iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -131,10 +134,13 @@ func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationSignOnP iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationSignOnPolicyAssignmentsApi.ReadAllSignOnPolicyAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicyAssignments", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicyAssignments", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -164,10 +170,13 @@ func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationSignOnP func (r *PingOneApplicationSignOnPolicyAssignmentResource) getSignOnPolicyName(signOnPolicyId string) (*string, error) { signOnPolicy, response, err := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPoliciesApi.ReadOneSignOnPolicy(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, signOnPolicyId).Execute() - err = common.HandleClientResponse(response, err, "ReadOneSignOnPolicy", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadOneSignOnPolicy", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if signOnPolicy != nil { signOnPolicyName, signOnPolicyNameOk := signOnPolicy.GetNameOk() diff --git a/internal/connector/pingone/sso/resources/pingone_group.go b/internal/connector/pingone/sso/resources/pingone_group.go index 04fb7527..f2ef4e5d 100644 --- a/internal/connector/pingone/sso/resources/pingone_group.go +++ b/internal/connector/pingone/sso/resources/pingone_group.go @@ -66,10 +66,13 @@ func (r *PingOneGroupResource) getGroupData() (*map[string]string, error) { iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_group_nesting.go b/internal/connector/pingone/sso/resources/pingone_group_nesting.go index 97d463ab..c04b54cc 100644 --- a/internal/connector/pingone/sso/resources/pingone_group_nesting.go +++ b/internal/connector/pingone/sso/resources/pingone_group_nesting.go @@ -75,10 +75,13 @@ func (r *PingOneGroupNestingResource) getGroupData() (*map[string]string, error) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -108,10 +111,13 @@ func (r *PingOneGroupNestingResource) getGroupNestingData(parentGroupId string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadGroupNesting(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, parentGroupId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGroupNesting", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGroupNesting", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go b/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go index c51b1475..11bd60a4 100644 --- a/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go @@ -81,10 +81,13 @@ func (r *PingOneGroupRoleAssignmentResource) getGroupData() (*map[string]string, iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -114,10 +117,13 @@ func (r *PingOneGroupRoleAssignmentResource) getGroupRoleAssignmentData(groupId iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupRoleAssignmentsApi.ReadGroupRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, groupId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGroupRoleAssignments", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGroupRoleAssignments", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -147,10 +153,13 @@ func (r *PingOneGroupRoleAssignmentResource) getGroupRoleAssignmentData(groupId func (r *PingOneGroupRoleAssignmentResource) getRoleName(roleId string) (*management.EnumRoleName, error) { apiRole, resp, err := r.clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(r.clientInfo.Context, roleId).Execute() - err = common.HandleClientResponse(resp, err, "ReadOneRole", r.ResourceType()) + ok, err := common.HandleClientResponse(resp, err, "ReadOneRole", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if apiRole != nil { apiRoleName, apiRoleNameOk := apiRole.GetNameOk() diff --git a/internal/connector/pingone/sso/resources/pingone_identity_provider.go b/internal/connector/pingone/sso/resources/pingone_identity_provider.go index 0bbe0782..74ba8f37 100644 --- a/internal/connector/pingone/sso/resources/pingone_identity_provider.go +++ b/internal/connector/pingone/sso/resources/pingone_identity_provider.go @@ -66,10 +66,13 @@ func (r *PingOneIdentityProviderResource) getIdentityProviderData() (*map[string iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProvidersApi.ReadAllIdentityProviders(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviders", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviders", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go b/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go index 92f6342a..8c67a6d9 100644 --- a/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go @@ -75,10 +75,13 @@ func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderData() (*m iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProvidersApi.ReadAllIdentityProviders(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviders", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviders", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -135,10 +138,13 @@ func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderAttributeD iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProviderAttributesApi.ReadAllIdentityProviderAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, idpId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviderAttributes", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviderAttributes", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_password_policy.go b/internal/connector/pingone/sso/resources/pingone_password_policy.go index 7cb74291..9fc61a01 100644 --- a/internal/connector/pingone/sso/resources/pingone_password_policy.go +++ b/internal/connector/pingone/sso/resources/pingone_password_policy.go @@ -66,10 +66,13 @@ func (r *PingOnePasswordPolicyResource) getPasswordPolicyData() (*map[string]str iter := r.clientInfo.ApiClient.ManagementAPIClient.PasswordPoliciesApi.ReadAllPasswordPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPasswordPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPasswordPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_population.go b/internal/connector/pingone/sso/resources/pingone_population.go index ce8f5728..2ce63d66 100644 --- a/internal/connector/pingone/sso/resources/pingone_population.go +++ b/internal/connector/pingone/sso/resources/pingone_population.go @@ -66,10 +66,13 @@ func (r *PingOnePopulationResource) getPopulationData() (*map[string]string, err iter := r.clientInfo.ApiClient.ManagementAPIClient.PopulationsApi.ReadAllPopulations(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPopulations", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPopulations", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_population_default.go b/internal/connector/pingone/sso/resources/pingone_population_default.go index d995637b..a471b894 100644 --- a/internal/connector/pingone/sso/resources/pingone_population_default.go +++ b/internal/connector/pingone/sso/resources/pingone_population_default.go @@ -61,10 +61,13 @@ func (r *PingOnePopulationDefaultResource) getDefaultPopulationName() (*string, iter := r.clientInfo.ApiClient.ManagementAPIClient.PopulationsApi.ReadAllPopulations(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPopulations", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPopulations", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_resource.go b/internal/connector/pingone/sso/resources/pingone_resource.go index 6ea34150..4c843e64 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource.go +++ b/internal/connector/pingone/sso/resources/pingone_resource.go @@ -66,10 +66,13 @@ func (r *PingOneResourceResource) getResourceData() (*map[string]string, error) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_resource_attribute.go b/internal/connector/pingone/sso/resources/pingone_resource_attribute.go index c0d29da3..b53898ff 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_attribute.go @@ -79,10 +79,13 @@ func (r *PingOneResourceAttributeResource) getResourceData() (*map[string][]stri iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -115,10 +118,13 @@ func (r *PingOneResourceAttributeResource) getResourceAttributeData(resourceId s iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceAttributesApi.ReadAllResourceAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceAttributes", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceAttributes", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope.go b/internal/connector/pingone/sso/resources/pingone_resource_scope.go index d9753841..00de782c 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope.go @@ -76,10 +76,13 @@ func (r *PingOneResourceScopeResource) getResourceData() (*map[string]string, er iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -112,10 +115,13 @@ func (r *PingOneResourceScopeResource) getResourceScopeData(resourceId string) ( iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go b/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go index ff04507a..b182eb6b 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go @@ -75,10 +75,13 @@ func (r *PingOneResourceScopeOpenIdResource) getResourceData() (*map[string]stri iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -111,10 +114,13 @@ func (r *PingOneResourceScopeOpenIdResource) getResourceScopeData(resourceId str iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go b/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go index 8226a7fa..99eeaf75 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go @@ -76,10 +76,13 @@ func (r *PingOneResourceScopePingOneApiResource) getResourceData() (*map[string] iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -112,10 +115,13 @@ func (r *PingOneResourceScopePingOneApiResource) getResourceScopeData(resourceId iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_schema_attribute.go b/internal/connector/pingone/sso/resources/pingone_schema_attribute.go index 9c7de31a..515cdf02 100644 --- a/internal/connector/pingone/sso/resources/pingone_schema_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_schema_attribute.go @@ -75,10 +75,13 @@ func (r *PingOneSchemaAttributeResource) getSchemaData() (*map[string]string, er iter := r.clientInfo.ApiClient.ManagementAPIClient.SchemasApi.ReadAllSchemas(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSchemas", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSchemas", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -107,10 +110,13 @@ func (r *PingOneSchemaAttributeResource) getSchemaAttributeData(schemaId string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SchemasApi.ReadAllSchemaAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, schemaId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSchemaAttributes", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSchemaAttributes", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go b/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go index eaa7e9e0..d369181c 100644 --- a/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go +++ b/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go @@ -66,10 +66,13 @@ func (r *PingOneSignOnPolicyResource) getSignOnPolicyData() (*map[string]string, iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPoliciesApi.ReadAllSignOnPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go b/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go index 82cbffb7..78230c7b 100644 --- a/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go +++ b/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go @@ -76,10 +76,13 @@ func (r *PingOneSignOnPolicyActionResource) getSignOnPolicyData() (*map[string]s iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPoliciesApi.ReadAllSignOnPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicies", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicies", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) @@ -109,10 +112,13 @@ func (r *PingOneSignOnPolicyActionResource) getSignOnPolicyActionData(signOnPoli iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPolicyActionsApi.ReadAllSignOnPolicyActions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, signOnPolicyId).Execute() for cursor, err := range iter { - err = common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicyActions", r.ResourceType()) + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicyActions", r.ResourceType()) if err != nil { return nil, err } + if !ok { + return nil, nil + } if cursor.EntityArray == nil { return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) diff --git a/internal/testing/testutils_terraform/terraform_utils.go b/internal/testing/testutils_terraform/terraform_utils.go index fe5e3d64..6eaf7433 100644 --- a/internal/testing/testutils_terraform/terraform_utils.go +++ b/internal/testing/testutils_terraform/terraform_utils.go @@ -200,13 +200,13 @@ func InitPingFederateTerraform(t *testing.T) { } provider "pingfederate" { - username = "%s" - password = "%s" - https_host = "%s" - admin_api_path = "%s" - product_version = "12.2" - insecure_trust_all_tls = true - x_bypass_external_validation_header = true + username = "%s" + password = "%s" + https_host = "%s" + admin_api_path = "%s" + product_version = "12.2" + insecure_trust_all_tls = true + x_bypass_external_validation_header = true } `, os.Getenv("PINGCLI_PINGFEDERATE_PROVIDER_VERSION"), diff --git a/server-profiles/12.2/data.json b/server-profiles/12.2/data.json new file mode 100644 index 00000000..d7a3e129 --- /dev/null +++ b/server-profiles/12.2/data.json @@ -0,0 +1,4748 @@ +{ + "metadata": { + "pfVersion": "12.2.0.4" + }, + "operations": [ + { + "resourceType": "/configStore", + "operationType": "SAVE", + "subResource": "cert-time-tracking", + "items": [ + { + "id": "9vgmnd36wykte1l2nm8s8uead", + "type": "STRING", + "stringValue": "1735851845" + }, + { + "id": "sslservercert", + "type": "STRING", + "stringValue": "1735840761" + }, + { + "id": "tiq4n26axjircjk30oz5zf6k3", + "type": "STRING", + "stringValue": "1735851641" + } + ] + }, + { + "resourceType": "/configStore", + "operationType": "SAVE", + "subResource": "org.sourceid.oauth20.domain.ClientManagerXmlFileImpl", + "items": [ + { + "id": "MigrationComplete8.4", + "type": "STRING", + "stringValue": "true" + } + ] + }, + { + "resourceType": "/configStore", + "operationType": "SAVE", + "subResource": "org.sourceid.saml20.domain.LoggingMode", + "items": [ + { + "id": "IdPOverrideOn", + "type": "STRING", + "stringValue": "false" + }, + { + "id": "SPOverrideOn", + "type": "STRING", + "stringValue": "false" + } + ] + }, + { + "resourceType": "/configStore", + "operationType": "SAVE", + "subResource": "org.sourceid.saml20.domain.mgmt.AdminUserManager", + "items": [ + { + "id": "isDcRoleUpdated", + "type": "STRING", + "stringValue": "true" + }, + { + "id": "isEaRoleUpdated", + "type": "STRING", + "stringValue": "true" + } + ] + }, + { + "resourceType": "/configStore", + "operationType": "SAVE", + "subResource": "org.sourceid.saml20.domain.mgmt.impl.PartnerCertMigrator", + "items": [ + { + "id": "partner.cert.migration.complete", + "type": "STRING", + "stringValue": "true" + } + ] + }, + { + "resourceType": "/configStore", + "operationType": "SAVE", + "subResource": "org.sourceid.saml20.metadata.partner.impl.MetadataDirectoryHybridDbImpl", + "items": [ + { + "id": "MigrationComplete8.4", + "type": "STRING", + "stringValue": "true" + } + ] + }, + { + "resourceType": "/license/agreement", + "operationType": "SAVE", + "items": [ + { + "licenseAgreementUrl": "https://localhost:9999/pf-admin-api/license-agreement", + "accepted": true + } + ] + }, + { + "resourceType": "/certificates/ca", + "operationType": "SAVE", + "items": [ + { + "id": "sslservercert", + "fileData": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURVekNDQWoyZ0F3SUJBZ0lRSFJOTEZ3a0RRTHc3WGZ6NVZKTlJnekFMQmdrcWhraUc5dzBCQVFzd1N6RU9NQXdHQTFVRUNBd0YKVkVWWVFWTXhEekFOQmdOVkJBY01Ca0ZWVTFSSlRqRU5NQXNHQTFVRUN3d0VVRWxPUnpFTU1Bb0dBMVVFQ2d3RFEwUlNNUXN3Q1FZRApWUVFHREFKVlV6QWVGdzB5TkRBNE1USXhPVFEzTVRkYUZ3MDBOREE0TURjeE9UUTNNVGRhTUVzeERqQU1CZ05WQkFnTUJWUkZXRUZUCk1ROHdEUVlEVlFRSERBWkJWVk5VU1U0eERUQUxCZ05WQkFzTUJGQkpUa2N4RERBS0JnTlZCQW9NQTBORVVqRUxNQWtHQTFVRUJnd0MKVlZNd2dnRWlNQTBHQ1NxR1NJYjNEUUVCQVFVQUE0SUJEd0F3Z2dFS0FvSUJBUUNodTE3Z1FiYnZNdnBsbkJ0YnBLOTNVVTMvYjRUZApKamJ5dXJNRDRQOFMrakNWeER4cDF4ZGxUeGJxbFphcVRuaE8yOG1GRHdFRFlhdVgyZHdENmUwTUxkNEV5aWQ3eUp5T2ViZmdQUzRMClJrc3ZVb3RlUlUxV2RoZ1I4NDdyRFNOZnFha3JQUkRaVWZJOUpmY0pqMG4rWElJT2hobEhQZXB4bE56aDRyK0xUY3ZqcXIvTWgxMEgKNzhteG1xZUhvUWlZYmhydExpaGgxN2N2cGVJWlhPT3dVU0JvV1pDWkcreXlYVXNGd2RHU3VoV1l0clNPbE1TZnZlTm5rbk41amh5aApVZWJRQ05vVUhTdEs1cW9YeTFVVU1HRE5IcEFHSDNWNHJpWmhCNkxhTkszZ3gwbmF5d3RvcDF0WkpaNXg0ZllJMFQvVTVreTlGZWxlCkE2SEMzZmR4QWdNQkFBR2pOekExTUIwR0ExVWREZ1FXQkJSWVBlRkVtTkxHcURGQ2pOcWhBUVc3NThZT3FqQVVCZ05WSFJFRURUQUwKZ2dsc2IyTmhiR2h2YzNRd0N3WUpLb1pJaHZjTkFRRUxBNElCQVFBVVBRM1hKSmtJZ3JNSU5xVjJPdnB4bUR2c0JsVEVjQmE4Z2JRcwpTMXZuQUdDNFRsKzV2QWpwa0Z4VFhUbnBHaWtJU25POVp3SWJRYTJ1RlZRMjZFbkNKazF3Z3JMWFRkY0FXQjRLQmZRYWRKUTdVQzltCmE3RTZYaW5FSjBUWGd5UXNSc3R4cldVNldLWGV1d3lYZEFidGE1ZWhzRjZZUDNPYzNZZTBqR201L1FtaWZhVmwzWUJNQ3JxOUVGdkwKUzQ1MUVTcVJMaDA4QUZjZ3RaWlc4RGo1MHNyUGlWbDZidVVQOWd3YWxqamhYV01FTDBNVWtKMlgweHlVMHlGMytNV2lMMU9oaThURwpNeEw5YzliN3JScUQyWk9mU2xXVGN1Sm83OXM1ZkNFOG1leDU3VGdlSEh5eC9GVEIrUzhpMWYvT1J5WTl0ZlErbjJvQk1obnRzN2pkCi0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K" + } + ] + }, + { + "resourceType": "/keyPairs/sslServer", + "operationType": "SAVE", + "items": [ + { + "id": "sslservercert", + "fileData": "MIIKgAIBAzCCCioGCSqGSIb3DQEHAaCCChsEggoXMIIKEzCCBaoGCSqGSIb3DQEHAaCCBZsEggWXMIIFkzCCBY8GCyqGSIb3DQEMCgECoIIFQDCCBTwwZgYJKoZIhvcNAQUNMFkwOAYJKoZIhvcNAQUMMCsEFNJjFcCjl6Zj86enQwnfa5Dhaed9AgInEAIBIDAMBggqhkiG9w0CCQUAMB0GCWCGSAFlAwQBKgQQL4FBvarelURw_mtJCbortQSCBNBoO3Ra2M6piPUds4H-QJ3j7zS_EqAieZ4Xib0xV-tlARdKibyq1iLzjJKQe_nZhYBOAkGtIqLvFiXFuOsdo2mpMvE8hx1MGB-UioPQMCzRndSSFHFJavziLrRrvbIHNnV-ZXUCr--vw9w_0hGrY6HxQf2sNY2TInT4-SBtP2o2Y6x4Y252Us4F-CqBFtS7JxoOKC7pVLIojWVW5y7DoqilrD7nB7NVUkl4n6S8lOE67hkWKKMxPuMi_uWVUwltzFrlfh7AD7W4-FXU7tglxcXc-e-GoznYQnKKhGrewTG-7kpjitpZjI_3nbVk5jfDrCDUgfsbRi1S3trbdg_PPNkcrFpdyibex83BQ8Fu-VMkCf4WljqzdyG8MRPnHWmK_XakHOUuuycY6qlCxTMWPgHGJ_gLEx6kqjjdqnB-AM_EuvklctwjiWQ-9_JsN54bJwKj8q1uV2rrVKgIhKJ9KtpiXN4mwPWnKLNqkmtqT9GYkIn2vRRs9ANa26zWahXZm4LpkEOgqwfLrrAqpX2w9tsQdlPouWW6tAVM17ZRUQlD8owIvjDzQkgzPM1o-o3va3QwKUiEXix5spDlzcOr8BKo6JhheBDtoqjbQ2oRKolgm8wlmQ5gm1qpz8rBfI9joKmZl8AV9wf1BthNMieNPhQGUmv2owk2SLyZSMb-zzDG0Nb3swGG8YPS2sGSa1SQlmVNTcrj5zWA3ur8JTEIpGBY8DJbCKLpSkCE2VGRctJMinBpASl3WUCsI691n7yMQo1E84Wb7ng3QFrEClkxE9cJuhEhTgPcAwSAM-uushoXT0_okUILLUQFU9vzRMSifH1toSEhobaNB053znjWYdrJtupgegFcwU0EvDyhxGuvM-bZtL_2ZQGUcGtUlSs1PWRwWOXs3LX74xVWcNGLg972Q0n8JsDw-sNDJQV9KnOYeVCjCZBa5Zc3D66VydEsN2wSFlB1SYrH1C3EMbXcSQYtYw9kv-hoD-kIcgwXE7e9C_3S8bE9ivCdVN8c0EG-qxt_CcnhPxUGYrEGl3SV1N9tZVOEYG0DyOeMkLDCXn8hRt7_Gn1GSgrtaF4_ZUJgv8i9A2TUgkIzqgm4TiEI57BlWkKNlttajANgfWn1W387WLvGG27AV0fLrqDlHpuFGCDseWq9J2rWiAdH4n20TLPoYxJxC8h9pqsOyxDMlT6j8geC8ckYXcoabH2u7HLhZlyhT4CKo1Yj7w2vgp68wOJk40jDo7c9AnrWixliZLfe0XUznS7GDQqlX8PFoCFn8vihalXSIh1vDf-DWebtB5XbHC3vkwh9IlHJ0wqSANzkWRCxCxQkLGxnMUBwjSM1cFUBr_i1D-Iqj8Dftc_7fkntf12D2W9WykGJaTBsFLyBM5Sihh2zQg_o2iCRX9b_WIGt4axS2sg4yILqDSf6EOxFZNbuWo8u6oYzRRTRSQvFzt4ujEGA1BolY9gvrGpG-PrzKVr_f-BTanQ9sTm3BqWI7Ayy3KXFhsf46303NuZDa2doZLnqvUZmXWdpBcFcnkcSlJ9D6iKpalZYU2dAlg1tAI6-ky5agyBaoOjvZGQgMiQh2_jBcgLbxqhvL0z880JDDJ6MqFSBt7ZC0WFT2j6YFYQupRV42dpXfCEeRei_8jE8MBcGCSqGSIb3DQEJFDEKHggAcABpAG4AZzAhBgkqhkiG9w0BCRUxFAQSVGltZSAxNzM4MzYyNzc3ODU3MIIEYQYJKoZIhvcNAQcGoIIEUjCCBE4CAQAwggRHBgkqhkiG9w0BBwEwZgYJKoZIhvcNAQUNMFkwOAYJKoZIhvcNAQUMMCsEFLWihKD1yvXe_U3wbIF4DQihO9JqAgInEAIBIDAMBggqhkiG9w0CCQUAMB0GCWCGSAFlAwQBKgQQ5m2yLlmCbkq1ITkP4Sf2lICCA9Ck1EuI9vUQ0dVQTsuLhHEQ2g8tNb0XvPDcpFvTqDEd5nJM3C2V7R_4Add2j7H9L312xg7WKOdWHuvsMTOcRSLIuT66D43aG4qvmWg0j_MsLJXmfYuHDcXaM7QCaPlP6AnFv4YWjqrfCdOcPe1GhjYShe3GZ7agihonM3nNq4ztzWUz7TrNRbBvEgQlebOWoO3xvC9CCCBNWeoceepDsk5QBU01JDBUG5lgA8OXfu1vOyamHnjEmJm23V3bmx5iPOWucOUTFwUuXO3q6QV5Gm9ehbP8IazHrvGJHdJF6Jxrohx93bmopGmQfV8rUuy5PQvu9LR8BPhfMsttSYwKHSy-wsMlhWk_zBMSDurgzvEmD64qHhFArAY1A4ZxXmW2KHwWt0VavGVsfOOTUZuH9kC5xrAEBkPOYjeWO3Cp3Se7o7VRbfTC7kweXc1fFY0R-gIReFr1J7us2PBajDQdFXBfxVukUHOjITtpkBVTxPWW6uJwrnUuLN6IVnbEl7CFYrm9U5vw_3K_S2ZpZg7A_T_MdXxt1oOka4eRlUENw-d5LfH25NBbeTW78ySoSZGmI0lelBuZRZsjyBdJz2l3cuS-OgEB-Mxt2eHuMdr-2aUt_6_uPNyfpBB3GkX0xvW1sY34KAuPVtB2roclJnvtzuza_3-HezWkd9ivy_b2-kDYsGrVhNg-qj_aG4OmE4MgVGYfRxHUsvM2dDnMB6iVl4xka8dUCR9yWlB47sJz8Q8M1Ct5uad8cJVhfGAJJ2_o0Bs_oBmToYuJqbI0cZqPm6Evf4GzQFr6hSv9jjJC0dNTnr8Nss5tAhdARuR1u7gEjS6Wl7L1hOnuj6bWB6WSJYFS50uHkc64AmPPvbGxhuT5sHiHyoFm16zLgOrc_AWiADvAfcJkGXGWl_x1cxSUkC7aj0CiI4TCGqu02B8SJ_ow4qVdaiDTECLodPA5Ko1asCadQTb3ztaN92g2NBBlmau6foJsExw-uiPU5GdBiJjxMiSPhvcTl_x3AEjsFXZR2Vb4czciY8pm3Le1vzS7nyA8XSPAIhgfcbr5EnDUFfzRp1_ypubs_jyJkIo1XebJQBpBtQHsC1L88WuvpHXiBZuJeZYqhWCNZpXqVdjJZZ8JhgvjW7eeh1Ez1DoNXvR-w8mFmF9hfN82er9qWIoYEgQULZncEO68NzdM3dY3g3VAWEQe-9Y_5tUOdb_v2oiL0QKr6ftsVVkFLBbNfercUMfzcsDIbHWp5GbDkEkezHULOFgWdDWpOywUKiVU22r5MK11N4WJnijbGc2MBj9qYJswME0wMTANBglghkgBZQMEAgEFAAQgrr2WgyTN6lz9Fid8P0NKmQOuO-uZNvf0EGgt3KuNEacEFE7isjyhDWcthECVtprKcnSQlk-kAgInEA==", + "format": "PKCS12", + "encryptedPassword": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..e3UIFPccb6Jp7bU0HRfmlQ.UAdZ0HlBqmKXjZgyZScUjYcq51rmu2SWCIVVB0gmeT8.nkrx4RFZrT07wr1DMLirFA" + } + ] + }, + { + "resourceType": "/keyPairs/sslServer/settings", + "operationType": "SAVE", + "items": [ + { + "runtimeServerCertRef": { + "id": "sslservercert", + "location": "https://localhost:9999/pf-admin-api/v1/keyPairs/sslServer/sslservercert" + }, + "adminConsoleCertRef": { + "id": "sslservercert", + "location": "https://localhost:9999/pf-admin-api/v1/keyPairs/sslServer/sslservercert" + }, + "activeRuntimeServerCerts": [ + { + "id": "sslservercert", + "location": "https://localhost:9999/pf-admin-api/v1/keyPairs/sslServer/sslservercert" + } + ], + "activeAdminConsoleCerts": [ + { + "id": "sslservercert", + "location": "https://localhost:9999/pf-admin-api/v1/keyPairs/sslServer/sslservercert" + } + ] + } + ] + }, + { + "resourceType": "/keyPairs/signing", + "operationType": "SAVE", + "items": [ + { + "id": "9vgmnd36wykte1l2nm8s8uead", + "fileData": "MIIKYAIBAzCCCgoGCSqGSIb3DQEHAaCCCfsEggn3MIIJ8zCCBaoGCSqGSIb3DQEHAaCCBZsEggWXMIIFkzCCBY8GCyqGSIb3DQEMCgECoIIFQDCCBTwwZgYJKoZIhvcNAQUNMFkwOAYJKoZIhvcNAQUMMCsEFGE1eouos0ogOnWNc6FlD_t_Lq3UAgInEAIBIDAMBggqhkiG9w0CCQUAMB0GCWCGSAFlAwQBKgQQIypkDlv39a_TEUt3GdyjbQSCBNB1iYlhzaVOv82x1xTAlmHUhWUaDBBVmnC_rntb3atP5_jx3GGsrHMiXQpe06ashkgrZ1G5zQbch4zu0NKG7OZ18qnd3G9sWp9aW_Q1dvniv6Qppi1jf1xMV2VgPkCUk2di4EAOTpSUeau6E6OWwSkxwpqy1uEGEemph2YG082Yu-C28WjTr_XViMQ6gs3lIw4dHKC6ViyP2Ti-zPLUl1bTnU7k9yebQZabTl4PAcK3DiTsKOHnGkWs_Rfa0ZsEaivlR7UcMbkUsFmOby9PpDK81frg4Sf-yqsTzulmNVfiwOOEGl_O3Cymd6oacHwhbBZp_BUFyjah5ZIQc3Q7jnkpK0nog3OOeBmjJHkLX38k6q3I4aDip-op6MmcbYip6h4vOJQT8nl8Xsg1oi4Yjjx-xv-TjXSQ-ChRuLE60TquhIl7QD9uyWjqzIWmZJ7Xi8SchTHRwJa3JbxxZlnxnseJtVcoeKhc_BIkcqJu3MeuhsHzWu1Lyap_v_0OLvAfaj4IfqP5lHuw7Q8iQ9S1vGcmH03mI879-Y9pfzhjKpn94JfCg_VNu8vRScy_m7r7W_yxxr7TZfdQEUVMd1r02mWCKMuVa0esVhms_aOo2VGGfMA1dNLMOdvspNvbLPCKPGFofHyNDL9Xbq6ANYrWRgXCOC-vKyMCxz73vbD-LuXkaV7Fk_qbGZZ7DnIuTjeXN2LNVDrjKZK1156dHBE0kLvstla_GiV-LZalN1nwCKxg4Oec9mh0uaXQXw5YT5lo-LiY1fM7aoUZOIy4OLykhWSyN3O9gu-C4LlchXO4If8lKSRLieTh4DV8F7dq91NOmbwPySRrQxzRg6IUs5CWT7rdm58v14SUYLr7ER2uhKm8Pcc3BtiJ39F2Mvk_PhTNPj5ELm-dXXDoT07YIqg-3UV-vF7UVdVfFfDGwylTMMmmtOeBv5-z_tWHqjoJDx7f7sl4LPdENhfO-hXkX74N2TbogvljkIRSGQKd-d8TNR1XzYo5oZAY2_L_oP7MIDGGK1rHZ1kjpiXguyOwJNaQsbpRbhAucwjbWKGCwaU_EMeS2Wu9tkqR49ww-Q_HUosga_zdeMzrpsIdhN0mH4dqYkX0zSa0a661pKlbfHKTUFlOyFkxu7j7df5vGqUJlQXekGXKHiiNYHXIXynHDfrdmJiIYO4TFqvmyVjIogJ92UOMfHShCOv08Z2vWXG55bmiD5cl-KuY8mfdr2-E4HJMukSgBrA-iEuhqvA3YaScpeabHxzpn-vBFGmVc_8ovbCX9VBJoBQxpu7zIK834m1hoDvZcodI7vGNBZlWjK5o7uoAcP5uk7c4U5EdOco3PQs-w10L-aQt8LsOnDv3jrg1Xu6IB0YOsG0XY24xK6Wh73yvsZcZepMkU1ZAWzZxu2s1z0lU3Ih2aHDGvrmz6BXuSG-lYVX5oRIMoyFa6dSTU86F7RkmBz-nx_ZalEGJMU64JAcUeW5V2A8QmywDFhsEYZUbNGKij0CEaBwBXzXAbwEGiUgee4y4yYQr6cTC2-VnJ6hJZafAQl5RDPYdKNQVi1OrjdrTHFo67ieHlmEnGZ50ruXEzEPGymM3nVawS5iQh9EKpnu7SwCFU53XVX4MSlO_gzXg0752TPQ-cNCnWsftIDE8MBcGCSqGSIb3DQEJFDEKHggAcABpAG4AZzAhBgkqhkiG9w0BCRUxFAQSVGltZSAxNzM4MzYyNzc3ODk4MIIEQQYJKoZIhvcNAQcGoIIEMjCCBC4CAQAwggQnBgkqhkiG9w0BBwEwZgYJKoZIhvcNAQUNMFkwOAYJKoZIhvcNAQUMMCsEFDowzdgMEzuCIw3Y9t_PTzXDX648AgInEAIBIDAMBggqhkiG9w0CCQUAMB0GCWCGSAFlAwQBKgQQi48YGZqK7dbYho_BunhoLICCA7Dg9qWc5rLprVyg1yi6MIXUL1J5uZjy5p6YcykUQxCdtQ1dSCtXnyPHPDh_M4pNlYaZhnZaHBEJUGrf_DtOXWIx4DTfHQx51ekMuLmXMrXcoe2cHIap0r1ZkC5Pec8sXAtlV9NXpItDBDzPDUowJSuiOyX_JZ4xyfKI0zy-RCYwT7AP7e-roRt1Kcx1mJ58GHgc8ni57UhUBDAyUS9EAS8-5pyImBC_jFuIAnzL7h4_7v0_906Dt-f-B_0oQLHWlyrIw1ZANnkt1BPsyzgIvaaa_He-dyel2-ZafThiLhfYGWqw-oy3Euwbeij2957U8dV7VNjzNT17f6UJlMM7tZ8L-gEnSAGTrF-E6AZRMybia5dFAZHSpRoBms9IXaOIMUXkqLZJVs0Lcq59iTIt_1KPnTxUpWYzmeVoL273NgVjLmk_Ms7CMjCl6a_D0Cnil_Pij_GR1jxVkl7gf8-x2r78Wapltpc1ckjNZjRZdxiLETN-1AV99vDClDZbHjcCDwqbuxgPfcT58JsYeNtTU8-FKdCyapyDZltjbm72lQtdeFkWmc5Duqz1Om2dZQ7R6voNFFjZwHK_w0_6Spn542mOUPVOonHMy0ryWJAQk1kXtNVY2FsJjyrs30drMduWDTk9zZYTmzMqhPIldNfT3EGt_cYsa-i5pP5OcCjyOSQJT4uutk8xi638O3vHcerNhwQGUgsC_mPPceSK46FtOdCP8NJbgRYmq38oQtvd04J2eLWGz5YW3A0g08INZSX9NCq2UK9LVbLy4QmK9E_B_Kev0At-bUuQuARuNCSW4o5K338NjwVWxEJqHYFzQV0dLk6L8sw5xs7dDmoSw85Umk_6Tgc3zowOYH4itkkbOVXpupWLjBitUdxKqGNyA06khtxPxpIjY0Gs4RQdD-kFrxkIVHQRdhOEauRtp5JPjBLaWqfWhHM1FkXC_HMZGHVCQdAl6rOVoTOJmitO_3V9ge5OUy3yE-e-M5hOws0tp2TrNAn6CHOB-haUBbzuMknTuFy5tls1lomIhiBz4t4rP3NN0bnlBdKA0uuYM1jyrWDtbmJbIsSRlJKgLswOzP-q_CrEl46gac_bUVnIeKPOdRdXcmybgczK0DSkkdWZCHV8zXUlq3VCJFWJuICg3dP52DdmadWJkqzCf9TBY-I_rfRfhersW6O4q6jpUPPfJxVMr1fKpC_AAzToXtZBcPJKWwrMgl12a67hvaIEw5bRdsx1nTnL-eXXvQMCj0EcDUFB7zBNMDEwDQYJYIZIAWUDBAIBBQAEIFg2gaa_X-B6s-HT3bVLHh9khDb50NP5eyyz79-bA90ABBTevhK8eADgl1aq9JJTH9dcOeMesAICJxA=", + "format": "PKCS12", + "encryptedPassword": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..h7BMDiugph9XZtAF6dmR0Q.a8qB8DAG-p_IA1CTjPkH7lKPKi0e0AFvIBGtYWWDHf0.G7dcXNLpAOlNVjpY6UGkXQ" + }, + { + "id": "tiq4n26axjircjk30oz5zf6k3", + "fileData": "MIIKUAIBAzCCCfoGCSqGSIb3DQEHAaCCCesEggnnMIIJ4zCCBaoGCSqGSIb3DQEHAaCCBZsEggWXMIIFkzCCBY8GCyqGSIb3DQEMCgECoIIFQDCCBTwwZgYJKoZIhvcNAQUNMFkwOAYJKoZIhvcNAQUMMCsEFGuOOanUm8DAZylSj_vArT9nIy7GAgInEAIBIDAMBggqhkiG9w0CCQUAMB0GCWCGSAFlAwQBKgQQwpKllSJdf-uLTHA2IjUCiwSCBNC6XTUwZKnUEfLCTc8Utk-JgksT37eNN81ZaK10BrkQkUNPNHxWXAN2Fb6iYQZh4StFnelFl0SOOnmtf557VA-midwuq5vifB7cS-YGt6P9UQUL3rEKuo3-pkGKQPHbhrhPwrllTXKOD4E0y6_yNV9qaGByF6eT4Sk-owCXb5aFMdUNMqnjoPPXSibIUfxu4TdKmXGCNHFQWytKOvG10KLJ3CuerSrr2AZKaw4vq1l-n4dvcf5GqUTswOnbw8EkF9ZhWtWf4udJN2_CkbcWD4bzwFJHWK_NWSrHiAr9bDV0suZ8l59SOYnui5-nhgcECraKxXhCjoPhaR6jtINVOPo6_Yx-BPw9JmCTK1PI7ZxxBudmoTInw_JAsZYuQevQvlrx5jjlc5iGq9b1h9xLWJj_3g-Mvt-auMQUg0vVuRbD2eHFxLX8uB9wDB_XoDa55d7P-6KRRPYQtwBeYYN6UNhLrnSBCQJsKKhkN957reH936z21ONfjxzeQh8jYdhl8deKqnL3Nead5QjiY7mErMr35LDqozmDysiDr1GHIJya2eYCxqYKTjKzNyGGxKZ1AfPTAXw_PNOpxl_AmzLVCbgMz6fpqVuFo6z1TUbmZhvxi5JUWp4WuH6gtBByNdTyoUCu9PGGYx3Ctsh3rjTjLi4MKBPilfhpx63XBVLkio1CZMhnBmJBs1aod992aQlF_oSWI9hNBPrHngEIpEt3AO1UP7lcblgFoym9EIjZB61l3q1hCcOHqz-HMlu2jfUwOpN9-poqQqyOtODsEgdWtCVpu85iVoh_YgANa-UKtBZL99yqDNqTpHykxCiXFJiToprDtVruX7veKnE3LhtdmmNg10Netwvh0xdzsAR642V_2oYxW2ARJkZ4TWchRicT4m6UfiRTTjnhDei-4JJp-7pEyukQcWPh5inkGVirH6tbBwxDn9cOx_h3aLOykDhWnCPAQHMRtIANtxmVEiCOcmqxgVMl5ogPZ6l9udhVdHkbAPlh7q3hEwskVOzBsnwdzrKZ9wyN3q1kM2BX6g7EeHhnD6SPHAvBnlihQwX-HIR7-04buenq7ZuC8kJ7yybsm5-_LoOm0JuHrTevsjc_uMsNlzDo8R3nfm_Y9cf53sUe2C9AZG8110A4gvEOJxwjAPgrANnapIXKd0i50ZUaUBP00SUxMyQKFC6bo_E5PFr2Xk6PY_EtQK_wELawaoTblzQfdgkZGltyqn1oTO1Ohodi_pPMcqhNd2LGt2qs20yxGMBUsVMdgZxaf1zbTajcDMaNfre70zhxjnla0Hf8ceyne9bBll3pJBEYxiFI0Stcln4aztEmqYJdWuAty7QKqVIA-QSchP3-rzSExri8vDLCnF2O-W9iuAJgbztJ8PTXMbNhNR5Pi5GhhBGJppjdsRUVf7oORatotwFBDdDljiGSmKtSpCV4-OD59DWSNrh9iJ3m4x9VKqhYcJDImFKhGzaWSVSnLoMKWUKnnSuilPoS4iMCYnrcPZeFDtCSo2mjwJeu80ex9la0oFdmQ7VCcPGZq9AzyMTUa4jiZIRQklb0Elua8ic4LAptJUwd9PWOcUMQHzfg_UlWPuRuTWrhfTBxR-sLNmvtsp5i0EPA5-4vrSF5Bhxcmh0oUUWhx2efzDE8MBcGCSqGSIb3DQEJFDEKHggAcABpAG4AZzAhBgkqhkiG9w0BCRUxFAQSVGltZSAxNzM4MzYyNzc3OTMxMIIEMQYJKoZIhvcNAQcGoIIEIjCCBB4CAQAwggQXBgkqhkiG9w0BBwEwZgYJKoZIhvcNAQUNMFkwOAYJKoZIhvcNAQUMMCsEFAvVF_i5GyLqTXVcJquxRb1Oj8p1AgInEAIBIDAMBggqhkiG9w0CCQUAMB0GCWCGSAFlAwQBKgQQhHSet9X7FtMBKCSk0pNjoICCA6BAqo1uUYK6yfxiLwRKR2ufTtUg5do1ruz4vbYAN3jn2l0dqyVo5KkeSwqFGD3GFsOfaNUSeArjB6fRM0O4wc-vLFXQAZ2qN_RIHBeEceF7tdbhgY-HcPp1tvRwqpXMQxBpXqO2JmGhMJOazHJei3Vn4-GN-sEbCNjbruMuXT_UeESzqEerXIuxLfDGnwA4T5vKcA80geRTea2lp8ikSDAuOhRqiprxoJRstahq07tvFQjXcx7QoNqJzkUXCX75l-mL5hmePGkOYbaFWeKWFgLCDlu8QCa4XzofLXQgy_A5ePNCe1npv0jXTq_ai7B4za9nD7qGTwUtknTNW4KQoIjhxoFQg4zMSfZukyDwCjhN4EXxRZirvp-MfvwRImz3Xat7OtAOjGLf1mFfNGe7RaXFTv40PLOUzE6QZqw4Ow7Cw2sqF597yOVOcDfh5JRZoeeBNtQkQkgyZqvOvvE2-3F9vtmXa-Jy2mq6zXUzXzHVNp9uRYS5tIAq5s-larLxE-af4kmB9iod3AlMyR-NEa3C1qe7sNli4Sy7Woelw_IgmPEqD2CVl5RD7u8GT2Hl2lcx4K2m-SLRpl4uRJ1J-3BDYUTfFCsi5wRTZq0XVUquPeAiZ6l6T7110aA3ii2kaA9LCXdahKJ6TXhlVU4dnHG9dKQ1ha8GGSo0YLb95Pjpq2435wz3l4pkcoycIq_K-hwiemCB9mdeaOanVFc1VGznAxJSeijoWZcgkNdyzze-6MWGXsk5DgZHt3TL_w22y84ujCOte3jOxOHYgnzFTKTOlJ3jVf8gbBZZH3nyfyqZ2DJBUT0xZDa0I3V0jtLvTPDUUXsxDaYdCgc2w8VKAQciasH1ephgnk7co6-CPoQfqVXgzzL34_TFZujRKMD8s-nD7RA6r8SzOk03HZDNxq26f_o2_TXo_PWes2SB8G0lDIvfMlZMPU-MopapbwjVMsxYR-5P49Fl4liXjiO5E703gQuW1Jt7iXvZ8RW5evrC-AjNF3nkSGDu_x2fUTmkmiZjn5aWGzbr0cPYS-oumtnczOfx9CDwVMZKRA67LPkF4HvBge_U55eZrmbUv0CJ4KRiAYX9UuNgDxcCSUC76lkEb4d4qOyVinSPQkjXviMd0E6gNifhWEpASyfp2t5Hc3hB9rDZZ367bkdxuIovAHlsdXh9yeB2ICM2v9CQAtoN7F4TDvPrBhybPITpY0jAX71eg0rdsyQnmeKgKP47E8B0ME0wMTANBglghkgBZQMEAgEFAAQgkbCJWiLDEwnrJgpojDldYI53FioUQrTir0QGk4OElaQEFEDuQVfguSwEz_oUv7rRAjgWwX_TAgInEA==", + "format": "PKCS12", + "encryptedPassword": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..1I3czs6vz28qZOTDxxkoIQ.F4Ep-IwVdgCVWZ6ydpSrxBEVkOWtngLnyWR_DZbrdbo.hFrSPzu2NLxiDtmz2bk9EQ" + } + ] + }, + { + "resourceType": "/keyPairs/signing/rotationSettings", + "operationType": "SAVE", + "items": [ + { + "id": "9vgmnd36wykte1l2nm8s8uead", + "validDays": 36500, + "keySize": 2048, + "signatureAlgorithm": "SHA256withRSA", + "creationBufferDays": 9125, + "activationBufferDays": 3650, + "keyAlgorithm": "RSA" + } + ] + }, + { + "resourceType": "/keyPairs/oauthOpenIdConnect", + "operationType": "SAVE", + "items": [ + { + "staticJwksEnabled": false + } + ] + }, + { + "resourceType": "/certificates/groups", + "operationType": "SAVE", + "subResource": "STS Settings Mutual SSL Authentication Certs", + "items": [ + { + "id": "ycrgw3j4ckw91gxdmd479qftb", + "fileData": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURuVENDQW9XZ0F3SUJBZ0lVUzJUQkNkUnpwSzRaemUrSERLakI5RVFTSHFZd0RRWUpLb1pJaHZjTkFRRUxCUUF3WGpFTE1Ba0cKQTFVRUJoTUNWVk14Q3pBSkJnTlZCQWdNQWtOUE1ROHdEUVlEVlFRSERBWkVaVzUyWlhJeElqQWdCZ05WQkFvTUdWQnBibWNnU1dSbApiblJwZEhrZ1EyOXljRzl5WVhScGIyNHhEVEFMQmdOVkJBTU1CSFJsYzNRd0hoY05NalF4TWpFeU1qTXlPREkwV2hjTk1qY3dPVEE0Ck1qTXlPREkwV2pCZU1Rc3dDUVlEVlFRR0V3SlZVekVMTUFrR0ExVUVDQXdDUTA4eER6QU5CZ05WQkFjTUJrUmxiblpsY2pFaU1DQUcKQTFVRUNnd1pVR2x1WnlCSlpHVnVkR2wwZVNCRGIzSndiM0poZEdsdmJqRU5NQXNHQTFVRUF3d0VkR1Z6ZERDQ0FTSXdEUVlKS29aSQpodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCQUpkb0d1cmdEdlNSQkwyY0llVWFDWTNwbzVZRFpuVjFleXVPUVR4UWM2T1QySlMwCis0MGdKYkptZk5yYmNPU3QrMURieHpQK0l4YmxrY3o1NjlWT0M1bGJST24zOHllYU1VMzJYYy80REdTcDFIQ1kvSmZTeWd6LytxcjgKOFlUcU1hSTIxQWJabkFpWTV4MFJ3NTZJRG1KZ2xYYVhlVmJDVUp5N29QVHlBb1lZVDkzREpEazQxWmU1MVVjVG1Vc1RLTjRLM2d2dgpTYVJ1eXE1K2c2RVhCcTdBa2VPbmJQMGJTSHliTjFLRVY1QlhOTnBnazloMEp3M1BFK3FrbS81bllSenhCZjRSQS9BZ2Z2OWVzRzlOCnozWGdEb3dBR0JteHIrclUvbmE3cHdFRXVkTWg2NjhERURlUlZ3aDFaYXBZcEJ0VmN4TUhtZEpQZ0ZKckJsbzZtTUVDQXdFQUFhTlQKTUZFd0hRWURWUjBPQkJZRUZHSmMzWjBqOWtYUHNUbW1iZ0FzWS9QSzJjdXBNQjhHQTFVZEl3UVlNQmFBRkdKYzNaMGo5a1hQc1RtbQpiZ0FzWS9QSzJjdXBNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBSlZCdmNIaGgrMDBnelEwCnBuWkt0Ukp4dkVnK3BHaCtCOUUrNWkyUHNOR3lJQXZBWHc0bWRCY1FaS3hmaVhNMzFaRTJnZTFtUCs0ZGkxMStQS1lOSDJFOTczUEwKSit3R0hlUVoxRVRERzVmbzc5dDBNRzFSekh0R29pclpXN3Y0Qk5VSTZaTTJGakVhQ090WmcxclVoa2RJZnFEeDRDZU5qemIwcmhYSQp6WE5UUzRZNlZseFdBclFud0FncVB0YjVwb0pHM01tLzNmNnVRZy9sMExJS1RZL0dSNnlRc05Da3pUWlFocklwWGo0UnBxblgzUWdECjFJV1RvTW9uN250cDRnQVAvbEFTTTUveG01SnpiNmRtRitob04wNzNnMDJVZVYyVERMemU4MCtLK1hyMUdaZWVVTHVYTnJoT0VYRFIKeXR2dWJlOE9YUFBZNi96Q3BoVmIyMWc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K" + } + ] + }, + { + "resourceType": "/secretManagers", + "operationType": "SAVE", + "items": [ + { + "id": "testSecretManager", + "name": "Test Secret Manager", + "pluginDescriptorRef": { + "id": "com.pingidentity.pf.secretmanagers.cyberark.CyberArkCredentialProvider", + "location": "https://localhost:9999/pf-admin-api/v1/secretManagers/descriptors/com.pingidentity.pf.secretmanagers.cyberark.CyberArkCredentialProvider" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "APP ID", + "value": "testAppId" + }, + { + "name": "Connection Port", + "value": "18923" + }, + { + "name": "Connection Timeout (sec)", + "value": "30" + }, + { + "name": "Username Retrieval Property Name", + "value": "username" + } + ] + }, + "lastModified": "2025-01-31T22:32:14.755Z" + } + ] + }, + { + "resourceType": "/pingOneConnections", + "operationType": "SAVE", + "items": [ + { + "id": "noeOvj5ltBnf4rcmtZAKdJ", + "name": "internal_brassteam_893438732", + "active": true, + "encryptedCredential": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..9kOSOKSt93i8OBPktHZM9g.ZLpaS52b3jpfvAYFwnYtSqX8WF3fajMAVBXDQKLpevqjxgvJtT-L09h9JMjtRU4N70QCqSRvm9jlOg_n57Pt1tu5Gk5-QKVUxgbo0llQJlKsU_rboxh50z_rC9Q6aJwa5pa-pAjTKdhXsTte0yQCnMeRyqV0tVrX7_66fHXCE7QxkreazomjIaHDPeb-nT29g2e_bFOjEjZkFIIYS6fn7BwwRp89FUGC1_ZISVgBtNfDa3EgdPOdN4CznzSK3lIreq4uuAHlnQvvHTGziUUzuhftq_KdkFOBCFZrFUUy9Pe1EOgeV10x1hwOYl84AKz4wy7jLjFDWKKIMltBXwB_XVFHV3okz1sZ8BYarbB37mmE8vjdNrq9jyezqOnVwyHgMPD6ti_cfKyIpGS3MOGsJePIVAtPdeWMBKB7m8M5Fp2BUcQFHi9kS2CpZkVePfZElsIH9Ltw4Z9Afih2hyBvFG5Y_0k2zS730rt4VMZW4EIVkUNUYfiw3CMYyqr4SVePWbfN5lO1fh3u3j5VSi30izT8QxUMlNm9BS83zBcliGMQP8PUjLWXj0KfAKIg82VpDYVD4A0IHPkw0qv7vmvZ5O54x5QmghPRqObpcTNNMFBVevXCyvp2H0MQYsLT2SSv2LnmhBakeXcaV2Uoem7VglbL82hQeZMV2WqbVfyugPnnE3cZ07bDa0iZd0XAPoN_K9KiwWp5Vm_SMLmc3_-hxBqGpYOqbRfeehf2yggtkcEQlEDyZs9MYU1ykkCwqsk2Q1oEJH8I5B16Y7uY5kIX8ym9i5h4qDQm9q7uj32Gtxq7IDP8EuEBfPE_WBMHbJC4qeItQptiyuUxtcGHQp1m98lBXV4rqK0_zzt4k2k0H3IT1XaA4T8gFyVSCkMJeJmLmN9tseKzdr_VyQwjItmQxScm7zVsuzcR-Jiagmv_fJYQKIJRVNa-m8UgBQl0VI1GO1l2TAryC1BhSJN04EFup2hRi-o3ddn7Gkrm7s1BA3RwuBLDzw6rh2vcJjrNNxWtsIZZhnU6DQR-Iukq3Jg4IJdQxkL0jijRcRTBkKNYmKJBZrrvWAvo9R4NMXRhLoOahy1OM_ndyh1OEu3_AbCbBrx38QVK_vPWjwys1XxsR7-5HNzmRep-OQRn2dXBaSO1oCHgGSsPZRbDb8165fEOORhzYstpOS34dlZX7t3pP8_B2erq1n32vToR3TOz7bLXS-J44Av32HFt4jBGZcmPRBWVqzS8yqMmeInkqxYTASgxCsj7WByvum7WrgSoHphlsSt5iI1QO-FWgemakahgIvKQiV21kXDBcfG-gGjFDtTEG9lPK7mGJ-vEX6qy8SJKFAHJIUHXPpy0fnTLALZt9_IN-XLPW59WBfe_yThSizFBegSL9We_7J9Vni8nu4JZJ9DmRblExLMWwtt31YVTELIgQLSFrplI1UHRCyHCF6MNcN3WrHJzxYZXlemZYPJyxXaV1aExut_a35UiOQWNJ9RKNawKML4wZ875sCZa02bkvyeDEuck3HumM7v825oNxEUTVU1DQ9a_Bgb-4MovlXWDZP3_HSTd657hxBccDlAcFtYr8oHmIYjYgGzcRi6uDYVVG33zVgE0ceZDGuGrmh88nqzBIbcX4I91AAWIBNJjzMyiXvOK1eKO7X_qYEsf4iDzYej8UlMeRpxJ5DsIVBtizvL5qJYrOHEFs9Kxih3sOrFwIOsb0JN275730cjJdsWzD-T245ADxzycwGQYNw.bvBBwx7JaS8a5OIdcKarmA", + "creationDate": "2025-01-31T22:32:14.801Z", + "credentialId": "971b5d20-0955-4030-b49b-7e349b3b9b1e", + "pingOneConnectionId": "554257ac-76ca-447a-a210-722343328312", + "environmentId": "f5901536-2b60-4d4a-a987-3d56aadad46d", + "organizationName": "internal_brassteam_893438732", + "region": "North America", + "pingOneManagementApiEndpoint": "https://api.pingone.com", + "pingOneAuthenticationApiEndpoint": "https://auth.pingone.com" + } + ] + }, + { + "resourceType": "/dataStores", + "operationType": "SAVE", + "items": [ + { + "type": "LDAP", + "id": "LDAP-PingDirectory", + "maskAttributeValues": false, + "hostnames": [ + "localhost:1389" + ], + "ldapType": "PING_DIRECTORY", + "bindAnonymously": false, + "userDN": "cn=pingfederate", + "encryptedPassword": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..64nlOkXuYGL4PoJX2FUx5A.qWhVq-Jjhh4uwYAZMX9A5g.3haZjzMXPBcs4ssG6OlBLw", + "useSsl": false, + "useDnsSrvRecords": false, + "name": "PingDirectory", + "hostnamesTags": [ + { + "hostnames": [ + "localhost:1389" + ], + "defaultSource": true + } + ], + "lastModified": "2025-01-31T22:32:14.916Z", + "retryFailedOperations": false, + "testOnBorrow": false, + "testOnReturn": false, + "createIfNecessary": true, + "verifyHost": true, + "minConnections": 10, + "maxConnections": 100, + "maxWait": -1, + "timeBetweenEvictions": 0, + "readTimeout": 0, + "connectionTimeout": 0, + "binaryAttributes": [], + "dnsTtl": 0, + "ldapDnsSrvPrefix": "_ldap._tcp", + "ldapsDnsSrvPrefix": "_ldaps._tcp", + "useStartTLS": false + }, + { + "type": "JDBC", + "id": "ProvisionerDS", + "maskAttributeValues": false, + "connectionUrl": "jdbc:hsqldb:${pf.server.data.dir}${/}hypersonic${/}ProvisionerDefaultDB;hsqldb.lock_file=false", + "driverClass": "org.hsqldb.jdbcDriver", + "userName": "sa", + "encryptedPassword": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..wiFBgJnmvSMp-pdNCcWxRA.wSWWVdwfp1ccq3JjbS3Msw.SsKTVuYcIpnx4GTaBp3ixA", + "allowMultiValueAttributes": false, + "name": "ProvisionerDS (sa)", + "connectionUrlTags": [ + { + "connectionUrl": "jdbc:hsqldb:${pf.server.data.dir}${/}hypersonic${/}ProvisionerDefaultDB;hsqldb.lock_file=false", + "defaultSource": true + } + ], + "lastModified": "2025-01-31T22:32:14.931Z", + "minPoolSize": 10, + "maxPoolSize": 100, + "blockingTimeout": 5000, + "idleTimeout": 5 + }, + { + "type": "LDAP", + "id": "pingdirectory", + "maskAttributeValues": false, + "hostnames": [ + "pingdirectory:1389" + ], + "ldapType": "PING_DIRECTORY", + "bindAnonymously": false, + "userDN": "cn=pingfederate", + "encryptedPassword": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..NpyVixL-cYvYcKhd7VuWXQ.hPBXeyuXN4-FoAR8zlt3Uw.LnxX4-w3XqQxPFDQhV0skQ", + "useSsl": false, + "useDnsSrvRecords": false, + "name": "pingdirectory", + "hostnamesTags": [ + { + "hostnames": [ + "pingdirectory:1389" + ], + "defaultSource": true + } + ], + "lastModified": "2025-01-31T22:32:14.941Z", + "retryFailedOperations": false, + "testOnBorrow": false, + "testOnReturn": false, + "createIfNecessary": true, + "verifyHost": true, + "minConnections": 10, + "maxConnections": 100, + "maxWait": -1, + "timeBetweenEvictions": 60000, + "readTimeout": 3000, + "connectionTimeout": 3000, + "binaryAttributes": [], + "dnsTtl": 60000, + "ldapDnsSrvPrefix": "_ldap._tcp", + "ldapsDnsSrvPrefix": "_ldaps._tcp", + "useStartTLS": false + } + ] + }, + { + "resourceType": "/notificationPublishers", + "operationType": "SAVE", + "items": [ + { + "id": "exampleSmtpPublisher", + "name": "exampleSmtpPublisher", + "pluginDescriptorRef": { + "id": "com.pingidentity.email.SmtpNotificationPlugin", + "location": "https://localhost:9999/pf-admin-api/v1/notificationPublishers/descriptors/com.pingidentity.email.SmtpNotificationPlugin" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "From Address", + "value": "example@pingidentity.com" + }, + { + "name": "Email Server", + "value": "example.com" + }, + { + "name": "Sender Name", + "value": "" + }, + { + "name": "SMTP Port", + "value": "25" + }, + { + "name": "Encryption Method", + "value": "NONE" + }, + { + "name": "SMTPS Port", + "value": "465" + }, + { + "name": "Verify Hostname", + "value": "true" + }, + { + "name": "UTF-8 Message Header Support", + "value": "false" + }, + { + "name": "Username", + "value": "" + }, + { + "name": "Password", + "value": "" + }, + { + "name": "Test Address", + "value": "" + }, + { + "name": "Connection Timeout", + "value": "30" + }, + { + "name": "Enable SMTP Debugging Messages", + "value": "false" + } + ] + }, + "lastModified": "2025-01-31T22:32:14.992Z" + }, + { + "id": "exampleSmtpPublisher2", + "name": "exampleSmtpPublisher2", + "pluginDescriptorRef": { + "id": "com.pingidentity.email.SmtpNotificationPlugin", + "location": "https://localhost:9999/pf-admin-api/v1/notificationPublishers/descriptors/com.pingidentity.email.SmtpNotificationPlugin" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "From Address", + "value": "example@pingdemo.example" + }, + { + "name": "Email Server", + "value": "pingdemo.example" + }, + { + "name": "Sender Name", + "value": "" + }, + { + "name": "SMTP Port", + "value": "25" + }, + { + "name": "Encryption Method", + "value": "NONE" + }, + { + "name": "SMTPS Port", + "value": "465" + }, + { + "name": "Verify Hostname", + "value": "true" + }, + { + "name": "UTF-8 Message Header Support", + "value": "false" + }, + { + "name": "Username", + "value": "" + }, + { + "name": "Password", + "value": "" + }, + { + "name": "Test Address", + "value": "" + }, + { + "name": "Connection Timeout", + "value": "30" + }, + { + "name": "Enable SMTP Debugging Messages", + "value": "false" + } + ] + }, + "lastModified": "2025-01-31T22:32:14.974Z" + } + ] + }, + { + "resourceType": "/notificationPublishers/settings", + "operationType": "SAVE", + "items": [ + { + "defaultNotificationPublisherRef": { + "id": "exampleSmtpPublisher", + "location": "https://localhost:9999/pf-admin-api/v1/notificationPublishers/exampleSmtpPublisher" + } + } + ] + }, + { + "resourceType": "/captchaProviders", + "operationType": "SAVE", + "items": [ + { + "id": "exampleCaptchaProvider", + "name": "exampleCaptchaProvider", + "pluginDescriptorRef": { + "id": "com.pingidentity.captcha.recaptchaV3.ReCaptchaV3Plugin", + "location": "https://localhost:9999/pf-admin-api/v1/captchaProviders/descriptors/com.pingidentity.captcha.recaptchaV3.ReCaptchaV3Plugin" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "Site Key", + "value": "asdf" + }, + { + "name": "Secret Key", + "encryptedValue": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..LEHbXKxxq0izxaHGeMAMAA.5gWiH8Z9IZCNJ5XTilpWYw.YCG2pILn3QiJertJcDMVpA" + }, + { + "name": "Pass Score Threshold", + "value": "1" + }, + { + "name": "JavaScript File Name", + "value": "recaptcha-v3.js" + } + ] + }, + "lastModified": "2025-01-31T22:32:15.038Z" + }, + { + "id": "exampleCaptchaProviderV2", + "name": "exampleCaptchaProviderV2", + "pluginDescriptorRef": { + "id": "com.pingidentity.captcha.ReCaptchaV2InvisiblePlugin", + "location": "https://localhost:9999/pf-admin-api/v1/captchaProviders/descriptors/com.pingidentity.captcha.ReCaptchaV2InvisiblePlugin" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "Site Key", + "value": "exampleCaptchaProviderV2" + }, + { + "name": "Secret Key", + "encryptedValue": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..D1Sppt9g51GeGAKZjrBdhg.4QDUIu63Od67tRn1nTFMcA.FtwqtuMxlkE5j0Z9U7Xa2A" + }, + { + "name": "JavaScript File Name", + "value": "recaptcha-v2-invisible.js" + } + ] + }, + "lastModified": "2025-01-31T22:32:15.069Z" + } + ] + }, + { + "resourceType": "/captchaProviders/settings", + "operationType": "SAVE", + "items": [ + { + "defaultCaptchaProviderRef": { + "id": "exampleCaptchaProviderV2", + "location": "https://localhost:9999/pf-admin-api/v1/captchaProviders/exampleCaptchaProviderV2" + } + } + ] + }, + { + "resourceType": "/serverSettings", + "operationType": "SAVE", + "items": [ + { + "contactInfo": {}, + "rolesAndProtocols": { + "oauthRole": { + "enableOauth": true, + "enableOpenIdConnect": true + }, + "idpRole": { + "enable": true, + "enableSaml11": true, + "enableSaml10": true, + "enableWsFed": true, + "enableWsTrust": true, + "saml20Profile": { + "enable": true + }, + "enableOutboundProvisioning": true + }, + "spRole": { + "enable": true, + "enableSaml11": true, + "enableSaml10": true, + "enableWsFed": true, + "enableWsTrust": true, + "saml20Profile": { + "enable": true, + "enableXASP": true + }, + "enableInboundProvisioning": true, + "enableOpenIDConnect": true + }, + "enableIdpDiscovery": true + }, + "federationInfo": { + "baseUrl": "https://localhost:9031", + "saml2EntityId": "samlEntityId", + "saml1xIssuerId": "", + "saml1xSourceId": "", + "wsfedRealm": "" + }, + "notifications": { + "notifyAdminUserPasswordChanges": false, + "expiringCertificateAdministrativeConsoleWarningDays": 14, + "expiredCertificateAdministrativeConsoleWarningDays": 14, + "threadPoolExhaustionNotificationSettings": { + "emailAddress": "", + "threadDumpEnabled": true, + "notificationMode": "LOGGING_ONLY" + } + } + } + ] + }, + { + "resourceType": "/serverSettings/systemKeys", + "operationType": "SAVE", + "items": [ + { + "current": { + "creationDate": "2025-01-02T17:59:19.959Z", + "encryptedKeyData": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4xLjQuMCIsInppcCI6IkRFRiJ9..mBwXJBuBBcBb1iuF7_J_oQ.aD0ENEXvfHwWh_wJBCV6_uj98eJ8hFuLpstFj19YSB6kFScALLsDk_6r4oSzepix.dj8Utcj8m66bpfazwNsw8A" + }, + "pending": { + "creationDate": "2025-01-02T17:59:19.960Z", + "encryptedKeyData": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4xLjQuMCIsInppcCI6IkRFRiJ9..lTUXjpewvJW85TygS2XTtw.tn7hmeI-KHBTvmRmev2pvqN8R2qeW5PHhMBTUa761u6vbJ7wH70SJyU-RoZ3mYX0.XLC2NhA4WJ4mmmE-RtRyQw" + } + } + ] + }, + { + "resourceType": "/serverSettings/outboundProvisioning", + "operationType": "SAVE", + "items": [ + { + "dataStoreRef": { + "id": "ProvisionerDS", + "location": "https://localhost:9999/pf-admin-api/v1/dataStores/ProvisionerDS" + }, + "synchronizationFrequency": 60 + } + ] + }, + { + "resourceType": "/serverSettings/wsTrustStsSettings", + "operationType": "SAVE", + "items": [ + { + "basicAuthnEnabled": true, + "clientCertAuthnEnabled": true, + "restrictBySubjectDn": true, + "restrictByIssuerCert": true, + "subjectDns": [ + "CN=test, O=Ping Identity Corporation, L=Denver, ST=CO, C=US" + ], + "users": [ + { + "username": "testUser", + "encryptedPassword": "lPkeLavAtN0Qb4eY579HVgd5Uk3vdODyatGvGAV-tVQ.odLwjB--.2" + } + ], + "issuerCerts": [ + { + "id": "ycrgw3j4ckw91gxdmd479qftb", + "location": "https://localhost:9999/pf-admin-api/v1/serverSettings/wsTrustStsSettings/ycrgw3j4ckw91gxdmd479qftb" + } + ] + } + ] + }, + { + "resourceType": "/serverSettings/wsTrustStsSettings/issuerCertificates", + "operationType": "SAVE", + "items": [ + { + "id": "ycrgw3j4ckw91gxdmd479qftb", + "fileData": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURuVENDQW9XZ0F3SUJBZ0lVUzJUQkNkUnpwSzRaemUrSERLakI5RVFTSHFZd0RRWUpLb1pJaHZjTkFRRUxCUUF3WGpFTE1Ba0cKQTFVRUJoTUNWVk14Q3pBSkJnTlZCQWdNQWtOUE1ROHdEUVlEVlFRSERBWkVaVzUyWlhJeElqQWdCZ05WQkFvTUdWQnBibWNnU1dSbApiblJwZEhrZ1EyOXljRzl5WVhScGIyNHhEVEFMQmdOVkJBTU1CSFJsYzNRd0hoY05NalF4TWpFeU1qTXlPREkwV2hjTk1qY3dPVEE0Ck1qTXlPREkwV2pCZU1Rc3dDUVlEVlFRR0V3SlZVekVMTUFrR0ExVUVDQXdDUTA4eER6QU5CZ05WQkFjTUJrUmxiblpsY2pFaU1DQUcKQTFVRUNnd1pVR2x1WnlCSlpHVnVkR2wwZVNCRGIzSndiM0poZEdsdmJqRU5NQXNHQTFVRUF3d0VkR1Z6ZERDQ0FTSXdEUVlKS29aSQpodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCQUpkb0d1cmdEdlNSQkwyY0llVWFDWTNwbzVZRFpuVjFleXVPUVR4UWM2T1QySlMwCis0MGdKYkptZk5yYmNPU3QrMURieHpQK0l4YmxrY3o1NjlWT0M1bGJST24zOHllYU1VMzJYYy80REdTcDFIQ1kvSmZTeWd6LytxcjgKOFlUcU1hSTIxQWJabkFpWTV4MFJ3NTZJRG1KZ2xYYVhlVmJDVUp5N29QVHlBb1lZVDkzREpEazQxWmU1MVVjVG1Vc1RLTjRLM2d2dgpTYVJ1eXE1K2c2RVhCcTdBa2VPbmJQMGJTSHliTjFLRVY1QlhOTnBnazloMEp3M1BFK3FrbS81bllSenhCZjRSQS9BZ2Z2OWVzRzlOCnozWGdEb3dBR0JteHIrclUvbmE3cHdFRXVkTWg2NjhERURlUlZ3aDFaYXBZcEJ0VmN4TUhtZEpQZ0ZKckJsbzZtTUVDQXdFQUFhTlQKTUZFd0hRWURWUjBPQkJZRUZHSmMzWjBqOWtYUHNUbW1iZ0FzWS9QSzJjdXBNQjhHQTFVZEl3UVlNQmFBRkdKYzNaMGo5a1hQc1RtbQpiZ0FzWS9QSzJjdXBNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBSlZCdmNIaGgrMDBnelEwCnBuWkt0Ukp4dkVnK3BHaCtCOUUrNWkyUHNOR3lJQXZBWHc0bWRCY1FaS3hmaVhNMzFaRTJnZTFtUCs0ZGkxMStQS1lOSDJFOTczUEwKSit3R0hlUVoxRVRERzVmbzc5dDBNRzFSekh0R29pclpXN3Y0Qk5VSTZaTTJGakVhQ090WmcxclVoa2RJZnFEeDRDZU5qemIwcmhYSQp6WE5UUzRZNlZseFdBclFud0FncVB0YjVwb0pHM01tLzNmNnVRZy9sMExJS1RZL0dSNnlRc05Da3pUWlFocklwWGo0UnBxblgzUWdECjFJV1RvTW9uN250cDRnQVAvbEFTTTUveG01SnpiNmRtRitob04wNzNnMDJVZVYyVERMemU4MCtLK1hyMUdaZWVVTHVYTnJoT0VYRFIKeXR2dWJlOE9YUFBZNi96Q3BoVmIyMWc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K" + } + ] + }, + { + "resourceType": "/serverSettings/generalSettings", + "operationType": "SAVE", + "items": [ + { + "disableAutomaticConnectionValidation": false, + "idpConnectionTransactionLoggingOverride": "DONT_OVERRIDE", + "spConnectionTransactionLoggingOverride": "DONT_OVERRIDE", + "datastoreValidationIntervalSecs": 300, + "requestHeaderForCorrelationId": "" + } + ] + }, + { + "resourceType": "/serverSettings/logSettings", + "operationType": "SAVE", + "items": [ + { + "logCategories": [ + { + "id": "core", + "name": "Core", + "description": "Debug logging for core components.", + "enabled": false + }, + { + "id": "protocolrequestresponse", + "name": "Protocol Requests and Responses", + "description": "Log protocol request and response messages.", + "enabled": false + }, + { + "id": "policytree", + "name": "Policy Tree", + "description": "Policy tree debug logging.", + "enabled": false + }, + { + "id": "dsresponsetime", + "name": "Data Store Response Times", + "description": "Log response times for data store requests.", + "enabled": false + }, + { + "id": "trustedcas", + "name": "Trusted CAs", + "description": "Log PingFederate and JRE trusted CAs when they are loaded.", + "enabled": false + }, + { + "id": "xmlsig", + "name": "XML Signatures", + "description": "Debug logging for XML signature operations.", + "enabled": false + }, + { + "id": "requestheaders", + "name": "HTTP Request Headers", + "description": "Log HTTP request headers. Sensitive information, such as passwords, may be logged when this category is enabled.", + "enabled": false + }, + { + "id": "requestparams", + "name": "HTTP Request Parameters", + "description": "Log HTTP GET request parameters. Sensitive information, such as passwords, may be logged when this category is enabled.", + "enabled": false + }, + { + "id": "restdatastore", + "name": "REST Data Store Requests and Responses", + "description": "Log REST datastore requests and responses. Sensitive information, such as passwords, may be logged when this category is enabled.", + "enabled": false + } + ] + } + ] + }, + { + "resourceType": "/administrativeAccounts", + "operationType": "SAVE", + "items": [ + { + "username": "Administrator", + "encryptedPassword": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..kXCR48-wTysghVHlJnW7gw.13D06DlCeQZMfG1ZzeLtV47R7hhfqXsTeHJk89yIciHWqTyzaHoaoUeKP0NvQV73MaNwwFLy-6xXiJb_M18wew.rzhaAzkb9Nikklu0r_wNgA", + "description": "Initial administrator user.", + "auditor": false, + "active": true, + "roles": [ + "ADMINISTRATOR", + "USER_ADMINISTRATOR", + "CRYPTO_ADMINISTRATOR", + "EXPRESSION_ADMINISTRATOR", + "DATA_COLLECTION_ADMINISTRATOR" + ] + } + ] + }, + { + "resourceType": "/certificates/revocation/ocspCertificates", + "operationType": "SAVE", + "items": [ + { + "id": "opcey20sf9djwvk8snv1actzq", + "fileData": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURuVENDQW9XZ0F3SUJBZ0lVUzJUQkNkUnpwSzRaemUrSERLakI5RVFTSHFZd0RRWUpLb1pJaHZjTkFRRUxCUUF3WGpFTE1Ba0cKQTFVRUJoTUNWVk14Q3pBSkJnTlZCQWdNQWtOUE1ROHdEUVlEVlFRSERBWkVaVzUyWlhJeElqQWdCZ05WQkFvTUdWQnBibWNnU1dSbApiblJwZEhrZ1EyOXljRzl5WVhScGIyNHhEVEFMQmdOVkJBTU1CSFJsYzNRd0hoY05NalF4TWpFeU1qTXlPREkwV2hjTk1qY3dPVEE0Ck1qTXlPREkwV2pCZU1Rc3dDUVlEVlFRR0V3SlZVekVMTUFrR0ExVUVDQXdDUTA4eER6QU5CZ05WQkFjTUJrUmxiblpsY2pFaU1DQUcKQTFVRUNnd1pVR2x1WnlCSlpHVnVkR2wwZVNCRGIzSndiM0poZEdsdmJqRU5NQXNHQTFVRUF3d0VkR1Z6ZERDQ0FTSXdEUVlKS29aSQpodmNOQVFFQkJRQURnZ0VQQURDQ0FRb0NnZ0VCQUpkb0d1cmdEdlNSQkwyY0llVWFDWTNwbzVZRFpuVjFleXVPUVR4UWM2T1QySlMwCis0MGdKYkptZk5yYmNPU3QrMURieHpQK0l4YmxrY3o1NjlWT0M1bGJST24zOHllYU1VMzJYYy80REdTcDFIQ1kvSmZTeWd6LytxcjgKOFlUcU1hSTIxQWJabkFpWTV4MFJ3NTZJRG1KZ2xYYVhlVmJDVUp5N29QVHlBb1lZVDkzREpEazQxWmU1MVVjVG1Vc1RLTjRLM2d2dgpTYVJ1eXE1K2c2RVhCcTdBa2VPbmJQMGJTSHliTjFLRVY1QlhOTnBnazloMEp3M1BFK3FrbS81bllSenhCZjRSQS9BZ2Z2OWVzRzlOCnozWGdEb3dBR0JteHIrclUvbmE3cHdFRXVkTWg2NjhERURlUlZ3aDFaYXBZcEJ0VmN4TUhtZEpQZ0ZKckJsbzZtTUVDQXdFQUFhTlQKTUZFd0hRWURWUjBPQkJZRUZHSmMzWjBqOWtYUHNUbW1iZ0FzWS9QSzJjdXBNQjhHQTFVZEl3UVlNQmFBRkdKYzNaMGo5a1hQc1RtbQpiZ0FzWS9QSzJjdXBNQThHQTFVZEV3RUIvd1FGTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVMQlFBRGdnRUJBSlZCdmNIaGgrMDBnelEwCnBuWkt0Ukp4dkVnK3BHaCtCOUUrNWkyUHNOR3lJQXZBWHc0bWRCY1FaS3hmaVhNMzFaRTJnZTFtUCs0ZGkxMStQS1lOSDJFOTczUEwKSit3R0hlUVoxRVRERzVmbzc5dDBNRzFSekh0R29pclpXN3Y0Qk5VSTZaTTJGakVhQ090WmcxclVoa2RJZnFEeDRDZU5qemIwcmhYSQp6WE5UUzRZNlZseFdBclFud0FncVB0YjVwb0pHM01tLzNmNnVRZy9sMExJS1RZL0dSNnlRc05Da3pUWlFocklwWGo0UnBxblgzUWdECjFJV1RvTW9uN250cDRnQVAvbEFTTTUveG01SnpiNmRtRitob04wNzNnMDJVZVYyVERMemU4MCtLK1hyMUdaZWVVTHVYTnJoT0VYRFIKeXR2dWJlOE9YUFBZNi96Q3BoVmIyMWc9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K" + } + ] + }, + { + "resourceType": "/certificates/revocation/settings", + "operationType": "SAVE", + "items": [ + { + "ocspSettings": { + "requesterAddNonce": false, + "actionOnResponderUnavailable": "CONTINUE", + "actionOnStatusUnknown": "FAIL", + "actionOnUnsuccessfulResponse": "FAIL", + "currentUpdateGracePeriod": 5, + "nextUpdateGracePeriod": 5, + "responseCachePeriod": 48, + "responderTimeout": 5, + "responderCertReference": { + "id": "opcey20sf9djwvk8snv1actzq", + "location": "https://localhost:9999/pf-admin-api/v1/certificates/revocation/ocspCertificates/opcey20sf9djwvk8snv1actzq" + } + } + } + ] + }, + { + "resourceType": "/virtualHostNames", + "operationType": "SAVE", + "items": [ + { + "virtualHostNames": [] + } + ] + }, + { + "resourceType": "/redirectValidation", + "operationType": "SAVE", + "items": [ + { + "redirectValidationLocalSettings": { + "enableTargetResourceValidationForSSO": false, + "enableTargetResourceValidationForSLO": false, + "enableTargetResourceValidationForIdpDiscovery": false, + "enableInErrorResourceValidation": false, + "whiteList": [], + "uriAllowList": [] + }, + "redirectValidationPartnerSettings": { + "enableWreplyValidationSLO": false + } + } + ] + }, + { + "resourceType": "/incomingProxySettings", + "operationType": "SAVE", + "items": [ + { + "enableClientCertHeaderAuth": false, + "clientCertHeaderEncodingFormat": "APACHE_MOD_SSL", + "proxyTerminatesHttpsConns": false + } + ] + }, + { + "resourceType": "/protocolMetadata/lifetimeSettings", + "operationType": "SAVE", + "items": [ + { + "cacheDuration": 1440, + "reloadDelay": 1440 + } + ] + }, + { + "resourceType": "/protocolMetadata/signingSettings", + "operationType": "SAVE", + "items": [ + {} + ] + }, + { + "resourceType": "/serviceAuthentication", + "operationType": "SAVE", + "items": [ + {} + ] + }, + { + "resourceType": "/extendedProperties", + "operationType": "SAVE", + "items": [ + { + "name": "authNexp", + "description": "Authentication Experience [Single_Factor | Internal | ID-First | Multi_Factor]", + "multiValued": false + }, + { + "name": "useAuthnApi", + "description": "Use the AuthN API", + "multiValued": false + } + ] + }, + { + "resourceType": "/authenticationPolicyContracts", + "operationType": "SAVE", + "items": [ + { + "id": "DkhZxRcZchsed90U", + "name": "Fragment - Subject", + "coreAttributes": [ + { + "name": "subject" + } + ], + "extendedAttributes": [], + "lastModified": "2025-01-31T22:32:15.606Z" + }, + { + "id": "QGxlec5CX693lBQL", + "name": "apc", + "coreAttributes": [ + { + "name": "subject" + } + ], + "extendedAttributes": [], + "lastModified": "2025-01-31T22:32:15.617Z" + }, + { + "id": "default", + "name": "Default", + "coreAttributes": [ + { + "name": "subject" + } + ], + "extendedAttributes": [ + { + "name": "firstName" + }, + { + "name": "lastName" + }, + { + "name": "ImmutableID" + }, + { + "name": "mail" + }, + { + "name": "SAML_AUTHN_CTX" + } + ], + "lastModified": "2025-01-31T22:32:15.619Z" + }, + { + "id": "samplePolicyContract", + "name": "Sample Policy Contract", + "coreAttributes": [ + { + "name": "subject" + } + ], + "extendedAttributes": [ + { + "name": "firstName" + }, + { + "name": "lastName" + }, + { + "name": "ImmutableID" + }, + { + "name": "mail" + }, + { + "name": "SAML_AUTHN_CTX" + } + ], + "lastModified": "2025-01-31T22:32:15.627Z" + }, + { + "id": "wIdHhK789PmadmMS", + "name": "Fragment - Form", + "coreAttributes": [ + { + "name": "subject" + } + ], + "extendedAttributes": [ + { + "name": "entryUUID" + }, + { + "name": "uid" + }, + { + "name": "mail" + } + ], + "lastModified": "2025-01-31T22:32:15.632Z" + } + ] + }, + { + "resourceType": "/passwordCredentialValidators", + "operationType": "SAVE", + "items": [ + { + "id": "PDPCV", + "name": "PD PCV", + "pluginDescriptorRef": { + "id": "org.sourceid.saml20.domain.LDAPUsernamePasswordCredentialValidator", + "location": "https://localhost:9999/pf-admin-api/v1/passwordCredentialValidators/descriptors/org.sourceid.saml20.domain.LDAPUsernamePasswordCredentialValidator" + }, + "configuration": { + "tables": [ + { + "name": "Authentication Error Overrides", + "rows": [] + } + ], + "fields": [ + { + "name": "LDAP Datastore", + "value": "LDAP-PingDirectory" + }, + { + "name": "Search Base", + "value": "dc=example,dc=com" + }, + { + "name": "Search Filter", + "value": "(|(uid=${username})(mail=${username}))" + }, + { + "name": "Scope of Search", + "value": "Subtree" + }, + { + "name": "Case-Sensitive Matching", + "value": "true" + }, + { + "name": "Display Name Attribute", + "value": "displayName" + }, + { + "name": "Mail Attribute", + "value": "mail" + }, + { + "name": "SMS Attribute", + "value": "" + }, + { + "name": "PingID Username Attribute", + "value": "uid" + }, + { + "name": "Mail Search Filter", + "value": "mail=${mail}" + }, + { + "name": "Username Attribute", + "value": "uid" + }, + { + "name": "Trim Username Spaces For Search", + "value": "true" + }, + { + "name": "Mail Verified Attribute", + "value": "" + }, + { + "name": "Account Disabled Attribute", + "value": "" + }, + { + "name": "Enable PingDirectory Detailed Password Policy Requirement Messaging", + "value": "false" + }, + { + "name": "Expect Password Expired Control", + "value": "false" + } + ] + }, + "lastModified": "2025-01-31T22:32:15.886Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "mail" + }, + { + "name": "givenName" + }, + { + "name": "DN" + }, + { + "name": "username" + } + ], + "extendedAttributes": [ + { + "name": "entryUUID" + }, + { + "name": "uid" + }, + { + "name": "sn" + } + ] + } + }, + { + "id": "pingdirectory", + "name": "pingdirectory", + "pluginDescriptorRef": { + "id": "org.sourceid.saml20.domain.LDAPUsernamePasswordCredentialValidator", + "location": "https://localhost:9999/pf-admin-api/v1/passwordCredentialValidators/descriptors/org.sourceid.saml20.domain.LDAPUsernamePasswordCredentialValidator" + }, + "configuration": { + "tables": [ + { + "name": "Authentication Error Overrides", + "rows": [] + } + ], + "fields": [ + { + "name": "LDAP Datastore", + "value": "pingdirectory" + }, + { + "name": "Search Base", + "value": "dc=example,dc=com" + }, + { + "name": "Search Filter", + "value": "(&(objectClass=person)(|(mail=${username})(cn=${username})(uid=${username})))" + }, + { + "name": "Scope of Search", + "value": "Subtree" + }, + { + "name": "Case-Sensitive Matching", + "value": "false" + }, + { + "name": "Display Name Attribute", + "value": "displayName" + }, + { + "name": "Mail Attribute", + "value": "mail" + }, + { + "name": "SMS Attribute", + "value": "" + }, + { + "name": "PingID Username Attribute", + "value": "" + }, + { + "name": "Mail Search Filter", + "value": "" + }, + { + "name": "Username Attribute", + "value": "" + }, + { + "name": "Mail Verified Attribute", + "value": "" + }, + { + "name": "Trim Username Spaces For Search", + "value": "false" + }, + { + "name": "Account Disabled Attribute", + "value": "" + }, + { + "name": "Enable PingDirectory Detailed Password Policy Requirement Messaging", + "value": "false" + }, + { + "name": "Expect Password Expired Control", + "value": "false" + } + ] + }, + "lastModified": "2025-01-31T22:32:15.900Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "mail" + }, + { + "name": "givenName" + }, + { + "name": "DN" + }, + { + "name": "username" + } + ], + "extendedAttributes": [ + { + "name": "entryUUID" + } + ] + } + }, + { + "id": "simple", + "name": "simple", + "pluginDescriptorRef": { + "id": "org.sourceid.saml20.domain.SimpleUsernamePasswordCredentialValidator", + "location": "https://localhost:9999/pf-admin-api/v1/passwordCredentialValidators/descriptors/org.sourceid.saml20.domain.SimpleUsernamePasswordCredentialValidator" + }, + "configuration": { + "tables": [ + { + "name": "Users", + "rows": [ + { + "fields": [ + { + "name": "Username", + "value": "joe" + }, + { + "name": "Password", + "encryptedValue": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..C5TQiZmuxKBmrRBjQEvEiA.KkyfPDp6zBRdvl0hs3jXna4vGYw_86Zyn4fxnqKCpOtkEuSZX0kUu7JFGX6dBW94UsArefoiHQ6SQwLxdo5GYg.kJA3CHPnu16GGqovGVkFHw" + }, + { + "name": "Confirm Password", + "encryptedValue": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9.._zgTvi1nWLsYZU-NQkcAxQ.kAXpw1Zso7vvZkVkOzT_twZnNELDBVCEEyxpbgXOdgZ1MgepmZwl3c7zmTJzxmcD5B2YlOVAaWzw-fIXEAwLhA.eEWHDXFzUhiSVYnnazTswg" + }, + { + "name": "Relax Password Requirements", + "value": "true" + } + ], + "defaultRow": false + } + ] + } + ], + "fields": [] + }, + "lastModified": "2025-01-31T22:32:15.917Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "username" + } + ] + } + } + ] + }, + { + "resourceType": "/localIdentity/identityProfiles", + "operationType": "SAVE", + "items": [ + { + "id": "adminIdentityProfile", + "name": "Admin Identity Profile", + "apcId": { + "id": "default", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/default" + }, + "authSources": [ + { + "source": "SecurityKey", + "id": "SecurityKey" + }, + { + "source": "FIDO", + "id": "FIDO" + } + ], + "authSourceUpdatePolicy": { + "storeAttributes": false, + "retainAttributes": false, + "updateAttributes": false, + "updateInterval": 0 + }, + "fieldConfig": { + "fields": [ + { + "type": "TEXT", + "id": "fullName", + "label": "Full Name", + "registrationPageField": false, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": false, + "Unique ID Field": false, + "Mask Log Values": false + }, + "defaultValue": "" + }, + { + "type": "TEXT", + "id": "firstName", + "label": "First Name", + "registrationPageField": false, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": false, + "Unique ID Field": false, + "Mask Log Values": false + }, + "defaultValue": "" + }, + { + "type": "TEXT", + "id": "lastName", + "label": "Last Name", + "registrationPageField": false, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": false, + "Unique ID Field": false, + "Mask Log Values": false + }, + "defaultValue": "" + }, + { + "type": "EMAIL", + "id": "email", + "label": "Email Address", + "registrationPageField": false, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": true, + "Unique ID Field": false, + "Mask Log Values": false + } + }, + { + "type": "PHONE", + "id": "phoneNumber", + "label": "Phone Number", + "registrationPageField": false, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": false, + "Unique ID Field": false, + "Mask Log Values": false + } + }, + { + "type": "TEXT", + "id": "username", + "label": "Username", + "registrationPageField": false, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": true, + "Unique ID Field": true, + "Mask Log Values": false + }, + "defaultValue": "" + } + ], + "stripSpaceFromUniqueField": true + }, + "emailVerificationConfig": { + "emailVerificationEnabled": false + }, + "dataStoreConfig": { + "type": "LDAP", + "dataStoreRef": { + "id": "LDAP-PingDirectory", + "location": "https://localhost:9999/pf-admin-api/v1/dataStores/LDAP-PingDirectory" + }, + "baseDn": "ou=Administrators,dc=example,dc=com", + "createPattern": "", + "objectClass": "", + "dataStoreMapping": { + "firstName": { + "type": "LDAP", + "name": "givenName", + "metadata": {} + }, + "lastName": { + "type": "LDAP", + "name": "sn", + "metadata": {} + }, + "phoneNumber": { + "type": "LDAP", + "name": "mobile", + "metadata": {} + }, + "fullName": { + "type": "LDAP", + "name": "cn", + "metadata": {} + }, + "email": { + "type": "LDAP", + "name": "mail", + "metadata": {} + }, + "username": { + "type": "LDAP", + "name": "uid", + "metadata": {} + } + } + }, + "profileConfig": { + "deleteIdentityEnabled": false, + "templateName": "local.identity.profile.html" + }, + "registrationEnabled": false, + "profileEnabled": true + }, + { + "id": "regIdentityProfile", + "name": "Registration Identity Profile", + "apcId": { + "id": "samplePolicyContract", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/samplePolicyContract" + }, + "authSources": [], + "authSourceUpdatePolicy": { + "storeAttributes": false, + "retainAttributes": false, + "updateAttributes": false, + "updateInterval": 0 + }, + "registrationConfig": { + "captchaEnabled": false, + "templateName": "local.identity.registration.html", + "createAuthnSessionAfterRegistration": true, + "usernameField": "username", + "thisIsMyDeviceEnabled": false + }, + "fieldConfig": { + "fields": [ + { + "type": "TEXT", + "id": "firstName", + "label": "First Name", + "registrationPageField": true, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": false, + "Unique ID Field": false, + "Mask Log Values": false + }, + "defaultValue": "" + }, + { + "type": "TEXT", + "id": "lastName", + "label": "Last Name", + "registrationPageField": true, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": false, + "Unique ID Field": false, + "Mask Log Values": false + }, + "defaultValue": "" + }, + { + "type": "TEXT", + "id": "fullName", + "label": "Full Name", + "registrationPageField": true, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": false, + "Unique ID Field": false, + "Mask Log Values": false + }, + "defaultValue": "" + }, + { + "type": "EMAIL", + "id": "email", + "label": "Email Address", + "registrationPageField": true, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": true, + "Unique ID Field": false, + "Mask Log Values": false + } + }, + { + "type": "PHONE", + "id": "phoneNumber", + "label": "Phone Number", + "registrationPageField": true, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": false, + "Unique ID Field": false, + "Mask Log Values": false + } + }, + { + "type": "TEXT", + "id": "username", + "label": "Username", + "registrationPageField": true, + "profilePageField": true, + "attributes": { + "Read-Only": false, + "Required": true, + "Unique ID Field": true, + "Mask Log Values": false + }, + "defaultValue": "" + }, + { + "type": "HIDDEN", + "id": "ImmutableID", + "label": "ImmutableID", + "registrationPageField": true, + "profilePageField": true, + "attributes": { + "Unique ID Field": false, + "Mask Log Values": false + } + }, + { + "type": "HIDDEN", + "id": "accountVerified", + "label": "Account Verified", + "registrationPageField": false, + "profilePageField": true, + "attributes": { + "Unique ID Field": false, + "Mask Log Values": false + } + } + ], + "stripSpaceFromUniqueField": false + }, + "emailVerificationConfig": { + "emailVerificationEnabled": false + }, + "dataStoreConfig": { + "type": "LDAP", + "dataStoreRef": { + "id": "LDAP-PingDirectory", + "location": "https://localhost:9999/pf-admin-api/v1/dataStores/LDAP-PingDirectory" + }, + "baseDn": "ou=People,dc=example,dc=com", + "createPattern": "uid=${username}", + "objectClass": "inetOrgPerson", + "auxiliaryObjectClasses": [ + "pf-connected-identities", + "ubidPersonAux" + ], + "dataStoreMapping": { + "firstName": { + "type": "LDAP", + "name": "givenName", + "metadata": {} + }, + "lastName": { + "type": "LDAP", + "name": "sn", + "metadata": {} + }, + "phoneNumber": { + "type": "LDAP", + "name": "mobile", + "metadata": {} + }, + "ImmutableID": { + "type": "LDAP", + "name": "entryUUID", + "metadata": {} + }, + "fullName": { + "type": "LDAP", + "name": "cn", + "metadata": {} + }, + "accountVerified": { + "type": "LDAP", + "name": "ubidAccountVerified", + "metadata": {} + }, + "email": { + "type": "LDAP", + "name": "mail", + "metadata": {} + }, + "username": { + "type": "LDAP", + "name": "uid", + "metadata": {} + } + } + }, + "profileConfig": { + "deleteIdentityEnabled": false, + "templateName": "local.identity.profile.html" + }, + "registrationEnabled": true, + "profileEnabled": true + } + ] + }, + { + "resourceType": "/oauth/accessTokenManagers", + "operationType": "SAVE", + "items": [ + { + "id": "jwt", + "name": "JSON Web Tokens", + "pluginDescriptorRef": { + "id": "com.pingidentity.pf.access.token.management.plugins.JwtBearerAccessTokenManagementPlugin", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/accessTokenManagers/descriptors/com.pingidentity.pf.access.token.management.plugins.JwtBearerAccessTokenManagementPlugin" + }, + "configuration": { + "tables": [ + { + "name": "Symmetric Keys", + "rows": [] + }, + { + "name": "Certificates", + "rows": [ + { + "fields": [ + { + "name": "Key ID", + "value": "k1" + }, + { + "name": "Certificate", + "value": "tiq4n26axjircjk30oz5zf6k3" + } + ], + "defaultRow": false + } + ] + } + ], + "fields": [ + { + "name": "Token Lifetime", + "value": "120" + }, + { + "name": "Use Centralized Signing Key", + "value": "false" + }, + { + "name": "JWS Algorithm", + "value": "RS256" + }, + { + "name": "Active Symmetric Key ID", + "value": "" + }, + { + "name": "Active Signing Certificate Key ID", + "value": "k1" + }, + { + "name": "JWE Algorithm", + "value": "" + }, + { + "name": "JWE Content Encryption Algorithm", + "value": "" + }, + { + "name": "Active Symmetric Encryption Key ID", + "value": "" + }, + { + "name": "Asymmetric Encryption Key", + "value": "" + }, + { + "name": "Asymmetric Encryption JWKS URL", + "value": "" + }, + { + "name": "Enable Token Revocation", + "value": "false" + }, + { + "name": "Include Key ID Header Parameter", + "value": "true" + }, + { + "name": "Include X.509 Thumbprint Header Parameter", + "value": "false" + }, + { + "name": "Default JWKS URL Cache Duration", + "value": "720" + }, + { + "name": "Include JWE Key ID Header Parameter", + "value": "true" + }, + { + "name": "Include JWE X.509 Thumbprint Header Parameter", + "value": "false" + }, + { + "name": "Client ID Claim Name", + "value": "client_id_name" + }, + { + "name": "Scope Claim Name", + "value": "scope" + }, + { + "name": "Space Delimit Scope Values", + "value": "false" + }, + { + "name": "Authorization Details Claim Name", + "value": "authorization_details" + }, + { + "name": "Issuer Claim Value", + "value": "" + }, + { + "name": "Audience Claim Value", + "value": "" + }, + { + "name": "Not Before Claim Offset", + "value": "" + }, + { + "name": "Include Issued At Claim", + "value": "false" + }, + { + "name": "JWT ID Claim Length", + "value": "22" + }, + { + "name": "Access Grant GUID Claim Name", + "value": "agid" + }, + { + "name": "Publish Keys to the PingFederate JWKS Endpoint", + "value": "false" + }, + { + "name": "JWKS Endpoint Path", + "value": "" + }, + { + "name": "JWKS Endpoint Cache Duration", + "value": "720" + }, + { + "name": "Publish Key ID X.509 URL", + "value": "false" + }, + { + "name": "Publish Thumbprint X.509 URL", + "value": "false" + }, + { + "name": "Expand Scope Groups", + "value": "false" + }, + { + "name": "Type Header Value", + "value": "" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.143Z", + "attributeContract": { + "coreAttributes": [], + "extendedAttributes": [ + { + "name": "Username", + "multiValued": false + }, + { + "name": "OrgName", + "multiValued": false + } + ], + "defaultSubjectAttribute": "OrgName" + }, + "tokenEndpointAttributeContract": { + "attributes": [], + "inherited": false + }, + "selectionSettings": { + "resourceUris": [] + }, + "accessControlSettings": { + "restrictClients": false, + "allowedClients": [] + }, + "sessionValidationSettings": { + "checkValidAuthnSession": false, + "checkSessionRevocationStatus": false, + "updateAuthnSessionActivity": false, + "includeSessionId": false + }, + "sequenceNumber": 2 + } + ] + }, + { + "resourceType": "/oauth/accessTokenManagers/settings", + "operationType": "SAVE", + "items": [ + { + "defaultAccessTokenManagerRef": { + "id": "jwt", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/accessTokenManagers/jwt" + } + } + ] + }, + { + "resourceType": "/kerberos/realms", + "operationType": "SAVE", + "items": [ + { + "id": "testKerberosRealm", + "kerberosRealmName": "Test Kerberos Realm", + "keyDistributionCenters": [ + "distCenterTest" + ], + "kerberosUsername": "user", + "kerberosEncryptedPassword": "eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..BXkYp-spJltD07g9ftFx7g.K9Z8nFyksI2dQWaTU1Wabg.2lCuOsObXEYPHTJVafj62A", + "retainPreviousKeysOnPasswordChange": true, + "suppressDomainNameConcatenation": true, + "connectionType": "DIRECT" + } + ] + }, + { + "resourceType": "/kerberos/realms/settings", + "operationType": "SAVE", + "items": [ + { + "forceTcp": false, + "kdcTimeout": "3", + "debugLogOutput": false, + "kdcRetries": "3", + "keySetRetentionPeriodMins": 610 + } + ] + }, + { + "resourceType": "/idp/adapters", + "operationType": "SAVE", + "items": [ + { + "id": "IDFirst", + "name": "Identifier-First", + "pluginDescriptorRef": { + "id": "com.pingidentity.adapters.identifierfirst.idp.IdentifierFirstAdapter", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/descriptors/com.pingidentity.adapters.identifierfirst.idp.IdentifierFirstAdapter" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "Identifier Cookie Lifetime", + "value": "30" + }, + { + "name": "Allow Cancelling Identifier Selection", + "value": "false" + }, + { + "name": "Maximum Identifiers Count", + "value": "5" + }, + { + "name": "Identifier Selection Template", + "value": "identifier.first.template.html" + }, + { + "name": "Enable Risk Provider", + "value": "false" + }, + { + "name": "Risk Provider", + "value": "" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.317Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "subject", + "masked": false, + "pseudonym": true + }, + { + "name": "domain", + "masked": false, + "pseudonym": false + } + ], + "extendedAttributes": [ + { + "name": "entryUUID", + "masked": false, + "pseudonym": false + }, + { + "name": "uid", + "masked": false, + "pseudonym": false + }, + { + "name": "mail", + "masked": false, + "pseudonym": false + } + ], + "maskOgnlValues": false + }, + "attributeMapping": { + "attributeSources": [ + { + "type": "LDAP", + "dataStoreRef": { + "id": "LDAP-PingDirectory", + "location": "https://localhost:9999/pf-admin-api/v1/dataStores/LDAP-PingDirectory" + }, + "id": "PD", + "description": "PD", + "baseDn": "dc=example,dc=com", + "searchScope": "SUBTREE", + "searchFilter": "(|(uid=${subject} )(mail=${subject}))", + "binaryAttributeSettings": {}, + "memberOfNestedGroup": false + } + ], + "attributeContractFulfillment": { + "entryUUID": { + "source": { + "type": "LDAP_DATA_STORE", + "id": "PD" + }, + "value": "entryUUID" + }, + "uid": { + "source": { + "type": "LDAP_DATA_STORE", + "id": "PD" + }, + "value": "uid" + }, + "mail": { + "source": { + "type": "LDAP_DATA_STORE", + "id": "PD" + }, + "value": "mail" + }, + "subject": { + "source": { + "type": "ADAPTER" + }, + "value": "subject" + }, + "domain": { + "source": { + "type": "ADAPTER" + }, + "value": "domain" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + } + }, + { + "id": "OTIdPJava", + "name": "OTIdPJava", + "pluginDescriptorRef": { + "id": "com.pingidentity.adapters.opentoken.IdpAuthnAdapter", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/descriptors/com.pingidentity.adapters.opentoken.IdpAuthnAdapter" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "Password", + "encryptedValue": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..VLkmV_SoOHMwCh-llliQUQ.g5LMasmJxSpgbIdpI7peiQ.rW1xpTvC9ydsiPQySRRRTw" + }, + { + "name": "Confirm Password", + "encryptedValue": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..Z12sPCihIExIXMzOuyFEnQ.pXEcsDlQK49qw01n62qF2w.9SAqaq3hnQWriZ-id2Xd0Q" + }, + { + "name": "Authentication Service", + "value": "https://localhost:9031/IdpSample/?cmd=sso" + }, + { + "name": "Transport Mode", + "value": "1" + }, + { + "name": "Token Name", + "value": "idpopentoken" + }, + { + "name": "Cipher Suite", + "value": "2" + }, + { + "name": "Logout Service", + "value": "https://localhost:9031/IdpSample/?cmd=slo" + }, + { + "name": "Cookie Domain", + "value": "" + }, + { + "name": "Cookie Path", + "value": "/" + }, + { + "name": "Token Lifetime", + "value": "300" + }, + { + "name": "Session Lifetime", + "value": "43200" + }, + { + "name": "Not Before Tolerance", + "value": "0" + }, + { + "name": "Force SunJCE Provider", + "value": "false" + }, + { + "name": "Use Verbose Error Messages", + "value": "false" + }, + { + "name": "Obfuscate Password", + "value": "true" + }, + { + "name": "Session Cookie", + "value": "false" + }, + { + "name": "Secure Cookie", + "value": "false" + }, + { + "name": "Delete Cookie", + "value": "false" + }, + { + "name": "Replay Prevention", + "value": "false" + }, + { + "name": "Skip Malformed Attribute Detection", + "value": "false" + }, + { + "name": "SameSite Cookie", + "value": "3" + }, + { + "name": "HTTP Only Flag", + "value": "true" + }, + { + "name": "Track Authentication Time", + "value": "true" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.377Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "subject", + "masked": false, + "pseudonym": true + } + ], + "extendedAttributes": [], + "maskOgnlValues": false + }, + "attributeMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "subject": { + "source": { + "type": "ADAPTER" + }, + "value": "subject" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + } + }, + { + "id": "ciamHtmlForm", + "name": "Customer HTML Form (PF)", + "pluginDescriptorRef": { + "id": "com.pingidentity.adapters.htmlform.idp.HtmlFormIdpAuthnAdapter", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/descriptors/com.pingidentity.adapters.htmlform.idp.HtmlFormIdpAuthnAdapter" + }, + "configuration": { + "tables": [ + { + "name": "Credential Validators", + "rows": [ + { + "fields": [ + { + "name": "Password Credential Validator Instance", + "value": "PDPCV" + } + ], + "defaultRow": false + } + ] + } + ], + "fields": [ + { + "name": "Challenge Retries", + "value": "3" + }, + { + "name": "Session State", + "value": "None" + }, + { + "name": "Session Timeout", + "value": "60" + }, + { + "name": "Session Max Timeout", + "value": "480" + }, + { + "name": "Allow Password Changes", + "value": "true" + }, + { + "name": "Password Management System", + "value": "" + }, + { + "name": "Enable 'Remember My Username'", + "value": "true" + }, + { + "name": "Enable 'This is My Device'", + "value": "false" + }, + { + "name": "Change Password Policy Contract", + "value": "" + }, + { + "name": "Change Password Email Notification", + "value": "false" + }, + { + "name": "Show Password Expiring Warning", + "value": "false" + }, + { + "name": "Password Reset Type", + "value": "NONE" + }, + { + "name": "Password Reset Policy Contract", + "value": "" + }, + { + "name": "Revoke Sessions After Password Change Or Reset", + "value": "false" + }, + { + "name": "Account Unlock", + "value": "false" + }, + { + "name": "Local Identity Profile", + "value": "regIdentityProfile" + }, + { + "name": "Notification Publisher", + "value": "" + }, + { + "name": "Enable Username Recovery", + "value": "false" + }, + { + "name": "Login Template", + "value": "html.form.login.template.html" + }, + { + "name": "Logout Path", + "value": "" + }, + { + "name": "Logout Redirect", + "value": "" + }, + { + "name": "Logout Template", + "value": "idp.logout.success.page.template.html" + }, + { + "name": "Change Password Template", + "value": "html.form.change.password.template.html" + }, + { + "name": "Change Password Message Template", + "value": "html.form.message.template.html" + }, + { + "name": "Password Management System Message Template", + "value": "html.form.message.template.html" + }, + { + "name": "Change Password Email Template", + "value": "message-template-end-user-password-change.html" + }, + { + "name": "Expiring Password Warning Template", + "value": "html.form.password.expiring.notification.template.html" + }, + { + "name": "Threshold for Expiring Password Warning", + "value": "7" + }, + { + "name": "Snooze Interval for Expiring Password Warning", + "value": "24" + }, + { + "name": "Login Challenge Template", + "value": "html.form.login.challenge.template.html" + }, + { + "name": "'Remember My Username' Lifetime", + "value": "30" + }, + { + "name": "'This is My Device' Lifetime", + "value": "30" + }, + { + "name": "Allow Username Edits During Chaining", + "value": "false" + }, + { + "name": "Track Authentication Time", + "value": "true" + }, + { + "name": "Post-Password Change Re-Authentication Delay", + "value": "0" + }, + { + "name": "Password Reset Username Template", + "value": "forgot-password.html" + }, + { + "name": "Password Reset Code Template", + "value": "forgot-password-resume.html" + }, + { + "name": "Password Reset Template", + "value": "forgot-password-change.html" + }, + { + "name": "Password Reset Error Template", + "value": "forgot-password-error.html" + }, + { + "name": "Password Reset Success Template", + "value": "forgot-password-success.html" + }, + { + "name": "Account Unlock Template", + "value": "account-unlock.html" + }, + { + "name": "OTP Length", + "value": "8" + }, + { + "name": "OTP Time to Live", + "value": "10" + }, + { + "name": "PingID Properties", + "value": "" + }, + { + "name": "Require Verified Email", + "value": "false" + }, + { + "name": "Username Recovery Template", + "value": "username.recovery.template.html" + }, + { + "name": "Username Recovery Info Template", + "value": "username.recovery.info.template.html" + }, + { + "name": "Username Recovery Email Template", + "value": "message-template-username-recovery.html" + }, + { + "name": "CAPTCHA for Authentication", + "value": "false" + }, + { + "name": "CAPTCHA for Password change", + "value": "false" + }, + { + "name": "CAPTCHA for Password Reset", + "value": "false" + }, + { + "name": "CAPTCHA for Username recovery", + "value": "false" + }, + { + "name": "Password Update Timeout", + "value": "30" + }, + { + "name": "Require Re-Authentication For Expiring Password Flow", + "value": "false" + }, + { + "name": "Require Re-Authentication for Change Password Flow", + "value": "true" + }, + { + "name": "Require Re-Authentication for Password Reset Flow", + "value": "true" + }, + { + "name": "Password Reset One-Time Link Email Template", + "value": "message-template-forgot-password-link.html" + }, + { + "name": "Password Reset One-Time Password Email Template", + "value": "message-template-forgot-password-code.html" + }, + { + "name": "Account Disabled Email Template", + "value": "message-template-account-disabled.html" + }, + { + "name": "Password Reset Complete Email Template", + "value": "message-template-forgot-password-complete.html" + }, + { + "name": "Password Reset Failed Email Template", + "value": "message-template-forgot-password-failed.html" + }, + { + "name": "Account Unlock Email Template", + "value": "message-template-account-unlock-complete.html" + }, + { + "name": "Allowed OTP Character Set", + "value": "23456789BCDFGHJKMNPQRSTVWXZbcdfghjkmnpqrstvwxz" + }, + { + "name": "CAPTCHA Provider", + "value": "" + }, + { + "name": "Fail Authentication on Account Lockout", + "value": "true" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.454Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "policy.action", + "masked": false, + "pseudonym": false + }, + { + "name": "username", + "masked": false, + "pseudonym": true + } + ], + "extendedAttributes": [ + { + "name": "entryUUID", + "masked": false, + "pseudonym": false + }, + { + "name": "uid", + "masked": false, + "pseudonym": false + }, + { + "name": "mail", + "masked": false, + "pseudonym": false + }, + { + "name": "givenName", + "masked": false, + "pseudonym": false + }, + { + "name": "sn", + "masked": false, + "pseudonym": false + } + ], + "maskOgnlValues": false + }, + "attributeMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "entryUUID": { + "source": { + "type": "ADAPTER" + }, + "value": "entryUUID" + }, + "uid": { + "source": { + "type": "ADAPTER" + }, + "value": "uid" + }, + "mail": { + "source": { + "type": "ADAPTER" + }, + "value": "mail" + }, + "policy.action": { + "source": { + "type": "ADAPTER" + }, + "value": "policy.action" + }, + "givenName": { + "source": { + "type": "ADAPTER" + }, + "value": "givenName" + }, + "sn": { + "source": { + "type": "ADAPTER" + }, + "value": "sn" + }, + "username": { + "source": { + "type": "ADAPTER" + }, + "value": "username" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + } + }, + { + "id": "htmlForm", + "name": "Employee HTML Form", + "pluginDescriptorRef": { + "id": "com.pingidentity.adapters.htmlform.idp.HtmlFormIdpAuthnAdapter", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/descriptors/com.pingidentity.adapters.htmlform.idp.HtmlFormIdpAuthnAdapter" + }, + "configuration": { + "tables": [ + { + "name": "Credential Validators", + "rows": [ + { + "fields": [ + { + "name": "Password Credential Validator Instance", + "value": "PDPCV" + } + ], + "defaultRow": false + } + ] + } + ], + "fields": [ + { + "name": "Challenge Retries", + "value": "3" + }, + { + "name": "Session State", + "value": "None" + }, + { + "name": "Session Timeout", + "value": "60" + }, + { + "name": "Session Max Timeout", + "value": "480" + }, + { + "name": "Allow Password Changes", + "value": "false" + }, + { + "name": "Password Management System", + "value": "" + }, + { + "name": "Enable 'Remember My Username'", + "value": "false" + }, + { + "name": "Enable 'This is My Device'", + "value": "false" + }, + { + "name": "Change Password Email Notification", + "value": "false" + }, + { + "name": "Show Password Expiring Warning", + "value": "false" + }, + { + "name": "Password Reset Type", + "value": "NONE" + }, + { + "name": "Password Reset Policy Contract", + "value": "" + }, + { + "name": "Account Unlock", + "value": "false" + }, + { + "name": "Local Identity Profile", + "value": "adminIdentityProfile" + }, + { + "name": "Notification Publisher", + "value": "" + }, + { + "name": "Enable Username Recovery", + "value": "false" + }, + { + "name": "Change Password Policy Contract", + "value": "" + }, + { + "name": "Revoke Sessions After Password Change Or Reset", + "value": "false" + }, + { + "name": "Login Template", + "value": "html.form.login.template.html" + }, + { + "name": "Logout Path", + "value": "" + }, + { + "name": "Logout Redirect", + "value": "" + }, + { + "name": "Logout Template", + "value": "idp.logout.success.page.template.html" + }, + { + "name": "Change Password Template", + "value": "html.form.change.password.template.html" + }, + { + "name": "Change Password Message Template", + "value": "html.form.message.template.html" + }, + { + "name": "Password Management System Message Template", + "value": "html.form.message.template.html" + }, + { + "name": "Change Password Email Template", + "value": "message-template-end-user-password-change.html" + }, + { + "name": "Expiring Password Warning Template", + "value": "html.form.password.expiring.notification.template.html" + }, + { + "name": "Threshold for Expiring Password Warning", + "value": "7" + }, + { + "name": "Snooze Interval for Expiring Password Warning", + "value": "24" + }, + { + "name": "Login Challenge Template", + "value": "html.form.login.challenge.template.html" + }, + { + "name": "'Remember My Username' Lifetime", + "value": "30" + }, + { + "name": "'This is My Device' Lifetime", + "value": "30" + }, + { + "name": "Allow Username Edits During Chaining", + "value": "false" + }, + { + "name": "Track Authentication Time", + "value": "true" + }, + { + "name": "Post-Password Change Re-Authentication Delay", + "value": "0" + }, + { + "name": "Password Reset Username Template", + "value": "forgot-password.html" + }, + { + "name": "Password Reset Code Template", + "value": "forgot-password-resume.html" + }, + { + "name": "Password Reset Template", + "value": "forgot-password-change.html" + }, + { + "name": "Password Reset Error Template", + "value": "forgot-password-error.html" + }, + { + "name": "Password Reset Success Template", + "value": "forgot-password-success.html" + }, + { + "name": "Account Unlock Template", + "value": "account-unlock.html" + }, + { + "name": "OTP Length", + "value": "8" + }, + { + "name": "OTP Time to Live", + "value": "10" + }, + { + "name": "PingID Properties", + "value": "" + }, + { + "name": "Require Verified Email", + "value": "false" + }, + { + "name": "Username Recovery Template", + "value": "username.recovery.template.html" + }, + { + "name": "Username Recovery Info Template", + "value": "username.recovery.info.template.html" + }, + { + "name": "Username Recovery Email Template", + "value": "message-template-username-recovery.html" + }, + { + "name": "CAPTCHA for Authentication", + "value": "false" + }, + { + "name": "CAPTCHA for Password change", + "value": "false" + }, + { + "name": "CAPTCHA for Password Reset", + "value": "false" + }, + { + "name": "CAPTCHA for Username recovery", + "value": "false" + }, + { + "name": "Password Update Timeout", + "value": "30" + }, + { + "name": "Require Re-Authentication For Expiring Password Flow", + "value": "false" + }, + { + "name": "Require Re-Authentication for Change Password Flow", + "value": "true" + }, + { + "name": "Require Re-Authentication for Password Reset Flow", + "value": "true" + }, + { + "name": "Password Reset One-Time Link Email Template", + "value": "message-template-forgot-password-link.html" + }, + { + "name": "Password Reset One-Time Password Email Template", + "value": "message-template-forgot-password-code.html" + }, + { + "name": "Account Disabled Email Template", + "value": "message-template-account-disabled.html" + }, + { + "name": "Password Reset Complete Email Template", + "value": "message-template-forgot-password-complete.html" + }, + { + "name": "Password Reset Failed Email Template", + "value": "message-template-forgot-password-failed.html" + }, + { + "name": "Account Unlock Email Template", + "value": "message-template-account-unlock-complete.html" + }, + { + "name": "Allowed OTP Character Set", + "value": "23456789BCDFGHJKMNPQRSTVWXZbcdfghjkmnpqrstvwxz" + }, + { + "name": "CAPTCHA Provider", + "value": "" + }, + { + "name": "Fail Authentication on Account Lockout", + "value": "true" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.563Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "policy.action", + "masked": false, + "pseudonym": false + }, + { + "name": "username", + "masked": false, + "pseudonym": true + } + ], + "extendedAttributes": [ + { + "name": "entryUUID", + "masked": false, + "pseudonym": false + }, + { + "name": "uid", + "masked": false, + "pseudonym": false + }, + { + "name": "mail", + "masked": false, + "pseudonym": false + }, + { + "name": "givenName", + "masked": false, + "pseudonym": false + }, + { + "name": "cn", + "masked": false, + "pseudonym": false + }, + { + "name": "sn", + "masked": false, + "pseudonym": false + } + ], + "maskOgnlValues": false + }, + "attributeMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "entryUUID": { + "source": { + "type": "ADAPTER" + }, + "value": "entryUUID" + }, + "uid": { + "source": { + "type": "ADAPTER" + }, + "value": "uid" + }, + "mail": { + "source": { + "type": "ADAPTER" + }, + "value": "mail" + }, + "policy.action": { + "source": { + "type": "ADAPTER" + }, + "value": "policy.action" + }, + "givenName": { + "source": { + "type": "ADAPTER" + }, + "value": "givenName" + }, + "cn": { + "source": { + "type": "ADAPTER" + }, + "value": "cn" + }, + "sn": { + "source": { + "type": "ADAPTER" + }, + "value": "sn" + }, + "username": { + "source": { + "type": "ADAPTER" + }, + "value": "username" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + } + } + ] + }, + { + "resourceType": "/sp/adapters", + "operationType": "SAVE", + "items": [ + { + "id": "spadapter", + "name": "SpAdapter", + "pluginDescriptorRef": { + "id": "com.pingidentity.adapters.opentoken.SpAuthnAdapter", + "location": "https://localhost:9999/pf-admin-api/v1/sp/adapters/descriptors/com.pingidentity.adapters.opentoken.SpAuthnAdapter" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "Password", + "encryptedValue": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..u0YFl7URp7YzeIiI7BpTtg.o-pxKG_Hwv1Vc-OW2w42mQ.RcQEIMOebPYPZnmnqfhUEg" + }, + { + "name": "Confirm Password", + "encryptedValue": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..2fgwEHpx9lUiApM7XUHSXg.QEOl-gVWyzEzQUYNc-z2Bw.c53SlFrALoPQ9Fb4875OyA" + }, + { + "name": "Transport Mode", + "value": "2" + }, + { + "name": "Token Name", + "value": "opentoken" + }, + { + "name": "Cipher Suite", + "value": "2" + }, + { + "name": "Authentication Service", + "value": "" + }, + { + "name": "Account Link Service", + "value": "" + }, + { + "name": "Logout Service", + "value": "" + }, + { + "name": "SameSite Cookie", + "value": "3" + }, + { + "name": "Cookie Domain", + "value": "" + }, + { + "name": "Cookie Path", + "value": "/" + }, + { + "name": "Token Lifetime", + "value": "300" + }, + { + "name": "Session Lifetime", + "value": "43200" + }, + { + "name": "Not Before Tolerance", + "value": "0" + }, + { + "name": "Force SunJCE Provider", + "value": "false" + }, + { + "name": "Use Verbose Error Messages", + "value": "false" + }, + { + "name": "Obfuscate Password", + "value": "true" + }, + { + "name": "Session Cookie", + "value": "false" + }, + { + "name": "Secure Cookie", + "value": "true" + }, + { + "name": "HTTP Only Flag", + "value": "true" + }, + { + "name": "Send Subject as Query Parameter", + "value": "false" + }, + { + "name": "Subject Query Parameter ", + "value": "" + }, + { + "name": "Send Extended Attributes", + "value": "" + }, + { + "name": "Skip Trimming of Trailing Backslashes", + "value": "false" + }, + { + "name": "URL Encode Cookie Values", + "value": "true" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.608Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "subject" + } + ], + "extendedAttributes": [] + }, + "targetApplicationInfo": { + "applicationName": "test", + "applicationIconUrl": "https://test.com" + } + } + ] + }, + { + "resourceType": "/idpToSpAdapterMapping", + "operationType": "SAVE", + "items": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "subject": { + "source": { + "type": "ADAPTER" + }, + "value": "entryUUID" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "id": "ciamHtmlForm|spadapter", + "sourceId": "ciamHtmlForm", + "targetId": "spadapter" + } + ] + }, + { + "resourceType": "/sp/authenticationPolicyContractMappings", + "operationType": "SAVE", + "items": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "subject": { + "source": { + "type": "NO_MAPPING" + } + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "id": "wIdHhK789PmadmMS|spadapter", + "sourceId": "wIdHhK789PmadmMS", + "targetId": "spadapter" + } + ] + }, + { + "resourceType": "/identityStoreProvisioners", + "operationType": "SAVE", + "items": [ + { + "id": "ISPTestID", + "name": "ISP TestName", + "pluginDescriptorRef": { + "id": "com.pingidentity.identitystoreprovisioners.sample.SampleIdentityStoreProvisioner", + "location": "https://localhost:9999/pf-admin-api/v1/identityStoreProvisioners/descriptors/com.pingidentity.identitystoreprovisioners.sample.SampleIdentityStoreProvisioner" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "Delete user behavior", + "value": "Disable User" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.707Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "username" + } + ], + "inherited": false + }, + "groupAttributeContract": { + "coreAttributes": [ + { + "name": "groupname" + } + ], + "inherited": false + } + } + ] + }, + { + "resourceType": "/idp/tokenProcessors", + "operationType": "SAVE", + "items": [ + { + "id": "UsernameTokenProcessor", + "name": "UsernameTokenProcessor", + "pluginDescriptorRef": { + "id": "com.pingidentity.pf.tokenprocessors.username.UsernameTokenProcessor", + "location": "https://localhost:9999/pf-admin-api/v1/idp/tokenProcessors/descriptors/com.pingidentity.pf.tokenprocessors.username.UsernameTokenProcessor" + }, + "configuration": { + "tables": [ + { + "name": "Credential Validators", + "rows": [ + { + "fields": [ + { + "name": "Password Credential Validator Instance", + "value": "pingdirectory" + } + ], + "defaultRow": false + }, + { + "fields": [ + { + "name": "Password Credential Validator Instance", + "value": "simple" + } + ], + "defaultRow": false + } + ] + } + ], + "fields": [ + { + "name": "Authentication Attempts", + "value": "3" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.727Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "username", + "masked": false + } + ], + "extendedAttributes": [], + "maskOgnlValues": false + } + }, + { + "id": "tokenprocessor", + "name": "token processor", + "pluginDescriptorRef": { + "id": "org.sourceid.wstrust.processor.saml.Saml20TokenProcessor", + "location": "https://localhost:9999/pf-admin-api/v1/idp/tokenProcessors/descriptors/org.sourceid.wstrust.processor.saml.Saml20TokenProcessor" + }, + "configuration": { + "tables": [ + { + "name": "Valid Certificate Issuer DNs", + "rows": [] + }, + { + "name": "Valid Certificate Subject DNs", + "rows": [] + } + ], + "fields": [ + { + "name": "Audience", + "value": "audience" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.744Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "SAML_SUBJECT", + "masked": false + } + ], + "extendedAttributes": [], + "maskOgnlValues": false + } + } + ] + }, + { + "resourceType": "/sp/tokenGenerators", + "operationType": "SAVE", + "items": [ + { + "id": "tokengenerator", + "name": "token generator", + "pluginDescriptorRef": { + "id": "org.sourceid.wstrust.generator.saml.Saml20TokenGenerator", + "location": "https://localhost:9999/pf-admin-api/v1/sp/tokenGenerators/descriptors/org.sourceid.wstrust.generator.saml.Saml20TokenGenerator" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "Minutes Before", + "value": "60" + }, + { + "name": "Minutes After", + "value": "60" + }, + { + "name": "Issuer", + "value": "issuer" + }, + { + "name": "Signing Certificate", + "value": "tiq4n26axjircjk30oz5zf6k3" + }, + { + "name": "Signing Algorithm", + "value": "SHA1" + }, + { + "name": "Include Certificate in KeyInfo", + "value": "false" + }, + { + "name": "Include Raw Key in KeyValue", + "value": "false" + }, + { + "name": "Audience", + "value": "audience" + }, + { + "name": "Confirmation Method", + "value": "urn:oasis:names:tc:SAML:2.0:cm:sender-vouches" + }, + { + "name": "Encryption Certificate", + "value": "" + }, + { + "name": "Message Customization Expression", + "value": "" + } + ] + }, + "lastModified": "2025-01-31T22:32:16.762Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "SAML_SUBJECT" + } + ], + "extendedAttributes": [] + } + } + ] + }, + { + "resourceType": "/tokenProcessorToTokenGeneratorMappings", + "operationType": "SAVE", + "items": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "SAML_SUBJECT": { + "source": { + "type": "CONTEXT" + }, + "value": "ClientIp" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "id": "tokenprocessor|tokengenerator", + "sourceId": "tokenprocessor", + "targetId": "tokengenerator" + } + ] + }, + { + "resourceType": "/idp/defaultUrls", + "operationType": "SAVE", + "items": [ + { + "confirmIdpSlo": false, + "idpErrorMsg": "errorDetail.idpSsoFailure" + } + ] + }, + { + "resourceType": "/sp/defaultUrls", + "operationType": "SAVE", + "items": [ + { + "confirmSlo": false + } + ] + }, + { + "resourceType": "/idp/stsRequestParametersContracts", + "operationType": "SAVE", + "items": [ + { + "id": "STSTestID", + "name": "STS TestName", + "parameters": [ + "test" + ], + "lastModified": "2025-01-31T22:32:16.838Z" + } + ] + }, + { + "resourceType": "/metadataUrls", + "operationType": "SAVE", + "items": [ + { + "id": "i8uUHFDebYX7Z7gSfyhZ9yKUA", + "name": "Test Metadata URL", + "url": "https://www.example.com", + "validateSignature": false + } + ] + }, + { + "resourceType": "/oauth/authServerSettings", + "operationType": "SAVE", + "items": [ + { + "defaultScopeDescription": "", + "scopes": [ + { + "name": "email", + "description": "email scope", + "dynamic": false + } + ], + "scopeGroups": [], + "exclusiveScopes": [], + "exclusiveScopeGroups": [], + "authorizationCodeTimeout": 60, + "authorizationCodeEntropy": 30, + "disallowPlainPKCE": false, + "includeIssuerInAuthorizationResponse": false, + "persistentGrantLifetime": -1, + "persistentGrantLifetimeUnit": "DAYS", + "persistentGrantIdleTimeout": 30, + "persistentGrantIdleTimeoutTimeUnit": "DAYS", + "refreshTokenLength": 42, + "rollRefreshTokenValues": false, + "refreshTokenRollingGracePeriod": 60, + "refreshRollingInterval": 0, + "refreshRollingIntervalTimeUnit": "HOURS", + "persistentGrantReuseGrantTypes": [ + "IMPLICIT" + ], + "persistentGrantContract": { + "extendedAttributes": [], + "coreAttributes": [ + { + "name": "USER_KEY" + }, + { + "name": "USER_NAME" + } + ] + }, + "bypassAuthorizationForApprovedGrants": false, + "allowUnidentifiedClientROCreds": false, + "allowUnidentifiedClientExtensionGrants": false, + "tokenEndpointBaseUrl": "", + "requireOfflineAccessScopeToIssueRefreshTokens": false, + "offlineAccessRequireConsentPrompt": false, + "userAuthorizationUrl": "", + "registeredAuthorizationPath": "", + "pendingAuthorizationTimeout": 600, + "bypassActivationCodeConfirmation": false, + "devicePollingInterval": 5, + "activationCodeCheckMode": "AFTER_AUTHENTICATION", + "enableCookielessUserAuthorizationAuthenticationApi": false, + "returnIdTokenOnOpenIdWithDeviceAuthzGrant": false, + "userAuthorizationConsentPageSetting": "INTERNAL", + "atmIdForOAuthGrantManagement": "jwt", + "scopeForOAuthGrantManagement": "email", + "allowedOrigins": [], + "trackUserSessionsForLogout": false, + "parReferenceTimeout": 60, + "parReferenceLength": 24, + "parStatus": "ENABLED", + "clientSecretRetentionPeriod": 0, + "jwtSecuredAuthorizationResponseModeLifetime": 600, + "dpopProofRequireNonce": false, + "dpopProofLifetimeSeconds": 120, + "dpopProofEnforceReplayPrevention": false, + "bypassAuthorizationForApprovedConsents": false, + "consentLifetimeDays": -1 + } + ] + }, + { + "resourceType": "/sp/idpConnections", + "operationType": "SAVE", + "items": [ + { + "type": "IDP", + "id": "n26SCl49a8lB_ifAaLF_MyUbquv", + "name": "testConnection", + "entityId": "testPartnerId", + "active": true, + "contactInfo": {}, + "loggingMode": "STANDARD", + "virtualEntityIds": [], + "credentials": { + "certs": [ + { + "primaryVerificationCert": true, + "secondaryVerificationCert": false, + "certView": { + "id": "gpmlavn03e4mknkyml4m2ak9q", + "serialNumber": "430421198347763948001683365009287878912609754790", + "subjectDN": "CN=test, O=Ping Identity Corporation, L=Denver, ST=CO, C=US", + "subjectAlternativeNames": [], + "issuerDN": "CN=test, O=Ping Identity Corporation, L=Denver, ST=CO, C=US", + "validFrom": "2024-12-12T23:28:24.000Z", + "expires": "2027-09-08T23:28:24.000Z", + "keyAlgorithm": "RSA", + "keySize": 2048, + "signatureAlgorithm": "SHA256withRSA", + "version": 3, + "sha1Fingerprint": "B1B57BC2A8733287A1A9B65EB60BFFD01EFECEBA", + "sha256Fingerprint": "AA40F0AA0B7A438F15C49FA2A2EBE3B28AAB34A846781211BD170E8D7B06D291", + "status": "VALID" + }, + "x509File": { + "id": "gpmlavn03e4mknkyml4m2ak9q", + "fileData": "-----BEGIN CERTIFICATE-----\nMIIDnTCCAoWgAwIBAgIUS2TBCdRzpK4Zze+HDKjB9EQSHqYwDQYJKoZIhvcNAQELBQAwXjELMAkG\nA1UEBhMCVVMxCzAJBgNVBAgMAkNPMQ8wDQYDVQQHDAZEZW52ZXIxIjAgBgNVBAoMGVBpbmcgSWRl\nbnRpdHkgQ29ycG9yYXRpb24xDTALBgNVBAMMBHRlc3QwHhcNMjQxMjEyMjMyODI0WhcNMjcwOTA4\nMjMyODI0WjBeMQswCQYDVQQGEwJVUzELMAkGA1UECAwCQ08xDzANBgNVBAcMBkRlbnZlcjEiMCAG\nA1UECgwZUGluZyBJZGVudGl0eSBDb3Jwb3JhdGlvbjENMAsGA1UEAwwEdGVzdDCCASIwDQYJKoZI\nhvcNAQEBBQADggEPADCCAQoCggEBAJdoGurgDvSRBL2cIeUaCY3po5YDZnV1eyuOQTxQc6OT2JS0\n+40gJbJmfNrbcOSt+1DbxzP+Ixblkcz569VOC5lbROn38yeaMU32Xc/4DGSp1HCY/JfSygz/+qr8\n8YTqMaI21AbZnAiY5x0Rw56IDmJglXaXeVbCUJy7oPTyAoYYT93DJDk41Ze51UcTmUsTKN4K3gvv\nSaRuyq5+g6EXBq7AkeOnbP0bSHybN1KEV5BXNNpgk9h0Jw3PE+qkm/5nYRzxBf4RA/Agfv9esG9N\nz3XgDowAGBmxr+rU/na7pwEEudMh668DEDeRVwh1ZapYpBtVcxMHmdJPgFJrBlo6mMECAwEAAaNT\nMFEwHQYDVR0OBBYEFGJc3Z0j9kXPsTmmbgAsY/PK2cupMB8GA1UdIwQYMBaAFGJc3Z0j9kXPsTmm\nbgAsY/PK2cupMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAJVBvcHhh+00gzQ0\npnZKtRJxvEg+pGh+B9E+5i2PsNGyIAvAXw4mdBcQZKxfiXM31ZE2ge1mP+4di11+PKYNH2E973PL\nJ+wGHeQZ1ETDG5fo79t0MG1RzHtGoirZW7v4BNUI6ZM2FjEaCOtZg1rUhkdIfqDx4CeNjzb0rhXI\nzXNTS4Y6VlxWArQnwAgqPtb5poJG3Mm/3f6uQg/l0LIKTY/GR6yQsNCkzTZQhrIpXj4RpqnX3QgD\n1IWToMon7ntp4gAP/lASM5/xm5Jzb6dmF+hoN073g02UeV2TDLze80+K+Xr1GZeeULuXNrhOEXDR\nytvube8OXPPY6/zCphVb21g=\n-----END CERTIFICATE-----\n" + }, + "activeVerificationCert": true, + "encryptionCert": false + } + ] + }, + "modificationDate": "2025-01-31T22:32:17.051Z", + "creationDate": "2025-01-31T22:32:17.050Z", + "wsTrust": { + "attributeContract": { + "coreAttributes": [ + { + "name": "TOKEN_SUBJECT", + "masked": false + } + ], + "extendedAttributes": [] + }, + "tokenGeneratorMappings": [], + "generateLocalToken": false + } + } + ] + }, + { + "resourceType": "/idp/spConnections", + "operationType": "SAVE", + "items": [ + { + "type": "SP", + "id": "iIoQK.-GWcXI5kLp4KDNxQqAhDF", + "name": "test", + "entityId": "test", + "active": true, + "contactInfo": {}, + "loggingMode": "STANDARD", + "virtualEntityIds": [], + "credentials": { + "certs": [], + "signingSettings": { + "signingKeyPairRef": { + "id": "tiq4n26axjircjk30oz5zf6k3", + "location": "https://localhost:9999/pf-admin-api/v1/keyPairs/signing/tiq4n26axjircjk30oz5zf6k3" + }, + "algorithm": "SHA256withRSA", + "includeCertInSignature": false, + "includeRawKeyInSignature": false + } + }, + "modificationDate": "2025-01-31T22:32:17.901Z", + "creationDate": "2025-01-31T22:32:17.901Z", + "wsTrust": { + "partnerServiceIds": [ + "test" + ], + "oAuthAssertionProfiles": false, + "defaultTokenType": "SAML20", + "generateKey": false, + "encryptSaml2Assertion": false, + "minutesBefore": 5, + "minutesAfter": 30, + "attributeContract": { + "coreAttributes": [ + { + "name": "TOKEN_SUBJECT" + } + ], + "extendedAttributes": [] + }, + "tokenProcessorMappings": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "TOKEN_SUBJECT": { + "source": { + "type": "NO_MAPPING" + } + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "idpTokenProcessorRef": { + "id": "tokenprocessor", + "location": "https://localhost:9999/pf-admin-api/v1/idp/tokenProcessors/tokenprocessor" + }, + "restrictedVirtualEntityIds": [] + } + ] + }, + "connectionTargetType": "STANDARD" + } + ] + }, + { + "resourceType": "/session/settings", + "operationType": "SAVE", + "items": [ + { + "trackAdapterSessionsForLogout": false, + "revokeUserSessionOnLogout": true, + "sessionRevocationLifetime": 490 + } + ] + }, + { + "resourceType": "/session/applicationSessionPolicy", + "operationType": "SAVE", + "items": [ + { + "idleTimeoutMins": 60, + "maxTimeoutMins": 480 + } + ] + }, + { + "resourceType": "/session/authenticationSessionPolicies/global", + "operationType": "SAVE", + "items": [ + { + "enableSessions": false, + "persistentSessions": false, + "hashUniqueUserKeyAttribute": false, + "idleTimeoutMins": 60, + "idleTimeoutDisplayUnit": "MINUTES", + "maxTimeoutMins": 480, + "maxTimeoutDisplayUnit": "MINUTES" + } + ] + }, + { + "resourceType": "/session/authenticationSessionPolicies", + "operationType": "SAVE", + "items": [ + { + "id": "UfdnqYjWycSeo2vZZgSYB3gpw", + "authenticationSource": { + "type": "IDP_ADAPTER", + "sourceRef": { + "id": "OTIdPJava", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/OTIdPJava" + } + }, + "enableSessions": false, + "userDeviceType": "PRIVATE", + "persistent": false, + "timeoutDisplayUnit": "MINUTES", + "authnContextSensitive": false + } + ] + }, + { + "resourceType": "/oauth/issuers", + "operationType": "SAVE", + "items": [ + { + "id": "BmoJwEmyzs4RSNMzVUlCs8qTPC", + "name": "Test Issuer", + "description": "test issuer", + "host": "localhost", + "path": "" + } + ] + }, + { + "resourceType": "/additionalKeySets", + "operationType": "SAVE", + "items": [ + { + "id": "testID", + "name": "testName", + "description": "testDescription", + "signingKeys": { + "rsaActiveCertRef": { + "id": "tiq4n26axjircjk30oz5zf6k3", + "location": "https://localhost:9999/pf-admin-api/v1/keyPairs/signing/tiq4n26axjircjk30oz5zf6k3" + }, + "rsaPublishX5cParameter": true + }, + "issuers": [ + { + "id": "BmoJwEmyzs4RSNMzVUlCs8qTPC", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/issuers/BmoJwEmyzs4RSNMzVUlCs8qTPC" + } + ] + } + ] + }, + { + "resourceType": "/oauth/idpAdapterMappings", + "operationType": "SAVE", + "items": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "USER_NAME": { + "source": { + "type": "CONTEXT" + }, + "value": "OAuthScopes" + }, + "USER_KEY": { + "source": { + "type": "ADAPTER" + }, + "value": "subject" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "id": "OTIdPJava", + "idpAdapterRef": { + "id": "OTIdPJava", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/OTIdPJava" + } + } + ] + }, + { + "resourceType": "/oauth/authenticationPolicyContractMappings", + "operationType": "SAVE", + "items": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "USER_NAME": { + "source": { + "type": "CONTEXT" + }, + "value": "OAuthScopes" + }, + "USER_KEY": { + "source": { + "type": "AUTHENTICATION_POLICY_CONTRACT" + }, + "value": "subject" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "id": "QGxlec5CX693lBQL", + "authenticationPolicyContractRef": { + "id": "QGxlec5CX693lBQL", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/QGxlec5CX693lBQL" + } + } + ] + }, + { + "resourceType": "/oauth/outOfBandAuthPlugins", + "operationType": "SAVE", + "items": [ + { + "id": "exampleCibaAuthenticator", + "name": "exampleCibaAuthenticator", + "pluginDescriptorRef": { + "id": "com.pingidentity.oobauth.pingone.mfa.PingOneMfaCibaAuthenticator", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/outOfBandAuthPlugins/descriptors/com.pingidentity.oobauth.pingone.mfa.PingOneMfaCibaAuthenticator" + }, + "configuration": { + "tables": [ + { + "name": "PingOne Template Variables", + "rows": [] + } + ], + "fields": [ + { + "name": "PingOne Environment", + "value": "noeOvj5ltBnf4rcmtZAKdJ|f5901536-2b60-4d4a-a987-3d56aadad46d" + }, + { + "name": "Application", + "value": "2a7c1b5d-415b-4fb5-a6c0-1e290f776785" + }, + { + "name": "PingOne Authentication Policy", + "value": "" + }, + { + "name": "Test Username", + "value": "" + }, + { + "name": "PingOne Template Name", + "value": "transaction" + }, + { + "name": "PingOne Template Variant", + "value": "" + }, + { + "name": "Client Context", + "value": "#*\nDefine additional key/value pairs to be received at the mobile application.\nThe following variables are available by default:\n\n$oobAuthRequestContext - Context for the out-of-band authentication/authorization request\n$languagePackMessages - The language-pack file configured for this authenticator\n$subject - The user's PingOne username or user ID.\n$JSONValue - A JSON utility class that can be used to escape text and convert objects to JSON.\n Methods:\n escape(String s) - Escape quotes, \\, /, \\r, \\n, \\b, \\f, \\t and other control characters (U+0000 through U+001F).\n toJSONString(Object value) - Convert an object to JSON text.\n\nAdditionally, any Extended Contract attributes are also available using the $name syntax.\n\nExample:\n\n{\n \"requestingApplicationName\": \"$JSONValue.escape($oobAuthRequestContext.requestingApplication.name)\",\n \"requestedScope\": $JSONValue.toJSONString($oobAuthRequestContext.requestedScope.values()),\n \"amount\": \"$JSONValue.escape($amount)\",\n \"alert.color\": \"red\"\n}\n*#" + }, + { + "name": "Messages Files", + "value": "pingone-mfa-messages" + }, + { + "name": "API Request Timeout", + "value": "12000" + }, + { + "name": "Proxy Settings", + "value": "System Defaults" + }, + { + "name": "Custom Proxy Host", + "value": "" + }, + { + "name": "Custom Proxy Port", + "value": "" + } + ] + }, + "lastModified": "2025-01-31T22:32:19.734Z", + "attributeContract": { + "coreAttributes": [ + { + "name": "subject" + } + ], + "extendedAttributes": [] + } + } + ] + }, + { + "resourceType": "/oauth/cibaServerPolicy/requestPolicies", + "operationType": "SAVE", + "items": [ + { + "id": "exampleCibaReqPolicy", + "name": "exampleCibaReqPolicy", + "authenticatorRef": { + "id": "exampleCibaAuthenticator", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/outOfBandAuthPlugins/exampleCibaAuthenticator" + }, + "transactionLifetime": 120, + "allowUnsignedLoginHintToken": false, + "requireTokenForIdentityHint": false, + "alternativeLoginHintTokenIssuers": [], + "identityHintContract": { + "coreAttributes": [ + { + "name": "IDENTITY_HINT_SUBJECT" + } + ], + "extendedAttributes": [] + }, + "identityHintContractFulfillment": { + "attributeSources": [], + "attributeContractFulfillment": { + "IDENTITY_HINT_SUBJECT": { + "source": { + "type": "REQUEST" + }, + "value": "IDENTITY_HINT_SUBJECT" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + }, + "identityHintMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "subject": { + "source": { + "type": "NO_MAPPING" + } + }, + "USER_KEY": { + "source": { + "type": "NO_MAPPING" + } + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + }, + "lastModified": "2025-01-31T22:32:19.764Z" + } + ] + }, + { + "resourceType": "/oauth/cibaServerPolicy/settings", + "operationType": "SAVE", + "items": [ + { + "defaultRequestPolicyRef": { + "id": "exampleCibaReqPolicy", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/cibaServerPolicy/requestPolicies/exampleCibaReqPolicy" + } + } + ] + }, + { + "resourceType": "/oauth/openIdConnect/policies", + "operationType": "SAVE", + "items": [ + { + "id": "test-openid-connect-policy", + "name": "Test OpenID Connect Policy", + "idTokenLifetime": 5, + "attributeContract": { + "coreAttributes": [ + { + "name": "sub", + "multiValued": false + } + ], + "extendedAttributes": [] + }, + "attributeMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "sub": { + "source": { + "type": "TOKEN" + }, + "value": "OrgName" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + }, + "includeSriInIdToken": false, + "includeUserInfoInIdToken": false, + "includeSHashInIdToken": false, + "includeX5tInIdToken": false, + "idTokenTypHeaderValue": "", + "returnIdTokenOnRefreshGrant": false, + "returnIdTokenOnTokenExchangeGrant": false, + "reissueIdTokenInHybridFlow": false, + "accessTokenManagerRef": { + "id": "jwt", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/accessTokenManagers/jwt" + }, + "scopeAttributeMappings": {}, + "lastModified": "2025-01-31T22:32:19.793Z" + } + ] + }, + { + "resourceType": "/oauth/openIdConnect/settings", + "operationType": "SAVE", + "items": [ + { + "defaultPolicyRef": { + "id": "test-openid-connect-policy", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/openIdConnect/policies/test-openid-connect-policy" + }, + "sessionSettings": { + "trackUserSessionsForLogout": false, + "revokeUserSessionOnLogout": true, + "sessionRevocationLifetime": 490 + } + } + ] + }, + { + "resourceType": "/oauth/tokenExchange/processor/policies", + "operationType": "SAVE", + "items": [ + { + "id": "tokenexchangeprocessorpolicy", + "name": "tokenexchangeprocessorpolicy", + "actorTokenRequired": false, + "attributeContract": { + "coreAttributes": [ + { + "name": "subject" + } + ], + "extendedAttributes": [] + }, + "processorMappings": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "subject": { + "source": { + "type": "TEXT" + }, + "value": "value" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [ + { + "errorResult": "error", + "source": { + "type": "CONTEXT" + }, + "attributeName": "ClientIp", + "condition": "EQUALS", + "value": "value" + } + ] + }, + "subjectTokenType": "urn:ietf:params:oauth:token-type:saml2", + "subjectTokenProcessor": { + "id": "tokenprocessor", + "location": "https://localhost:9999/pf-admin-api/v1/idp/tokenProcessors/tokenprocessor" + }, + "actorTokenType": "", + "actorTokenProcessor": {} + } + ] + } + ] + }, + { + "resourceType": "/oauth/tokenExchange/processor/settings", + "operationType": "SAVE", + "items": [ + { + "defaultProcessorPolicyRef": { + "id": "tokenexchangeprocessorpolicy", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/tokenExchange/processor/policies/tokenexchangeprocessorpolicy" + } + } + ] + }, + { + "resourceType": "/oauth/tokenExchange/generator/groups", + "operationType": "SAVE", + "items": [ + { + "id": "exampleGeneratorGroup", + "name": "exampleGeneratorGroup", + "resourceUris": [], + "generatorMappings": [ + { + "requestedTokenType": "urn:ietf:params:oauth:token-type:saml2", + "tokenGenerator": { + "id": "tokengenerator", + "location": "https://localhost:9999/pf-admin-api/v1/sp/tokenGenerators/tokengenerator" + }, + "defaultMapping": true + } + ] + }, + { + "id": "exampleGeneratorGroup2", + "name": "exampleGeneratorGroup2", + "resourceUris": [], + "generatorMappings": [ + { + "requestedTokenType": "urn:ietf:params:oauth:token-type:saml2", + "tokenGenerator": { + "id": "tokengenerator", + "location": "https://localhost:9999/pf-admin-api/v1/sp/tokenGenerators/tokengenerator" + }, + "defaultMapping": true + } + ] + } + ] + }, + { + "resourceType": "/oauth/tokenExchange/generator/settings", + "operationType": "SAVE", + "items": [ + { + "defaultGeneratorGroupRef": { + "id": "exampleGeneratorGroup", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/tokenExchange/generator/groups/exampleGeneratorGroup" + } + } + ] + }, + { + "resourceType": "/oauth/tokenExchange/tokenGeneratorMappings", + "operationType": "SAVE", + "items": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "SAML_SUBJECT": { + "source": { + "type": "CONTEXT" + }, + "value": "OAuthScopes" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "id": "tokenexchangeprocessorpolicy|tokengenerator", + "sourceId": "tokenexchangeprocessorpolicy", + "targetId": "tokengenerator" + } + ] + }, + { + "resourceType": "/oauth/clients", + "operationType": "SAVE", + "items": [ + { + "clientId": "test", + "enabled": true, + "redirectUris": [], + "grantTypes": [ + "CLIENT_CREDENTIALS", + "ACCESS_TOKEN_VALIDATION" + ], + "name": "test", + "modificationDate": "2025-01-31T22:32:19.927Z", + "creationDate": "2025-01-31T22:32:19.927Z", + "refreshRolling": "SERVER_DEFAULT", + "refreshTokenRollingIntervalType": "SERVER_DEFAULT", + "persistentGrantExpirationType": "SERVER_DEFAULT", + "persistentGrantExpirationTime": 0, + "persistentGrantExpirationTimeUnit": "DAYS", + "persistentGrantIdleTimeoutType": "SERVER_DEFAULT", + "persistentGrantIdleTimeout": 0, + "persistentGrantIdleTimeoutTimeUnit": "DAYS", + "persistentGrantReuseType": "SERVER_DEFAULT", + "allowAuthenticationApiInit": false, + "enableCookielessAuthenticationApi": false, + "bypassApprovalPage": false, + "restrictScopes": false, + "requirePushedAuthorizationRequests": false, + "requireJwtSecuredAuthorizationResponseMode": false, + "restrictedScopes": [], + "exclusiveScopes": [], + "restrictedResponseTypes": [], + "authorizationDetailTypes": [], + "defaultAccessTokenManagerRef": { + "id": "jwt", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/accessTokenManagers/jwt" + }, + "restrictToDefaultAccessTokenManager": false, + "validateUsingAllEligibleAtms": false, + "oidcPolicy": { + "grantAccessSessionRevocationApi": false, + "grantAccessSessionSessionManagementApi": false, + "logoutMode": "NONE", + "pingAccessLogoutCapable": false, + "pairwiseIdentifierUserType": false + }, + "clientAuth": { + "type": "SECRET", + "encryptedSecret": "OBF:JWE:eyJhbGciOiJkaXIiLCJlbmMiOiJBMTI4Q0JDLUhTMjU2Iiwia2lkIjoiUWVzOVR5eTV5WiIsInZlcnNpb24iOiIxMi4yLjAuNCJ9..ek9f1RsTFzvZAr2zYUAKUg.oF0lexeGQn1HT68sDwGGMJWkl9WmrTz5ThtJq-E0dsb13biwdjYQOvJCmonsjXZkuGaPPV0dfADekdPIod9zV5nGplpqH75FrnWhtr06_6I.yenJNLd7e8YH3mleNSxAMQ", + "secondarySecrets": [] + }, + "deviceFlowSettingType": "SERVER_DEFAULT", + "requireProofKeyForCodeExchange": false, + "refreshTokenRollingGracePeriodType": "SERVER_DEFAULT", + "clientSecretRetentionPeriodType": "SERVER_DEFAULT", + "requireDpop": false, + "requireOfflineAccessScopeToIssueRefreshTokens": "SERVER_DEFAULT", + "offlineAccessRequireConsentPrompt": "SERVER_DEFAULT", + "lockoutMaxMaliciousActionsType": "SERVER_DEFAULT", + "requireSignedRequests": false + } + ] + }, + { + "resourceType": "/oauth/clientRegistrationPolicies", + "operationType": "SAVE", + "items": [ + { + "id": "testRegistrationPolicy", + "name": "Test Registration Policy", + "pluginDescriptorRef": { + "id": "com.pingidentity.pf.client.registration.ResponseTypesConstraintsPlugin", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/clientRegistrationPolicies/descriptors/com.pingidentity.pf.client.registration.ResponseTypesConstraintsPlugin" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "code", + "value": "true" + }, + { + "name": "code id_token", + "value": "true" + }, + { + "name": "code id_token token", + "value": "true" + }, + { + "name": "code token", + "value": "true" + }, + { + "name": "id_token", + "value": "true" + }, + { + "name": "id_token token", + "value": "true" + }, + { + "name": "token", + "value": "true" + } + ] + }, + "lastModified": "2025-01-31T22:32:19.959Z" + } + ] + }, + { + "resourceType": "/oauth/clientSettings", + "operationType": "SAVE", + "items": [ + { + "clientMetadata": [ + { + "parameter": "authNexp", + "description": "Authentication Experience [Single_Factor | Internal | ID-First | Multi_Factor]", + "multiValued": false + }, + { + "parameter": "useAuthnApi", + "description": "Use the AuthN API", + "multiValued": false + } + ] + } + ] + }, + { + "resourceType": "/oauth/accessTokenMappings", + "operationType": "SAVE", + "items": [ + { + "attributeSources": [], + "attributeContractFulfillment": { + "Username": { + "source": { + "type": "TEXT" + }, + "value": "Administrator" + }, + "OrgName": { + "source": { + "type": "TEXT" + }, + "value": "Ping" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "id": "client_credentials|jwt", + "context": { + "type": "CLIENT_CREDENTIALS" + }, + "accessTokenManagerRef": { + "id": "jwt", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/accessTokenManagers/jwt" + } + }, + { + "attributeSources": [], + "attributeContractFulfillment": { + "Username": { + "source": { + "type": "TEXT" + }, + "value": "Administrator" + }, + "OrgName": { + "source": { + "type": "TEXT" + }, + "value": "Ping" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + }, + "id": "default|jwt", + "context": { + "type": "DEFAULT" + }, + "accessTokenManagerRef": { + "id": "jwt", + "location": "https://localhost:9999/pf-admin-api/v1/oauth/accessTokenManagers/jwt" + } + } + ] + }, + { + "resourceType": "/authenticationSelectors", + "operationType": "SAVE", + "items": [ + { + "id": "authnExp", + "name": "AuthN Experiences", + "pluginDescriptorRef": { + "id": "com.pingidentity.pf.selectors.ExtendedPropertyAuthnSelector", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationSelectors/descriptors/com.pingidentity.pf.selectors.ExtendedPropertyAuthnSelector" + }, + "configuration": { + "tables": [], + "fields": [ + { + "name": "Extended Property", + "value": "authNexp" + }, + { + "name": "Case-Sensitive Matching", + "value": "true" + }, + { + "name": "Enable 'No Match' Result Value", + "value": "false" + } + ] + }, + "lastModified": "2025-01-31T22:32:20.047Z", + "attributeContract": { + "extendedAttributes": [ + { + "name": "Single_Factor" + }, + { + "name": "Internal" + } + ] + } + } + ] + }, + { + "resourceType": "/authenticationApi", + "operationType": "SAVE", + "items": [ + { + "id": "myauthenticationapiapplication", + "url": "https://example.com", + "description": "example", + "additionalAllowedOrigins": [], + "name": "myauthenticationapiapplication" + } + ] + }, + { + "resourceType": "/authenticationApi/settings", + "operationType": "SAVE", + "items": [ + { + "apiEnabled": false, + "enableApiDescriptions": true, + "restrictAccessToRedirectlessMode": true, + "includeRequestContext": false + } + ] + }, + { + "resourceType": "/authenticationPolicies/fragments", + "operationType": "SAVE", + "items": [ + { + "id": "FirstFactor", + "name": "First_Factor", + "description": "Used for Customer First Factor", + "rootNode": { + "action": { + "type": "AUTHN_SOURCE", + "authenticationSource": { + "type": "IDP_ADAPTER", + "sourceRef": { + "id": "ciamHtmlForm", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/ciamHtmlForm" + } + }, + "attributeRules": { + "items": [ + { + "attributeSource": { + "type": "ADAPTER", + "id": "ciamHtmlForm" + }, + "attributeName": "policy.action", + "condition": "EQUALS_CASE_INSENSITIVE", + "expectedValue": "identity.registration", + "result": "Register" + } + ], + "fallbackToSuccess": true + } + }, + "children": [ + { + "action": { + "type": "DONE", + "context": "Fail" + } + }, + { + "action": { + "type": "LOCAL_IDENTITY_MAPPING", + "context": "Register", + "localIdentityRef": { + "id": "regIdentityProfile", + "location": "https://localhost:9999/pf-admin-api/v1/localIdentity/identityProfiles/regIdentityProfile" + }, + "inboundMapping": { + "attributeSources": [], + "attributeContractFulfillment": {}, + "issuanceCriteria": { + "conditionalCriteria": [] + } + }, + "outboundAttributeMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "firstName": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "firstName" + }, + "lastName": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "lastName" + }, + "ImmutableID": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "ImmutableID" + }, + "mail": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "email" + }, + "subject": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "username" + }, + "SAML_AUTHN_CTX": { + "source": { + "type": "TEXT" + }, + "value": "registered" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + } + } + }, + { + "action": { + "type": "LOCAL_IDENTITY_MAPPING", + "context": "Success", + "localIdentityRef": { + "id": "regIdentityProfile", + "location": "https://localhost:9999/pf-admin-api/v1/localIdentity/identityProfiles/regIdentityProfile" + }, + "inboundMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "pf.local.identity.unique.id": { + "source": { + "type": "ADAPTER", + "id": "ciamHtmlForm" + }, + "value": "uid" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + }, + "outboundAttributeMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "firstName": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "firstName" + }, + "lastName": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "lastName" + }, + "ImmutableID": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "ImmutableID" + }, + "mail": { + "source": { + "type": "LOCAL_IDENTITY_PROFILE", + "id": "regIdentityProfile" + }, + "value": "email" + }, + "subject": { + "source": { + "type": "ADAPTER", + "id": "ciamHtmlForm" + }, + "value": "username" + }, + "SAML_AUTHN_CTX": { + "source": { + "type": "TEXT" + }, + "value": "single_factor" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + } + } + } + ] + }, + "inputs": { + "id": "DkhZxRcZchsed90U", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/DkhZxRcZchsed90U" + }, + "outputs": { + "id": "samplePolicyContract", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/samplePolicyContract" + } + }, + { + "id": "Identify_First", + "name": "Identify_First", + "description": "Used for First Factors that just use the User Identifier", + "rootNode": { + "action": { + "type": "AUTHN_SOURCE", + "authenticationSource": { + "type": "IDP_ADAPTER", + "sourceRef": { + "id": "IDFirst", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/IDFirst" + } + }, + "inputUserIdMapping": { + "source": { + "type": "INPUTS", + "id": "Inputs" + }, + "value": "subject" + }, + "userIdAuthenticated": false + }, + "children": [ + { + "action": { + "type": "DONE", + "context": "Fail" + } + }, + { + "action": { + "type": "APC_MAPPING", + "context": "Success", + "authenticationPolicyContractRef": { + "id": "DkhZxRcZchsed90U", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/DkhZxRcZchsed90U" + }, + "attributeMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "subject": { + "source": { + "type": "ADAPTER", + "id": "IDFirst" + }, + "value": "uid" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + } + } + } + ] + }, + "inputs": { + "id": "DkhZxRcZchsed90U", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/DkhZxRcZchsed90U" + }, + "outputs": { + "id": "DkhZxRcZchsed90U", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/DkhZxRcZchsed90U" + } + }, + { + "id": "InternalAuthN", + "name": "Internal AuthN", + "description": "Used for Internal Authentication", + "rootNode": { + "action": { + "type": "AUTHN_SOURCE", + "authenticationSource": { + "type": "IDP_ADAPTER", + "sourceRef": { + "id": "htmlForm", + "location": "https://localhost:9999/pf-admin-api/v1/idp/adapters/htmlForm" + } + } + }, + "children": [ + { + "action": { + "type": "DONE", + "context": "Fail" + } + }, + { + "action": { + "type": "APC_MAPPING", + "context": "Success", + "authenticationPolicyContractRef": { + "id": "default", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/default" + }, + "attributeMapping": { + "attributeSources": [], + "attributeContractFulfillment": { + "firstName": { + "source": { + "type": "NO_MAPPING" + } + }, + "lastName": { + "source": { + "type": "NO_MAPPING" + } + }, + "ImmutableID": { + "source": { + "type": "ADAPTER", + "id": "htmlForm" + }, + "value": "entryUUID" + }, + "mail": { + "source": { + "type": "ADAPTER", + "id": "htmlForm" + }, + "value": "mail" + }, + "subject": { + "source": { + "type": "ADAPTER", + "id": "htmlForm" + }, + "value": "uid" + }, + "SAML_AUTHN_CTX": { + "source": { + "type": "TEXT" + }, + "value": "internal" + } + }, + "issuanceCriteria": { + "conditionalCriteria": [] + } + } + } + } + ] + }, + "inputs": { + "id": "DkhZxRcZchsed90U", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/DkhZxRcZchsed90U" + }, + "outputs": { + "id": "default", + "location": "https://localhost:9999/pf-admin-api/v1/authenticationPolicyContracts/default" + } + } + ] + }, + { + "resourceType": "/authenticationPolicies/default", + "operationType": "SAVE", + "items": [ + { + "failIfNoSelection": false, + "authnSelectionTrees": [], + "defaultAuthenticationSources": [], + "trackedHttpParameters": [] + } + ] + }, + { + "resourceType": "/authenticationPolicies/settings", + "operationType": "SAVE", + "items": [ + { + "enableIdpAuthnSelection": false, + "enableSpAuthnSelection": false + } + ] + } + ] +} From a47788100ee7bde7e81e02a79bef785db19c846c Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Wed, 19 Feb 2025 17:49:44 -0700 Subject: [PATCH 04/18] Implement common data extractions from PingOne SDK entity array. Handle 204 and 403 response status codes for various expected API behaviors. --- internal/connector/common/resources_common.go | 66 ++++++- ...oauth_token_exchange_generator_settings.go | 10 + .../platform/resources/pingone_agreement.go | 44 ++--- .../pingone_agreement_localization.go | 101 +++------- ...pingone_agreement_localization_revision.go | 134 +++---------- .../resources/pingone_branding_settings.go | 23 +-- .../resources/pingone_branding_theme.go | 48 ++--- .../pingone_branding_theme_default.go | 53 ++---- .../platform/resources/pingone_certificate.go | 24 ++- .../resources/pingone_custom_domain.go | 40 ++-- .../platform/resources/pingone_environment.go | 20 +- .../platform/resources/pingone_form.go | 44 ++--- .../resources/pingone_forms_recaptcha_v2.go | 22 +-- .../platform/resources/pingone_gateway.go | 78 ++++---- .../resources/pingone_gateway_credential.go | 100 ++-------- .../pingone_gateway_role_assignment.go | 106 +++-------- .../pingone_identity_propagation_plan.go | 44 ++--- .../pingone/platform/resources/pingone_key.go | 24 ++- .../resources/pingone_key_rotation_policy.go | 44 ++--- .../platform/resources/pingone_language.go | 56 +++--- .../resources/pingone_language_update.go | 64 +++---- .../resources/pingone_notification_policy.go | 44 ++--- .../pingone_notification_settings.go | 23 +-- .../pingone_notification_settings_email.go | 23 +-- .../pingone_notification_template_content.go | 176 ++++++++---------- .../pingone_phone_delivery_settings.go | 93 ++++----- .../resources/pingone_system_application.go | 73 +++----- .../pingone_trusted_email_address.go | 84 ++------- .../resources/pingone_trusted_email_domain.go | 44 ++--- .../platform/resources/pingone_webhook.go | 44 ++--- 30 files changed, 618 insertions(+), 1131 deletions(-) diff --git a/internal/connector/common/resources_common.go b/internal/connector/common/resources_common.go index ff9d5b15..add3cdb1 100644 --- a/internal/connector/common/resources_common.go +++ b/internal/connector/common/resources_common.go @@ -4,8 +4,10 @@ import ( "fmt" "maps" "net/http" + "reflect" "slices" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/output" ) @@ -16,7 +18,7 @@ const ( func HandleClientResponse(response *http.Response, err error, apiFunctionName string, resourceType string) (bool, error) { if err != nil { // Only warn the user on client error and skip export of resource - output.Warn("Service API client error.", map[string]interface{}{ + output.Warn("API client error.", map[string]interface{}{ "api_function": apiFunctionName, "error": err, "resource": resourceType, @@ -32,7 +34,7 @@ func HandleClientResponse(response *http.Response, err error, apiFunctionName st // When the client returns forbidden, warn user and skip export of resource if response.StatusCode == 403 { - output.Warn("Service API client 403 forbidden response.", map[string]interface{}{ + output.Warn("API client 403 forbidden response.", map[string]interface{}{ "api_function": apiFunctionName, "resource": resourceType, "response_code": response.StatusCode, @@ -50,7 +52,7 @@ func HandleClientResponse(response *http.Response, err error, apiFunctionName st return true, nil } -func DataNilError(resourceType string, response *http.Response) error { +func dataNilError(resourceType string, response *http.Response) error { return fmt.Errorf("failed to export resource '%s'.\n"+ "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ "response code: %s\n"+ @@ -69,3 +71,61 @@ func GenerateCommentInformation(data map[string]string) string { return commentInformation } + +func CheckSingletonResource(response *http.Response, err error, apiFuncName, resourceType string) (bool, error) { + ok, err := HandleClientResponse(response, err, "ReadBrandingSettings", resourceType) + if err != nil { + return false, err + } + if !ok { + return false, nil + } + + if response.StatusCode == 204 { + output.Warn("API client 204 No Content response.", map[string]interface{}{ + "api_function": apiFuncName, + "resource": resourceType, + }) + return false, nil + } + + return true, nil +} + +func GetManagementAPIObjectsFromIterator[T any](iter management.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { + apiObjects := []T{} + + for cursor, err := range iter { + ok, err := HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) + if err != nil { + return nil, err + } + // A warning was given when handling the client response. Return nil embeddeds to skip export of resource + if !ok { + return nil, nil + } + + nilErr := dataNilError(resourceType, cursor.HTTPResponse) + + if cursor.EntityArray == nil { + return nil, nilErr + } + + embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() + if !embeddedOk { + return nil, nilErr + } + + reflectValues := reflect.ValueOf(embedded).MethodByName(extractionFuncName).Call(nil) + for _, rValue := range reflectValues { + apiObject, apiObjectOk := rValue.Interface().(T) + if !apiObjectOk { + output.SystemError(fmt.Sprintf("Failed to cast reflect value to %s", resourceType), nil) + } + + apiObjects = append(apiObjects, apiObject) + } + } + + return apiObjects, nil +} diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_generator_settings.go b/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_generator_settings.go index 3952ed53..0acfcfd8 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_generator_settings.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_generator_settings.go @@ -4,6 +4,7 @@ import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingfederate-go-client/v1210/configurationapi" ) // Verify that the resource satisfies the exportable resource interface @@ -32,6 +33,15 @@ func (r *PingFederateOAuthTokenExchangeGeneratorSettingsResource) ExportAll() (* importBlocks := []connector.ImportBlock{} + settings, response, err := r.clientInfo.ApiClient.OauthTokenExchangeGeneratorAPI.GetOauthTokenExchangeSettings(r.clientInfo.Context).Execute() + _ = response + _ = err + json, err := settings.MarshalJSON() + strJson := string(json) + _ = strJson + + t := configurationapi.TokenExchangeGeneratorSettings{} + oauthTokenExchangeGeneratorSettingsId := "oauth_token_exchange_generator_settings_singleton_id" // #nosec G101 // These variables do not contain sensitive token information oauthTokenExchangeGeneratorSettingsName := "OAuth Token Exchange Generator Settings" // #nosec G101 // These variables do not contain sensitive token information diff --git a/internal/connector/pingone/platform/resources/pingone_agreement.go b/internal/connector/pingone/platform/resources/pingone_agreement.go index a38765e4..3c7737f4 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneAgreementResource) ExportAll() (*[]connector.ImportBlock, error) importBlocks := []connector.ImportBlock{} - agreementData, err := r.getAgreementData() + agreementData, err := getAgreementData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for agreementId, agreementName := range *agreementData { + for agreementId, agreementName := range agreementData { commentData := map[string]string{ "Agreement ID": agreementId, "Agreement Name": agreementName, @@ -60,38 +61,23 @@ func (r *PingOneAgreementResource) ExportAll() (*[]connector.ImportBlock, error) return &importBlocks, nil } -func (r *PingOneAgreementResource) getAgreementData() (*map[string]string, error) { +func getAgreementData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { agreementData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + agreements, err := common.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", resourceType) + if err != nil { + return nil, err + } - for _, agreement := range embedded.GetAgreements() { - agreementId, agreementIdOk := agreement.GetIdOk() - agreementName, agreementNameOk := agreement.GetNameOk() + for _, agreement := range agreements { + agreementId, agreementIdOk := agreement.GetIdOk() + agreementName, agreementNameOk := agreement.GetNameOk() - if agreementIdOk && agreementNameOk { - agreementData[*agreementId] = *agreementName - } + if agreementIdOk && agreementNameOk { + agreementData[*agreementId] = *agreementName } } - return &agreementData, nil + return agreementData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_agreement_localization.go b/internal/connector/pingone/platform/resources/pingone_agreement_localization.go index a3594ef2..e8742ad5 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement_localization.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement_localization.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,31 +35,31 @@ func (r *PingOneAgreementLocalizationResource) ExportAll() (*[]connector.ImportB importBlocks := []connector.ImportBlock{} - agreementData, err := r.getAgreementData() + agreementData, err := getAgreementData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for agreementId, agreementName := range *agreementData { - agreementLanguageData, err := r.getAgreementLanguageData(agreementId) + for agreementId, agreementName := range agreementData { + agreementLocalizationData, err := getAgreementLocalizationData(r.clientInfo, r.ResourceType(), agreementId) if err != nil { return nil, err } - for agreementLanguageId, agreementLanguageLocale := range *agreementLanguageData { + for agreementLocalizationId, agreementLocalizationLocale := range agreementLocalizationData { commentData := map[string]string{ - "Agreement ID": agreementId, - "Agreement Language ID": agreementLanguageId, - "Agreement Language Locale": agreementLanguageLocale, - "Agreement Name": agreementName, - "Export Environment ID": r.clientInfo.ExportEnvironmentID, - "Resource Type": r.ResourceType(), + "Agreement ID": agreementId, + "Agreement Name": agreementName, + "Agreement Localization ID": agreementLocalizationId, + "Agreement Localization Locale": agreementLocalizationLocale, + "Export Environment ID": r.clientInfo.ExportEnvironmentID, + "Resource Type": r.ResourceType(), } importBlock := connector.ImportBlock{ ResourceType: r.ResourceType(), - ResourceName: fmt.Sprintf("%s_%s", agreementName, agreementLanguageLocale), - ResourceID: fmt.Sprintf("%s/%s/%s", r.clientInfo.ExportEnvironmentID, agreementId, agreementLanguageId), + ResourceName: fmt.Sprintf("%s_%s", agreementName, agreementLocalizationLocale), + ResourceID: fmt.Sprintf("%s/%s/%s", r.clientInfo.ExportEnvironmentID, agreementId, agreementLocalizationId), CommentInformation: common.GenerateCommentInformation(commentData), } @@ -69,75 +70,25 @@ func (r *PingOneAgreementLocalizationResource) ExportAll() (*[]connector.ImportB return &importBlocks, nil } -func (r *PingOneAgreementLocalizationResource) getAgreementData() (*map[string]string, error) { - agreementData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() +func getAgreementLocalizationData(clientInfo *connector.PingOneClientInfo, resourceType, agreementId string) (map[string]string, error) { + agreementLocalizationData := make(map[string]string) - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, agreement := range embedded.GetAgreements() { - agreementId, agreementIdOk := agreement.GetIdOk() - agreementName, agreementNameOk := agreement.GetNameOk() - - if agreementIdOk && agreementNameOk { - agreementData[*agreementId] = *agreementName - } - } + iter := clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(clientInfo.Context, clientInfo.ExportEnvironmentID, agreementId).Execute() + agreementLocalizations, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadAllAgreementLanguages", "GetLanguages", resourceType) + if err != nil { + return nil, err } - return &agreementData, nil -} - -func (r *PingOneAgreementLocalizationResource) getAgreementLanguageData(agreementId string) (*map[string]string, error) { - agreementLanguageData := make(map[string]string) - - iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguages", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, languageInner := range embedded.GetLanguages() { - if languageInner.AgreementLanguage != nil { - agreementLanguageId, agreementLanguageIdOk := languageInner.AgreementLanguage.GetIdOk() - agreementLanguageLocale, agreementLanguageLocaleOk := languageInner.AgreementLanguage.GetLocaleOk() + for _, agreementLocalization := range agreementLocalizations { + if agreementLocalization.AgreementLanguage != nil { + agreementLocalizationId, agreementLocalizationIdOk := agreementLocalization.AgreementLanguage.GetIdOk() + agreementLocalizationLocale, agreementLocalizationLocaleOk := agreementLocalization.AgreementLanguage.GetLocaleOk() - if agreementLanguageIdOk && agreementLanguageLocaleOk { - agreementLanguageData[*agreementLanguageId] = *agreementLanguageLocale - } + if agreementLocalizationIdOk && agreementLocalizationLocaleOk { + agreementLocalizationData[*agreementLocalizationId] = *agreementLocalizationLocale } } } - return &agreementLanguageData, nil + return agreementLocalizationData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go b/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go index 30e46fa5..cce92692 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,38 +35,38 @@ func (r *PingOneAgreementLocalizationRevisionResource) ExportAll() (*[]connector importBlocks := []connector.ImportBlock{} - agreementData, err := r.getAgreementData() + agreementData, err := getAgreementData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for agreementId, agreementName := range *agreementData { - agreementLanguageData, err := r.getAgreementLanguageData(agreementId) + for agreementId, agreementName := range agreementData { + agreementLocalizationData, err := getAgreementLocalizationData(r.clientInfo, r.ResourceType(), agreementId) if err != nil { return nil, err } - for agreementLanguageId, agreementLanguageLocale := range *agreementLanguageData { - agreementLanguageRevisionData, err := r.getAgreementLanguageRevisionData(agreementId, agreementLanguageId) + for agreementLocalizationId, agreementLocalizationLocale := range agreementLocalizationData { + agreementLocalizationRevisionData, err := getAgreementLocalizationRevisionData(r.clientInfo, r.ResourceType(), agreementId, agreementLocalizationId) if err != nil { return nil, err } - for _, agreementLanguageRevisionId := range *agreementLanguageRevisionData { + for _, agreementLocalizationRevisionId := range agreementLocalizationRevisionData { commentData := map[string]string{ "Agreement ID": agreementId, - "Agreement Language ID": agreementLanguageId, - "Agreement Language Locale": agreementLanguageLocale, - "Agreement Localization Revision ID": agreementLanguageRevisionId, "Agreement Name": agreementName, + "Agreement Localization ID": agreementLocalizationId, + "Agreement Localization Locale": agreementLocalizationLocale, + "Agreement Localization Revision ID": agreementLocalizationRevisionId, "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), } importBlock := connector.ImportBlock{ ResourceType: r.ResourceType(), - ResourceName: fmt.Sprintf("%s_%s_%s", agreementName, agreementLanguageLocale, agreementLanguageRevisionId), - ResourceID: fmt.Sprintf("%s/%s/%s/%s", r.clientInfo.ExportEnvironmentID, agreementId, agreementLanguageId, agreementLanguageRevisionId), + ResourceName: fmt.Sprintf("%s_%s_%s", agreementName, agreementLocalizationLocale, agreementLocalizationRevisionId), + ResourceID: fmt.Sprintf("%s/%s/%s/%s", r.clientInfo.ExportEnvironmentID, agreementId, agreementLocalizationId, agreementLocalizationRevisionId), CommentInformation: common.GenerateCommentInformation(commentData), } @@ -77,111 +78,22 @@ func (r *PingOneAgreementLocalizationRevisionResource) ExportAll() (*[]connector return &importBlocks, nil } -func (r *PingOneAgreementLocalizationRevisionResource) getAgreementData() (*map[string]string, error) { - agreementData := make(map[string]string) +func getAgreementLocalizationRevisionData(clientInfo *connector.PingOneClientInfo, resourceType, agreementId, agreementLocalizationId string) ([]string, error) { + agreementLocalizationRevisionData := []string{} - iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreements", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, agreement := range embedded.GetAgreements() { - agreementId, agreementIdOk := agreement.GetIdOk() - agreementName, agreementNameOk := agreement.GetNameOk() - - if agreementIdOk && agreementNameOk { - agreementData[*agreementId] = *agreementName - } - } - } - - return &agreementData, nil -} - -func (r *PingOneAgreementLocalizationRevisionResource) getAgreementLanguageData(agreementId string) (*map[string]string, error) { - agreementLanguageData := make(map[string]string) - - iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguages", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, languageInner := range embedded.GetLanguages() { - if languageInner.AgreementLanguage != nil { - agreementLanguageLocale, agreementLanguageLocaleOk := languageInner.AgreementLanguage.GetLocaleOk() - agreementLanguageId, agreementLanguageIdOk := languageInner.AgreementLanguage.GetIdOk() - - if agreementLanguageLocaleOk && agreementLanguageIdOk { - agreementLanguageData[*agreementLanguageId] = *agreementLanguageLocale - } - } - } + iter := clientInfo.ApiClient.ManagementAPIClient.AgreementRevisionsResourcesApi.ReadAllAgreementLanguageRevisions(clientInfo.Context, clientInfo.ExportEnvironmentID, agreementId, agreementLocalizationId).Execute() + agreementLocalizationRevisions, err := common.GetManagementAPIObjectsFromIterator[management.AgreementLanguageRevision](iter, "ReadAllAgreementLanguageRevisions", "GetRevisions", resourceType) + if err != nil { + return nil, err } - return &agreementLanguageData, nil -} - -func (r *PingOneAgreementLocalizationRevisionResource) getAgreementLanguageRevisionData(agreementId, agreementLanguageId string) (*[]string, error) { - agreementLanguageRevisionData := []string{} + for _, agreementLocalizationRevision := range agreementLocalizationRevisions { + agreementLocalizationRevisionId, agreementLocalizationRevisionIdOk := agreementLocalizationRevision.GetIdOk() - iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementRevisionsResourcesApi.ReadAllAgreementLanguageRevisions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId, agreementLanguageId).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllAgreementLanguageRevisions", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, revision := range embedded.GetRevisions() { - agreementLanguageRevisionId, agreementLanguageRevisionIdOk := revision.GetIdOk() - - if agreementLanguageRevisionIdOk { - agreementLanguageRevisionData = append(agreementLanguageRevisionData, *agreementLanguageRevisionId) - } + if agreementLocalizationRevisionIdOk { + agreementLocalizationRevisionData = append(agreementLocalizationRevisionData, *agreementLocalizationRevisionId) } } - return &agreementLanguageRevisionData, nil + return agreementLocalizationRevisionData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_settings.go b/internal/connector/pingone/platform/resources/pingone_branding_settings.go index fbc39b11..65b41c84 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_settings.go @@ -32,10 +32,13 @@ func (r *PingOneBrandingSettingsResource) ExportAll() (*[]connector.ImportBlock, importBlocks := []connector.ImportBlock{} - err := r.checkBrandingSettingsData() + ok, err := checkBrandingSettingsData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } + if !ok { + return &importBlocks, nil + } commentData := map[string]string{ "Resource Type": r.ResourceType(), @@ -54,19 +57,7 @@ func (r *PingOneBrandingSettingsResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingOneBrandingSettingsResource) checkBrandingSettingsData() error { - _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.BrandingSettingsApi.ReadBrandingSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "ReadBrandingSettings", r.ResourceType()) - if err != nil { - return err - } - if !ok { - return nil - } - - if response.StatusCode == 204 { - return common.DataNilError(r.ResourceType(), response) - } - - return nil +func checkBrandingSettingsData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { + _, response, err := clientInfo.ApiClient.ManagementAPIClient.BrandingSettingsApi.ReadBrandingSettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadBrandingSettings", resourceType) } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme.go b/internal/connector/pingone/platform/resources/pingone_branding_theme.go index df07571c..d0ca2573 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneBrandingThemeResource) ExportAll() (*[]connector.ImportBlock, er importBlocks := []connector.ImportBlock{} - brandingThemeData, err := r.getBrandingThemeData() + brandingThemeData, err := getBrandingThemeData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for brandingThemeId, brandingThemeName := range *brandingThemeData { + for brandingThemeId, brandingThemeName := range brandingThemeData { commentData := map[string]string{ "Branding Theme ID": brandingThemeId, "Branding Theme Name": brandingThemeName, @@ -60,42 +61,27 @@ func (r *PingOneBrandingThemeResource) ExportAll() (*[]connector.ImportBlock, er return &importBlocks, nil } -func (r *PingOneBrandingThemeResource) getBrandingThemeData() (*map[string]string, error) { +func getBrandingThemeData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { brandingThemeData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadBrandingThemes", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + brandingThemes, err := common.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", resourceType) + if err != nil { + return nil, err + } - for _, brandingTheme := range embedded.GetThemes() { - brandingThemeId, brandingThemeIdOk := brandingTheme.GetIdOk() - brandingThemeConfiguration, brandingThemeConfigurationOk := brandingTheme.GetConfigurationOk() + for _, brandingTheme := range brandingThemes { + brandingThemeId, brandingThemeIdOk := brandingTheme.GetIdOk() + brandingThemeConfiguration, brandingThemeConfigurationOk := brandingTheme.GetConfigurationOk() - if brandingThemeIdOk && brandingThemeConfigurationOk { - brandingThemeName, brandingThemeNameOk := brandingThemeConfiguration.GetNameOk() + if brandingThemeIdOk && brandingThemeConfigurationOk { + brandingThemeName, brandingThemeNameOk := brandingThemeConfiguration.GetNameOk() - if brandingThemeNameOk { - brandingThemeData[*brandingThemeId] = *brandingThemeName - } + if brandingThemeNameOk { + brandingThemeData[*brandingThemeId] = *brandingThemeName } } } - return &brandingThemeData, nil + return brandingThemeData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go index ecc4b44f..b698cbc3 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,20 +35,20 @@ func (r *PingOneBrandingThemeDefaultResource) ExportAll() (*[]connector.ImportBl importBlocks := []connector.ImportBlock{} - defaultBrandingThemeName, err := r.getDefaultBrandingThemeName() + defaultBrandingThemeName, err := getDefaultBrandingThemeName(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } commentData := map[string]string{ - "Default Branding Theme Name": *defaultBrandingThemeName, + "Default Branding Theme Name": defaultBrandingThemeName, "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), } importBlock := connector.ImportBlock{ ResourceType: r.ResourceType(), - ResourceName: fmt.Sprintf("%s_default_theme", *defaultBrandingThemeName), + ResourceName: fmt.Sprintf("%s_default_theme", defaultBrandingThemeName), ResourceID: r.clientInfo.ExportEnvironmentID, CommentInformation: common.GenerateCommentInformation(commentData), } @@ -57,43 +58,29 @@ func (r *PingOneBrandingThemeDefaultResource) ExportAll() (*[]connector.ImportBl return &importBlocks, nil } -func (r *PingOneBrandingThemeDefaultResource) getDefaultBrandingThemeName() (*string, error) { - iter := r.clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadBrandingThemes", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } +func getDefaultBrandingThemeName(clientInfo *connector.PingOneClientInfo, resourceType string) (string, error) { + iter := clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + brandingThemes, err := common.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", resourceType) + if err != nil { + return "", err + } - for _, brandingTheme := range embedded.GetThemes() { - brandingThemeDefault, brandingThemeDefaultOk := brandingTheme.GetDefaultOk() + for _, brandingTheme := range brandingThemes { + brandingThemeDefault, brandingThemeDefaultOk := brandingTheme.GetDefaultOk() - if brandingThemeDefaultOk && *brandingThemeDefault { - brandingThemeConfiguration, brandingThemeConfigurationOk := brandingTheme.GetConfigurationOk() + if brandingThemeDefaultOk && *brandingThemeDefault { + brandingThemeConfiguration, brandingThemeConfigurationOk := brandingTheme.GetConfigurationOk() - if brandingThemeConfigurationOk { - brandingThemeName, brandingThemeNameOk := brandingThemeConfiguration.GetNameOk() + if brandingThemeConfigurationOk { + brandingThemeName, brandingThemeNameOk := brandingThemeConfiguration.GetNameOk() - if brandingThemeNameOk { - return brandingThemeName, nil - } + if brandingThemeNameOk { + return *brandingThemeName, nil } } + } } - return nil, fmt.Errorf("failed to export resource '%s'. No default branding theme found.", r.ResourceType()) + return "", fmt.Errorf("failed to export resource '%s'. No default branding theme found.", resourceType) } diff --git a/internal/connector/pingone/platform/resources/pingone_certificate.go b/internal/connector/pingone/platform/resources/pingone_certificate.go index 3356831b..bfa3b4da 100644 --- a/internal/connector/pingone/platform/resources/pingone_certificate.go +++ b/internal/connector/pingone/platform/resources/pingone_certificate.go @@ -34,12 +34,12 @@ func (r *PingOneCertificateResource) ExportAll() (*[]connector.ImportBlock, erro importBlocks := []connector.ImportBlock{} - certificateData, err := r.getCertificateData() + certificateData, err := getCertificateData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for certificateId, certificateName := range *certificateData { + for certificateId, certificateName := range certificateData { commentData := map[string]string{ "Certificate ID": certificateId, "Certificate Name": certificateName, @@ -60,12 +60,12 @@ func (r *PingOneCertificateResource) ExportAll() (*[]connector.ImportBlock, erro return &importBlocks, nil } -func (r *PingOneCertificateResource) getCertificateData() (*map[string]string, error) { +func getCertificateData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { certificateData := make(map[string]string) // TODO: Implement pagination once supported in the PingOne Go Client SDK - entityArray, response, err := r.clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetCertificates(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "GetCertificates", r.ResourceType()) + entityArray, response, err := clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetCertificates(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + ok, err := common.HandleClientResponse(response, err, "GetCertificates", resourceType) if err != nil { return nil, err } @@ -74,12 +74,20 @@ func (r *PingOneCertificateResource) getCertificateData() (*map[string]string, e } if entityArray == nil { - return nil, common.DataNilError(r.ResourceType(), response) + return nil, fmt.Errorf("failed to export resource '%s'.\n"+ + "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ + "response code: %s\n"+ + "response body: %s", + resourceType, resourceType, response.Status, response.Body) } embedded, embeddedOk := entityArray.GetEmbeddedOk() if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), response) + return nil, fmt.Errorf("failed to export resource '%s'.\n"+ + "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ + "response code: %s\n"+ + "response body: %s", + resourceType, resourceType, response.Status, response.Body) } for _, certificate := range embedded.GetCertificates() { @@ -91,5 +99,5 @@ func (r *PingOneCertificateResource) getCertificateData() (*map[string]string, e } } - return &certificateData, nil + return certificateData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_custom_domain.go b/internal/connector/pingone/platform/resources/pingone_custom_domain.go index 03903daf..f09bd290 100644 --- a/internal/connector/pingone/platform/resources/pingone_custom_domain.go +++ b/internal/connector/pingone/platform/resources/pingone_custom_domain.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,7 +35,7 @@ func (r *PingOneCustomDomainResource) ExportAll() (*[]connector.ImportBlock, err importBlocks := []connector.ImportBlock{} - domainData, err := r.getCustomDomainData() + domainData, err := getCustomDomainData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } @@ -60,36 +61,21 @@ func (r *PingOneCustomDomainResource) ExportAll() (*[]connector.ImportBlock, err return &importBlocks, nil } -func (r *PingOneCustomDomainResource) getCustomDomainData() (*map[string]string, error) { +func getCustomDomainData(clientInfo *connector.PingOneClientInfo, resourceType string) (*map[string]string, error) { domainData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.CustomDomainsApi.ReadAllDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllDomains", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.CustomDomainsApi.ReadAllDomains(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + customDomains, err := common.GetManagementAPIObjectsFromIterator[management.CustomDomain](iter, "ReadAllDomains", "GetCustomDomains", resourceType) + if err != nil { + return nil, err + } - for _, customDomain := range embedded.GetCustomDomains() { - customDomainName, customDomainNameOk := customDomain.GetDomainNameOk() - customDomainId, customDomainIdOk := customDomain.GetIdOk() + for _, customDomain := range customDomains { + customDomainName, customDomainNameOk := customDomain.GetDomainNameOk() + customDomainId, customDomainIdOk := customDomain.GetIdOk() - if customDomainIdOk && customDomainNameOk { - domainData[*customDomainId] = *customDomainName - } + if customDomainIdOk && customDomainNameOk { + domainData[*customDomainId] = *customDomainName } } diff --git a/internal/connector/pingone/platform/resources/pingone_environment.go b/internal/connector/pingone/platform/resources/pingone_environment.go index 8774b030..75e7ecf8 100644 --- a/internal/connector/pingone/platform/resources/pingone_environment.go +++ b/internal/connector/pingone/platform/resources/pingone_environment.go @@ -32,10 +32,13 @@ func (r *PingOneEnvironmentResource) ExportAll() (*[]connector.ImportBlock, erro importBlocks := []connector.ImportBlock{} - err := r.checkEnvironmentData() + ok, err := checkEnvironmentData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } + if !ok { + return &importBlocks, nil + } commentData := map[string]string{ "Resource Type": r.ResourceType(), @@ -54,16 +57,7 @@ func (r *PingOneEnvironmentResource) ExportAll() (*[]connector.ImportBlock, erro return &importBlocks, nil } -func (r *PingOneEnvironmentResource) checkEnvironmentData() error { - _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.EnvironmentsApi.ReadOneEnvironment(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - ok, err := common.HandleClientResponse(response, err, "ReadOneEnvironment", r.ResourceType()) - if err != nil { - return err - } - if !ok { - return nil - } - - return nil +func checkEnvironmentData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { + _, response, err := clientInfo.ApiClient.ManagementAPIClient.EnvironmentsApi.ReadOneEnvironment(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadOneEnvironment", resourceType) } diff --git a/internal/connector/pingone/platform/resources/pingone_form.go b/internal/connector/pingone/platform/resources/pingone_form.go index d966d6ea..413365ab 100644 --- a/internal/connector/pingone/platform/resources/pingone_form.go +++ b/internal/connector/pingone/platform/resources/pingone_form.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneFormResource) ExportAll() (*[]connector.ImportBlock, error) { importBlocks := []connector.ImportBlock{} - formData, err := r.getFormData() + formData, err := getFormData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for formId, formName := range *formData { + for formId, formName := range formData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Form ID": formId, @@ -60,38 +61,23 @@ func (r *PingOneFormResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func (r *PingOneFormResource) getFormData() (*map[string]string, error) { +func getFormData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { formData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.FormManagementApi.ReadAllForms(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllForms", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.FormManagementApi.ReadAllForms(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + forms, err := common.GetManagementAPIObjectsFromIterator[management.Form](iter, "ReadAllForms", "GetForms", resourceType) + if err != nil { + return nil, err + } - for _, form := range embedded.GetForms() { - formId, formIdOk := form.GetIdOk() - formName, formNameOk := form.GetNameOk() + for _, form := range forms { + formId, formIdOk := form.GetIdOk() + formName, formNameOk := form.GetNameOk() - if formIdOk && formNameOk { - formData[*formId] = *formName - } + if formIdOk && formNameOk { + formData[*formId] = *formName } } - return &formData, nil + return formData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go b/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go index b039aab1..653e6670 100644 --- a/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go +++ b/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go @@ -32,13 +32,11 @@ func (r *PingOneFormRecaptchaV2Resource) ExportAll() (*[]connector.ImportBlock, importBlocks := []connector.ImportBlock{} - ok, err := r.checkFormRecaptchaV2Data() + ok, err := checkFormRecaptchaV2Data(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - if !ok { - l.Debug().Msgf("No '%s' resources to export. Skipping...", r.ResourceType()) return &importBlocks, nil } @@ -59,19 +57,7 @@ func (r *PingOneFormRecaptchaV2Resource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingOneFormRecaptchaV2Resource) checkFormRecaptchaV2Data() (bool, error) { - _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.RecaptchaConfigurationApi.ReadRecaptchaConfiguration(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "ReadRecaptchaConfiguration", r.ResourceType()) - if err != nil { - return false, err - } - if !ok { - return false, nil - } - - if response.StatusCode == 204 { - return false, nil - } - - return true, nil +func checkFormRecaptchaV2Data(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { + _, response, err := clientInfo.ApiClient.ManagementAPIClient.RecaptchaConfigurationApi.ReadRecaptchaConfiguration(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadRecaptchaConfiguration", resourceType) } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway.go b/internal/connector/pingone/platform/resources/pingone_gateway.go index 0bdd1202..928d0761 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneGatewayResource) ExportAll() (*[]connector.ImportBlock, error) { importBlocks := []connector.ImportBlock{} - gatewayData, err := r.getGatewayData() + gatewayData, err := getGatewayData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for gatewayId, gatewayName := range *gatewayData { + for gatewayId, gatewayName := range gatewayData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Gateway ID": gatewayId, @@ -60,56 +61,41 @@ func (r *PingOneGatewayResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func (r *PingOneGatewayResource) getGatewayData() (*map[string]string, error) { +func getGatewayData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { gatewayData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + gateways, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", resourceType) + if err != nil { + return nil, err + } - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, gatewayInner := range gateways { + var ( + gatewayId *string + gatewayIdOk bool + gatewayName *string + gatewayNameOk bool + ) + + switch { + case gatewayInner.Gateway != nil: + gatewayId, gatewayIdOk = gatewayInner.Gateway.GetIdOk() + gatewayName, gatewayNameOk = gatewayInner.Gateway.GetNameOk() + case gatewayInner.GatewayTypeLDAP != nil: + gatewayId, gatewayIdOk = gatewayInner.GatewayTypeLDAP.GetIdOk() + gatewayName, gatewayNameOk = gatewayInner.GatewayTypeLDAP.GetNameOk() + case gatewayInner.GatewayTypeRADIUS != nil: + gatewayId, gatewayIdOk = gatewayInner.GatewayTypeRADIUS.GetIdOk() + gatewayName, gatewayNameOk = gatewayInner.GatewayTypeRADIUS.GetNameOk() + default: + continue } - for _, gatewayInner := range embedded.GetGateways() { - var ( - gatewayId *string - gatewayName *string - gatewayIdOk bool - gatewayNameOk bool - ) - - switch { - case gatewayInner.Gateway != nil: - gatewayId, gatewayIdOk = gatewayInner.Gateway.GetIdOk() - gatewayName, gatewayNameOk = gatewayInner.Gateway.GetNameOk() - case gatewayInner.GatewayTypeLDAP != nil: - gatewayId, gatewayIdOk = gatewayInner.GatewayTypeLDAP.GetIdOk() - gatewayName, gatewayNameOk = gatewayInner.GatewayTypeLDAP.GetNameOk() - case gatewayInner.GatewayTypeRADIUS != nil: - gatewayId, gatewayIdOk = gatewayInner.GatewayTypeRADIUS.GetIdOk() - gatewayName, gatewayNameOk = gatewayInner.GatewayTypeRADIUS.GetNameOk() - default: - continue - } - - if gatewayIdOk && gatewayNameOk { - gatewayData[*gatewayId] = *gatewayName - } + if gatewayIdOk && gatewayNameOk { + gatewayData[*gatewayId] = *gatewayName } } - return &gatewayData, nil + return gatewayData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go index c9d361b9..50c2fa0b 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,18 +35,18 @@ func (r *PingOneGatewayCredentialResource) ExportAll() (*[]connector.ImportBlock importBlocks := []connector.ImportBlock{} - gatewayData, err := r.getGatewayData() + gatewayData, err := getGatewayData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for gatewayId, gatewayName := range *gatewayData { - gatewayCredentialData, err := r.getGatewayCredentialData(gatewayId) + for gatewayId, gatewayName := range gatewayData { + gatewayCredentialData, err := getGatewayCredentialData(r.clientInfo, r.ResourceType(), gatewayId) if err != nil { return nil, err } - for _, gatewayCredentialId := range *gatewayCredentialData { + for _, gatewayCredentialId := range gatewayCredentialData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Gateway Credential ID": gatewayCredentialId, @@ -68,91 +69,22 @@ func (r *PingOneGatewayCredentialResource) ExportAll() (*[]connector.ImportBlock return &importBlocks, nil } -func (r *PingOneGatewayCredentialResource) getGatewayData() (*map[string]string, error) { - gatewayData := make(map[string]string) - - iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, gatewayInner := range embedded.GetGateways() { - var ( - gatewayId *string - gatewayIdOk bool - gatewayName *string - gatewayNameOk bool - ) - - switch { - case gatewayInner.Gateway != nil: - gatewayId, gatewayIdOk = gatewayInner.Gateway.GetIdOk() - gatewayName, gatewayNameOk = gatewayInner.Gateway.GetNameOk() - case gatewayInner.GatewayTypeLDAP != nil: - gatewayId, gatewayIdOk = gatewayInner.GatewayTypeLDAP.GetIdOk() - gatewayName, gatewayNameOk = gatewayInner.GatewayTypeLDAP.GetNameOk() - case gatewayInner.GatewayTypeRADIUS != nil: - gatewayId, gatewayIdOk = gatewayInner.GatewayTypeRADIUS.GetIdOk() - gatewayName, gatewayNameOk = gatewayInner.GatewayTypeRADIUS.GetNameOk() - default: - continue - } - - if gatewayIdOk && gatewayNameOk { - gatewayData[*gatewayId] = *gatewayName - } - } - } - - return &gatewayData, nil -} - -func (r *PingOneGatewayCredentialResource) getGatewayCredentialData(gatewayId string) (*[]string, error) { +func getGatewayCredentialData(clientInfo *connector.PingOneClientInfo, resourceType, gatewayId string) ([]string, error) { gatewayCredentialData := []string{} - iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewayCredentialsApi.ReadAllGatewayCredentials(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, gatewayId).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGatewayCredentials", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.GatewayCredentialsApi.ReadAllGatewayCredentials(clientInfo.Context, clientInfo.ExportEnvironmentID, gatewayId).Execute() + gatewayCredentials, err := common.GetManagementAPIObjectsFromIterator[management.GatewayCredential](iter, "ReadAllGatewayCredentials", "GetGatewayCredentials", resourceType) + if err != nil { + return nil, err + } - for _, gatewayCredential := range embedded.GetCredentials() { - gatewayCredentialId, gatewayCredentialIdOk := gatewayCredential.GetIdOk() + for _, gatewayCredential := range gatewayCredentials { + gatewayCredentialId, gatewayCredentialIdOk := gatewayCredential.GetIdOk() - if gatewayCredentialIdOk { - gatewayCredentialData = append(gatewayCredentialData, *gatewayCredentialId) - } + if gatewayCredentialIdOk { + gatewayCredentialData = append(gatewayCredentialData, *gatewayCredentialId) } } - return &gatewayCredentialData, nil + return gatewayCredentialData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go index 5ea1df24..0719fd09 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go @@ -35,19 +35,21 @@ func (r *PingOneGatewayRoleAssignmentResource) ExportAll() (*[]connector.ImportB importBlocks := []connector.ImportBlock{} - gatewayData, err := r.getGatewayData() + gatewayData, err := getGatewayData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for gatewayId, gatewayName := range *gatewayData { - gatewayRoleAssignmentData, err := r.getGatewayRoleAssignmentData(gatewayId) + //TODO: Only PingFederate Connections have role assignments + + for gatewayId, gatewayName := range gatewayData { + gatewayRoleAssignmentData, err := getGatewayRoleAssignmentData(r.clientInfo, r.ResourceType(), gatewayId) if err != nil { return nil, err } - for roleAssignmentId, roleId := range *gatewayRoleAssignmentData { - roleName, err := r.getRoleAssignmentRoleName(roleId) + for roleAssignmentId, roleId := range gatewayRoleAssignmentData { + roleName, err := getRoleAssignmentRoleName(r.clientInfo, r.ResourceType(), roleId) if err != nil { return nil, err } @@ -75,91 +77,33 @@ func (r *PingOneGatewayRoleAssignmentResource) ExportAll() (*[]connector.ImportB return &importBlocks, nil } -func (r *PingOneGatewayRoleAssignmentResource) getGatewayData() (*map[string]string, error) { - gatewayData := make(map[string]string) - - iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGateways", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, gatewayInner := range embedded.GetGateways() { - // Only PingFederate Connections have role assignments - if gatewayInner.Gateway != nil { - gatewayType, gatewayTypeOk := gatewayInner.Gateway.GetTypeOk() - - if gatewayTypeOk && *gatewayType == management.ENUMGATEWAYTYPE_PING_FEDERATE { - gatewayId, gatewayIdOk := gatewayInner.Gateway.GetIdOk() - gatewayName, gatewayNameOk := gatewayInner.Gateway.GetNameOk() - - if gatewayIdOk && gatewayNameOk { - gatewayData[*gatewayId] = *gatewayName - } - } - } - } - } - - return &gatewayData, nil -} - -func (r *PingOneGatewayRoleAssignmentResource) getGatewayRoleAssignmentData(gatewayId string) (*map[string]string, error) { +func getGatewayRoleAssignmentData(clientInfo *connector.PingOneClientInfo, resourceType, gatewayId string) (map[string]string, error) { gatewayRoleAssignmentData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewayRoleAssignmentsApi.ReadGatewayRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, gatewayId).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGatewayRoleAssignments", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.GatewayRoleAssignmentsApi.ReadGatewayRoleAssignments(clientInfo.Context, clientInfo.ExportEnvironmentID, gatewayId).Execute() + gatewayRoleAssignments, err := common.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadGatewayRoleAssignments", "GetRoleAssignments", resourceType) + if err != nil { + return nil, err + } - for _, roleAssignment := range embedded.GetRoleAssignments() { - roleAssignmentId, roleAssignmentIdOk := roleAssignment.GetIdOk() - roleAssignmentRole, roleAssignmentRoleOk := roleAssignment.GetRoleOk() + for _, roleAssignment := range gatewayRoleAssignments { + roleAssignmentId, roleAssignmentIdOk := roleAssignment.GetIdOk() + roleAssignmentRole, roleAssignmentRoleOk := roleAssignment.GetRoleOk() - if roleAssignmentIdOk && roleAssignmentRoleOk { - roleAssignmentRoleId, roleAssignmentRoleIdOk := roleAssignmentRole.GetIdOk() - if roleAssignmentRoleIdOk { - gatewayRoleAssignmentData[*roleAssignmentId] = *roleAssignmentRoleId - } + if roleAssignmentIdOk && roleAssignmentRoleOk { + roleAssignmentRoleId, roleAssignmentRoleIdOk := roleAssignmentRole.GetIdOk() + if roleAssignmentRoleIdOk { + gatewayRoleAssignmentData[*roleAssignmentId] = *roleAssignmentRoleId } } } - return &gatewayRoleAssignmentData, nil + return gatewayRoleAssignmentData, nil } -func (r *PingOneGatewayRoleAssignmentResource) getRoleAssignmentRoleName(roleId string) (*management.EnumRoleName, error) { - role, resp, err := r.clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(r.clientInfo.Context, roleId).Execute() - ok, err := common.HandleClientResponse(resp, err, "ReadOneRole", r.ResourceType()) +func getRoleAssignmentRoleName(clientInfo *connector.PingOneClientInfo, resourceType, roleId string) (*management.EnumRoleName, error) { + role, resp, err := clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(clientInfo.Context, roleId).Execute() + ok, err := common.CheckSingletonResource(resp, err, "ReadOneRole", resourceType) if err != nil { return nil, err } @@ -174,5 +118,5 @@ func (r *PingOneGatewayRoleAssignmentResource) getRoleAssignmentRoleName(roleId } } - return nil, fmt.Errorf("failed to export resource '%s'. No role name found for Role ID '%s'.", r.ResourceType(), roleId) + return nil, fmt.Errorf("failed to export resource '%s'. No role name found for Role ID '%s'.", resourceType, roleId) } diff --git a/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go b/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go index 5688b9ea..b5de2148 100644 --- a/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go +++ b/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneIdentityPropagationPlanResource) ExportAll() (*[]connector.Impor importBlocks := []connector.ImportBlock{} - planData, err := r.getIdentityPropagationPlanData() + planData, err := getIdentityPropagationPlanData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for planId, planName := range *planData { + for planId, planName := range planData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Identity Propagation Plan ID": planId, @@ -60,38 +61,23 @@ func (r *PingOneIdentityPropagationPlanResource) ExportAll() (*[]connector.Impor return &importBlocks, nil } -func (r *PingOneIdentityPropagationPlanResource) getIdentityPropagationPlanData() (*map[string]string, error) { +func getIdentityPropagationPlanData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { identityPropagationPlanData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityPropagationPlansApi.ReadAllPlans(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPlans", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.IdentityPropagationPlansApi.ReadAllPlans(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + identityPropagationPlans, err := common.GetManagementAPIObjectsFromIterator[management.IdentityPropagationPlan](iter, "ReadAllPlans", "GetPlans", resourceType) + if err != nil { + return nil, err + } - for _, identityPropagationPlan := range embedded.GetPlans() { - identityPropagationPlanId, identityPropagationPlanIdOk := identityPropagationPlan.GetIdOk() - identityPropagationPlanName, identityPropagationPlanNameOk := identityPropagationPlan.GetNameOk() + for _, identityPropagationPlan := range identityPropagationPlans { + identityPropagationPlanId, identityPropagationPlanIdOk := identityPropagationPlan.GetIdOk() + identityPropagationPlanName, identityPropagationPlanNameOk := identityPropagationPlan.GetNameOk() - if identityPropagationPlanIdOk && identityPropagationPlanNameOk { - identityPropagationPlanData[*identityPropagationPlanId] = *identityPropagationPlanName - } + if identityPropagationPlanIdOk && identityPropagationPlanNameOk { + identityPropagationPlanData[*identityPropagationPlanId] = *identityPropagationPlanName } } - return &identityPropagationPlanData, nil + return identityPropagationPlanData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_key.go b/internal/connector/pingone/platform/resources/pingone_key.go index db1d436e..7329a20e 100644 --- a/internal/connector/pingone/platform/resources/pingone_key.go +++ b/internal/connector/pingone/platform/resources/pingone_key.go @@ -34,12 +34,12 @@ func (r *PingOneKeyResource) ExportAll() (*[]connector.ImportBlock, error) { importBlocks := []connector.ImportBlock{} - keyData, err := r.getKeyData() + keyData, err := getKeyData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for keyId, keyNameAndType := range *keyData { + for keyId, keyNameAndType := range keyData { keyName := keyNameAndType[0] keyType := keyNameAndType[1] @@ -64,13 +64,13 @@ func (r *PingOneKeyResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func (r *PingOneKeyResource) getKeyData() (*map[string][]string, error) { +func getKeyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string][]string, error) { keyData := make(map[string][]string) // TODO: Implement pagination once supported in the PingOne Go Client SDK - entityArray, response, err := r.clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetKeys(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + entityArray, response, err := clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetKeys(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "GetKeys", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "GetKeys", resourceType) if err != nil { return nil, err } @@ -79,12 +79,20 @@ func (r *PingOneKeyResource) getKeyData() (*map[string][]string, error) { } if entityArray == nil { - return nil, common.DataNilError(r.ResourceType(), response) + return nil, fmt.Errorf("failed to export resource '%s'.\n"+ + "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ + "response code: %s\n"+ + "response body: %s", + resourceType, resourceType, response.Status, response.Body) } embedded, embeddedOk := entityArray.GetEmbeddedOk() if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), response) + return nil, fmt.Errorf("failed to export resource '%s'.\n"+ + "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ + "response code: %s\n"+ + "response body: %s", + resourceType, resourceType, response.Status, response.Body) } for _, key := range embedded.GetKeys() { @@ -97,5 +105,5 @@ func (r *PingOneKeyResource) getKeyData() (*map[string][]string, error) { } } - return &keyData, nil + return keyData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go b/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go index ab13f360..51b918b2 100644 --- a/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go +++ b/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneKeyRotationPolicyResource) ExportAll() (*[]connector.ImportBlock importBlocks := []connector.ImportBlock{} - keyRotationPolicyData, err := r.getKeyRotationPolicyData() + keyRotationPolicyData, err := getKeyRotationPolicyData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for keyRotationPolicyId, keyRotationPolicyName := range *keyRotationPolicyData { + for keyRotationPolicyId, keyRotationPolicyName := range keyRotationPolicyData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Key Rotation Policy ID": keyRotationPolicyId, @@ -60,38 +61,23 @@ func (r *PingOneKeyRotationPolicyResource) ExportAll() (*[]connector.ImportBlock return &importBlocks, nil } -func (r *PingOneKeyRotationPolicyResource) getKeyRotationPolicyData() (*map[string]string, error) { +func getKeyRotationPolicyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { keyRotationPolicyData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.KeyRotationPoliciesApi.GetKeyRotationPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "GetKeyRotationPolicies", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.KeyRotationPoliciesApi.GetKeyRotationPolicies(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + keyRotationPolicies, err := common.GetManagementAPIObjectsFromIterator[management.KeyRotationPolicy](iter, "GetKeyRotationPolicies", "GetKeyRotationPolicies", resourceType) + if err != nil { + return nil, err + } - for _, keyRotationPolicy := range embedded.GetKeyRotationPolicies() { - keyRotationPolicyId, keyRotationPolicyIdOk := keyRotationPolicy.GetIdOk() - keyRotationPolicyName, keyRotationPolicyNameOk := keyRotationPolicy.GetNameOk() + for _, keyRotationPolicy := range keyRotationPolicies { + keyRotationPolicyId, keyRotationPolicyIdOk := keyRotationPolicy.GetIdOk() + keyRotationPolicyName, keyRotationPolicyNameOk := keyRotationPolicy.GetNameOk() - if keyRotationPolicyIdOk && keyRotationPolicyNameOk { - keyRotationPolicyData[*keyRotationPolicyId] = *keyRotationPolicyName - } + if keyRotationPolicyIdOk && keyRotationPolicyNameOk { + keyRotationPolicyData[*keyRotationPolicyId] = *keyRotationPolicyName } } - return &keyRotationPolicyData, nil + return keyRotationPolicyData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_language.go b/internal/connector/pingone/platform/resources/pingone_language.go index 92fcd5c8..82413b03 100644 --- a/internal/connector/pingone/platform/resources/pingone_language.go +++ b/internal/connector/pingone/platform/resources/pingone_language.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneLanguageResource) ExportAll() (*[]connector.ImportBlock, error) importBlocks := []connector.ImportBlock{} - languageData, err := r.getLanguageData() + languageData, err := getLanguageData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for languageId, languageName := range *languageData { + for languageId, languageName := range languageData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Language ID": languageId, @@ -60,46 +61,31 @@ func (r *PingOneLanguageResource) ExportAll() (*[]connector.ImportBlock, error) return &importBlocks, nil } -func (r *PingOneLanguageResource) getLanguageData() (*map[string]string, error) { +func getLanguageData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { languageData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", resourceType) + if err != nil { + return nil, err + } - for _, languageInner := range embedded.GetLanguages() { - if languageInner.Language != nil { - // If language is not customer added, skip it - languageCustomerAdded, languageCustomerAddedOk := languageInner.Language.GetCustomerAddedOk() - if !languageCustomerAddedOk || !*languageCustomerAdded { - continue - } + for _, languageInner := range languageInners { + if languageInner.Language != nil { + // If language is not customer added, skip it + languageCustomerAdded, languageCustomerAddedOk := languageInner.Language.GetCustomerAddedOk() + if !languageCustomerAddedOk || !*languageCustomerAdded { + continue + } - languageId, languageIdOk := languageInner.Language.GetIdOk() - languageName, languageNameOk := languageInner.Language.GetNameOk() + languageId, languageIdOk := languageInner.Language.GetIdOk() + languageName, languageNameOk := languageInner.Language.GetNameOk() - if languageIdOk && languageNameOk { - languageData[*languageId] = *languageName - } + if languageIdOk && languageNameOk { + languageData[*languageId] = *languageName } } } - return &languageData, nil + return languageData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_language_update.go b/internal/connector/pingone/platform/resources/pingone_language_update.go index 92f83084..45e067fc 100644 --- a/internal/connector/pingone/platform/resources/pingone_language_update.go +++ b/internal/connector/pingone/platform/resources/pingone_language_update.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneLanguageUpdateResource) ExportAll() (*[]connector.ImportBlock, e importBlocks := []connector.ImportBlock{} - languageData, err := r.getLanguageData() + languageData, err := getLanguageUpdateData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for languageId, languageName := range *languageData { + for languageId, languageName := range languageData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Language ID": languageId, @@ -60,53 +61,38 @@ func (r *PingOneLanguageUpdateResource) ExportAll() (*[]connector.ImportBlock, e return &importBlocks, nil } -func (r *PingOneLanguageUpdateResource) getLanguageData() (*map[string]string, error) { +func getLanguageUpdateData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { languageData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + iter := clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", resourceType) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } + for _, languageInner := range languageInners { + if languageInner.Language != nil { + languageEnabled, languageEnabledOk := languageInner.Language.GetEnabledOk() + languageLocale, languageLocaleOk := languageInner.Language.GetLocaleOk() + languageDefault, languageDefaultOk := languageInner.Language.GetDefaultOk() - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + if languageEnabledOk && languageLocaleOk && languageDefaultOk { + // Export the language if it meets any of the criteria of the following 3 conditions: + // 1) Any language enabled + // 2) The 'en' language disabled + // 3) If any language other than 'en' is the default - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + if *languageEnabled || (*languageLocale == "en" && !*languageEnabled) || (*languageLocale != "en" && *languageDefault) { + languageId, languageIdOk := languageInner.Language.GetIdOk() + languageName, languageNameOk := languageInner.Language.GetNameOk() - for _, languageInner := range embedded.GetLanguages() { - if languageInner.Language != nil { - languageEnabled, languageEnabledOk := languageInner.Language.GetEnabledOk() - languageLocale, languageLocaleOk := languageInner.Language.GetLocaleOk() - languageDefault, languageDefaultOk := languageInner.Language.GetDefaultOk() - - if languageEnabledOk && languageLocaleOk && languageDefaultOk { - // Export the language if it meets any of the criteria of the following 3 conditions: - // 1) Any language enabled - // 2) The 'en' language disabled - // 3) If any language other than 'en' is the default - - if *languageEnabled || (*languageLocale == "en" && !*languageEnabled) || (*languageLocale != "en" && *languageDefault) { - languageId, languageIdOk := languageInner.Language.GetIdOk() - languageName, languageNameOk := languageInner.Language.GetNameOk() - - if languageIdOk && languageNameOk { - languageData[*languageId] = *languageName - } + if languageIdOk && languageNameOk { + languageData[*languageId] = *languageName } } } } } - return &languageData, nil + return languageData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_policy.go b/internal/connector/pingone/platform/resources/pingone_notification_policy.go index 3fc4d048..8ea56401 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_policy.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_policy.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneNotificationPolicyResource) ExportAll() (*[]connector.ImportBloc importBlocks := []connector.ImportBlock{} - notificationPolicyData, err := r.getNotificationPolicyData() + notificationPolicyData, err := getNotificationPolicyData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for notificationPolicyId, notificationPolicyName := range *notificationPolicyData { + for notificationPolicyId, notificationPolicyName := range notificationPolicyData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Notification Policy ID": notificationPolicyId, @@ -60,38 +61,23 @@ func (r *PingOneNotificationPolicyResource) ExportAll() (*[]connector.ImportBloc return &importBlocks, nil } -func (r *PingOneNotificationPolicyResource) getNotificationPolicyData() (*map[string]string, error) { +func getNotificationPolicyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { notificationPolicyData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsPoliciesApi.ReadAllNotificationsPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllNotificationsPolicies", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.NotificationsPoliciesApi.ReadAllNotificationsPolicies(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + notificationPolicies, err := common.GetManagementAPIObjectsFromIterator[management.NotificationsPolicy](iter, "ReadAllNotificationsPolicies", "GetNotificationsPolicies", resourceType) + if err != nil { + return nil, err + } - for _, notificationPolicy := range embedded.GetNotificationsPolicies() { - notificationPolicyId, notificationPolicyIdOk := notificationPolicy.GetIdOk() - notificationPolicyName, notificationPolicyNameOk := notificationPolicy.GetNameOk() + for _, notificationPolicy := range notificationPolicies { + notificationPolicyId, notificationPolicyIdOk := notificationPolicy.GetIdOk() + notificationPolicyName, notificationPolicyNameOk := notificationPolicy.GetNameOk() - if notificationPolicyIdOk && notificationPolicyNameOk { - notificationPolicyData[*notificationPolicyId] = *notificationPolicyName - } + if notificationPolicyIdOk && notificationPolicyNameOk { + notificationPolicyData[*notificationPolicyId] = *notificationPolicyName } } - return ¬ificationPolicyData, nil + return notificationPolicyData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_settings.go b/internal/connector/pingone/platform/resources/pingone_notification_settings.go index 1b5e645b..4ada4421 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_settings.go @@ -32,10 +32,13 @@ func (r *PingOneNotificationSettingsResource) ExportAll() (*[]connector.ImportBl importBlocks := []connector.ImportBlock{} - err := r.checkNotificationSettingsData() + ok, err := checkNotificationSettingsData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } + if !ok { + return &importBlocks, nil + } commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, @@ -54,19 +57,7 @@ func (r *PingOneNotificationSettingsResource) ExportAll() (*[]connector.ImportBl return &importBlocks, nil } -func (r *PingOneNotificationSettingsResource) checkNotificationSettingsData() error { - _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsApi.ReadNotificationsSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "ReadNotificationsSettings", r.ResourceType()) - if err != nil { - return err - } - if !ok { - return nil - } - - if response.StatusCode == 204 { - return common.DataNilError(r.ResourceType(), response) - } - - return nil +func checkNotificationSettingsData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { + _, response, err := clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsApi.ReadNotificationsSettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadNotificationsSettings", resourceType) } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go b/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go index a754e3a0..b272b543 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go @@ -32,10 +32,13 @@ func (r *PingOneNotificationSettingsEmailResource) ExportAll() (*[]connector.Imp importBlocks := []connector.ImportBlock{} - err := r.checkNotificationSettingsEmailData() + ok, err := checkNotificationSettingsEmailData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } + if !ok { + return &importBlocks, nil + } commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, @@ -54,19 +57,7 @@ func (r *PingOneNotificationSettingsEmailResource) ExportAll() (*[]connector.Imp return &importBlocks, nil } -func (r *PingOneNotificationSettingsEmailResource) checkNotificationSettingsEmailData() error { - _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsSMTPApi.ReadEmailNotificationsSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "ReadEmailNotificationsSettings", r.ResourceType()) - if err != nil { - return err - } - if !ok { - return nil - } - - if response.StatusCode == 204 { - return common.DataNilError(r.ResourceType(), response) - } - - return nil +func checkNotificationSettingsEmailData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { + _, response, err := clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsSMTPApi.ReadEmailNotificationsSettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadEmailNotificationsSettings", resourceType) } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_template_content.go b/internal/connector/pingone/platform/resources/pingone_notification_template_content.go index 6786aba8..a17e804a 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_template_content.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_template_content.go @@ -9,6 +9,7 @@ import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/output" ) type NotificationTemplateContentData struct { @@ -44,30 +45,30 @@ func (r *PingOneNotificationTemplateContentResource) ExportAll() (*[]connector.I importBlocks := []connector.ImportBlock{} - enabledLocales, err := r.getEnabledLocales() + enabledLocales, err := getEnabledLocales(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - templateNames, err := r.getTemplateNames() + templateNames, err := getTemplateNames(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for _, templateName := range *templateNames { - templateContentData, err := r.getTemplateContentData(templateName) + for _, templateName := range templateNames { + templateContentData, err := getTemplateContentData(r.clientInfo, r.ResourceType(), templateName) if err != nil { return nil, err } - for _, templateContentInfo := range *templateContentData { + for _, templateContentInfo := range templateContentData { templateContentId := templateContentInfo.TemplateContentId templateContentDeliveryMethod := templateContentInfo.TemplateContentDeliveryMethod templateContentLocale := templateContentInfo.TemplateContentLocale templateContentVariant := templateContentInfo.TemplateContentVariant // Only export template content if the locale is enabled - if (*enabledLocales)[templateContentLocale] { + if enabledLocales[templateContentLocale] { commentData := map[string]string{ "Resource Type": r.ResourceType(), "Template Name": string(templateName), @@ -97,49 +98,34 @@ func (r *PingOneNotificationTemplateContentResource) ExportAll() (*[]connector.I return &importBlocks, nil } -func (r *PingOneNotificationTemplateContentResource) getEnabledLocales() (*map[string]bool, error) { +func getEnabledLocales(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]bool, error) { enabledLocales := make(map[string]bool) - iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadLanguages", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", resourceType) + if err != nil { + return nil, err + } - for _, languageInner := range embedded.GetLanguages() { - if languageInner.Language != nil { - languageLocale, languageLocaleOk := languageInner.Language.GetLocaleOk() - languageEnabled, languageEnabledOk := languageInner.Language.GetEnabledOk() + for _, languageInner := range languageInners { + if languageInner.Language != nil { + languageLocale, languageLocaleOk := languageInner.Language.GetLocaleOk() + languageEnabled, languageEnabledOk := languageInner.Language.GetEnabledOk() - if languageLocaleOk && languageEnabledOk && *languageEnabled { - enabledLocales[*languageLocale] = true - } + if languageLocaleOk && languageEnabledOk && *languageEnabled { + enabledLocales[*languageLocale] = true } } } - return &enabledLocales, nil + return enabledLocales, nil } -func (r *PingOneNotificationTemplateContentResource) getTemplateNames() (*[]management.EnumTemplateName, error) { +func getTemplateNames(clientInfo *connector.PingOneClientInfo, resourceType string) ([]management.EnumTemplateName, error) { templateNames := []management.EnumTemplateName{} for _, templateName := range management.AllowedEnumTemplateNameEnumValues { - _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadOneTemplate(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, templateName).Execute() + _, response, err := clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadOneTemplate(clientInfo.Context, clientInfo.ExportEnvironmentID, templateName).Execute() // When PingOne services are not enabled in an environment, // the response code for the templates related to that service is // 400 Bad Request - "CONSTRAINT_VIOLATION" @@ -156,7 +142,7 @@ func (r *PingOneNotificationTemplateContentResource) getTemplateNames() (*[]mana } // Handle all other errors or bad responses - ok, err := common.HandleClientResponse(response, err, "ReadOneTemplate", r.ResourceType()) + ok, err := common.HandleClientResponse(response, err, "ReadOneTemplate", resourceType) if err != nil { return nil, err } @@ -167,80 +153,64 @@ func (r *PingOneNotificationTemplateContentResource) getTemplateNames() (*[]mana templateNames = append(templateNames, templateName) } - return &templateNames, nil + return templateNames, nil } -func (r *PingOneNotificationTemplateContentResource) getTemplateContentData(templateName management.EnumTemplateName) (*[]NotificationTemplateContentData, error) { - l := logger.Get() +func getTemplateContentData(clientInfo *connector.PingOneClientInfo, resourceType string, templateName management.EnumTemplateName) ([]NotificationTemplateContentData, error) { templateContentData := []NotificationTemplateContentData{} - iter := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadAllTemplateContents(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, templateName).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTemplateContents", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadAllTemplateContents(clientInfo.Context, clientInfo.ExportEnvironmentID, templateName).Execute() + templateContents, err := common.GetManagementAPIObjectsFromIterator[management.TemplateContent](iter, "ReadAllTemplateContents", "GetContents", resourceType) + if err != nil { + return nil, err + } - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, templateContent := range templateContents { + var ( + templateContentId *string + templateContentIdOk bool + templateContentDeliveryMethod *management.EnumTemplateContentDeliveryMethod + templateContentDeliveryMethodOk bool + templateContentLocale *string + templateContentLocaleOk bool + templateContentVariant string + ) + + switch { + case templateContent.TemplateContentPush != nil: + templateContentId, templateContentIdOk = templateContent.TemplateContentPush.GetIdOk() + templateContentDeliveryMethod, templateContentDeliveryMethodOk = templateContent.TemplateContentPush.GetDeliveryMethodOk() + templateContentLocale, templateContentLocaleOk = templateContent.TemplateContentPush.GetLocaleOk() + templateContentVariant = templateContent.TemplateContentPush.GetVariant() + case templateContent.TemplateContentSMS != nil: + templateContentId, templateContentIdOk = templateContent.TemplateContentSMS.GetIdOk() + templateContentDeliveryMethod, templateContentDeliveryMethodOk = templateContent.TemplateContentSMS.GetDeliveryMethodOk() + templateContentLocale, templateContentLocaleOk = templateContent.TemplateContentSMS.GetLocaleOk() + templateContentVariant = templateContent.TemplateContentSMS.GetVariant() + case templateContent.TemplateContentEmail != nil: + templateContentId, templateContentIdOk = templateContent.TemplateContentEmail.GetIdOk() + templateContentDeliveryMethod, templateContentDeliveryMethodOk = templateContent.TemplateContentEmail.GetDeliveryMethodOk() + templateContentLocale, templateContentLocaleOk = templateContent.TemplateContentEmail.GetLocaleOk() + templateContentVariant = templateContent.TemplateContentEmail.GetVariant() + case templateContent.TemplateContentVoice != nil: + templateContentId, templateContentIdOk = templateContent.TemplateContentVoice.GetIdOk() + templateContentDeliveryMethod, templateContentDeliveryMethodOk = templateContent.TemplateContentVoice.GetDeliveryMethodOk() + templateContentLocale, templateContentLocaleOk = templateContent.TemplateContentVoice.GetLocaleOk() + templateContentVariant = templateContent.TemplateContentVoice.GetVariant() + default: + output.Warn(fmt.Sprintf("Template content '%v' for template '%s' is not one of: Push, SMS, Email, or Voice. Skipping export.", templateContent, templateName), nil) + continue } - for _, templateContent := range embedded.GetContents() { - var ( - templateContentId *string - templateContentIdOk bool - templateContentDeliveryMethod *management.EnumTemplateContentDeliveryMethod - templateContentDeliveryMethodOk bool - templateContentLocale *string - templateContentLocaleOk bool - templateContentVariant string - ) - - switch { - case templateContent.TemplateContentPush != nil: - templateContentId, templateContentIdOk = templateContent.TemplateContentPush.GetIdOk() - templateContentDeliveryMethod, templateContentDeliveryMethodOk = templateContent.TemplateContentPush.GetDeliveryMethodOk() - templateContentLocale, templateContentLocaleOk = templateContent.TemplateContentPush.GetLocaleOk() - templateContentVariant = templateContent.TemplateContentPush.GetVariant() - case templateContent.TemplateContentSMS != nil: - templateContentId, templateContentIdOk = templateContent.TemplateContentSMS.GetIdOk() - templateContentDeliveryMethod, templateContentDeliveryMethodOk = templateContent.TemplateContentSMS.GetDeliveryMethodOk() - templateContentLocale, templateContentLocaleOk = templateContent.TemplateContentSMS.GetLocaleOk() - templateContentVariant = templateContent.TemplateContentSMS.GetVariant() - case templateContent.TemplateContentEmail != nil: - templateContentId, templateContentIdOk = templateContent.TemplateContentEmail.GetIdOk() - templateContentDeliveryMethod, templateContentDeliveryMethodOk = templateContent.TemplateContentEmail.GetDeliveryMethodOk() - templateContentLocale, templateContentLocaleOk = templateContent.TemplateContentEmail.GetLocaleOk() - templateContentVariant = templateContent.TemplateContentEmail.GetVariant() - case templateContent.TemplateContentVoice != nil: - templateContentId, templateContentIdOk = templateContent.TemplateContentVoice.GetIdOk() - templateContentDeliveryMethod, templateContentDeliveryMethodOk = templateContent.TemplateContentVoice.GetDeliveryMethodOk() - templateContentLocale, templateContentLocaleOk = templateContent.TemplateContentVoice.GetLocaleOk() - templateContentVariant = templateContent.TemplateContentVoice.GetVariant() - default: - l.Warn().Msgf("Template content '%v' for template '%s' is not one of: Push, SMS, Email, or Voice. Skipping export.", templateContent, templateName) - continue - } - - if templateContentIdOk && templateContentDeliveryMethodOk && templateContentLocaleOk { - templateContentData = append(templateContentData, NotificationTemplateContentData{ - TemplateContentId: *templateContentId, - TemplateContentDeliveryMethod: string(*templateContentDeliveryMethod), - TemplateContentLocale: *templateContentLocale, - TemplateContentVariant: templateContentVariant, - }) - } + if templateContentIdOk && templateContentDeliveryMethodOk && templateContentLocaleOk { + templateContentData = append(templateContentData, NotificationTemplateContentData{ + TemplateContentId: *templateContentId, + TemplateContentDeliveryMethod: string(*templateContentDeliveryMethod), + TemplateContentLocale: *templateContentLocale, + TemplateContentVariant: templateContentVariant, + }) } } - return &templateContentData, nil + return templateContentData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go b/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go index 42309330..36180d4e 100644 --- a/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go @@ -35,12 +35,12 @@ func (r *PingOnePhoneDeliverySettingsResource) ExportAll() (*[]connector.ImportB importBlocks := []connector.ImportBlock{} - phoneDeliverySettingsData, err := r.getPhoneDeliverySettingsData() + phoneDeliverySettingsData, err := getPhoneDeliverySettingsData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for phoneDeliverySettingsId, phoneDeliverySettingsName := range *phoneDeliverySettingsData { + for phoneDeliverySettingsId, phoneDeliverySettingsName := range phoneDeliverySettingsData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Phone Delivery Settings ID": phoneDeliverySettingsId, @@ -61,65 +61,50 @@ func (r *PingOnePhoneDeliverySettingsResource) ExportAll() (*[]connector.ImportB return &importBlocks, nil } -func (r *PingOnePhoneDeliverySettingsResource) getPhoneDeliverySettingsData() (*map[string]string, error) { +func getPhoneDeliverySettingsData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { phoneDeliverySettingsData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.PhoneDeliverySettingsApi.ReadAllPhoneDeliverySettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPhoneDeliverySettings", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.PhoneDeliverySettingsApi.ReadAllPhoneDeliverySettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + phoneDeliverySettings, err := common.GetManagementAPIObjectsFromIterator[management.NotificationsSettingsPhoneDeliverySettings](iter, "ReadAllPhoneDeliverySettings", "GetPhoneDeliverySettings", resourceType) + if err != nil { + return nil, err + } - for _, phoneDeliverySettings := range embedded.GetPhoneDeliverySettings() { - var ( - phoneDeliverySettingsId *string - phoneDeliverySettingsIdOk bool - phoneDeliverySettingsName string - phoneDeliverySettingsNameOk bool - ) - - switch { - case phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsCustom != nil: - phoneDeliverySettingsId, phoneDeliverySettingsIdOk = phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsCustom.GetIdOk() - if phoneDeliverySettingsIdOk { - phoneDeliverySettingsName, phoneDeliverySettingsNameOk = fmt.Sprintf("provider_custom_%s", *phoneDeliverySettingsId), true - } - case phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsTwilioSyniverse != nil: - phoneDeliverySettingsId, phoneDeliverySettingsIdOk = phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsTwilioSyniverse.GetIdOk() - phoneDeliverySettingsProvider, phoneDeliverySettingProviderOk := phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsTwilioSyniverse.GetProviderOk() - if phoneDeliverySettingsIdOk && phoneDeliverySettingProviderOk { - switch *phoneDeliverySettingsProvider { - case management.ENUMNOTIFICATIONSSETTINGSPHONEDELIVERYSETTINGSPROVIDER_TWILIO: - phoneDeliverySettingsName, phoneDeliverySettingsNameOk = fmt.Sprintf("provider_twilio_%s", *phoneDeliverySettingsId), true - case management.ENUMNOTIFICATIONSSETTINGSPHONEDELIVERYSETTINGSPROVIDER_SYNIVERSE: - phoneDeliverySettingsName, phoneDeliverySettingsNameOk = fmt.Sprintf("provider_syniverse_%s", *phoneDeliverySettingsId), true - default: - continue - } + for _, phoneDeliverySettings := range phoneDeliverySettings { + var ( + phoneDeliverySettingsId *string + phoneDeliverySettingsIdOk bool + phoneDeliverySettingsName string + phoneDeliverySettingsNameOk bool + ) + + switch { + case phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsCustom != nil: + phoneDeliverySettingsId, phoneDeliverySettingsIdOk = phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsCustom.GetIdOk() + if phoneDeliverySettingsIdOk { + phoneDeliverySettingsName, phoneDeliverySettingsNameOk = fmt.Sprintf("provider_custom_%s", *phoneDeliverySettingsId), true + } + case phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsTwilioSyniverse != nil: + phoneDeliverySettingsId, phoneDeliverySettingsIdOk = phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsTwilioSyniverse.GetIdOk() + phoneDeliverySettingsProvider, phoneDeliverySettingProviderOk := phoneDeliverySettings.NotificationsSettingsPhoneDeliverySettingsTwilioSyniverse.GetProviderOk() + if phoneDeliverySettingsIdOk && phoneDeliverySettingProviderOk { + switch *phoneDeliverySettingsProvider { + case management.ENUMNOTIFICATIONSSETTINGSPHONEDELIVERYSETTINGSPROVIDER_TWILIO: + phoneDeliverySettingsName, phoneDeliverySettingsNameOk = fmt.Sprintf("provider_twilio_%s", *phoneDeliverySettingsId), true + case management.ENUMNOTIFICATIONSSETTINGSPHONEDELIVERYSETTINGSPROVIDER_SYNIVERSE: + phoneDeliverySettingsName, phoneDeliverySettingsNameOk = fmt.Sprintf("provider_syniverse_%s", *phoneDeliverySettingsId), true + default: + continue } - default: - continue } + default: + continue + } - if phoneDeliverySettingsIdOk && phoneDeliverySettingsNameOk { - phoneDeliverySettingsData[*phoneDeliverySettingsId] = phoneDeliverySettingsName - } + if phoneDeliverySettingsIdOk && phoneDeliverySettingsNameOk { + phoneDeliverySettingsData[*phoneDeliverySettingsId] = phoneDeliverySettingsName } } - return &phoneDeliverySettingsData, nil + return phoneDeliverySettingsData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_system_application.go b/internal/connector/pingone/platform/resources/pingone_system_application.go index 1a416c4c..b243fb37 100644 --- a/internal/connector/pingone/platform/resources/pingone_system_application.go +++ b/internal/connector/pingone/platform/resources/pingone_system_application.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneSystemApplicationResource) ExportAll() (*[]connector.ImportBlock importBlocks := []connector.ImportBlock{} - applicationData, err := r.getSystemApplicationData() + applicationData, err := getSystemApplicationData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -60,53 +61,37 @@ func (r *PingOneSystemApplicationResource) ExportAll() (*[]connector.ImportBlock return &importBlocks, nil } -func (r *PingOneSystemApplicationResource) getSystemApplicationData() (*map[string]string, error) { +func getSystemApplicationData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { applicationData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + iter := clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", resourceType) + if err != nil { + return nil, err + } + for _, application := range applications { + var ( + applicationId *string + applicationIdOk bool + applicationName *string + applicationNameOk bool + ) + + switch { + case application.ApplicationPingOnePortal != nil: + applicationId, applicationIdOk = application.ApplicationPingOnePortal.GetIdOk() + applicationName, applicationNameOk = application.ApplicationPingOnePortal.GetNameOk() + case application.ApplicationPingOneSelfService != nil: + applicationId, applicationIdOk = application.ApplicationPingOneSelfService.GetIdOk() + applicationName, applicationNameOk = application.ApplicationPingOneSelfService.GetNameOk() + default: + continue } - for _, app := range embedded.GetApplications() { - var ( - appId *string - appIdOk bool - appName *string - appNameOk bool - ) - - switch { - case app.ApplicationPingOnePortal != nil: - appId, appIdOk = app.ApplicationPingOnePortal.GetIdOk() - appName, appNameOk = app.ApplicationPingOnePortal.GetNameOk() - case app.ApplicationPingOneSelfService != nil: - appId, appIdOk = app.ApplicationPingOneSelfService.GetIdOk() - appName, appNameOk = app.ApplicationPingOneSelfService.GetNameOk() - default: - continue - } - - if appIdOk && appNameOk { - applicationData[*appId] = *appName - } + if applicationIdOk && applicationNameOk { + applicationData[*applicationId] = *applicationName } } - return &applicationData, nil + return applicationData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go b/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go index 0939eb6d..6f0fcd6f 100644 --- a/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go +++ b/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,18 +35,18 @@ func (r *PingOneTrustedEmailAddressResource) ExportAll() (*[]connector.ImportBlo importBlocks := []connector.ImportBlock{} - trustedEmailDomainData, err := r.getTrustedEmailDomainData() + trustedEmailDomainData, err := getTrustedEmailDomainData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for trustedEmailDomainId, trustedEmailDomainName := range *trustedEmailDomainData { - trustedEmailAddressData, err := r.getTrustedEmailAddressData(trustedEmailDomainId) + for trustedEmailDomainId, trustedEmailDomainName := range trustedEmailDomainData { + trustedEmailAddressData, err := getTrustedEmailAddressData(r.clientInfo, r.ResourceType(), trustedEmailDomainId) if err != nil { return nil, err } - for trustedEmailId, trustedEmailAddress := range *trustedEmailAddressData { + for trustedEmailId, trustedEmailAddress := range trustedEmailAddressData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -69,74 +70,23 @@ func (r *PingOneTrustedEmailAddressResource) ExportAll() (*[]connector.ImportBlo return &importBlocks, nil } -func (r *PingOneTrustedEmailAddressResource) getTrustedEmailDomainData() (*map[string]string, error) { - trustedEmailDomainData := make(map[string]string) - - iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailDomains", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, trustedEmailDomain := range embedded.GetEmailDomains() { - trustedEmailDomainId, trustedEmailDomainIdOk := trustedEmailDomain.GetIdOk() - trustedEmailDomainName, trustedEmailDomainNameOk := trustedEmailDomain.GetDomainNameOk() - - if trustedEmailDomainIdOk && trustedEmailDomainNameOk { - trustedEmailDomainData[*trustedEmailDomainId] = *trustedEmailDomainName - } - } - } - - return &trustedEmailDomainData, nil -} - -func (r *PingOneTrustedEmailAddressResource) getTrustedEmailAddressData(trustedEmailDomainId string) (*map[string]string, error) { +func getTrustedEmailAddressData(clientInfo *connector.PingOneClientInfo, resourceType, trustedEmailDomainId string) (map[string]string, error) { trustedEmailAddressData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailAddressesApi.ReadAllTrustedEmailAddresses(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, trustedEmailDomainId).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailAddresses", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.TrustedEmailAddressesApi.ReadAllTrustedEmailAddresses(clientInfo.Context, clientInfo.ExportEnvironmentID, trustedEmailDomainId).Execute() + trustedEmailAddresses, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomainTrustedEmail](iter, "ReadAllTrustedEmailAddresses", "GetTrustedEmails", resourceType) + if err != nil { + return nil, err + } - for _, trustedEmail := range embedded.GetTrustedEmails() { - trustedEmailAddress, trustedEmailAddressOk := trustedEmail.GetEmailAddressOk() - trustedEmailId, trustedEmailIdOk := trustedEmail.GetIdOk() + for _, trustedEmail := range trustedEmailAddresses { + trustedEmailAddress, trustedEmailAddressOk := trustedEmail.GetEmailAddressOk() + trustedEmailId, trustedEmailIdOk := trustedEmail.GetIdOk() - if trustedEmailAddressOk && trustedEmailIdOk { - trustedEmailAddressData[*trustedEmailId] = *trustedEmailAddress - } + if trustedEmailAddressOk && trustedEmailIdOk { + trustedEmailAddressData[*trustedEmailId] = *trustedEmailAddress } } - return &trustedEmailAddressData, nil + return trustedEmailAddressData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go b/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go index 8bc0a169..f22752e8 100644 --- a/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go +++ b/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneTrustedEmailDomainResource) ExportAll() (*[]connector.ImportBloc importBlocks := []connector.ImportBlock{} - trustedEmailDomainData, err := r.getTrustedEmailDomainData() + trustedEmailDomainData, err := getTrustedEmailDomainData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for trustedEmailDomainId, trustedEmailDomainName := range *trustedEmailDomainData { + for trustedEmailDomainId, trustedEmailDomainName := range trustedEmailDomainData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -60,38 +61,23 @@ func (r *PingOneTrustedEmailDomainResource) ExportAll() (*[]connector.ImportBloc return &importBlocks, nil } -func (r *PingOneTrustedEmailDomainResource) getTrustedEmailDomainData() (*map[string]string, error) { +func getTrustedEmailDomainData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { trustedEmailDomainData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllTrustedEmailDomains", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + trustedEmailDomains, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomain](iter, "ReadAllTrustedEmailDomains", "GetEmailDomains", resourceType) + if err != nil { + return nil, err + } - for _, emailDomain := range embedded.GetEmailDomains() { - emailDomainId, emailDomainIdOk := emailDomain.GetIdOk() - emailDomainName, emailDomainNameOk := emailDomain.GetDomainNameOk() + for _, trustedEmailDomain := range trustedEmailDomains { + trustedEmailDomainId, trustedEmailDomainIdOk := trustedEmailDomain.GetIdOk() + trustedEmailDomainName, trustedEmailDomainNameOk := trustedEmailDomain.GetDomainNameOk() - if emailDomainIdOk && emailDomainNameOk { - trustedEmailDomainData[*emailDomainId] = *emailDomainName - } + if trustedEmailDomainIdOk && trustedEmailDomainNameOk { + trustedEmailDomainData[*trustedEmailDomainId] = *trustedEmailDomainName } } - return &trustedEmailDomainData, nil + return trustedEmailDomainData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_webhook.go b/internal/connector/pingone/platform/resources/pingone_webhook.go index e58db1b2..9d380f1d 100644 --- a/internal/connector/pingone/platform/resources/pingone_webhook.go +++ b/internal/connector/pingone/platform/resources/pingone_webhook.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneWebhookResource) ExportAll() (*[]connector.ImportBlock, error) { importBlocks := []connector.ImportBlock{} - subscriptionData, err := r.getSubscriptionData() + subscriptionData, err := getSubscriptionData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for subscriptionId, subscriptionName := range *subscriptionData { + for subscriptionId, subscriptionName := range subscriptionData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -60,38 +61,23 @@ func (r *PingOneWebhookResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func (r *PingOneWebhookResource) getSubscriptionData() (*map[string]string, error) { +func getSubscriptionData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { subscriptionData := make(map[string]string) - iter := r.clientInfo.ApiClient.ManagementAPIClient.SubscriptionsWebhooksApi.ReadAllSubscriptions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSubscriptions", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.SubscriptionsWebhooksApi.ReadAllSubscriptions(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + subscriptions, err := common.GetManagementAPIObjectsFromIterator[management.Subscription](iter, "ReadAllSubscriptions", "GetSubscriptions", resourceType) + if err != nil { + return nil, err + } - for _, subscription := range embedded.GetSubscriptions() { - subscriptionId, subscriptionIdOk := subscription.GetIdOk() - subscriptionName, subscriptionNameOk := subscription.GetNameOk() + for _, subscription := range subscriptions { + subscriptionId, subscriptionIdOk := subscription.GetIdOk() + subscriptionName, subscriptionNameOk := subscription.GetNameOk() - if subscriptionIdOk && subscriptionNameOk { - subscriptionData[*subscriptionId] = *subscriptionName - } + if subscriptionIdOk && subscriptionNameOk { + subscriptionData[*subscriptionId] = *subscriptionName } } - return &subscriptionData, nil + return subscriptionData, nil } From 8a1735b67aab123ae9f5048ee152936d5772ca7e Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Wed, 19 Feb 2025 17:51:18 -0700 Subject: [PATCH 05/18] Fix error message formatting --- .../platform/resources/pingone_branding_theme_default.go | 2 +- .../platform/resources/pingone_gateway_role_assignment.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go index b698cbc3..d842e89b 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go @@ -82,5 +82,5 @@ func getDefaultBrandingThemeName(clientInfo *connector.PingOneClientInfo, resour } } - return "", fmt.Errorf("failed to export resource '%s'. No default branding theme found.", resourceType) + return "", fmt.Errorf("failed to export resource '%s'. No default branding theme found", resourceType) } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go index 0719fd09..085d5ba0 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go @@ -118,5 +118,5 @@ func getRoleAssignmentRoleName(clientInfo *connector.PingOneClientInfo, resource } } - return nil, fmt.Errorf("failed to export resource '%s'. No role name found for Role ID '%s'.", resourceType, roleId) + return nil, fmt.Errorf("failed to export resource '%s'. No role name found for Role ID '%s'", resourceType, roleId) } From 3faa38cec89060d419403f1f712b1ae01dfcd20a Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Wed, 19 Feb 2025 18:10:33 -0700 Subject: [PATCH 06/18] Implement common data extractions from PingOne SDK entity array for MFA. --- internal/connector/common/resources_common.go | 43 +++++++- ...pingone_mfa_application_push_credential.go | 100 ++++++------------ .../resources/pingone_mfa_device_policy.go | 44 +++----- .../mfa/resources/pingone_mfa_fido2_policy.go | 44 +++----- .../mfa/resources/pingone_mfa_settings.go | 23 ++-- 5 files changed, 113 insertions(+), 141 deletions(-) diff --git a/internal/connector/common/resources_common.go b/internal/connector/common/resources_common.go index add3cdb1..673252b4 100644 --- a/internal/connector/common/resources_common.go +++ b/internal/connector/common/resources_common.go @@ -8,6 +8,7 @@ import ( "slices" "github.com/patrickcping/pingone-go-sdk-v2/management" + "github.com/patrickcping/pingone-go-sdk-v2/mfa" "github.com/pingidentity/pingcli/internal/output" ) @@ -28,7 +29,7 @@ func HandleClientResponse(response *http.Response, err error, apiFunctionName st } if response == nil { - return false, fmt.Errorf("%s Request for resource '%s' was not successful. Response is nil.", apiFunctionName, resourceType) + return false, fmt.Errorf("%s Request for resource '%s' was not successful. Response is nil", apiFunctionName, resourceType) } defer response.Body.Close() @@ -100,7 +101,45 @@ func GetManagementAPIObjectsFromIterator[T any](iter management.EntityArrayPaged if err != nil { return nil, err } - // A warning was given when handling the client response. Return nil embeddeds to skip export of resource + // A warning was given when handling the client response. Return nil apiObjects to skip export of resource + if !ok { + return nil, nil + } + + nilErr := dataNilError(resourceType, cursor.HTTPResponse) + + if cursor.EntityArray == nil { + return nil, nilErr + } + + embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() + if !embeddedOk { + return nil, nilErr + } + + reflectValues := reflect.ValueOf(embedded).MethodByName(extractionFuncName).Call(nil) + for _, rValue := range reflectValues { + apiObject, apiObjectOk := rValue.Interface().(T) + if !apiObjectOk { + output.SystemError(fmt.Sprintf("Failed to cast reflect value to %s", resourceType), nil) + } + + apiObjects = append(apiObjects, apiObject) + } + } + + return apiObjects, nil +} + +func GetMfaAPIObjectsFromIterator[T any](iter mfa.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { + apiObjects := []T{} + + for cursor, err := range iter { + ok, err := HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) + if err != nil { + return nil, err + } + // A warning was given when handling the client response. Return nil apiObjects to skip export of resource if !ok { return nil, nil } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go b/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go index b64b8fb0..7c8bcd94 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go @@ -4,6 +4,7 @@ import ( "fmt" "github.com/patrickcping/pingone-go-sdk-v2/management" + "github.com/patrickcping/pingone-go-sdk-v2/mfa" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -35,18 +36,18 @@ func (r *PingOneMFAApplicationPushCredentialResource) ExportAll() (*[]connector. importBlocks := []connector.ImportBlock{} - appData, err := r.getApplicationData() + applicationData, err := getOIDCApplicationData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for appId, appName := range *appData { - pushCredData, err := r.getPushCredentialData(appId) + for appId, appName := range applicationData { + pushCredData, err := getPushCredentialData(r.clientInfo, r.ResourceType(), appId) if err != nil { return nil, err } - for pushCredId, pushCredType := range *pushCredData { + for pushCredId, pushCredType := range pushCredData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "MFA Application Push Credential ID": pushCredId, @@ -70,81 +71,50 @@ func (r *PingOneMFAApplicationPushCredentialResource) ExportAll() (*[]connector. return &importBlocks, nil } -func (r *PingOneMFAApplicationPushCredentialResource) getApplicationData() (*map[string]string, error) { - appData := make(map[string]string) +func getOIDCApplicationData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { + applicationData := make(map[string]string) - // Fetch all pingone_application resources that could have pingone_mfa_application_push_credentials - iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", "pingone_application") - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", resourceType) + if err != nil { + return nil, err + } - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + for _, application := range applications { + // MFa application push credentials are only for OIDC Native Apps + if application.ApplicationOIDC != nil { + applicationId, applicationIdOk := application.ApplicationOIDC.GetIdOk() + applicationName, applicationNameOk := application.ApplicationOIDC.GetNameOk() + applicationType, applicationTypeOk := application.ApplicationOIDC.GetTypeOk() - for _, app := range embedded.GetApplications() { - // MFa application push credentials are only for OIDC Native Apps - if app.ApplicationOIDC != nil { - appId, appIdOk := app.ApplicationOIDC.GetIdOk() - appName, appNameOk := app.ApplicationOIDC.GetNameOk() - appType, appTypeOk := app.ApplicationOIDC.GetTypeOk() - - if appIdOk && appNameOk && appTypeOk { - if *appType == management.ENUMAPPLICATIONTYPE_NATIVE_APP { - appData[*appId] = *appName - } + if applicationIdOk && applicationNameOk && applicationTypeOk { + if *applicationType == management.ENUMAPPLICATIONTYPE_NATIVE_APP { + applicationData[*applicationId] = *applicationName } } } } - return &appData, nil + return applicationData, nil } -func (r *PingOneMFAApplicationPushCredentialResource) getPushCredentialData(appId string) (*map[string]string, error) { - pushCredData := make(map[string]string) - - iter := r.clientInfo.ApiClient.MFAAPIClient.ApplicationsApplicationMFAPushCredentialsApi.ReadAllMFAPushCredentials(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() +func getPushCredentialData(clientInfo *connector.PingOneClientInfo, resourceType, applicationId string) (map[string]string, error) { + mfaPushCredentialData := make(map[string]string) - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllMFAPushCredentials", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.MFAAPIClient.ApplicationsApplicationMFAPushCredentialsApi.ReadAllMFAPushCredentials(clientInfo.Context, clientInfo.ExportEnvironmentID, applicationId).Execute() + mfaPushCredentials, err := common.GetMfaAPIObjectsFromIterator[mfa.MFAPushCredentialResponse](iter, "ReadAllMFAPushCredentials", "GetPushCredentials", resourceType) + if err != nil { + return nil, err + } - for _, pushCred := range embedded.GetPushCredentials() { - pushCredId, pushCredIdOk := pushCred.GetIdOk() - pushCredType, pushCredTypeOk := pushCred.GetTypeOk() + for _, mfaPushCredential := range mfaPushCredentials { + mfaPushCredentialId, mfaPushCredentialIdOk := mfaPushCredential.GetIdOk() + mfaPushCredentialType, mfaPushCredentialTypeOk := mfaPushCredential.GetTypeOk() - if pushCredIdOk && pushCredTypeOk { - pushCredData[*pushCredId] = string(*pushCredType) - } + if mfaPushCredentialIdOk && mfaPushCredentialTypeOk { + mfaPushCredentialData[*mfaPushCredentialId] = string(*mfaPushCredentialType) } } - return &pushCredData, nil + return mfaPushCredentialData, nil } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go b/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go index e4f0f3f5..02c8eab2 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/mfa" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneMFADevicePolicyResource) ExportAll() (*[]connector.ImportBlock, importBlocks := []connector.ImportBlock{} - deviceAuthPolicyData, err := r.getDeviceAuthPolicyData() + deviceAuthPolicyData, err := getDeviceAuthPolicyData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for devicePolicyId, devicePolicyName := range *deviceAuthPolicyData { + for devicePolicyId, devicePolicyName := range deviceAuthPolicyData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "MFA Device Policy ID": devicePolicyId, @@ -60,38 +61,23 @@ func (r *PingOneMFADevicePolicyResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingOneMFADevicePolicyResource) getDeviceAuthPolicyData() (*map[string]string, error) { +func getDeviceAuthPolicyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { deviceAuthPolicyData := make(map[string]string) - iter := r.clientInfo.ApiClient.MFAAPIClient.DeviceAuthenticationPolicyApi.ReadDeviceAuthenticationPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadDeviceAuthenticationPolicies", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.MFAAPIClient.DeviceAuthenticationPolicyApi.ReadDeviceAuthenticationPolicies(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + deviceAuthPolicies, err := common.GetMfaAPIObjectsFromIterator[mfa.DeviceAuthenticationPolicy](iter, "ReadDeviceAuthenticationPolicies", "GetDeviceAuthenticationPolicies", resourceType) + if err != nil { + return nil, err + } - for _, devicePolicy := range embedded.GetDeviceAuthenticationPolicies() { - devicePolicyId, devicePolicyIdOk := devicePolicy.GetIdOk() - devicePolicyName, devicePolicyNameOk := devicePolicy.GetNameOk() + for _, devicePolicy := range deviceAuthPolicies { + devicePolicyId, devicePolicyIdOk := devicePolicy.GetIdOk() + devicePolicyName, devicePolicyNameOk := devicePolicy.GetNameOk() - if devicePolicyIdOk && devicePolicyNameOk { - deviceAuthPolicyData[*devicePolicyId] = *devicePolicyName - } + if devicePolicyIdOk && devicePolicyNameOk { + deviceAuthPolicyData[*devicePolicyId] = *devicePolicyName } } - return &deviceAuthPolicyData, nil + return deviceAuthPolicyData, nil } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go b/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go index f52c7b11..5854790f 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/mfa" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneMFAFido2PolicyResource) ExportAll() (*[]connector.ImportBlock, e importBlocks := []connector.ImportBlock{} - fido2PolicyData, err := r.getFido2PolicyData() + fido2PolicyData, err := getFido2PolicyData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for fido2PolicyId, fido2PolicyName := range *fido2PolicyData { + for fido2PolicyId, fido2PolicyName := range fido2PolicyData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "FIDO2 Policy ID": fido2PolicyId, @@ -60,38 +61,23 @@ func (r *PingOneMFAFido2PolicyResource) ExportAll() (*[]connector.ImportBlock, e return &importBlocks, nil } -func (r *PingOneMFAFido2PolicyResource) getFido2PolicyData() (*map[string]string, error) { +func getFido2PolicyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { fido2PolicyData := make(map[string]string) - iter := r.clientInfo.ApiClient.MFAAPIClient.FIDO2PolicyApi.ReadFIDO2Policies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadFIDO2Policies", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.MFAAPIClient.FIDO2PolicyApi.ReadFIDO2Policies(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + fido2Policies, err := common.GetMfaAPIObjectsFromIterator[mfa.FIDO2Policy](iter, "ReadFIDO2Policies", "GetFido2Policies", resourceType) + if err != nil { + return nil, err + } - for _, fido2Policy := range embedded.GetFido2Policies() { - fido2PolicyId, fido2PolicyIdOk := fido2Policy.GetIdOk() - fido2PolicyName, fido2PolicyNameOk := fido2Policy.GetNameOk() + for _, fido2Policy := range fido2Policies { + fido2PolicyId, fido2PolicyIdOk := fido2Policy.GetIdOk() + fido2PolicyName, fido2PolicyNameOk := fido2Policy.GetNameOk() - if fido2PolicyIdOk && fido2PolicyNameOk { - fido2PolicyData[*fido2PolicyId] = *fido2PolicyName - } + if fido2PolicyIdOk && fido2PolicyNameOk { + fido2PolicyData[*fido2PolicyId] = *fido2PolicyName } } - return &fido2PolicyData, nil + return fido2PolicyData, nil } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go b/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go index 366aade3..5608d2cb 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go @@ -32,10 +32,13 @@ func (r *PingOneMFASettingsResource) ExportAll() (*[]connector.ImportBlock, erro importBlocks := []connector.ImportBlock{} - err := r.checkMFASettingsData() + ok, err := checkMFASettingsData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } + if !ok { + return &importBlocks, nil + } commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, @@ -54,19 +57,7 @@ func (r *PingOneMFASettingsResource) ExportAll() (*[]connector.ImportBlock, erro return &importBlocks, nil } -func (r *PingOneMFASettingsResource) checkMFASettingsData() error { - _, response, err := r.clientInfo.ApiClient.MFAAPIClient.MFASettingsApi.ReadMFASettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "ReadMFASettings", r.ResourceType()) - if err != nil { - return err - } - if !ok { - return nil - } - - if response.StatusCode == 204 { - return common.DataNilError(r.ResourceType(), response) - } - - return nil +func checkMFASettingsData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { + _, response, err := clientInfo.ApiClient.MFAAPIClient.MFASettingsApi.ReadMFASettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadMFASettings", resourceType) } From 0d43d9375b92d7f5f3e1d2add04c3fd9107464c2 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Wed, 19 Feb 2025 18:17:43 -0700 Subject: [PATCH 07/18] Implement common data extractions from PingOne SDK entity array for Protect --- internal/connector/common/resources_common.go | 39 ++++ .../protect/resources/pingone_risk_policy.go | 44 ++--- .../resources/pingone_risk_predictor.go | 167 ++++++++---------- 3 files changed, 130 insertions(+), 120 deletions(-) diff --git a/internal/connector/common/resources_common.go b/internal/connector/common/resources_common.go index 673252b4..cc347a3a 100644 --- a/internal/connector/common/resources_common.go +++ b/internal/connector/common/resources_common.go @@ -9,6 +9,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/patrickcping/pingone-go-sdk-v2/mfa" + "github.com/patrickcping/pingone-go-sdk-v2/risk" "github.com/pingidentity/pingcli/internal/output" ) @@ -168,3 +169,41 @@ func GetMfaAPIObjectsFromIterator[T any](iter mfa.EntityArrayPagedIterator, clie return apiObjects, nil } + +func GetRiskAPIObjectsFromIterator[T any](iter risk.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { + apiObjects := []T{} + + for cursor, err := range iter { + ok, err := HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) + if err != nil { + return nil, err + } + // A warning was given when handling the client response. Return nil apiObjects to skip export of resource + if !ok { + return nil, nil + } + + nilErr := dataNilError(resourceType, cursor.HTTPResponse) + + if cursor.EntityArray == nil { + return nil, nilErr + } + + embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() + if !embeddedOk { + return nil, nilErr + } + + reflectValues := reflect.ValueOf(embedded).MethodByName(extractionFuncName).Call(nil) + for _, rValue := range reflectValues { + apiObject, apiObjectOk := rValue.Interface().(T) + if !apiObjectOk { + output.SystemError(fmt.Sprintf("Failed to cast reflect value to %s", resourceType), nil) + } + + apiObjects = append(apiObjects, apiObject) + } + } + + return apiObjects, nil +} diff --git a/internal/connector/pingone/protect/resources/pingone_risk_policy.go b/internal/connector/pingone/protect/resources/pingone_risk_policy.go index 94ba40ed..04f1673f 100644 --- a/internal/connector/pingone/protect/resources/pingone_risk_policy.go +++ b/internal/connector/pingone/protect/resources/pingone_risk_policy.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/risk" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -34,12 +35,12 @@ func (r *PingOneRiskPolicyResource) ExportAll() (*[]connector.ImportBlock, error importBlocks := []connector.ImportBlock{} - ristPolicySetData, err := r.getRiskPolicySetData() + ristPolicySetData, err := getRiskPolicySetData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for riskPolicySetId, riskPolicySetName := range *ristPolicySetData { + for riskPolicySetId, riskPolicySetName := range ristPolicySetData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -60,38 +61,23 @@ func (r *PingOneRiskPolicyResource) ExportAll() (*[]connector.ImportBlock, error return &importBlocks, nil } -func (r *PingOneRiskPolicyResource) getRiskPolicySetData() (*map[string]string, error) { +func getRiskPolicySetData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { riskPolicySetData := make(map[string]string) - iter := r.clientInfo.ApiClient.RiskAPIClient.RiskPoliciesApi.ReadRiskPolicySets(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadRiskPolicySets", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.RiskAPIClient.RiskPoliciesApi.ReadRiskPolicySets(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + riskPolicySets, err := common.GetRiskAPIObjectsFromIterator[risk.RiskPolicySet](iter, "ReadRiskPolicySets", "GetRiskPolicySets", resourceType) + if err != nil { + return nil, err + } - for _, riskPolicySet := range embedded.GetRiskPolicySets() { - riskPolicySetName, riskPolicySetNameOk := riskPolicySet.GetNameOk() - riskPolicySetId, riskPolicySetIdOk := riskPolicySet.GetIdOk() + for _, riskPolicySet := range riskPolicySets { + riskPolicySetName, riskPolicySetNameOk := riskPolicySet.GetNameOk() + riskPolicySetId, riskPolicySetIdOk := riskPolicySet.GetIdOk() - if riskPolicySetIdOk && riskPolicySetNameOk { - riskPolicySetData[*riskPolicySetId] = *riskPolicySetName - } + if riskPolicySetIdOk && riskPolicySetNameOk { + riskPolicySetData[*riskPolicySetId] = *riskPolicySetName } } - return &riskPolicySetData, nil + return riskPolicySetData, nil } diff --git a/internal/connector/pingone/protect/resources/pingone_risk_predictor.go b/internal/connector/pingone/protect/resources/pingone_risk_predictor.go index 741eaeb8..2b5de564 100644 --- a/internal/connector/pingone/protect/resources/pingone_risk_predictor.go +++ b/internal/connector/pingone/protect/resources/pingone_risk_predictor.go @@ -35,12 +35,12 @@ func (r *PingOneRiskPredictorResource) ExportAll() (*[]connector.ImportBlock, er importBlocks := []connector.ImportBlock{} - riskPredictorData, err := r.getRiskPredictorData() + riskPredictorData, err := getRiskPredictorData(r.clientInfo, r.ResourceType()) if err != nil { return nil, err } - for riskPredictorId, riskPredictorInfo := range *riskPredictorData { + for riskPredictorId, riskPredictorInfo := range riskPredictorData { riskPredictorName := riskPredictorInfo[0] riskPredictorType := riskPredictorInfo[1] @@ -65,101 +65,86 @@ func (r *PingOneRiskPredictorResource) ExportAll() (*[]connector.ImportBlock, er return &importBlocks, nil } -func (r *PingOneRiskPredictorResource) getRiskPredictorData() (*map[string][]string, error) { +func getRiskPredictorData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string][]string, error) { riskPredictorData := make(map[string][]string) - iter := r.clientInfo.ApiClient.RiskAPIClient.RiskAdvancedPredictorsApi.ReadAllRiskPredictors(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllRiskPredictors", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } + iter := clientInfo.ApiClient.RiskAPIClient.RiskAdvancedPredictorsApi.ReadAllRiskPredictors(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + riskPredictors, err := common.GetRiskAPIObjectsFromIterator[risk.RiskPredictor](iter, "ReadAllRiskPredictors", "GetRiskPredictors", resourceType) + if err != nil { + return nil, err + } - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, riskPredictor := range riskPredictors { + var ( + riskPredictorId *string + riskPredictorIdOk bool + riskPredictorName *string + riskPredictorNameOk bool + riskPredictorType *risk.EnumPredictorType + riskPredictorTypeOk bool + ) + + switch { + case riskPredictor.RiskPredictorAdversaryInTheMiddle != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorAdversaryInTheMiddle.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorAdversaryInTheMiddle.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorAdversaryInTheMiddle.GetTypeOk() + case riskPredictor.RiskPredictorAnonymousNetwork != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorAnonymousNetwork.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorAnonymousNetwork.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorAnonymousNetwork.GetTypeOk() + case riskPredictor.RiskPredictorBotDetection != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorBotDetection.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorBotDetection.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorBotDetection.GetTypeOk() + case riskPredictor.RiskPredictorCommon != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorCommon.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorCommon.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorCommon.GetTypeOk() + case riskPredictor.RiskPredictorComposite != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorComposite.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorComposite.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorComposite.GetTypeOk() + case riskPredictor.RiskPredictorCustom != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorCustom.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorCustom.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorCustom.GetTypeOk() + case riskPredictor.RiskPredictorDevice != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorDevice.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorDevice.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorDevice.GetTypeOk() + case riskPredictor.RiskPredictorEmailReputation != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorEmailReputation.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorEmailReputation.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorEmailReputation.GetTypeOk() + case riskPredictor.RiskPredictorGeovelocity != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorGeovelocity.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorGeovelocity.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorGeovelocity.GetTypeOk() + case riskPredictor.RiskPredictorIPReputation != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorIPReputation.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorIPReputation.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorIPReputation.GetTypeOk() + case riskPredictor.RiskPredictorUserLocationAnomaly != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorUserLocationAnomaly.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorUserLocationAnomaly.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorUserLocationAnomaly.GetTypeOk() + case riskPredictor.RiskPredictorUserRiskBehavior != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorUserRiskBehavior.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorUserRiskBehavior.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorUserRiskBehavior.GetTypeOk() + case riskPredictor.RiskPredictorVelocity != nil: + riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorVelocity.GetIdOk() + riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorVelocity.GetNameOk() + riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorVelocity.GetTypeOk() + default: + continue } - for _, riskPredictor := range embedded.GetRiskPredictors() { - var ( - riskPredictorId *string - riskPredictorIdOk bool - riskPredictorName *string - riskPredictorNameOk bool - riskPredictorType *risk.EnumPredictorType - riskPredictorTypeOk bool - ) - - switch { - case riskPredictor.RiskPredictorAdversaryInTheMiddle != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorAdversaryInTheMiddle.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorAdversaryInTheMiddle.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorAdversaryInTheMiddle.GetTypeOk() - case riskPredictor.RiskPredictorAnonymousNetwork != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorAnonymousNetwork.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorAnonymousNetwork.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorAnonymousNetwork.GetTypeOk() - case riskPredictor.RiskPredictorBotDetection != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorBotDetection.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorBotDetection.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorBotDetection.GetTypeOk() - case riskPredictor.RiskPredictorCommon != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorCommon.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorCommon.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorCommon.GetTypeOk() - case riskPredictor.RiskPredictorComposite != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorComposite.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorComposite.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorComposite.GetTypeOk() - case riskPredictor.RiskPredictorCustom != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorCustom.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorCustom.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorCustom.GetTypeOk() - case riskPredictor.RiskPredictorDevice != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorDevice.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorDevice.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorDevice.GetTypeOk() - case riskPredictor.RiskPredictorEmailReputation != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorEmailReputation.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorEmailReputation.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorEmailReputation.GetTypeOk() - case riskPredictor.RiskPredictorGeovelocity != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorGeovelocity.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorGeovelocity.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorGeovelocity.GetTypeOk() - case riskPredictor.RiskPredictorIPReputation != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorIPReputation.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorIPReputation.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorIPReputation.GetTypeOk() - case riskPredictor.RiskPredictorUserLocationAnomaly != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorUserLocationAnomaly.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorUserLocationAnomaly.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorUserLocationAnomaly.GetTypeOk() - case riskPredictor.RiskPredictorUserRiskBehavior != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorUserRiskBehavior.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorUserRiskBehavior.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorUserRiskBehavior.GetTypeOk() - case riskPredictor.RiskPredictorVelocity != nil: - riskPredictorId, riskPredictorIdOk = riskPredictor.RiskPredictorVelocity.GetIdOk() - riskPredictorName, riskPredictorNameOk = riskPredictor.RiskPredictorVelocity.GetNameOk() - riskPredictorType, riskPredictorTypeOk = riskPredictor.RiskPredictorVelocity.GetTypeOk() - default: - continue - } - - if riskPredictorIdOk && riskPredictorNameOk && riskPredictorTypeOk { - riskPredictorData[*riskPredictorId] = []string{*riskPredictorName, string(*riskPredictorType)} - } + if riskPredictorIdOk && riskPredictorNameOk && riskPredictorTypeOk { + riskPredictorData[*riskPredictorId] = []string{*riskPredictorName, string(*riskPredictorType)} } } - return &riskPredictorData, nil + return riskPredictorData, nil } From f2c442c9f84ec9b45ce4cca3a71713509df8ea38 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Wed, 19 Feb 2025 19:23:27 -0700 Subject: [PATCH 08/18] Implement common data extractions from PingOne SDK entity array for SSO --- internal/connector/common/resources_common.go | 10 +- ...oauth_token_exchange_generator_settings.go | 10 -- .../platform/resources/pingone_certificate.go | 12 +- .../pingone/platform/resources/pingone_key.go | 12 +- .../sso/resources/pingone_application.go | 74 ++++---- .../pingone_application_attribute_mapping.go | 109 +++++------- ...gone_application_flow_policy_assignment.go | 136 ++++++--------- .../pingone_application_resource_grant.go | 136 ++++++--------- .../pingone_application_role_assignment.go | 159 ++++++++---------- .../resources/pingone_application_secret.go | 90 +++++----- ...e_application_sign_on_policy_assignment.go | 136 ++++++--------- .../pingone/sso/resources/pingone_group.go | 40 ++--- .../sso/resources/pingone_group_nesting.go | 79 +++------ .../pingone_group_role_assignment.go | 85 ++++------ .../resources/pingone_identity_provider.go | 92 +++++----- .../pingone_identity_provider_attribute.go | 127 ++++++-------- .../sso/resources/pingone_password_policy.go | 40 ++--- .../sso/resources/pingone_population.go | 40 ++--- .../resources/pingone_population_default.go | 36 ++-- .../pingone/sso/resources/pingone_resource.go | 42 ++--- .../resources/pingone_resource_attribute.go | 110 +++++------- .../sso/resources/pingone_resource_scope.go | 82 +++------ .../pingone_resource_scope_openid.go | 82 +++------ .../pingone_resource_scope_pingone_api.go | 92 ++++------ .../sso/resources/pingone_schema_attribute.go | 75 +++------ .../sso/resources/pingone_sign_on_policy.go | 40 ++--- .../pingone_sign_on_policy_action.go | 136 ++++++--------- 27 files changed, 770 insertions(+), 1312 deletions(-) diff --git a/internal/connector/common/resources_common.go b/internal/connector/common/resources_common.go index cc347a3a..8a28afd4 100644 --- a/internal/connector/common/resources_common.go +++ b/internal/connector/common/resources_common.go @@ -54,9 +54,9 @@ func HandleClientResponse(response *http.Response, err error, apiFunctionName st return true, nil } -func dataNilError(resourceType string, response *http.Response) error { +func DataNilError(resourceType string, response *http.Response) error { return fmt.Errorf("failed to export resource '%s'.\n"+ - "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ + "API Client request for resource '%s' was not successful. response data is nil.\n"+ "response code: %s\n"+ "response body: %s", resourceType, resourceType, response.Status, response.Body) @@ -107,7 +107,7 @@ func GetManagementAPIObjectsFromIterator[T any](iter management.EntityArrayPaged return nil, nil } - nilErr := dataNilError(resourceType, cursor.HTTPResponse) + nilErr := DataNilError(resourceType, cursor.HTTPResponse) if cursor.EntityArray == nil { return nil, nilErr @@ -145,7 +145,7 @@ func GetMfaAPIObjectsFromIterator[T any](iter mfa.EntityArrayPagedIterator, clie return nil, nil } - nilErr := dataNilError(resourceType, cursor.HTTPResponse) + nilErr := DataNilError(resourceType, cursor.HTTPResponse) if cursor.EntityArray == nil { return nil, nilErr @@ -183,7 +183,7 @@ func GetRiskAPIObjectsFromIterator[T any](iter risk.EntityArrayPagedIterator, cl return nil, nil } - nilErr := dataNilError(resourceType, cursor.HTTPResponse) + nilErr := DataNilError(resourceType, cursor.HTTPResponse) if cursor.EntityArray == nil { return nil, nilErr diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_generator_settings.go b/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_generator_settings.go index 0acfcfd8..3952ed53 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_generator_settings.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_generator_settings.go @@ -4,7 +4,6 @@ import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" - "github.com/pingidentity/pingfederate-go-client/v1210/configurationapi" ) // Verify that the resource satisfies the exportable resource interface @@ -33,15 +32,6 @@ func (r *PingFederateOAuthTokenExchangeGeneratorSettingsResource) ExportAll() (* importBlocks := []connector.ImportBlock{} - settings, response, err := r.clientInfo.ApiClient.OauthTokenExchangeGeneratorAPI.GetOauthTokenExchangeSettings(r.clientInfo.Context).Execute() - _ = response - _ = err - json, err := settings.MarshalJSON() - strJson := string(json) - _ = strJson - - t := configurationapi.TokenExchangeGeneratorSettings{} - oauthTokenExchangeGeneratorSettingsId := "oauth_token_exchange_generator_settings_singleton_id" // #nosec G101 // These variables do not contain sensitive token information oauthTokenExchangeGeneratorSettingsName := "OAuth Token Exchange Generator Settings" // #nosec G101 // These variables do not contain sensitive token information diff --git a/internal/connector/pingone/platform/resources/pingone_certificate.go b/internal/connector/pingone/platform/resources/pingone_certificate.go index bfa3b4da..5817651a 100644 --- a/internal/connector/pingone/platform/resources/pingone_certificate.go +++ b/internal/connector/pingone/platform/resources/pingone_certificate.go @@ -74,20 +74,12 @@ func getCertificateData(clientInfo *connector.PingOneClientInfo, resourceType st } if entityArray == nil { - return nil, fmt.Errorf("failed to export resource '%s'.\n"+ - "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ - "response code: %s\n"+ - "response body: %s", - resourceType, resourceType, response.Status, response.Body) + return nil, common.DataNilError(resourceType, response) } embedded, embeddedOk := entityArray.GetEmbeddedOk() if !embeddedOk { - return nil, fmt.Errorf("failed to export resource '%s'.\n"+ - "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ - "response code: %s\n"+ - "response body: %s", - resourceType, resourceType, response.Status, response.Body) + return nil, common.DataNilError(resourceType, response) } for _, certificate := range embedded.GetCertificates() { diff --git a/internal/connector/pingone/platform/resources/pingone_key.go b/internal/connector/pingone/platform/resources/pingone_key.go index 7329a20e..d180a36c 100644 --- a/internal/connector/pingone/platform/resources/pingone_key.go +++ b/internal/connector/pingone/platform/resources/pingone_key.go @@ -79,20 +79,12 @@ func getKeyData(clientInfo *connector.PingOneClientInfo, resourceType string) (m } if entityArray == nil { - return nil, fmt.Errorf("failed to export resource '%s'.\n"+ - "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ - "response code: %s\n"+ - "response body: %s", - resourceType, resourceType, response.Status, response.Body) + return nil, common.DataNilError(resourceType, response) } embedded, embeddedOk := entityArray.GetEmbeddedOk() if !embeddedOk { - return nil, fmt.Errorf("failed to export resource '%s'.\n"+ - "PingOne API request for resource '%s' was not successful. response data is nil.\n"+ - "response code: %s\n"+ - "response body: %s", - resourceType, resourceType, response.Status, response.Body) + return nil, common.DataNilError(resourceType, response) } for _, key := range embedded.GetKeys() { diff --git a/internal/connector/pingone/sso/resources/pingone_application.go b/internal/connector/pingone/sso/resources/pingone_application.go index 306faa66..5e3587e9 100644 --- a/internal/connector/pingone/sso/resources/pingone_application.go +++ b/internal/connector/pingone/sso/resources/pingone_application.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,7 +40,7 @@ func (r *PingOneApplicationResource) ExportAll() (*[]connector.ImportBlock, erro return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { commentData := map[string]string{ "Application ID": appId, "Application Name": appName, @@ -60,56 +61,41 @@ func (r *PingOneApplicationResource) ExportAll() (*[]connector.ImportBlock, erro return &importBlocks, nil } -func (r *PingOneApplicationResource) getApplicationData() (*map[string]string, error) { +func (r *PingOneApplicationResource) getApplicationData() (map[string]string, error) { applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, app := range applications { + var ( + appId *string + appIdOk bool + appName *string + appNameOk bool + ) + + switch { + case app.ApplicationOIDC != nil: + appId, appIdOk = app.ApplicationOIDC.GetIdOk() + appName, appNameOk = app.ApplicationOIDC.GetNameOk() + case app.ApplicationSAML != nil: + appId, appIdOk = app.ApplicationSAML.GetIdOk() + appName, appNameOk = app.ApplicationSAML.GetNameOk() + case app.ApplicationExternalLink != nil: + appId, appIdOk = app.ApplicationExternalLink.GetIdOk() + appName, appNameOk = app.ApplicationExternalLink.GetNameOk() + default: + continue } - for _, app := range embedded.GetApplications() { - var ( - appId *string - appIdOk bool - appName *string - appNameOk bool - ) - - switch { - case app.ApplicationOIDC != nil: - appId, appIdOk = app.ApplicationOIDC.GetIdOk() - appName, appNameOk = app.ApplicationOIDC.GetNameOk() - case app.ApplicationSAML != nil: - appId, appIdOk = app.ApplicationSAML.GetIdOk() - appName, appNameOk = app.ApplicationSAML.GetNameOk() - case app.ApplicationExternalLink != nil: - appId, appIdOk = app.ApplicationExternalLink.GetIdOk() - appName, appNameOk = app.ApplicationExternalLink.GetNameOk() - default: - continue - } - - if appIdOk && appNameOk { - applicationData[*appId] = *appName - } + if appIdOk && appNameOk { + applicationData[*appId] = *appName } } - return &applicationData, nil + return applicationData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go b/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go index 7a561784..a3279cb8 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go +++ b/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,13 +40,13 @@ func (r *PingOneApplicationAttributeMappingResource) ExportAll() (*[]connector.I return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { applicationAttributeMappingData, err := r.getApplicationAttributeMappingData(appId) if err != nil { return nil, err } - for attributeMappingId, attributeMappingName := range *applicationAttributeMappingData { + for attributeMappingId, attributeMappingName := range applicationAttributeMappingData { commentData := map[string]string{ "Application ID": appId, "Application Name": appName, @@ -69,91 +70,61 @@ func (r *PingOneApplicationAttributeMappingResource) ExportAll() (*[]connector.I return &importBlocks, nil } -func (r *PingOneApplicationAttributeMappingResource) getApplicationData() (*map[string]string, error) { +func (r *PingOneApplicationAttributeMappingResource) getApplicationData() (map[string]string, error) { applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, app := range applications { + var ( + appId *string + appIdOk bool + appName *string + appNameOk bool + ) + + switch { + case app.ApplicationOIDC != nil: + appId, appIdOk = app.ApplicationOIDC.GetIdOk() + appName, appNameOk = app.ApplicationOIDC.GetNameOk() + case app.ApplicationSAML != nil: + appId, appIdOk = app.ApplicationSAML.GetIdOk() + appName, appNameOk = app.ApplicationSAML.GetNameOk() + default: + continue } - for _, app := range embedded.GetApplications() { - var ( - appId *string - appIdOk bool - appName *string - appNameOk bool - ) - - switch { - case app.ApplicationOIDC != nil: - appId, appIdOk = app.ApplicationOIDC.GetIdOk() - appName, appNameOk = app.ApplicationOIDC.GetNameOk() - case app.ApplicationSAML != nil: - appId, appIdOk = app.ApplicationSAML.GetIdOk() - appName, appNameOk = app.ApplicationSAML.GetNameOk() - default: - continue - } - - if appIdOk && appNameOk { - applicationData[*appId] = *appName - } + if appIdOk && appNameOk { + applicationData[*appId] = *appName } } - return &applicationData, nil + return applicationData, nil } -func (r *PingOneApplicationAttributeMappingResource) getApplicationAttributeMappingData(appId string) (*map[string]string, error) { +func (r *PingOneApplicationAttributeMappingResource) getApplicationAttributeMappingData(appId string) (map[string]string, error) { applicationAttributeMappingData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationAttributeMappingApi.ReadAllApplicationAttributeMappings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() + attributeMappingInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllApplicationAttributeMappings", "GetAttributes", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplicationAttributeMappings", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, attributeMapping := range embedded.GetAttributes() { - if attributeMapping.ApplicationAttributeMapping != nil { - attributeMappingId, attributeMappingIdOk := attributeMapping.ApplicationAttributeMapping.GetIdOk() - attributeMappingName, attributeMappingNameOk := attributeMapping.ApplicationAttributeMapping.GetNameOk() + for _, attributeMappingInner := range attributeMappingInners { + if attributeMappingInner.ApplicationAttributeMapping != nil { + attributeMappingId, attributeMappingIdOk := attributeMappingInner.ApplicationAttributeMapping.GetIdOk() + attributeMappingName, attributeMappingNameOk := attributeMappingInner.ApplicationAttributeMapping.GetNameOk() - if attributeMappingIdOk && attributeMappingNameOk { - applicationAttributeMappingData[*attributeMappingId] = *attributeMappingName - } + if attributeMappingIdOk && attributeMappingNameOk { + applicationAttributeMappingData[*attributeMappingId] = *attributeMappingName } } } - return &applicationAttributeMappingData, nil + return applicationAttributeMappingData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go index 0324d277..3c11ba6c 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,30 +40,33 @@ func (r *PingOneApplicationFlowPolicyAssignmentResource) ExportAll() (*[]connect return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { flowPolicyAssignmentData, err := r.getFlowPolicyAssignmentData(appId) if err != nil { return nil, err } - for flowPolicyAssignmentId, flowPolicyId := range *flowPolicyAssignmentData { - flowPolicyName, err := r.getFlowPolicyName(flowPolicyId) + for flowPolicyAssignmentId, flowPolicyId := range flowPolicyAssignmentData { + flowPolicyName, flowPolicyNameOk, err := r.getFlowPolicyName(flowPolicyId) if err != nil { return nil, err } + if !flowPolicyNameOk { + continue + } commentData := map[string]string{ "Application ID": appId, "Application Name": appName, "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Flow Policy Assignment ID": flowPolicyAssignmentId, - "Flow Policy Name": *flowPolicyName, + "Flow Policy Name": flowPolicyName, "Resource Type": r.ResourceType(), } importBlock := connector.ImportBlock{ ResourceType: r.ResourceType(), - ResourceName: fmt.Sprintf("%s_%s", appName, *flowPolicyName), + ResourceName: fmt.Sprintf("%s_%s", appName, flowPolicyName), ResourceID: fmt.Sprintf("%s/%s/%s", r.clientInfo.ExportEnvironmentID, appId, flowPolicyAssignmentId), CommentInformation: common.GenerateCommentInformation(commentData), } @@ -74,118 +78,88 @@ func (r *PingOneApplicationFlowPolicyAssignmentResource) ExportAll() (*[]connect return &importBlocks, nil } -func (r *PingOneApplicationFlowPolicyAssignmentResource) getApplicationData() (*map[string]string, error) { +func (r *PingOneApplicationFlowPolicyAssignmentResource) getApplicationData() (map[string]string, error) { applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, app := range applications { + var ( + appId *string + appIdOk bool + appName *string + appNameOk bool + ) + + switch { + case app.ApplicationOIDC != nil: + appId, appIdOk = app.ApplicationOIDC.GetIdOk() + appName, appNameOk = app.ApplicationOIDC.GetNameOk() + case app.ApplicationSAML != nil: + appId, appIdOk = app.ApplicationSAML.GetIdOk() + appName, appNameOk = app.ApplicationSAML.GetNameOk() + case app.ApplicationExternalLink != nil: + appId, appIdOk = app.ApplicationExternalLink.GetIdOk() + appName, appNameOk = app.ApplicationExternalLink.GetNameOk() + default: + continue } - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, app := range embedded.GetApplications() { - var ( - appId *string - appIdOk bool - appName *string - appNameOk bool - ) - - switch { - case app.ApplicationOIDC != nil: - appId, appIdOk = app.ApplicationOIDC.GetIdOk() - appName, appNameOk = app.ApplicationOIDC.GetNameOk() - case app.ApplicationSAML != nil: - appId, appIdOk = app.ApplicationSAML.GetIdOk() - appName, appNameOk = app.ApplicationSAML.GetNameOk() - case app.ApplicationExternalLink != nil: - appId, appIdOk = app.ApplicationExternalLink.GetIdOk() - appName, appNameOk = app.ApplicationExternalLink.GetNameOk() - default: - continue - } - - if appIdOk && appNameOk { - applicationData[*appId] = *appName - } + if appIdOk && appNameOk { + applicationData[*appId] = *appName } } - return &applicationData, nil + return applicationData, nil } -func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyAssignmentData(appId string) (*map[string]string, error) { +func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyAssignmentData(appId string) (map[string]string, error) { flowPolicyAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationFlowPolicyAssignmentsApi.ReadAllFlowPolicyAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() + flowPolicyAssignments, err := common.GetManagementAPIObjectsFromIterator[management.FlowPolicyAssignment](iter, "ReadAllFlowPolicyAssignments", "GetFlowPolicyAssignments", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllFlowPolicyAssignments", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, flowPolicyAssignment := range embedded.GetFlowPolicyAssignments() { - flowPolicyAssignmentId, flowPolicyAssignmentIdOk := flowPolicyAssignment.GetIdOk() - flowPolicyAssignmentFlowPolicy, flowPolicyAssignmentFlowPolicyOk := flowPolicyAssignment.GetFlowPolicyOk() + for _, flowPolicyAssignment := range flowPolicyAssignments { + flowPolicyAssignmentId, flowPolicyAssignmentIdOk := flowPolicyAssignment.GetIdOk() + flowPolicyAssignmentFlowPolicy, flowPolicyAssignmentFlowPolicyOk := flowPolicyAssignment.GetFlowPolicyOk() - if flowPolicyAssignmentIdOk && flowPolicyAssignmentFlowPolicyOk { - flowPolicyId, flowPolicyIdOk := flowPolicyAssignmentFlowPolicy.GetIdOk() + if flowPolicyAssignmentIdOk && flowPolicyAssignmentFlowPolicyOk { + flowPolicyId, flowPolicyIdOk := flowPolicyAssignmentFlowPolicy.GetIdOk() - if flowPolicyIdOk { - flowPolicyAssignmentData[*flowPolicyAssignmentId] = *flowPolicyId - } + if flowPolicyIdOk { + flowPolicyAssignmentData[*flowPolicyAssignmentId] = *flowPolicyId } } } - return &flowPolicyAssignmentData, nil + return flowPolicyAssignmentData, nil } -func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyName(flowPolicyId string) (*string, error) { +func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyName(flowPolicyId string) (string, bool, error) { flowPolicy, response, err := r.clientInfo.ApiClient.ManagementAPIClient.FlowPoliciesApi.ReadOneFlowPolicy(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, flowPolicyId).Execute() ok, err := common.HandleClientResponse(response, err, "ReadOneFlowPolicy", r.ResourceType()) if err != nil { - return nil, err + return "", false, err } if !ok { - return nil, nil + return "", false, nil } if flowPolicy != nil { flowPolicyName, flowPolicyNameOk := flowPolicy.GetNameOk() if flowPolicyNameOk { - return flowPolicyName, nil + return *flowPolicyName, true, nil } } - return nil, fmt.Errorf("Unable to get Flow Policy Name for Flow Policy ID: %s", flowPolicyId) + return "", false, fmt.Errorf("Unable to get Flow Policy Name for Flow Policy ID: %s", flowPolicyId) } diff --git a/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go b/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go index e4bed0fc..8f86855c 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go +++ b/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,30 +40,33 @@ func (r *PingOneApplicationResourceGrantResource) ExportAll() (*[]connector.Impo return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { applicationGrantData, err := r.getApplicationGrantData(appId) if err != nil { return nil, err } - for grantId, grantResourceId := range *applicationGrantData { - resourceName, err := r.getGrantResourceName(grantResourceId) + for grantId, grantResourceId := range applicationGrantData { + resourceName, resourceNameOk, err := r.getGrantResourceName(grantResourceId) if err != nil { return nil, err } + if !resourceNameOk { + continue + } commentData := map[string]string{ "Application ID": appId, "Application Name": appName, "Application Resource Grant ID": grantId, - "Application Resource Name": *resourceName, + "Application Resource Name": resourceName, "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), } importBlock := connector.ImportBlock{ ResourceType: r.ResourceType(), - ResourceName: fmt.Sprintf("%s_%s", appName, *resourceName), + ResourceName: fmt.Sprintf("%s_%s", appName, resourceName), ResourceID: fmt.Sprintf("%s/%s/%s", r.clientInfo.ExportEnvironmentID, appId, grantId), CommentInformation: common.GenerateCommentInformation(commentData), } @@ -74,116 +78,86 @@ func (r *PingOneApplicationResourceGrantResource) ExportAll() (*[]connector.Impo return &importBlocks, nil } -func (r *PingOneApplicationResourceGrantResource) getApplicationData() (*map[string]string, error) { +func (r *PingOneApplicationResourceGrantResource) getApplicationData() (map[string]string, error) { applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, app := range applications { + var ( + appId *string + appIdOk bool + appName *string + appNameOk bool + ) + + switch { + case app.ApplicationPingOnePortal != nil: + appId, appIdOk = app.ApplicationPingOnePortal.GetIdOk() + appName, appNameOk = app.ApplicationPingOnePortal.GetNameOk() + case app.ApplicationPingOneSelfService != nil: + appId, appIdOk = app.ApplicationPingOneSelfService.GetIdOk() + appName, appNameOk = app.ApplicationPingOneSelfService.GetNameOk() + case app.ApplicationExternalLink != nil: + appId, appIdOk = app.ApplicationExternalLink.GetIdOk() + appName, appNameOk = app.ApplicationExternalLink.GetNameOk() + default: + continue } - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, app := range embedded.GetApplications() { - var ( - appId *string - appIdOk bool - appName *string - appNameOk bool - ) - - switch { - case app.ApplicationPingOnePortal != nil: - appId, appIdOk = app.ApplicationPingOnePortal.GetIdOk() - appName, appNameOk = app.ApplicationPingOnePortal.GetNameOk() - case app.ApplicationPingOneSelfService != nil: - appId, appIdOk = app.ApplicationPingOneSelfService.GetIdOk() - appName, appNameOk = app.ApplicationPingOneSelfService.GetNameOk() - case app.ApplicationExternalLink != nil: - appId, appIdOk = app.ApplicationExternalLink.GetIdOk() - appName, appNameOk = app.ApplicationExternalLink.GetNameOk() - default: - continue - } - - if appIdOk && appNameOk { - applicationData[*appId] = *appName - } + if appIdOk && appNameOk { + applicationData[*appId] = *appName } } - return &applicationData, nil + return applicationData, nil } -func (r *PingOneApplicationResourceGrantResource) getApplicationGrantData(appId string) (*map[string]string, error) { +func (r *PingOneApplicationResourceGrantResource) getApplicationGrantData(appId string) (map[string]string, error) { applicationGrantData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationResourceGrantsApi.ReadAllApplicationGrants(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() + applicationGrants, err := common.GetManagementAPIObjectsFromIterator[management.ApplicationResourceGrant](iter, "ReadAllApplicationGrants", "GetGrants", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplicationGrants", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, grant := range embedded.GetGrants() { - grantId, grantIdOk := grant.GetIdOk() - grantResource, grantResourceOk := grant.GetResourceOk() + for _, grant := range applicationGrants { + grantId, grantIdOk := grant.GetIdOk() + grantResource, grantResourceOk := grant.GetResourceOk() - if grantIdOk && grantResourceOk { - grantResourceId, grantResourceIdOk := grantResource.GetIdOk() + if grantIdOk && grantResourceOk { + grantResourceId, grantResourceIdOk := grantResource.GetIdOk() - if grantResourceIdOk { - applicationGrantData[*grantId] = *grantResourceId - } + if grantResourceIdOk { + applicationGrantData[*grantId] = *grantResourceId } } } - return &applicationGrantData, nil + return applicationGrantData, nil } -func (r *PingOneApplicationResourceGrantResource) getGrantResourceName(grantResourceId string) (*string, error) { +func (r *PingOneApplicationResourceGrantResource) getGrantResourceName(grantResourceId string) (string, bool, error) { resource, response, err := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadOneResource(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, grantResourceId).Execute() ok, err := common.HandleClientResponse(response, err, "ReadOneResource", r.ResourceType()) if err != nil { - return nil, err + return "", false, err } if !ok { - return nil, nil + return "", false, nil } if resource != nil { resourceName, resourceNameOk := resource.GetNameOk() if resourceNameOk { - return resourceName, nil + return *resourceName, true, nil } } - return nil, fmt.Errorf("Unable to get resource name for grant resource ID: %s", grantResourceId) + return "", false, fmt.Errorf("Unable to get resource name for grant resource ID: %s", grantResourceId) } diff --git a/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go index bf08c6ab..949ab640 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go @@ -40,30 +40,33 @@ func (r *PingOneApplicationRoleAssignmentResource) ExportAll() (*[]connector.Imp return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { applicationRoleAssignmentData, err := r.getApplicationRoleAssignmentData(appId) if err != nil { return nil, err } - for roleAssignmentId, roleId := range *applicationRoleAssignmentData { - roleName, err := r.getRoleName(roleId) + for roleAssignmentId, roleId := range applicationRoleAssignmentData { + roleName, roleNameOk, err := r.getRoleName(roleId) if err != nil { return nil, err } + if !roleNameOk { + continue + } commentData := map[string]string{ "Application ID": appId, "Application Name": appName, "Application Role Assignment ID": roleAssignmentId, - "Application Role Name": string(*roleName), + "Application Role Name": string(roleName), "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), } importBlock := connector.ImportBlock{ ResourceType: r.ResourceType(), - ResourceName: fmt.Sprintf("%s_%s_%s", appName, string(*roleName), roleAssignmentId), + ResourceName: fmt.Sprintf("%s_%s_%s", appName, string(roleName), roleAssignmentId), ResourceID: fmt.Sprintf("%s/%s/%s", r.clientInfo.ExportEnvironmentID, appId, roleAssignmentId), CommentInformation: common.GenerateCommentInformation(commentData), } @@ -75,131 +78,101 @@ func (r *PingOneApplicationRoleAssignmentResource) ExportAll() (*[]connector.Imp return &importBlocks, nil } -func (r *PingOneApplicationRoleAssignmentResource) getApplicationData() (*map[string]string, error) { +func (r *PingOneApplicationRoleAssignmentResource) getApplicationData() (map[string]string, error) { applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, app := range applications { + var ( + appId *string + appIdOk bool + appName *string + appNameOk bool + appAccessControlRole *management.ApplicationAccessControlRole + appAccessControlRoleOk bool + ) + + switch { + case app.ApplicationOIDC != nil: + appId, appIdOk = app.ApplicationOIDC.GetIdOk() + appName, appNameOk = app.ApplicationOIDC.GetNameOk() + if app.ApplicationOIDC.AccessControl != nil { + appAccessControlRole, appAccessControlRoleOk = app.ApplicationOIDC.AccessControl.GetRoleOk() + } + case app.ApplicationSAML != nil: + appId, appIdOk = app.ApplicationSAML.GetIdOk() + appName, appNameOk = app.ApplicationSAML.GetNameOk() + if app.ApplicationSAML.AccessControl != nil { + appAccessControlRole, appAccessControlRoleOk = app.ApplicationSAML.AccessControl.GetRoleOk() + } + case app.ApplicationExternalLink != nil: + appId, appIdOk = app.ApplicationExternalLink.GetIdOk() + appName, appNameOk = app.ApplicationExternalLink.GetNameOk() + if app.ApplicationExternalLink.AccessControl != nil { + appAccessControlRole, appAccessControlRoleOk = app.ApplicationExternalLink.AccessControl.GetRoleOk() + } + default: + continue } - for _, app := range embedded.GetApplications() { - var ( - appId *string - appIdOk bool - appName *string - appNameOk bool - appAccessControlRole *management.ApplicationAccessControlRole - appAccessControlRoleOk bool - ) - - switch { - case app.ApplicationOIDC != nil: - appId, appIdOk = app.ApplicationOIDC.GetIdOk() - appName, appNameOk = app.ApplicationOIDC.GetNameOk() - if app.ApplicationOIDC.AccessControl != nil { - appAccessControlRole, appAccessControlRoleOk = app.ApplicationOIDC.AccessControl.GetRoleOk() - } - case app.ApplicationSAML != nil: - appId, appIdOk = app.ApplicationSAML.GetIdOk() - appName, appNameOk = app.ApplicationSAML.GetNameOk() - if app.ApplicationSAML.AccessControl != nil { - appAccessControlRole, appAccessControlRoleOk = app.ApplicationSAML.AccessControl.GetRoleOk() - } - case app.ApplicationExternalLink != nil: - appId, appIdOk = app.ApplicationExternalLink.GetIdOk() - appName, appNameOk = app.ApplicationExternalLink.GetNameOk() - if app.ApplicationExternalLink.AccessControl != nil { - appAccessControlRole, appAccessControlRoleOk = app.ApplicationExternalLink.AccessControl.GetRoleOk() - } - default: + if appIdOk && appNameOk && appAccessControlRoleOk { + if appAccessControlRole.GetType() != management.ENUMAPPLICATIONACCESSCONTROLTYPE_ADMIN_USERS_ONLY { continue } - if appIdOk && appNameOk && appAccessControlRoleOk { - if appAccessControlRole.GetType() != management.ENUMAPPLICATIONACCESSCONTROLTYPE_ADMIN_USERS_ONLY { - continue - } - - applicationData[*appId] = *appName - } + applicationData[*appId] = *appName } } - return &applicationData, nil + return applicationData, nil } -func (r *PingOneApplicationRoleAssignmentResource) getApplicationRoleAssignmentData(appId string) (*map[string]string, error) { +func (r *PingOneApplicationRoleAssignmentResource) getApplicationRoleAssignmentData(appId string) (map[string]string, error) { applicationRoleAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationRoleAssignmentsApi.ReadApplicationRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() + applicationRoleAssignments, err := common.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadApplicationRoleAssignments", "GetRoleAssignments", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadApplicationRoleAssignments", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, roleAssignment := range embedded.GetRoleAssignments() { - roleAssignmentId, roleAssignmentIdOk := roleAssignment.GetIdOk() - roleAssignmentRole, roleAssignmentRoleOk := roleAssignment.GetRoleOk() + for _, roleAssignment := range applicationRoleAssignments { + roleAssignmentId, roleAssignmentIdOk := roleAssignment.GetIdOk() + roleAssignmentRole, roleAssignmentRoleOk := roleAssignment.GetRoleOk() - if roleAssignmentIdOk && roleAssignmentRoleOk { - roleAssignmentRoleId, roleAssignmentRoleIdOk := roleAssignmentRole.GetIdOk() + if roleAssignmentIdOk && roleAssignmentRoleOk { + roleAssignmentRoleId, roleAssignmentRoleIdOk := roleAssignmentRole.GetIdOk() - if roleAssignmentRoleIdOk { - applicationRoleAssignmentData[*roleAssignmentId] = *roleAssignmentRoleId - } + if roleAssignmentRoleIdOk { + applicationRoleAssignmentData[*roleAssignmentId] = *roleAssignmentRoleId } } } - return &applicationRoleAssignmentData, nil + return applicationRoleAssignmentData, nil } -func (r *PingOneApplicationRoleAssignmentResource) getRoleName(roleId string) (*management.EnumRoleName, error) { +func (r *PingOneApplicationRoleAssignmentResource) getRoleName(roleId string) (management.EnumRoleName, bool, error) { apiRole, resp, err := r.clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(r.clientInfo.Context, roleId).Execute() ok, err := common.HandleClientResponse(resp, err, "ReadOneRole", r.ResourceType()) if err != nil { - return nil, err + return "", false, err } if !ok { - return nil, nil + return "", false, nil } if apiRole != nil { apiRoleName, apiRoleNameOk := apiRole.GetNameOk() if apiRoleNameOk { - return apiRoleName, nil + return *apiRoleName, true, nil } } - return nil, fmt.Errorf("Unable to get role name for role ID: %s", roleId) + return "", false, fmt.Errorf("Unable to get role name for role ID: %s", roleId) } diff --git a/internal/connector/pingone/sso/resources/pingone_application_secret.go b/internal/connector/pingone/sso/resources/pingone_application_secret.go index d773b0a1..206cce11 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_secret.go +++ b/internal/connector/pingone/sso/resources/pingone_application_secret.go @@ -3,9 +3,11 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" + "github.com/pingidentity/pingcli/internal/output" ) // Verify that the resource satisfies the exportable resource interface @@ -39,7 +41,7 @@ func (r *PingOneApplicationSecretResource) ExportAll() (*[]connector.ImportBlock return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { ok, err := r.checkApplicationSecretData(appId) if err != nil { return nil, err @@ -69,82 +71,70 @@ func (r *PingOneApplicationSecretResource) ExportAll() (*[]connector.ImportBlock return &importBlocks, nil } -func (r *PingOneApplicationSecretResource) getApplicationData() (*map[string]string, error) { +func (r *PingOneApplicationSecretResource) getApplicationData() (map[string]string, error) { applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, app := range applications { + var ( + appId *string + appIdOk bool + appName *string + appNameOk bool + ) + + switch { + case app.ApplicationOIDC != nil: + appId, appIdOk = app.ApplicationOIDC.GetIdOk() + appName, appNameOk = app.ApplicationOIDC.GetNameOk() + case app.ApplicationSAML != nil: + appId, appIdOk = app.ApplicationSAML.GetIdOk() + appName, appNameOk = app.ApplicationSAML.GetNameOk() + case app.ApplicationExternalLink != nil: + appId, appIdOk = app.ApplicationExternalLink.GetIdOk() + appName, appNameOk = app.ApplicationExternalLink.GetNameOk() + default: + continue } - for _, app := range embedded.GetApplications() { - var ( - appId *string - appIdOk bool - appName *string - appNameOk bool - ) - - switch { - case app.ApplicationOIDC != nil: - appId, appIdOk = app.ApplicationOIDC.GetIdOk() - appName, appNameOk = app.ApplicationOIDC.GetNameOk() - case app.ApplicationSAML != nil: - appId, appIdOk = app.ApplicationSAML.GetIdOk() - appName, appNameOk = app.ApplicationSAML.GetNameOk() - case app.ApplicationExternalLink != nil: - appId, appIdOk = app.ApplicationExternalLink.GetIdOk() - appName, appNameOk = app.ApplicationExternalLink.GetNameOk() - default: - continue - } - - if appIdOk && appNameOk { - applicationData[*appId] = *appName - } + if appIdOk && appNameOk { + applicationData[*appId] = *appName } } - return &applicationData, nil + return applicationData, nil } func (r *PingOneApplicationSecretResource) checkApplicationSecretData(appId string) (bool, error) { - l := logger.Get() - // The platform enforces that worker apps cannot read their own secret // Make sure we can read the secret before adding it to the import blocks _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationSecretApi.ReadApplicationSecret(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() + defer response.Body.Close() // If the appId is the same as the worker ID, make sure the API response is a 403 and ignore the error if appId == *r.clientInfo.ApiClientId { if response.StatusCode == 403 { return false, nil } else { - return false, fmt.Errorf("ReadApplicationSecret: Expected response code 403 - worker apps cannot read their own secret, actual response code: %d", response.StatusCode) + return false, fmt.Errorf("Error: Expected 403 Forbidden response - worker apps cannot read their own secret\n%s Response Code: %s\nResponse Body: %s", "ReadApplicationSecret", response.Status, response.Body) } } // Use output package to warn the user of any errors or non-200 response codes // Expected behavior in this case is to skip the resource, and continue exporting the other resources - defer response.Body.Close() - if err != nil || response.StatusCode >= 300 || response.StatusCode < 200 { - l.Warn().Msgf("Failed to read secret for application %s. %s Response Code: %s\nResponse Body: %s", appId, "ReadApplicationSecret", response.Status, response.Body) + output.Warn("Failed to read secret for application", map[string]interface{}{ + "Application ID": appId, + "API function name": "ReadApplicationSecret", + "Response Code": response.Status, + "Response Body": response.Body, + }) + return false, nil } return true, nil diff --git a/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go index 27827f4a..1dc6ae1d 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,30 +40,33 @@ func (r *PingOneApplicationSignOnPolicyAssignmentResource) ExportAll() (*[]conne return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { signOnPolicyAssignmentData, err := r.getApplicationSignOnPolicyAssignmentData(appId) if err != nil { return nil, err } - for signOnPolicyAssignmentId, signOnPolicyId := range *signOnPolicyAssignmentData { - signOnPolicyName, err := r.getSignOnPolicyName(signOnPolicyId) + for signOnPolicyAssignmentId, signOnPolicyId := range signOnPolicyAssignmentData { + signOnPolicyName, signOnPolicyNameOk, err := r.getSignOnPolicyName(signOnPolicyId) if err != nil { return nil, err } + if !signOnPolicyNameOk { + continue + } commentData := map[string]string{ "Resource Type": r.ResourceType(), "Application ID": appId, "Application Name": appName, "Application Sign-On Policy Assignment ID": signOnPolicyAssignmentId, - "Application Sign-On Policy Name": *signOnPolicyName, + "Application Sign-On Policy Name": signOnPolicyName, "Export Environment ID": r.clientInfo.ExportEnvironmentID, } importBlock := connector.ImportBlock{ ResourceType: r.ResourceType(), - ResourceName: fmt.Sprintf("%s_%s", appName, *signOnPolicyName), + ResourceName: fmt.Sprintf("%s_%s", appName, signOnPolicyName), ResourceID: fmt.Sprintf("%s/%s/%s", r.clientInfo.ExportEnvironmentID, appId, signOnPolicyAssignmentId), CommentInformation: common.GenerateCommentInformation(commentData), } @@ -74,117 +78,87 @@ func (r *PingOneApplicationSignOnPolicyAssignmentResource) ExportAll() (*[]conne return &importBlocks, nil } -func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationData() (*map[string]string, error) { +func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationData() (map[string]string, error) { applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllApplications", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, app := range applications { + var ( + appId *string + appIdOk bool + appName *string + appNameOk bool + ) + + switch { + case app.ApplicationOIDC != nil: + appId, appIdOk = app.ApplicationOIDC.GetIdOk() + appName, appNameOk = app.ApplicationOIDC.GetNameOk() + case app.ApplicationSAML != nil: + appId, appIdOk = app.ApplicationSAML.GetIdOk() + appName, appNameOk = app.ApplicationSAML.GetNameOk() + case app.ApplicationExternalLink != nil: + appId, appIdOk = app.ApplicationExternalLink.GetIdOk() + appName, appNameOk = app.ApplicationExternalLink.GetNameOk() + default: + continue } - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, app := range embedded.GetApplications() { - var ( - appId *string - appIdOk bool - appName *string - appNameOk bool - ) - - switch { - case app.ApplicationOIDC != nil: - appId, appIdOk = app.ApplicationOIDC.GetIdOk() - appName, appNameOk = app.ApplicationOIDC.GetNameOk() - case app.ApplicationSAML != nil: - appId, appIdOk = app.ApplicationSAML.GetIdOk() - appName, appNameOk = app.ApplicationSAML.GetNameOk() - case app.ApplicationExternalLink != nil: - appId, appIdOk = app.ApplicationExternalLink.GetIdOk() - appName, appNameOk = app.ApplicationExternalLink.GetNameOk() - default: - continue - } - - if appIdOk && appNameOk { - applicationData[*appId] = *appName - } + if appIdOk && appNameOk { + applicationData[*appId] = *appName } } - return &applicationData, nil + return applicationData, nil } -func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationSignOnPolicyAssignmentData(appId string) (*map[string]string, error) { +func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationSignOnPolicyAssignmentData(appId string) (map[string]string, error) { signOnPolicyAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationSignOnPolicyAssignmentsApi.ReadAllSignOnPolicyAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() + signOnPolicyAssignments, err := common.GetManagementAPIObjectsFromIterator[management.SignOnPolicyAssignment](iter, "ReadAllSignOnPolicyAssignments", "GetSignOnPolicyAssignments", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicyAssignments", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, signOnPolicyAssignment := range embedded.GetSignOnPolicyAssignments() { - signOnPolicyAssignmentId, signOnPolicyAssignmentIdOk := signOnPolicyAssignment.GetIdOk() - signOnPolicyAssignmentSignOnPolicy, signOnPolicyAssignmentSignOnPolicyOk := signOnPolicyAssignment.GetSignOnPolicyOk() + for _, signOnPolicyAssignment := range signOnPolicyAssignments { + signOnPolicyAssignmentId, signOnPolicyAssignmentIdOk := signOnPolicyAssignment.GetIdOk() + signOnPolicyAssignmentSignOnPolicy, signOnPolicyAssignmentSignOnPolicyOk := signOnPolicyAssignment.GetSignOnPolicyOk() - if signOnPolicyAssignmentIdOk && signOnPolicyAssignmentSignOnPolicyOk { - signOnPolicyAssignmentSignOnPolicyId, signOnPolicyAssignmentSignOnPolicyIdOk := signOnPolicyAssignmentSignOnPolicy.GetIdOk() + if signOnPolicyAssignmentIdOk && signOnPolicyAssignmentSignOnPolicyOk { + signOnPolicyAssignmentSignOnPolicyId, signOnPolicyAssignmentSignOnPolicyIdOk := signOnPolicyAssignmentSignOnPolicy.GetIdOk() - if signOnPolicyAssignmentSignOnPolicyIdOk { - signOnPolicyAssignmentData[*signOnPolicyAssignmentId] = *signOnPolicyAssignmentSignOnPolicyId - } + if signOnPolicyAssignmentSignOnPolicyIdOk { + signOnPolicyAssignmentData[*signOnPolicyAssignmentId] = *signOnPolicyAssignmentSignOnPolicyId } } } - return &signOnPolicyAssignmentData, nil + return signOnPolicyAssignmentData, nil } -func (r *PingOneApplicationSignOnPolicyAssignmentResource) getSignOnPolicyName(signOnPolicyId string) (*string, error) { +func (r *PingOneApplicationSignOnPolicyAssignmentResource) getSignOnPolicyName(signOnPolicyId string) (string, bool, error) { signOnPolicy, response, err := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPoliciesApi.ReadOneSignOnPolicy(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, signOnPolicyId).Execute() ok, err := common.HandleClientResponse(response, err, "ReadOneSignOnPolicy", r.ResourceType()) if err != nil { - return nil, err + return "", false, err } if !ok { - return nil, nil + return "", false, nil } if signOnPolicy != nil { signOnPolicyName, signOnPolicyNameOk := signOnPolicy.GetNameOk() if signOnPolicyNameOk { - return signOnPolicyName, nil + return *signOnPolicyName, true, nil } } - return nil, fmt.Errorf("Unable to get sign-on policy name for sign-on policy ID: %s", signOnPolicyId) + return "", false, fmt.Errorf("Unable to get sign-on policy name for sign-on policy ID: %s", signOnPolicyId) } diff --git a/internal/connector/pingone/sso/resources/pingone_group.go b/internal/connector/pingone/sso/resources/pingone_group.go index f2ef4e5d..4bbfba89 100644 --- a/internal/connector/pingone/sso/resources/pingone_group.go +++ b/internal/connector/pingone/sso/resources/pingone_group.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,7 +40,7 @@ func (r *PingOneGroupResource) ExportAll() (*[]connector.ImportBlock, error) { return nil, err } - for groupId, groupName := range *groupData { + for groupId, groupName := range groupData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Group ID": groupId, @@ -60,38 +61,23 @@ func (r *PingOneGroupResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func (r *PingOneGroupResource) getGroupData() (*map[string]string, error) { +func (r *PingOneGroupResource) getGroupData() (map[string]string, error) { groupData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + groups, err := common.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, group := range embedded.GetGroups() { - groupId, groupIdOk := group.GetIdOk() - groupName, groupNameOk := group.GetNameOk() + for _, group := range groups { + groupId, groupIdOk := group.GetIdOk() + groupName, groupNameOk := group.GetNameOk() - if groupIdOk && groupNameOk { - groupData[*groupId] = *groupName - } + if groupIdOk && groupNameOk { + groupData[*groupId] = *groupName } } - return &groupData, nil + return groupData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_group_nesting.go b/internal/connector/pingone/sso/resources/pingone_group_nesting.go index c04b54cc..cc99aca0 100644 --- a/internal/connector/pingone/sso/resources/pingone_group_nesting.go +++ b/internal/connector/pingone/sso/resources/pingone_group_nesting.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,13 +40,13 @@ func (r *PingOneGroupNestingResource) ExportAll() (*[]connector.ImportBlock, err return nil, err } - for parentGroupId, parentGroupName := range *groupData { + for parentGroupId, parentGroupName := range groupData { groupNestingData, err := r.getGroupNestingData(parentGroupId) if err != nil { return nil, err } - for nestedGroupId, nestedGroupName := range *groupNestingData { + for nestedGroupId, nestedGroupName := range groupNestingData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Nested Group ID": nestedGroupId, @@ -69,74 +70,44 @@ func (r *PingOneGroupNestingResource) ExportAll() (*[]connector.ImportBlock, err return &importBlocks, nil } -func (r *PingOneGroupNestingResource) getGroupData() (*map[string]string, error) { +func (r *PingOneGroupNestingResource) getGroupData() (map[string]string, error) { groupData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + groups, err := common.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, parentGroup := range embedded.GetGroups() { - parentGroupId, parentGroupIdOk := parentGroup.GetIdOk() - parentGroupName, parentGroupNameOk := parentGroup.GetNameOk() + for _, parentGroup := range groups { + parentGroupId, parentGroupIdOk := parentGroup.GetIdOk() + parentGroupName, parentGroupNameOk := parentGroup.GetNameOk() - if parentGroupIdOk && parentGroupNameOk { - groupData[*parentGroupId] = *parentGroupName - } + if parentGroupIdOk && parentGroupNameOk { + groupData[*parentGroupId] = *parentGroupName } } - return &groupData, nil + return groupData, nil } -func (r *PingOneGroupNestingResource) getGroupNestingData(parentGroupId string) (*map[string]string, error) { +func (r *PingOneGroupNestingResource) getGroupNestingData(parentGroupId string) (map[string]string, error) { groupNestingData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadGroupNesting(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, parentGroupId).Execute() + groupNestings, err := common.GetManagementAPIObjectsFromIterator[management.GroupMembership](iter, "ReadGroupNesting", "GetGroupMemberships", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGroupNesting", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, nestedGroup := range embedded.GetGroupMemberships() { - nestedGroupId, nestedGroupIdOk := nestedGroup.GetIdOk() - nestedGroupName, nestedGroupNameOk := nestedGroup.GetNameOk() + for _, nestedGroup := range groupNestings { + nestedGroupId, nestedGroupIdOk := nestedGroup.GetIdOk() + nestedGroupName, nestedGroupNameOk := nestedGroup.GetNameOk() - if nestedGroupIdOk && nestedGroupNameOk { - groupNestingData[*nestedGroupId] = *nestedGroupName - } + if nestedGroupIdOk && nestedGroupNameOk { + groupNestingData[*nestedGroupId] = *nestedGroupName } } - return &groupNestingData, nil + return groupNestingData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go b/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go index 11bd60a4..15384167 100644 --- a/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go @@ -40,17 +40,20 @@ func (r *PingOneGroupRoleAssignmentResource) ExportAll() (*[]connector.ImportBlo return nil, err } - for groupId, groupName := range *groupData { + for groupId, groupName := range groupData { groupRoleAssignmentData, err := r.getGroupRoleAssignmentData(groupId) if err != nil { return nil, err } - for groupRoleAssignmentId, roleId := range *groupRoleAssignmentData { + for groupRoleAssignmentId, roleId := range groupRoleAssignmentData { roleName, err := r.getRoleName(roleId) if err != nil { return nil, err } + if roleName == nil { + continue + } commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, @@ -75,80 +78,50 @@ func (r *PingOneGroupRoleAssignmentResource) ExportAll() (*[]connector.ImportBlo return &importBlocks, nil } -func (r *PingOneGroupRoleAssignmentResource) getGroupData() (*map[string]string, error) { +func (r *PingOneGroupRoleAssignmentResource) getGroupData() (map[string]string, error) { groupData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + groups, err := common.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllGroups", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, group := range embedded.GetGroups() { - groupId, groupIdOk := group.GetIdOk() - groupName, groupNameOk := group.GetNameOk() + for _, group := range groups { + groupId, groupIdOk := group.GetIdOk() + groupName, groupNameOk := group.GetNameOk() - if groupIdOk && groupNameOk { - groupData[*groupId] = *groupName - } + if groupIdOk && groupNameOk { + groupData[*groupId] = *groupName } } - return &groupData, nil + return groupData, nil } -func (r *PingOneGroupRoleAssignmentResource) getGroupRoleAssignmentData(groupId string) (*map[string]string, error) { +func (r *PingOneGroupRoleAssignmentResource) getGroupRoleAssignmentData(groupId string) (map[string]string, error) { groupRoleAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupRoleAssignmentsApi.ReadGroupRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, groupId).Execute() + roleAssignments, err := common.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadGroupRoleAssignments", "GetRoleAssignments", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadGroupRoleAssignments", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, groupRoleAssignment := range embedded.GetRoleAssignments() { - groupRoleAssignmentId, groupRoleAssignmentIdOk := groupRoleAssignment.GetIdOk() - groupRoleAssignmentRole, groupRoleAssignmentRoleOk := groupRoleAssignment.GetRoleOk() + for _, groupRoleAssignment := range roleAssignments { + groupRoleAssignmentId, groupRoleAssignmentIdOk := groupRoleAssignment.GetIdOk() + groupRoleAssignmentRole, groupRoleAssignmentRoleOk := groupRoleAssignment.GetRoleOk() - if groupRoleAssignmentIdOk && groupRoleAssignmentRoleOk { - groupRoleAssignmentRoleId, groupRoleAssignmentRoleIdOk := groupRoleAssignmentRole.GetIdOk() + if groupRoleAssignmentIdOk && groupRoleAssignmentRoleOk { + groupRoleAssignmentRoleId, groupRoleAssignmentRoleIdOk := groupRoleAssignmentRole.GetIdOk() - if groupRoleAssignmentRoleIdOk { - groupRoleAssignmentData[*groupRoleAssignmentId] = *groupRoleAssignmentRoleId - } + if groupRoleAssignmentRoleIdOk { + groupRoleAssignmentData[*groupRoleAssignmentId] = *groupRoleAssignmentRoleId } } } - return &groupRoleAssignmentData, nil + return groupRoleAssignmentData, nil } func (r *PingOneGroupRoleAssignmentResource) getRoleName(roleId string) (*management.EnumRoleName, error) { diff --git a/internal/connector/pingone/sso/resources/pingone_identity_provider.go b/internal/connector/pingone/sso/resources/pingone_identity_provider.go index 74ba8f37..446250c0 100644 --- a/internal/connector/pingone/sso/resources/pingone_identity_provider.go +++ b/internal/connector/pingone/sso/resources/pingone_identity_provider.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,7 +40,7 @@ func (r *PingOneIdentityProviderResource) ExportAll() (*[]connector.ImportBlock, return nil, err } - for idpId, idpName := range *identityProviderData { + for idpId, idpName := range identityProviderData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Identity Provider ID": idpId, @@ -60,65 +61,50 @@ func (r *PingOneIdentityProviderResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingOneIdentityProviderResource) getIdentityProviderData() (*map[string]string, error) { +func (r *PingOneIdentityProviderResource) getIdentityProviderData() (map[string]string, error) { identityProviderData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProvidersApi.ReadAllIdentityProviders(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + identityProviders, err := common.GetManagementAPIObjectsFromIterator[management.IdentityProvider](iter, "ReadAllIdentityProviders", "GetIdentityProviders", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviders", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, idp := range identityProviders { + var ( + idpId *string + idpIdOk bool + idpName *string + idpNameOk bool + ) + + switch { + case idp.IdentityProviderApple != nil: + idpId, idpIdOk = idp.IdentityProviderApple.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderApple.GetNameOk() + case idp.IdentityProviderClientIDClientSecret != nil: + idpId, idpIdOk = idp.IdentityProviderClientIDClientSecret.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderClientIDClientSecret.GetNameOk() + case idp.IdentityProviderFacebook != nil: + idpId, idpIdOk = idp.IdentityProviderFacebook.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderFacebook.GetNameOk() + case idp.IdentityProviderOIDC != nil: + idpId, idpIdOk = idp.IdentityProviderOIDC.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderOIDC.GetNameOk() + case idp.IdentityProviderPaypal != nil: + idpId, idpIdOk = idp.IdentityProviderPaypal.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderPaypal.GetNameOk() + case idp.IdentityProviderSAML != nil: + idpId, idpIdOk = idp.IdentityProviderSAML.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderSAML.GetNameOk() + default: + continue } - for _, idp := range embedded.GetIdentityProviders() { - var ( - idpId *string - idpIdOk bool - idpName *string - idpNameOk bool - ) - - switch { - case idp.IdentityProviderApple != nil: - idpId, idpIdOk = idp.IdentityProviderApple.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderApple.GetNameOk() - case idp.IdentityProviderClientIDClientSecret != nil: - idpId, idpIdOk = idp.IdentityProviderClientIDClientSecret.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderClientIDClientSecret.GetNameOk() - case idp.IdentityProviderFacebook != nil: - idpId, idpIdOk = idp.IdentityProviderFacebook.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderFacebook.GetNameOk() - case idp.IdentityProviderOIDC != nil: - idpId, idpIdOk = idp.IdentityProviderOIDC.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderOIDC.GetNameOk() - case idp.IdentityProviderPaypal != nil: - idpId, idpIdOk = idp.IdentityProviderPaypal.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderPaypal.GetNameOk() - case idp.IdentityProviderSAML != nil: - idpId, idpIdOk = idp.IdentityProviderSAML.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderSAML.GetNameOk() - default: - continue - } - - if idpIdOk && idpNameOk { - identityProviderData[*idpId] = *idpName - } + if idpIdOk && idpNameOk { + identityProviderData[*idpId] = *idpName } } - return &identityProviderData, nil + return identityProviderData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go b/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go index 8c67a6d9..ddc87010 100644 --- a/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,13 +40,13 @@ func (r *PingOneIdentityProviderAttributeResource) ExportAll() (*[]connector.Imp return nil, err } - for idpId, idpName := range *identityProviderData { + for idpId, idpName := range identityProviderData { identityProviderAttributeData, err := r.getIdentityProviderAttributeData(idpId) if err != nil { return nil, err } - for idpAttributeId, idpAttributeName := range *identityProviderAttributeData { + for idpAttributeId, idpAttributeName := range identityProviderAttributeData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Identity Provider Attribute ID": idpAttributeId, @@ -69,95 +70,67 @@ func (r *PingOneIdentityProviderAttributeResource) ExportAll() (*[]connector.Imp return &importBlocks, nil } -func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderData() (*map[string]string, error) { +func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderData() (map[string]string, error) { identityProviderData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProvidersApi.ReadAllIdentityProviders(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + identityProviders, err := common.GetManagementAPIObjectsFromIterator[management.IdentityProvider](iter, "ReadAllIdentityProviders", "GetIdentityProviders", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviders", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, idp := range identityProviders { + var ( + idpId *string + idpIdOk bool + idpName *string + idpNameOk bool + ) + + switch { + case idp.IdentityProviderApple != nil: + idpId, idpIdOk = idp.IdentityProviderApple.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderApple.GetNameOk() + case idp.IdentityProviderClientIDClientSecret != nil: + idpId, idpIdOk = idp.IdentityProviderClientIDClientSecret.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderClientIDClientSecret.GetNameOk() + case idp.IdentityProviderFacebook != nil: + idpId, idpIdOk = idp.IdentityProviderFacebook.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderFacebook.GetNameOk() + case idp.IdentityProviderOIDC != nil: + idpId, idpIdOk = idp.IdentityProviderOIDC.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderOIDC.GetNameOk() + case idp.IdentityProviderPaypal != nil: + idpId, idpIdOk = idp.IdentityProviderPaypal.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderPaypal.GetNameOk() + case idp.IdentityProviderSAML != nil: + idpId, idpIdOk = idp.IdentityProviderSAML.GetIdOk() + idpName, idpNameOk = idp.IdentityProviderSAML.GetNameOk() + default: + continue } - for _, idp := range embedded.GetIdentityProviders() { - var ( - idpId *string - idpIdOk bool - idpName *string - idpNameOk bool - ) - - switch { - case idp.IdentityProviderApple != nil: - idpId, idpIdOk = idp.IdentityProviderApple.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderApple.GetNameOk() - case idp.IdentityProviderClientIDClientSecret != nil: - idpId, idpIdOk = idp.IdentityProviderClientIDClientSecret.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderClientIDClientSecret.GetNameOk() - case idp.IdentityProviderFacebook != nil: - idpId, idpIdOk = idp.IdentityProviderFacebook.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderFacebook.GetNameOk() - case idp.IdentityProviderOIDC != nil: - idpId, idpIdOk = idp.IdentityProviderOIDC.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderOIDC.GetNameOk() - case idp.IdentityProviderPaypal != nil: - idpId, idpIdOk = idp.IdentityProviderPaypal.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderPaypal.GetNameOk() - case idp.IdentityProviderSAML != nil: - idpId, idpIdOk = idp.IdentityProviderSAML.GetIdOk() - idpName, idpNameOk = idp.IdentityProviderSAML.GetNameOk() - default: - continue - } - - if idpIdOk && idpNameOk { - identityProviderData[*idpId] = *idpName - } + if idpIdOk && idpNameOk { + identityProviderData[*idpId] = *idpName } } - return &identityProviderData, nil + return identityProviderData, nil } -func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderAttributeData(idpId string) (*map[string]string, error) { +func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderAttributeData(idpId string) (map[string]string, error) { identityProviderAttributeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProviderAttributesApi.ReadAllIdentityProviderAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, idpId).Execute() + attributeInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllIdentityProviderAttributes", "GetAttributes", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllIdentityProviderAttributes", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, idpAttribute := range embedded.GetAttributes() { - idpAttributeId, idpAttributeIdOk := idpAttribute.IdentityProviderAttribute.GetIdOk() - idpAttributeName, idpAttributeNameOk := idpAttribute.IdentityProviderAttribute.GetNameOk() + for _, attributeInners := range attributeInners { + if attributeInners.IdentityProviderAttribute != nil { + idpAttributeId, idpAttributeIdOk := attributeInners.IdentityProviderAttribute.GetIdOk() + idpAttributeName, idpAttributeNameOk := attributeInners.IdentityProviderAttribute.GetNameOk() if idpAttributeIdOk && idpAttributeNameOk { identityProviderAttributeData[*idpAttributeId] = *idpAttributeName @@ -165,5 +138,5 @@ func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderAttributeD } } - return &identityProviderAttributeData, nil + return identityProviderAttributeData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_password_policy.go b/internal/connector/pingone/sso/resources/pingone_password_policy.go index 9fc61a01..6b265b8d 100644 --- a/internal/connector/pingone/sso/resources/pingone_password_policy.go +++ b/internal/connector/pingone/sso/resources/pingone_password_policy.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,7 +40,7 @@ func (r *PingOnePasswordPolicyResource) ExportAll() (*[]connector.ImportBlock, e return nil, err } - for passwordPolicyId, passwordPolicyName := range *passwordPolicyData { + for passwordPolicyId, passwordPolicyName := range passwordPolicyData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Password Policy ID": passwordPolicyId, @@ -60,38 +61,23 @@ func (r *PingOnePasswordPolicyResource) ExportAll() (*[]connector.ImportBlock, e return &importBlocks, nil } -func (r *PingOnePasswordPolicyResource) getPasswordPolicyData() (*map[string]string, error) { +func (r *PingOnePasswordPolicyResource) getPasswordPolicyData() (map[string]string, error) { passwordPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.PasswordPoliciesApi.ReadAllPasswordPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + passwordPolicies, err := common.GetManagementAPIObjectsFromIterator[management.PasswordPolicy](iter, "ReadAllPasswordPolicies", "GetPasswordPolicies", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPasswordPolicies", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, passwordPolicy := range embedded.GetPasswordPolicies() { - passwordPolicyId, passwordPolicyIdOk := passwordPolicy.GetIdOk() - passwordPolicyName, passwordPolicyNameOk := passwordPolicy.GetNameOk() + for _, passwordPolicy := range passwordPolicies { + passwordPolicyId, passwordPolicyIdOk := passwordPolicy.GetIdOk() + passwordPolicyName, passwordPolicyNameOk := passwordPolicy.GetNameOk() - if passwordPolicyIdOk && passwordPolicyNameOk { - passwordPolicyData[*passwordPolicyId] = *passwordPolicyName - } + if passwordPolicyIdOk && passwordPolicyNameOk { + passwordPolicyData[*passwordPolicyId] = *passwordPolicyName } } - return &passwordPolicyData, nil + return passwordPolicyData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_population.go b/internal/connector/pingone/sso/resources/pingone_population.go index 2ce63d66..478927c9 100644 --- a/internal/connector/pingone/sso/resources/pingone_population.go +++ b/internal/connector/pingone/sso/resources/pingone_population.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,7 +40,7 @@ func (r *PingOnePopulationResource) ExportAll() (*[]connector.ImportBlock, error return nil, err } - for populationId, populationName := range *populationData { + for populationId, populationName := range populationData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Population ID": populationId, @@ -60,38 +61,23 @@ func (r *PingOnePopulationResource) ExportAll() (*[]connector.ImportBlock, error return &importBlocks, nil } -func (r *PingOnePopulationResource) getPopulationData() (*map[string]string, error) { +func (r *PingOnePopulationResource) getPopulationData() (map[string]string, error) { populationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.PopulationsApi.ReadAllPopulations(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + populations, err := common.GetManagementAPIObjectsFromIterator[management.Population](iter, "ReadAllPopulations", "GetPopulations", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPopulations", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, population := range embedded.GetPopulations() { - populationId, populationIdOk := population.GetIdOk() - populationName, populationNameOk := population.GetNameOk() + for _, population := range populations { + populationId, populationIdOk := population.GetIdOk() + populationName, populationNameOk := population.GetNameOk() - if populationIdOk && populationNameOk { - populationData[*populationId] = *populationName - } + if populationIdOk && populationNameOk { + populationData[*populationId] = *populationName } } - return &populationData, nil + return populationData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_population_default.go b/internal/connector/pingone/sso/resources/pingone_population_default.go index a471b894..ffad3fef 100644 --- a/internal/connector/pingone/sso/resources/pingone_population_default.go +++ b/internal/connector/pingone/sso/resources/pingone_population_default.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -59,34 +60,19 @@ func (r *PingOnePopulationDefaultResource) ExportAll() (*[]connector.ImportBlock func (r *PingOnePopulationDefaultResource) getDefaultPopulationName() (*string, error) { iter := r.clientInfo.ApiClient.ManagementAPIClient.PopulationsApi.ReadAllPopulations(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + populations, err := common.GetManagementAPIObjectsFromIterator[management.Population](iter, "ReadAllPopulations", "GetPopulations", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllPopulations", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, population := range embedded.GetPopulations() { - populationDefault, populationDefaultOk := population.GetDefaultOk() + for _, population := range populations { + populationDefault, populationDefaultOk := population.GetDefaultOk() - if populationDefaultOk && *populationDefault { - populationName, populationNameOk := population.GetNameOk() + if populationDefaultOk && *populationDefault { + populationName, populationNameOk := population.GetNameOk() - if populationNameOk { - return populationName, nil - } + if populationNameOk { + return populationName, nil } } } diff --git a/internal/connector/pingone/sso/resources/pingone_resource.go b/internal/connector/pingone/sso/resources/pingone_resource.go index 4c843e64..17b2605a 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource.go +++ b/internal/connector/pingone/sso/resources/pingone_resource.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,7 +40,7 @@ func (r *PingOneResourceResource) ExportAll() (*[]connector.ImportBlock, error) return nil, err } - for resourceId, resourceName := range *resourceData { + for resourceId, resourceName := range resourceData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource ID": resourceId, @@ -60,40 +61,25 @@ func (r *PingOneResourceResource) ExportAll() (*[]connector.ImportBlock, error) return &importBlocks, nil } -func (r *PingOneResourceResource) getResourceData() (*map[string]string, error) { +func (r *PingOneResourceResource) getResourceData() (map[string]string, error) { resourceData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, resourceInner := range embedded.GetResources() { - if resourceInner.Resource != nil { - resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() - resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() + for _, resourceInner := range resourceInners { + if resourceInner.Resource != nil { + resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() + resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() - if resourceIdOk && resourceNameOk { - resourceData[*resourceId] = *resourceName - } + if resourceIdOk && resourceNameOk { + resourceData[*resourceId] = *resourceName } } } - return &resourceData, nil + return resourceData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_resource_attribute.go b/internal/connector/pingone/sso/resources/pingone_resource_attribute.go index b53898ff..5045ae1a 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_attribute.go @@ -40,7 +40,7 @@ func (r *PingOneResourceAttributeResource) ExportAll() (*[]connector.ImportBlock return nil, err } - for resourceId, resourceNameAndType := range *resourceData { + for resourceId, resourceNameAndType := range resourceData { resourceName := resourceNameAndType[0] resourceType := resourceNameAndType[1] @@ -49,7 +49,7 @@ func (r *PingOneResourceAttributeResource) ExportAll() (*[]connector.ImportBlock return nil, err } - for resourceAttributeId, resourceAttributeName := range *resourceAttributeData { + for resourceAttributeId, resourceAttributeName := range resourceAttributeData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Attribute ID": resourceAttributeId, @@ -73,95 +73,65 @@ func (r *PingOneResourceAttributeResource) ExportAll() (*[]connector.ImportBlock return &importBlocks, nil } -func (r *PingOneResourceAttributeResource) getResourceData() (*map[string][]string, error) { +func (r *PingOneResourceAttributeResource) getResourceData() (map[string][]string, error) { resourceData := make(map[string][]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, resourceInner := range embedded.GetResources() { - if resourceInner.Resource != nil { - resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() - resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() - resourceType, resourceTypeOk := resourceInner.Resource.GetTypeOk() + for _, resourceInner := range resourceInners { + if resourceInner.Resource != nil { + resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() + resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() + resourceType, resourceTypeOk := resourceInner.Resource.GetTypeOk() - if resourceIdOk && resourceNameOk && resourceTypeOk { - resourceData[*resourceId] = []string{*resourceName, string(*resourceType)} - } + if resourceIdOk && resourceNameOk && resourceTypeOk { + resourceData[*resourceId] = []string{*resourceName, string(*resourceType)} } } } - return &resourceData, nil + return resourceData, nil } -func (r *PingOneResourceAttributeResource) getResourceAttributeData(resourceId string, resourceType string) (*map[string]string, error) { +func (r *PingOneResourceAttributeResource) getResourceAttributeData(resourceId string, resourceType string) (map[string]string, error) { resourceAttributeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceAttributesApi.ReadAllResourceAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() + attributeInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllResourceAttributes", "GetAttributes", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceAttributes", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, attributeInner := range embedded.GetAttributes() { - if attributeInner.ResourceAttribute != nil { - resourceAttributeId, resourceAttributeIdOk := attributeInner.ResourceAttribute.GetIdOk() - resourceAttributeName, resourceAttributeNameOk := attributeInner.ResourceAttribute.GetNameOk() - resourceAttributeType, resourceAttributeTypeOk := attributeInner.ResourceAttribute.GetTypeOk() - - if resourceAttributeIdOk && resourceAttributeNameOk && resourceAttributeTypeOk { - // Any CORE attribute is required and cannot be overridden - // Do not export CORE attributes - // There is one exception where a CUSTOM resource can override the sub CORE attribute - if *resourceAttributeType == management.ENUMRESOURCEATTRIBUTETYPE_CORE { - if resourceType == string(management.ENUMRESOURCETYPE_CUSTOM) { - // Skip export of all CORE attributes except for the sub attribute for CUSTOM resources - if *resourceAttributeName != "sub" { - continue - } - } else { - // Skip export of all CORE attributes for non-CUSTOM resources + for _, attributeInner := range attributeInners { + if attributeInner.ResourceAttribute != nil { + resourceAttributeId, resourceAttributeIdOk := attributeInner.ResourceAttribute.GetIdOk() + resourceAttributeName, resourceAttributeNameOk := attributeInner.ResourceAttribute.GetNameOk() + resourceAttributeType, resourceAttributeTypeOk := attributeInner.ResourceAttribute.GetTypeOk() + + if resourceAttributeIdOk && resourceAttributeNameOk && resourceAttributeTypeOk { + // Any CORE attribute is required and cannot be overridden + // Do not export CORE attributes + // There is one exception where a CUSTOM resource can override the sub CORE attribute + if *resourceAttributeType == management.ENUMRESOURCEATTRIBUTETYPE_CORE { + if resourceType == string(management.ENUMRESOURCETYPE_CUSTOM) { + // Skip export of all CORE attributes except for the sub attribute for CUSTOM resources + if *resourceAttributeName != "sub" { continue } + } else { + // Skip export of all CORE attributes for non-CUSTOM resources + continue } - - resourceAttributeData[*resourceAttributeId] = *resourceAttributeName } + + resourceAttributeData[*resourceAttributeId] = *resourceAttributeName } } } - return &resourceAttributeData, nil + return resourceAttributeData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope.go b/internal/connector/pingone/sso/resources/pingone_resource_scope.go index 00de782c..6cf45770 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope.go @@ -40,13 +40,13 @@ func (r *PingOneResourceScopeResource) ExportAll() (*[]connector.ImportBlock, er return nil, err } - for resourceId, resourceName := range *resourceData { + for resourceId, resourceName := range resourceData { resourceScopeData, err := r.getResourceScopeData(resourceId) if err != nil { return nil, err } - for resourceScopeId, resourceScopeName := range *resourceScopeData { + for resourceScopeId, resourceScopeName := range resourceScopeData { commentData := map[string]string{ "Custom Resource ID": resourceId, "Custom Resource Name": resourceName, @@ -70,76 +70,46 @@ func (r *PingOneResourceScopeResource) ExportAll() (*[]connector.ImportBlock, er return &importBlocks, nil } -func (r *PingOneResourceScopeResource) getResourceData() (*map[string]string, error) { +func (r *PingOneResourceScopeResource) getResourceData() (map[string]string, error) { resourceData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, resourceInner := range embedded.GetResources() { - if resourceInner.Resource != nil { - resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() - resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() - resourceType, resourceTypeOk := resourceInner.Resource.GetTypeOk() + for _, resourceInner := range resourceInners { + if resourceInner.Resource != nil { + resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() + resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() + resourceType, resourceTypeOk := resourceInner.Resource.GetTypeOk() - if resourceIdOk && resourceNameOk && resourceTypeOk && *resourceType == management.ENUMRESOURCETYPE_CUSTOM { - resourceData[*resourceId] = *resourceName - } + if resourceIdOk && resourceNameOk && resourceTypeOk && *resourceType == management.ENUMRESOURCETYPE_CUSTOM { + resourceData[*resourceId] = *resourceName } } } - return &resourceData, nil + return resourceData, nil } -func (r *PingOneResourceScopeResource) getResourceScopeData(resourceId string) (*map[string]string, error) { +func (r *PingOneResourceScopeResource) getResourceScopeData(resourceId string) (map[string]string, error) { resourceScopeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() + resourceScopes, err := common.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, scope := range embedded.GetScopes() { - scopeId, scopeIdOk := scope.GetIdOk() - scopeName, scopeNameOk := scope.GetNameOk() - if scopeIdOk && scopeNameOk { - resourceScopeData[*scopeId] = *scopeName - } + for _, scope := range resourceScopes { + scopeId, scopeIdOk := scope.GetIdOk() + scopeName, scopeNameOk := scope.GetNameOk() + if scopeIdOk && scopeNameOk { + resourceScopeData[*scopeId] = *scopeName } } - return &resourceScopeData, nil + return resourceScopeData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go b/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go index b182eb6b..853b8cea 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go @@ -40,13 +40,13 @@ func (r *PingOneResourceScopeOpenIdResource) ExportAll() (*[]connector.ImportBlo return nil, err } - for resourceId, resourceName := range *resourceData { + for resourceId, resourceName := range resourceData { resourceScopeData, err := r.getResourceScopeData(resourceId) if err != nil { return nil, err } - for resourceScopeId, resourceScopeName := range *resourceScopeData { + for resourceScopeId, resourceScopeName := range resourceScopeData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "OpenID Connect Resource Name": resourceName, @@ -69,77 +69,47 @@ func (r *PingOneResourceScopeOpenIdResource) ExportAll() (*[]connector.ImportBlo return &importBlocks, nil } -func (r *PingOneResourceScopeOpenIdResource) getResourceData() (*map[string]string, error) { +func (r *PingOneResourceScopeOpenIdResource) getResourceData() (map[string]string, error) { resourceData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, resourceInner := range embedded.GetResources() { - if resourceInner.Resource != nil { - resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() - resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() - resourceType, resourceTypeOk := resourceInner.Resource.GetTypeOk() + for _, resourceInner := range resourceInners { + if resourceInner.Resource != nil { + resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() + resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() + resourceType, resourceTypeOk := resourceInner.Resource.GetTypeOk() - if resourceIdOk && resourceNameOk && resourceTypeOk && *resourceType == management.ENUMRESOURCETYPE_OPENID_CONNECT { - resourceData[*resourceId] = *resourceName - } + if resourceIdOk && resourceNameOk && resourceTypeOk && *resourceType == management.ENUMRESOURCETYPE_OPENID_CONNECT { + resourceData[*resourceId] = *resourceName } } } - return &resourceData, nil + return resourceData, nil } -func (r *PingOneResourceScopeOpenIdResource) getResourceScopeData(resourceId string) (*map[string]string, error) { +func (r *PingOneResourceScopeOpenIdResource) getResourceScopeData(resourceId string) (map[string]string, error) { resourceScopeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() + resourceScopes, err := common.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, scopeOpenId := range embedded.GetScopes() { - scopeOpenIdId, scopeOpenIdIdOk := scopeOpenId.GetIdOk() - scopeOpenIdName, scopeOpenIdNameOk := scopeOpenId.GetNameOk() + for _, scopeOpenId := range resourceScopes { + scopeOpenIdId, scopeOpenIdIdOk := scopeOpenId.GetIdOk() + scopeOpenIdName, scopeOpenIdNameOk := scopeOpenId.GetNameOk() - if scopeOpenIdIdOk && scopeOpenIdNameOk { - resourceScopeData[*scopeOpenIdId] = *scopeOpenIdName - } + if scopeOpenIdIdOk && scopeOpenIdNameOk { + resourceScopeData[*scopeOpenIdId] = *scopeOpenIdName } } - return &resourceScopeData, nil + return resourceScopeData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go b/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go index 99eeaf75..4e6f1e30 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go @@ -41,13 +41,13 @@ func (r *PingOneResourceScopePingOneApiResource) ExportAll() (*[]connector.Impor return nil, err } - for resourceId, resourceName := range *resourceData { + for resourceId, resourceName := range resourceData { resourceScopeData, err := r.getResourceScopeData(resourceId) if err != nil { return nil, err } - for resourceScopeId, resourceScopeName := range *resourceScopeData { + for resourceScopeId, resourceScopeName := range resourceScopeData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "PingOne API Resource Name": resourceName, @@ -70,84 +70,54 @@ func (r *PingOneResourceScopePingOneApiResource) ExportAll() (*[]connector.Impor return &importBlocks, nil } -func (r *PingOneResourceScopePingOneApiResource) getResourceData() (*map[string]string, error) { +func (r *PingOneResourceScopePingOneApiResource) getResourceData() (map[string]string, error) { resourceData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResources", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, resourceInner := range embedded.GetResources() { - if resourceInner.Resource != nil { - resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() - resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() - resourceType, resourceTypeOk := resourceInner.Resource.GetTypeOk() + for _, resourceInner := range resourceInners { + if resourceInner.Resource != nil { + resourceId, resourceIdOk := resourceInner.Resource.GetIdOk() + resourceName, resourceNameOk := resourceInner.Resource.GetNameOk() + resourceType, resourceTypeOk := resourceInner.Resource.GetTypeOk() - if resourceIdOk && resourceNameOk && resourceTypeOk && *resourceType == management.ENUMRESOURCETYPE_PINGONE_API { - resourceData[*resourceId] = *resourceName - } + if resourceIdOk && resourceNameOk && resourceTypeOk && *resourceType == management.ENUMRESOURCETYPE_PINGONE_API { + resourceData[*resourceId] = *resourceName } } } - return &resourceData, nil + return resourceData, nil } -func (r *PingOneResourceScopePingOneApiResource) getResourceScopeData(resourceId string) (*map[string]string, error) { +func (r *PingOneResourceScopePingOneApiResource) getResourceScopeData(resourceId string) (map[string]string, error) { resourceScopeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() + resourceScopes, err := common.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllResourceScopes", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, scopePingOneApi := range embedded.GetScopes() { - scopePingOneApiId, scopePingOneApiIdOk := scopePingOneApi.GetIdOk() - scopePingOneApiName, scopePingOneApiNameOk := scopePingOneApi.GetNameOk() + for _, scopePingOneApi := range resourceScopes { + scopePingOneApiId, scopePingOneApiIdOk := scopePingOneApi.GetIdOk() + scopePingOneApiName, scopePingOneApiNameOk := scopePingOneApi.GetNameOk() - if scopePingOneApiIdOk && scopePingOneApiNameOk { - // Make sure the scope name is in the form of one of the following four patterns - // p1:read:user, p1:update:user, p1:read:user:{suffix}, or p1:update:user:{suffix} - // as supported by https://registry.terraform.io/providers/pingidentity/pingone/latest/docs/resources/resource_scope_pingone_api - re := regexp.MustCompile(`^p1:(read|update):user(|:.+)$`) + if scopePingOneApiIdOk && scopePingOneApiNameOk { + // Make sure the scope name is in the form of one of the following four patterns + // p1:read:user, p1:update:user, p1:read:user:{suffix}, or p1:update:user:{suffix} + // as supported by https://registry.terraform.io/providers/pingidentity/pingone/latest/docs/resources/resource_scope_pingone_api + re := regexp.MustCompile(`^p1:(read|update):user(|:.+)$`) - if re.MatchString(*scopePingOneApiName) { - resourceScopeData[*scopePingOneApiId] = *scopePingOneApiName - } + if re.MatchString(*scopePingOneApiName) { + resourceScopeData[*scopePingOneApiId] = *scopePingOneApiName } } } - return &resourceScopeData, nil + return resourceScopeData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_schema_attribute.go b/internal/connector/pingone/sso/resources/pingone_schema_attribute.go index 515cdf02..83326310 100644 --- a/internal/connector/pingone/sso/resources/pingone_schema_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_schema_attribute.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,13 +40,13 @@ func (r *PingOneSchemaAttributeResource) ExportAll() (*[]connector.ImportBlock, return nil, err } - for schemaId, schemaName := range *schemaData { + for schemaId, schemaName := range schemaData { schemaAttributeData, err := r.getSchemaAttributeData(schemaId) if err != nil { return nil, err } - for schemaAttributeId, schemaAttributeName := range *schemaAttributeData { + for schemaAttributeId, schemaAttributeName := range schemaAttributeData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -69,72 +70,44 @@ func (r *PingOneSchemaAttributeResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingOneSchemaAttributeResource) getSchemaData() (*map[string]string, error) { +func (r *PingOneSchemaAttributeResource) getSchemaData() (map[string]string, error) { schemaData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SchemasApi.ReadAllSchemas(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + schemas, err := common.GetManagementAPIObjectsFromIterator[management.Schema](iter, "ReadAllSchemas", "GetSchemas", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSchemas", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, schema := range embedded.GetSchemas() { - schemaId, schemaIdOk := schema.GetIdOk() - schemaName, schemaNameOk := schema.GetNameOk() - if schemaIdOk && schemaNameOk { - schemaData[*schemaId] = *schemaName - } + for _, schema := range schemas { + schemaId, schemaIdOk := schema.GetIdOk() + schemaName, schemaNameOk := schema.GetNameOk() + if schemaIdOk && schemaNameOk { + schemaData[*schemaId] = *schemaName } } - return &schemaData, nil + return schemaData, nil } -func (r *PingOneSchemaAttributeResource) getSchemaAttributeData(schemaId string) (*map[string]string, error) { +func (r *PingOneSchemaAttributeResource) getSchemaAttributeData(schemaId string) (map[string]string, error) { schemaAttributeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SchemasApi.ReadAllSchemaAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, schemaId).Execute() + attributeInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllSchemaAttributes", "GetAttributes", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSchemaAttributes", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, schemaAttribute := range embedded.GetAttributes() { - schemaAttributeId, schemaAttributeIdOk := schemaAttribute.SchemaAttribute.GetIdOk() - schemaAttributeName, schemaAttributeNameOk := schemaAttribute.SchemaAttribute.GetNameOk() + for _, attributeInner := range attributeInners { + if attributeInner.SchemaAttribute != nil { + schemaAttributeId, schemaAttributeIdOk := attributeInner.SchemaAttribute.GetIdOk() + schemaAttributeName, schemaAttributeNameOk := attributeInner.SchemaAttribute.GetNameOk() if schemaAttributeIdOk && schemaAttributeNameOk { schemaAttributeData[*schemaAttributeId] = *schemaAttributeName } } } - return &schemaAttributeData, nil + return schemaAttributeData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go b/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go index d369181c..3d510233 100644 --- a/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go +++ b/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go @@ -3,6 +3,7 @@ package resources import ( "fmt" + "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" "github.com/pingidentity/pingcli/internal/logger" @@ -39,7 +40,7 @@ func (r *PingOneSignOnPolicyResource) ExportAll() (*[]connector.ImportBlock, err return nil, err } - for signOnPolicyId, signOnPolicyName := range *signOnPolicyData { + for signOnPolicyId, signOnPolicyName := range signOnPolicyData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -60,38 +61,23 @@ func (r *PingOneSignOnPolicyResource) ExportAll() (*[]connector.ImportBlock, err return &importBlocks, nil } -func (r *PingOneSignOnPolicyResource) getSignOnPolicyData() (*map[string]string, error) { +func (r *PingOneSignOnPolicyResource) getSignOnPolicyData() (map[string]string, error) { signOnPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPoliciesApi.ReadAllSignOnPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + signOnPolicies, err := common.GetManagementAPIObjectsFromIterator[management.SignOnPolicy](iter, "ReadAllSignOnPolicies", "GetSignOnPolicies", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicies", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, signOnPolicy := range embedded.GetSignOnPolicies() { - signOnPolicyId, signOnPolicyIdOk := signOnPolicy.GetIdOk() - signOnPolicyName, signOnPolicyNameOk := signOnPolicy.GetNameOk() + for _, signOnPolicy := range signOnPolicies { + signOnPolicyId, signOnPolicyIdOk := signOnPolicy.GetIdOk() + signOnPolicyName, signOnPolicyNameOk := signOnPolicy.GetNameOk() - if signOnPolicyIdOk && signOnPolicyNameOk { - signOnPolicyData[*signOnPolicyId] = *signOnPolicyName - } + if signOnPolicyIdOk && signOnPolicyNameOk { + signOnPolicyData[*signOnPolicyId] = *signOnPolicyName } } - return &signOnPolicyData, nil + return signOnPolicyData, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go b/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go index 78230c7b..e0857fa4 100644 --- a/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go +++ b/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go @@ -40,13 +40,13 @@ func (r *PingOneSignOnPolicyActionResource) ExportAll() (*[]connector.ImportBloc return nil, err } - for signOnPolicyId, signOnPolicyName := range *signOnPolicyData { + for signOnPolicyId, signOnPolicyName := range signOnPolicyData { signOnPolicyActionData, err := r.getSignOnPolicyActionData(signOnPolicyId) if err != nil { return nil, err } - for actionId, actionType := range *signOnPolicyActionData { + for actionId, actionType := range signOnPolicyActionData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -70,104 +70,74 @@ func (r *PingOneSignOnPolicyActionResource) ExportAll() (*[]connector.ImportBloc return &importBlocks, nil } -func (r *PingOneSignOnPolicyActionResource) getSignOnPolicyData() (*map[string]string, error) { +func (r *PingOneSignOnPolicyActionResource) getSignOnPolicyData() (map[string]string, error) { signOnPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPoliciesApi.ReadAllSignOnPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + signOnPolicies, err := common.GetManagementAPIObjectsFromIterator[management.SignOnPolicy](iter, "ReadAllSignOnPolicies", "GetSignOnPolicies", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicies", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - for _, signOnPolicy := range embedded.GetSignOnPolicies() { - signOnPolicyId, signOnPolicyIdOk := signOnPolicy.GetIdOk() - signOnPolicyName, signOnPolicyNameOk := signOnPolicy.GetNameOk() + for _, signOnPolicy := range signOnPolicies { + signOnPolicyId, signOnPolicyIdOk := signOnPolicy.GetIdOk() + signOnPolicyName, signOnPolicyNameOk := signOnPolicy.GetNameOk() - if signOnPolicyIdOk && signOnPolicyNameOk { - signOnPolicyData[*signOnPolicyId] = *signOnPolicyName - } + if signOnPolicyIdOk && signOnPolicyNameOk { + signOnPolicyData[*signOnPolicyId] = *signOnPolicyName } } - return &signOnPolicyData, nil + return signOnPolicyData, nil } -func (r *PingOneSignOnPolicyActionResource) getSignOnPolicyActionData(signOnPolicyId string) (*map[string]string, error) { +func (r *PingOneSignOnPolicyActionResource) getSignOnPolicyActionData(signOnPolicyId string) (map[string]string, error) { signOnPolicyActionData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPolicyActionsApi.ReadAllSignOnPolicyActions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, signOnPolicyId).Execute() + signOnPolicyActions, err := common.GetManagementAPIObjectsFromIterator[management.SignOnPolicyAction](iter, "ReadAllSignOnPolicyActions", "GetActions", r.ResourceType()) + if err != nil { + return nil, err + } - for cursor, err := range iter { - ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, "ReadAllSignOnPolicyActions", r.ResourceType()) - if err != nil { - return nil, err - } - if !ok { - return nil, nil - } - - if cursor.EntityArray == nil { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, common.DataNilError(r.ResourceType(), cursor.HTTPResponse) + for _, action := range signOnPolicyActions { + var ( + actionId *string + actionIdOk bool + actionType *management.EnumSignOnPolicyType + actionTypeOk bool + ) + + switch { + case action.SignOnPolicyActionAgreement != nil: + actionId, actionIdOk = action.SignOnPolicyActionAgreement.GetIdOk() + actionType, actionTypeOk = action.SignOnPolicyActionAgreement.GetTypeOk() + case action.SignOnPolicyActionCommon != nil: + actionId, actionIdOk = action.SignOnPolicyActionCommon.GetIdOk() + actionType, actionTypeOk = action.SignOnPolicyActionCommon.GetTypeOk() + case action.SignOnPolicyActionIDFirst != nil: + actionId, actionIdOk = action.SignOnPolicyActionIDFirst.GetIdOk() + actionType, actionTypeOk = action.SignOnPolicyActionIDFirst.GetTypeOk() + case action.SignOnPolicyActionIDP != nil: + actionId, actionIdOk = action.SignOnPolicyActionIDP.GetIdOk() + actionType, actionTypeOk = action.SignOnPolicyActionIDP.GetTypeOk() + case action.SignOnPolicyActionLogin != nil: + actionId, actionIdOk = action.SignOnPolicyActionLogin.GetIdOk() + actionType, actionTypeOk = action.SignOnPolicyActionLogin.GetTypeOk() + case action.SignOnPolicyActionMFA != nil: + actionId, actionIdOk = action.SignOnPolicyActionMFA.GetIdOk() + actionType, actionTypeOk = action.SignOnPolicyActionMFA.GetTypeOk() + case action.SignOnPolicyActionPingIDWinLoginPasswordless != nil: + actionId, actionIdOk = action.SignOnPolicyActionPingIDWinLoginPasswordless.GetIdOk() + actionType, actionTypeOk = action.SignOnPolicyActionPingIDWinLoginPasswordless.GetTypeOk() + default: + continue } - for _, action := range embedded.GetActions() { - var ( - actionId *string - actionIdOk bool - actionType *management.EnumSignOnPolicyType - actionTypeOk bool - ) - - switch { - case action.SignOnPolicyActionAgreement != nil: - actionId, actionIdOk = action.SignOnPolicyActionAgreement.GetIdOk() - actionType, actionTypeOk = action.SignOnPolicyActionAgreement.GetTypeOk() - case action.SignOnPolicyActionCommon != nil: - actionId, actionIdOk = action.SignOnPolicyActionCommon.GetIdOk() - actionType, actionTypeOk = action.SignOnPolicyActionCommon.GetTypeOk() - case action.SignOnPolicyActionIDFirst != nil: - actionId, actionIdOk = action.SignOnPolicyActionIDFirst.GetIdOk() - actionType, actionTypeOk = action.SignOnPolicyActionIDFirst.GetTypeOk() - case action.SignOnPolicyActionIDP != nil: - actionId, actionIdOk = action.SignOnPolicyActionIDP.GetIdOk() - actionType, actionTypeOk = action.SignOnPolicyActionIDP.GetTypeOk() - case action.SignOnPolicyActionLogin != nil: - actionId, actionIdOk = action.SignOnPolicyActionLogin.GetIdOk() - actionType, actionTypeOk = action.SignOnPolicyActionLogin.GetTypeOk() - case action.SignOnPolicyActionMFA != nil: - actionId, actionIdOk = action.SignOnPolicyActionMFA.GetIdOk() - actionType, actionTypeOk = action.SignOnPolicyActionMFA.GetTypeOk() - case action.SignOnPolicyActionPingIDWinLoginPasswordless != nil: - actionId, actionIdOk = action.SignOnPolicyActionPingIDWinLoginPasswordless.GetIdOk() - actionType, actionTypeOk = action.SignOnPolicyActionPingIDWinLoginPasswordless.GetTypeOk() - default: - continue - } - - if actionIdOk && actionTypeOk { - signOnPolicyActionData[*actionId] = string(*actionType) - } + if actionIdOk && actionTypeOk { + signOnPolicyActionData[*actionId] = string(*actionType) } } - return &signOnPolicyActionData, nil + return signOnPolicyActionData, nil } From 5f162430505dbc37f46b4b6875317bb0947f155f Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Wed, 19 Feb 2025 19:30:16 -0700 Subject: [PATCH 09/18] Update dependencies and use tool directive instead of tools.go --- go.mod | 95 ++++++++++---------- go.sum | 195 +++++++++++++++++++--------------------- internal/tools/tools.go | 12 --- 3 files changed, 142 insertions(+), 160 deletions(-) delete mode 100644 internal/tools/tools.go diff --git a/go.mod b/go.mod index c9fff6cf..d76aef6d 100644 --- a/go.mod +++ b/go.mod @@ -1,19 +1,23 @@ module github.com/pingidentity/pingcli -go 1.23.5 +go 1.24.0 + +tool ( + github.com/golangci/golangci-lint/cmd/golangci-lint + github.com/pavius/impi +) require ( github.com/fatih/color v1.18.0 - github.com/golangci/golangci-lint v1.63.4 github.com/hashicorp/go-uuid v1.0.3 github.com/manifoldco/promptui v0.9.0 - github.com/patrickcping/pingone-go-sdk-v2 v0.12.8 - github.com/patrickcping/pingone-go-sdk-v2/management v0.48.0 - github.com/patrickcping/pingone-go-sdk-v2/risk v0.18.0 - github.com/pavius/impi v0.0.3 + github.com/patrickcping/pingone-go-sdk-v2 v0.12.9 + github.com/patrickcping/pingone-go-sdk-v2/management v0.49.0 + github.com/patrickcping/pingone-go-sdk-v2/mfa v0.23.0 + github.com/patrickcping/pingone-go-sdk-v2/risk v0.19.0 github.com/pingidentity/pingfederate-go-client/v1210 v1210.0.5 github.com/rs/zerolog v1.33.0 - github.com/spf13/cobra v1.8.1 + github.com/spf13/cobra v1.9.1 github.com/spf13/pflag v1.0.6 github.com/spf13/viper v1.19.0 gopkg.in/yaml.v3 v3.0.1 @@ -21,14 +25,14 @@ require ( require ( 4d63.com/gocheckcompilerdirectives v1.2.1 // indirect - 4d63.com/gochecknoglobals v0.2.1 // indirect + 4d63.com/gochecknoglobals v0.2.2 // indirect github.com/4meepo/tagalign v1.4.1 // indirect github.com/Abirdcfly/dupword v0.1.3 // indirect github.com/Antonboom/errname v1.0.0 // indirect github.com/Antonboom/nilnil v1.0.1 // indirect github.com/Antonboom/testifylint v1.5.2 // indirect github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c // indirect - github.com/Crocmagnon/fatcontext v0.5.3 // indirect + github.com/Crocmagnon/fatcontext v0.7.1 // indirect github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 // indirect github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 // indirect github.com/Masterminds/semver/v3 v3.3.0 // indirect @@ -37,7 +41,7 @@ require ( github.com/alexkohler/nakedret/v2 v2.0.5 // indirect github.com/alexkohler/prealloc v1.0.0 // indirect github.com/alingse/asasalint v0.0.11 // indirect - github.com/alingse/nilnesserr v0.1.1 // indirect + github.com/alingse/nilnesserr v0.1.2 // indirect github.com/ashanbrown/forbidigo v1.6.0 // indirect github.com/ashanbrown/makezero v1.2.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -48,9 +52,9 @@ require ( github.com/breml/errchkjson v0.4.0 // indirect github.com/butuzov/ireturn v0.3.1 // indirect github.com/butuzov/mirror v1.3.0 // indirect - github.com/catenacyber/perfsprint v0.7.1 // indirect + github.com/catenacyber/perfsprint v0.8.1 // indirect github.com/ccojocar/zxcvbn-go v1.0.2 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charithe/durationcheck v0.0.10 // indirect github.com/chavacava/garif v0.1.0 // indirect github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect @@ -64,8 +68,8 @@ require ( github.com/firefart/nonamedreturns v1.0.5 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/fzipp/gocyclo v0.6.0 // indirect - github.com/ghostiam/protogetter v0.3.8 // indirect - github.com/go-critic/go-critic v0.11.5 // indirect + github.com/ghostiam/protogetter v0.3.9 // indirect + github.com/go-critic/go-critic v0.12.0 // indirect github.com/go-toolsmith/astcast v1.1.0 // indirect github.com/go-toolsmith/astcopy v1.1.0 // indirect github.com/go-toolsmith/astequal v1.2.0 // indirect @@ -80,16 +84,17 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/go-printf-func-name v0.1.0 // indirect - github.com/golangci/gofmt v0.0.0-20241223200906-057b0627d9b9 // indirect + github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d // indirect + github.com/golangci/golangci-lint v1.64.5 // indirect github.com/golangci/misspell v0.6.0 // indirect github.com/golangci/plugin-module-register v0.1.1 // indirect - github.com/golangci/revgrep v0.5.3 // indirect + github.com/golangci/revgrep v0.8.0 // indirect github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect github.com/google/go-cmp v0.6.0 // indirect github.com/gordonklaus/ineffassign v0.1.0 // indirect github.com/gostaticanalysis/analysisutil v0.7.1 // indirect github.com/gostaticanalysis/comment v1.4.2 // indirect - github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect + github.com/gostaticanalysis/forcetypeassert v0.2.0 // indirect github.com/gostaticanalysis/nilerr v0.1.1 // indirect github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect github.com/hashicorp/go-version v1.7.0 // indirect @@ -101,17 +106,16 @@ require ( github.com/jingyugao/rowserrcheck v1.1.1 // indirect github.com/jjti/go-spancheck v0.6.4 // indirect github.com/julz/importas v0.2.0 // indirect - github.com/karamaru-alpha/copyloopvar v1.1.0 // indirect + github.com/karamaru-alpha/copyloopvar v1.2.1 // indirect github.com/kisielk/errcheck v1.8.0 // indirect github.com/kisielk/gotool v1.0.0 // indirect github.com/kkHAIKE/contextcheck v1.1.5 // indirect github.com/kulti/thelper v0.6.3 // indirect github.com/kunwardeep/paralleltest v1.0.10 // indirect - github.com/kyoh86/exportloopref v0.1.11 // indirect github.com/lasiar/canonicalheader v1.1.2 // indirect - github.com/ldez/exptostd v0.3.1 // indirect - github.com/ldez/gomoddirectives v0.6.0 // indirect - github.com/ldez/grignotin v0.7.0 // indirect + github.com/ldez/exptostd v0.4.1 // indirect + github.com/ldez/gomoddirectives v0.6.1 // indirect + github.com/ldez/grignotin v0.9.0 // indirect github.com/ldez/tagliatelle v0.7.1 // indirect github.com/ldez/usetesting v0.4.2 // indirect github.com/leonklingele/grouper v1.1.2 // indirect @@ -119,27 +123,27 @@ require ( github.com/magiconair/properties v1.8.7 // indirect github.com/maratori/testableexamples v1.0.0 // indirect github.com/maratori/testpackage v1.1.1 // indirect - github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect + github.com/matoous/godox v1.1.0 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect - github.com/mgechev/revive v1.5.1 // indirect + github.com/mgechev/revive v1.6.1 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/moricho/tparallel v0.3.2 // indirect github.com/nakabonne/nestif v0.3.1 // indirect github.com/nishanths/exhaustive v0.12.0 // indirect github.com/nishanths/predeclared v0.2.2 // indirect - github.com/nunnatsa/ginkgolinter v0.18.4 // indirect + github.com/nunnatsa/ginkgolinter v0.19.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/patrickcping/pingone-go-sdk-v2/authorize v0.7.0 // indirect - github.com/patrickcping/pingone-go-sdk-v2/credentials v0.10.0 // indirect - github.com/patrickcping/pingone-go-sdk-v2/mfa v0.22.0 // indirect - github.com/patrickcping/pingone-go-sdk-v2/verify v0.8.0 // indirect + github.com/patrickcping/pingone-go-sdk-v2/authorize v0.8.0 // indirect + github.com/patrickcping/pingone-go-sdk-v2/credentials v0.11.0 // indirect + github.com/patrickcping/pingone-go-sdk-v2/verify v0.9.0 // indirect + github.com/pavius/impi v0.0.3 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/polyfloyd/go-errorlint v1.7.0 // indirect + github.com/polyfloyd/go-errorlint v1.7.1 // indirect github.com/prometheus/client_golang v1.12.1 // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect @@ -160,22 +164,21 @@ require ( github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect github.com/sashamelentyev/interfacebloat v1.1.0 // indirect github.com/sashamelentyev/usestdlibvars v1.28.0 // indirect - github.com/securego/gosec/v2 v2.21.4 // indirect - github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c // indirect + github.com/securego/gosec/v2 v2.22.1 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/sivchari/containedctx v1.0.3 // indirect github.com/sivchari/tenv v1.12.1 // indirect github.com/sonatard/noctx v0.1.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/sourcegraph/go-diff v0.7.0 // indirect - github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/afero v1.12.0 // indirect github.com/spf13/cast v1.6.0 // indirect github.com/ssgreg/nlreturn/v2 v2.2.1 // indirect github.com/stbenjam/no-sprintf-host-port v0.2.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.10.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect - github.com/tdakkota/asciicheck v0.3.0 // indirect + github.com/tdakkota/asciicheck v0.4.0 // indirect github.com/tetafro/godot v1.4.20 // indirect github.com/timakin/bodyclose v0.0.0-20241017074812-ed6a65f985e3 // indirect github.com/timonwong/loggercheck v0.10.1 // indirect @@ -184,30 +187,30 @@ require ( github.com/ultraware/funlen v0.2.0 // indirect github.com/ultraware/whitespace v0.2.0 // indirect github.com/uudashr/gocognit v1.2.0 // indirect - github.com/uudashr/iface v1.3.0 // indirect + github.com/uudashr/iface v1.3.1 // indirect github.com/xen0n/gosmopolitan v1.2.2 // indirect github.com/yagipy/maintidx v1.0.0 // indirect github.com/yeya24/promlinter v0.3.0 // indirect github.com/ykadowak/zerologlint v0.1.5 // indirect gitlab.com/bosi/decorder v0.4.2 // indirect go-simpler.org/musttag v0.13.0 // indirect - go-simpler.org/sloglint v0.7.2 // indirect + go-simpler.org/sloglint v0.9.0 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.9.0 // indirect go.uber.org/zap v1.24.0 // indirect golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect - golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f // indirect - golang.org/x/mod v0.22.0 // indirect - golang.org/x/oauth2 v0.25.0 // indirect - golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/text v0.20.0 // indirect - golang.org/x/tools v0.28.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac // indirect + golang.org/x/mod v0.23.0 // indirect + golang.org/x/oauth2 v0.26.0 // indirect + golang.org/x/sync v0.11.0 // indirect + golang.org/x/sys v0.30.0 // indirect + golang.org/x/text v0.22.0 // indirect + golang.org/x/tools v0.30.0 // indirect + google.golang.org/protobuf v1.36.4 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - honnef.co/go/tools v0.5.1 // indirect + honnef.co/go/tools v0.6.0 // indirect mvdan.cc/gofumpt v0.7.0 // indirect mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect ) diff --git a/go.sum b/go.sum index 4d5ce69a..24d08f5c 100644 --- a/go.sum +++ b/go.sum @@ -1,7 +1,7 @@ 4d63.com/gocheckcompilerdirectives v1.2.1 h1:AHcMYuw56NPjq/2y615IGg2kYkBdTvOaojYCBcRE7MA= 4d63.com/gocheckcompilerdirectives v1.2.1/go.mod h1:yjDJSxmDTtIHHCqX0ufRYZDL6vQtMG7tJdKVeWwsqvs= -4d63.com/gochecknoglobals v0.2.1 h1:1eiorGsgHOFOuoOiJDy2psSrQbRdIHrlge0IJIkUgDc= -4d63.com/gochecknoglobals v0.2.1/go.mod h1:KRE8wtJB3CXCsb1xy421JfTHIIbmT3U5ruxw2Qu8fSU= +4d63.com/gochecknoglobals v0.2.2 h1:H1vdnwnMaZdQW/N+NrkT1SZMTBmcwHe9Vq8lJcYYTtU= +4d63.com/gochecknoglobals v0.2.2/go.mod h1:lLxwTQjL5eIesRbvnzIP3jZtG140FnTdz+AlMa+ogt0= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= @@ -49,8 +49,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c h1:pxW6RcqyfI9/kWtOwnv/G+AzdKuy2ZrqINhenH4HyNs= github.com/BurntSushi/toml v1.4.1-0.20240526193622-a339e1f7089c/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Crocmagnon/fatcontext v0.5.3 h1:zCh/wjc9oyeF+Gmp+V60wetm8ph2tlsxocgg/J0hOps= -github.com/Crocmagnon/fatcontext v0.5.3/go.mod h1:XoCQYY1J+XTfyv74qLXvNw4xFunr3L1wkopIIKG7wGM= +github.com/Crocmagnon/fatcontext v0.7.1 h1:SC/VIbRRZQeQWj/TcQBS6JmrXcfA+BU4OGSVUt54PjM= +github.com/Crocmagnon/fatcontext v0.7.1/go.mod h1:1wMvv3NXEBJucFGfwOJBxSVWcoIO6emV215SMkW9MFU= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24 h1:sHglBQTwgx+rWPdisA5ynNEsoARbiCBOyGcJM4/OzsM= github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24/go.mod h1:4UJr5HIiMZrwgkSPdsjy2uOQExX/WEILpIrO9UPGuXs= github.com/GaijinEntertainment/go-exhaustruct/v3 v3.3.0 h1:/fTUt5vmbkAcMBt4YQiuC23cV0kEsN1MVMNqeOW43cU= @@ -76,8 +76,8 @@ github.com/alexkohler/prealloc v1.0.0 h1:Hbq0/3fJPQhNkN0dR95AVrr6R7tou91y0uHG5pO github.com/alexkohler/prealloc v1.0.0/go.mod h1:VetnK3dIgFBBKmg0YnD9F9x6Icjd+9cvfHR56wJVlKE= github.com/alingse/asasalint v0.0.11 h1:SFwnQXJ49Kx/1GghOFz1XGqHYKp21Kq1nHad/0WQRnw= github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqrSP7t/cW5+I= -github.com/alingse/nilnesserr v0.1.1 h1:7cYuJewpy9jFNMEA72Q1+3Nm3zKHzg+Q28D5f2bBFUA= -github.com/alingse/nilnesserr v0.1.1/go.mod h1:1xJPrXonEtX7wyTq8Dytns5P2hNzoWymVUIaKm4HNFg= +github.com/alingse/nilnesserr v0.1.2 h1:Yf8Iwm3z2hUUrP4muWfW83DF4nE3r1xZ26fGWUKCZlo= +github.com/alingse/nilnesserr v0.1.2/go.mod h1:1xJPrXonEtX7wyTq8Dytns5P2hNzoWymVUIaKm4HNFg= github.com/ashanbrown/forbidigo v1.6.0 h1:D3aewfM37Yb3pxHujIPSpTf6oQk9sc9WZi8gerOIVIY= github.com/ashanbrown/forbidigo v1.6.0/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU= github.com/ashanbrown/makezero v1.2.0 h1:/2Lp1bypdmK9wDIq7uWBlDF1iMUpIIS4A+pF6C9IEUU= @@ -102,14 +102,15 @@ github.com/butuzov/ireturn v0.3.1 h1:mFgbEI6m+9W8oP/oDdfA34dLisRFCj2G6o/yiI1yZrY github.com/butuzov/ireturn v0.3.1/go.mod h1:ZfRp+E7eJLC0NQmk1Nrm1LOrn/gQlOykv+cVPdiXH5M= github.com/butuzov/mirror v1.3.0 h1:HdWCXzmwlQHdVhwvsfBb2Au0r3HyINry3bDWLYXiKoc= github.com/butuzov/mirror v1.3.0/go.mod h1:AEij0Z8YMALaq4yQj9CPPVYOyJQyiexpQEQgihajRfI= -github.com/catenacyber/perfsprint v0.7.1 h1:PGW5G/Kxn+YrN04cRAZKC+ZuvlVwolYMrIyyTJ/rMmc= -github.com/catenacyber/perfsprint v0.7.1/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= +github.com/catenacyber/perfsprint v0.8.1 h1:bGOHuzHe0IkoGeY831RW4aSlt1lPRd3WRAScSWOaV7E= +github.com/catenacyber/perfsprint v0.8.1/go.mod h1:/wclWYompEyjUD2FuIIDVKNkqz7IgBIWXIH3V0Zol50= github.com/ccojocar/zxcvbn-go v1.0.2 h1:na/czXU8RrhXO4EZme6eQJLR4PzcGsahsBOAwU6I3Vg= github.com/ccojocar/zxcvbn-go v1.0.2/go.mod h1:g1qkXtUSvHP8lhHp5GrSmTz6uWALGRMQdw6Qnz/hi60= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/charithe/durationcheck v0.0.10 h1:wgw73BiocdBDQPik+zcEoBG/ob8uyBHf2iyoHGPf5w4= github.com/charithe/durationcheck v0.0.10/go.mod h1:bCWXb7gYRysD1CU3C+u4ceO49LoGOY1C1L6uouGNreQ= github.com/chavacava/garif v0.1.0 h1:2JHa3hbYf5D9dsgseMKAmc/MZ109otzgNFk5s87H9Pc= @@ -125,7 +126,7 @@ github.com/ckaznocha/intrange v0.3.0/go.mod h1:+I/o2d2A1FBHgGELbGxzIcyd3/9l9Duwj github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/curioswitch/go-reassign v0.3.0 h1:dh3kpQHuADL3cobV/sSGETA8DOv457dwl+fbBAhrQPs= github.com/curioswitch/go-reassign v0.3.0/go.mod h1:nApPCCTtqLJN/s8HfItCcKV0jIPwluBOvZP+dsJGA88= github.com/daixiang0/gci v0.13.5 h1:kThgmH1yBmZSBCh1EJVxQ7JsHpm5Oms0AMed/0LaH4c= @@ -156,10 +157,10 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= github.com/fzipp/gocyclo v0.6.0 h1:lsblElZG7d3ALtGMx9fmxeTKZaLLpU8mET09yN4BBLo= github.com/fzipp/gocyclo v0.6.0/go.mod h1:rXPyn8fnlpa0R2csP/31uerbiVBugk5whMdlyaLkLoA= -github.com/ghostiam/protogetter v0.3.8 h1:LYcXbYvybUyTIxN2Mj9h6rHrDZBDwZloPoKctWrFyJY= -github.com/ghostiam/protogetter v0.3.8/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA= -github.com/go-critic/go-critic v0.11.5 h1:TkDTOn5v7EEngMxu8KbuFqFR43USaaH8XRJLz1jhVYA= -github.com/go-critic/go-critic v0.11.5/go.mod h1:wu6U7ny9PiaHaZHcvMDmdysMqvDem162Rh3zWTrqk8M= +github.com/ghostiam/protogetter v0.3.9 h1:j+zlLLWzqLay22Cz/aYwTHKQ88GE2DQ6GkWSYFOI4lQ= +github.com/ghostiam/protogetter v0.3.9/go.mod h1:WZ0nw9pfzsgxuRsPOFQomgDVSWtDLJRfQJEhsGbmQMA= +github.com/go-critic/go-critic v0.12.0 h1:iLosHZuye812wnkEz1Xu3aBwn5ocCPfc9yqmFG9pa6w= +github.com/go-critic/go-critic v0.12.0/go.mod h1:DpE0P6OVc6JzVYzmM5gq5jMU31zLr4am5mB/VfFK64w= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -238,16 +239,16 @@ github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9 github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= github.com/golangci/go-printf-func-name v0.1.0 h1:dVokQP+NMTO7jwO4bwsRwLWeudOVUPPyAKJuzv8pEJU= github.com/golangci/go-printf-func-name v0.1.0/go.mod h1:wqhWFH5mUdJQhweRnldEywnR5021wTdZSNgwYceV14s= -github.com/golangci/gofmt v0.0.0-20241223200906-057b0627d9b9 h1:t5wybL6RtO83VwoMOb7U/Peqe3gGKQlPIC66wXmnkvM= -github.com/golangci/gofmt v0.0.0-20241223200906-057b0627d9b9/go.mod h1:Ag3L7sh7E28qAp/5xnpMMTuGYqxLZoSaEHZDkZB1RgU= -github.com/golangci/golangci-lint v1.63.4 h1:bJQFQ3hSfUto597dkL7ipDzOxsGEpiWdLiZ359OWOBI= -github.com/golangci/golangci-lint v1.63.4/go.mod h1:Hx0B7Lg5/NXbaOHem8+KU+ZUIzMI6zNj/7tFwdnn10I= +github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d h1:viFft9sS/dxoYY0aiOTsLKO2aZQAPT4nlQCsimGcSGE= +github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d/go.mod h1:ivJ9QDg0XucIkmwhzCDsqcnxxlDStoTl89jDMIoNxKY= +github.com/golangci/golangci-lint v1.64.5 h1:5omC86XFBKXZgCrVdUWU+WNHKd+CWCxNx717KXnzKZY= +github.com/golangci/golangci-lint v1.64.5/go.mod h1:WZnwq8TF0z61h3jLQ7Sk5trcP7b3kUFxLD6l1ivtdvU= github.com/golangci/misspell v0.6.0 h1:JCle2HUTNWirNlDIAUO44hUsKhOFqGPoC4LZxlaSXDs= github.com/golangci/misspell v0.6.0/go.mod h1:keMNyY6R9isGaSAu+4Q8NMBwMPkh15Gtc8UCVoDtAWo= github.com/golangci/plugin-module-register v0.1.1 h1:TCmesur25LnyJkpsVrupv1Cdzo+2f7zX0H6Jkw1Ol6c= github.com/golangci/plugin-module-register v0.1.1/go.mod h1:TTpqoB6KkwOJMV8u7+NyXMrkwwESJLOkfl9TxR1DGFc= -github.com/golangci/revgrep v0.5.3 h1:3tL7c1XBMtWHHqVpS5ChmiAAoe4PF/d5+ULzV9sLAzs= -github.com/golangci/revgrep v0.5.3/go.mod h1:U4R/s9dlXZsg8uJmaR1GrloUr14D7qDl8gi2iPXJH8k= +github.com/golangci/revgrep v0.8.0 h1:EZBctwbVd0aMeRnNUsFogoyayvKHyxlV3CdUA46FX2s= +github.com/golangci/revgrep v0.8.0/go.mod h1:U4R/s9dlXZsg8uJmaR1GrloUr14D7qDl8gi2iPXJH8k= github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed h1:IURFTjxeTfNFP0hTEi1YKjB/ub8zkpaOqFFMApi2EAs= github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed/go.mod h1:XLXN8bNw4CGRPaqgl3bv/lhz7bsGPh4/xSaMTbo2vkQ= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -276,8 +277,8 @@ github.com/google/pprof v0.0.0-20200212024743-f11f1df84d12/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20200229191704-1ebb73c60ed3/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200430221834-fc25d7d30c6d/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5 h1:5iH8iuqE5apketRbSFBy+X1V0o+l+8NF1avt4HWl7cA= -github.com/google/pprof v0.0.0-20240827171923-fa2c70bbbfe5/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad h1:a6HEuzUHeKH6hwfN/ZoQgRgVIWFJljSWa/zetS2WTvg= +github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= @@ -288,8 +289,8 @@ github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/o github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= -github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= -github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= +github.com/gostaticanalysis/forcetypeassert v0.2.0 h1:uSnWrrUEYDr86OCxWa4/Tp2jeYDlogZiZHzGkWFefTk= +github.com/gostaticanalysis/forcetypeassert v0.2.0/go.mod h1:M5iPavzE9pPqWyeiVXSFghQjljW1+l/Uke3PXHS6ILY= github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk= github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= @@ -330,8 +331,8 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.2.0 h1:y+MJN/UdL63QbFJHws9BVC5RpA2iq0kpjrFajTGivjQ= github.com/julz/importas v0.2.0/go.mod h1:pThlt589EnCYtMnmhmRYY/qn9lCf/frPOK+WMx3xiJY= -github.com/karamaru-alpha/copyloopvar v1.1.0 h1:x7gNyKcC2vRBO1H2Mks5u1VxQtYvFiym7fCjIP8RPos= -github.com/karamaru-alpha/copyloopvar v1.1.0/go.mod h1:u7CIfztblY0jZLOQZgH3oYsJzpC2A7S6u/lfgSXHy0k= +github.com/karamaru-alpha/copyloopvar v1.2.1 h1:wmZaZYIjnJ0b5UoKDjUHrikcV0zuPyyxI4SVplLd2CI= +github.com/karamaru-alpha/copyloopvar v1.2.1/go.mod h1:nFmMlFNlClC2BPvNaHMdkirmTJxVCY0lhxBtlfOypMM= github.com/kisielk/errcheck v1.8.0 h1:ZX/URYa7ilESY19ik/vBmCn6zdGQLxACwjAcWbHlYlg= github.com/kisielk/errcheck v1.8.0/go.mod h1:1kLL+jV4e+CFfueBmI1dSK2ADDyQnlrnrY/FqKluHJQ= github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= @@ -352,16 +353,14 @@ github.com/kulti/thelper v0.6.3 h1:ElhKf+AlItIu+xGnI990no4cE2+XaSu1ULymV2Yulxs= github.com/kulti/thelper v0.6.3/go.mod h1:DsqKShOvP40epevkFrvIwkCMNYxMeTNjdWL4dqWHZ6I= github.com/kunwardeep/paralleltest v1.0.10 h1:wrodoaKYzS2mdNVnc4/w31YaXFtsc21PCTdvWJ/lDDs= github.com/kunwardeep/paralleltest v1.0.10/go.mod h1:2C7s65hONVqY7Q5Efj5aLzRCNLjw2h4eMc9EcypGjcY= -github.com/kyoh86/exportloopref v0.1.11 h1:1Z0bcmTypkL3Q4k+IDHMWTcnCliEZcaPiIe0/ymEyhQ= -github.com/kyoh86/exportloopref v0.1.11/go.mod h1:qkV4UF1zGl6EkF1ox8L5t9SwyeBAZ3qLMd6up458uqA= github.com/lasiar/canonicalheader v1.1.2 h1:vZ5uqwvDbyJCnMhmFYimgMZnJMjwljN5VGY0VKbMXb4= github.com/lasiar/canonicalheader v1.1.2/go.mod h1:qJCeLFS0G/QlLQ506T+Fk/fWMa2VmBUiEI2cuMK4djI= -github.com/ldez/exptostd v0.3.1 h1:90yWWoAKMFHeovTK8uzBms9Ppp8Du/xQ20DRO26Ymrw= -github.com/ldez/exptostd v0.3.1/go.mod h1:iZBRYaUmcW5jwCR3KROEZ1KivQQp6PHXbDPk9hqJKCQ= -github.com/ldez/gomoddirectives v0.6.0 h1:Jyf1ZdTeiIB4dd+2n4qw+g4aI9IJ6JyfOZ8BityWvnA= -github.com/ldez/gomoddirectives v0.6.0/go.mod h1:TuwOGYoPAoENDWQpe8DMqEm5nIfjrxZXmxX/CExWyZ4= -github.com/ldez/grignotin v0.7.0 h1:vh0dI32WhHaq6LLPZ38g7WxXuZ1+RzyrJ7iPG9JMa8c= -github.com/ldez/grignotin v0.7.0/go.mod h1:uaVTr0SoZ1KBii33c47O1M8Jp3OP3YDwhZCmzT9GHEk= +github.com/ldez/exptostd v0.4.1 h1:DIollgQ3LWZMp3HJbSXsdE2giJxMfjyHj3eX4oiD6JU= +github.com/ldez/exptostd v0.4.1/go.mod h1:iZBRYaUmcW5jwCR3KROEZ1KivQQp6PHXbDPk9hqJKCQ= +github.com/ldez/gomoddirectives v0.6.1 h1:Z+PxGAY+217f/bSGjNZr/b2KTXcyYLgiWI6geMBN2Qc= +github.com/ldez/gomoddirectives v0.6.1/go.mod h1:cVBiu3AHR9V31em9u2kwfMKD43ayN5/XDgr+cdaFaKs= +github.com/ldez/grignotin v0.9.0 h1:MgOEmjZIVNn6p5wPaGp/0OKWyvq42KnzAt/DAb8O4Ow= +github.com/ldez/grignotin v0.9.0/go.mod h1:uaVTr0SoZ1KBii33c47O1M8Jp3OP3YDwhZCmzT9GHEk= github.com/ldez/tagliatelle v0.7.1 h1:bTgKjjc2sQcsgPiT902+aadvMjCeMHrY7ly2XKFORIk= github.com/ldez/tagliatelle v0.7.1/go.mod h1:3zjxUpsNB2aEZScWiZTHrAXOl1x25t3cRmzfK1mlo2I= github.com/ldez/usetesting v0.4.2 h1:J2WwbrFGk3wx4cZwSMiCQQ00kjGR0+tuuyW0Lqm4lwA= @@ -378,12 +377,13 @@ github.com/maratori/testableexamples v1.0.0 h1:dU5alXRrD8WKSjOUnmJZuzdxWOEQ57+7s github.com/maratori/testableexamples v1.0.0/go.mod h1:4rhjL1n20TUTT4vdh3RDqSizKLyXp7K2u6HgraZCGzE= github.com/maratori/testpackage v1.1.1 h1:S58XVV5AD7HADMmD0fNnziNHqKvSdDuEKdPD1rNTU04= github.com/maratori/testpackage v1.1.1/go.mod h1:s4gRK/ym6AMrqpOa/kEbQTV4Q4jb7WeLZzVhVVVOQMc= -github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26 h1:gWg6ZQ4JhDfJPqlo2srm/LN17lpybq15AryXIRcWYLE= -github.com/matoous/godox v0.0.0-20230222163458-006bad1f9d26/go.mod h1:1BELzlh859Sh1c6+90blK8lbYy0kwQf1bYlBhBysy1s= +github.com/matoous/godox v1.1.0 h1:W5mqwbyWrwZv6OQ5Z1a/DHGMOvXYCBP3+Ht7KMoJhq4= +github.com/matoous/godox v1.1.0/go.mod h1:jgE/3fUXiTurkdHOLT5WEkThTSuE7yxHv5iWPa80afs= github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE= github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -393,8 +393,8 @@ github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6T github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/mgechev/revive v1.5.1 h1:hE+QPeq0/wIzJwOphdVyUJ82njdd8Khp4fUIHGZHW3M= -github.com/mgechev/revive v1.5.1/go.mod h1:lC9AhkJIBs5zwx8wkudyHrU+IJkrEKmpCmGMnIJPk4o= +github.com/mgechev/revive v1.6.1 h1:ncK0ZCMWtb8GXwVAmk+IeWF2ULIDsvRxSRfg5sTwQ2w= +github.com/mgechev/revive v1.6.1/go.mod h1:/2tfHWVO8UQi/hqJsIYNEKELi+DJy/e+PQpLgTB1v88= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= @@ -414,14 +414,14 @@ github.com/nishanths/exhaustive v0.12.0 h1:vIY9sALmw6T/yxiASewa4TQcFsVYZQQRUQJhK github.com/nishanths/exhaustive v0.12.0/go.mod h1:mEZ95wPIZW+x8kC4TgC+9YCUgiST7ecevsVDTgc2obs= github.com/nishanths/predeclared v0.2.2 h1:V2EPdZPliZymNAn79T8RkNApBjMmVKh5XRpLm/w98Vk= github.com/nishanths/predeclared v0.2.2/go.mod h1:RROzoN6TnGQupbC+lqggsOlcgysk3LMK/HI84Mp280c= -github.com/nunnatsa/ginkgolinter v0.18.4 h1:zmX4KUR+6fk/vhUFt8DOP6KwznekhkmVSzzVJve2vyM= -github.com/nunnatsa/ginkgolinter v0.18.4/go.mod h1:AMEane4QQ6JwFz5GgjI5xLUM9S/CylO+UyM97fN2iBI= +github.com/nunnatsa/ginkgolinter v0.19.0 h1:CnHRFAeBS3LdLI9h+Jidbcc5KH71GKOmaBZQk8Srnto= +github.com/nunnatsa/ginkgolinter v0.19.0/go.mod h1:jkQ3naZDmxaZMXPWaS9rblH+i+GWXQCaS/JFIWcOH2s= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= -github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= -github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= -github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= +github.com/onsi/ginkgo/v2 v2.22.2 h1:/3X8Panh8/WwhU/3Ssa6rCKqPLuAkVY2I0RoyDLySlU= +github.com/onsi/ginkgo/v2 v2.22.2/go.mod h1:oeMosUL+8LtarXBHu/c0bx2D/K9zyQ6uX3cTyztHwsk= +github.com/onsi/gomega v1.36.2 h1:koNYke6TVk6ZmnyHrCXba/T/MoLBXFjeC1PtvYgw0A8= +github.com/onsi/gomega v1.36.2/go.mod h1:DdwyADRjrc825LhMEkD76cHR5+pUnjhUN8GlHlRPHzY= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/copy v1.14.0 h1:dCI/t1iTdYGtkvCuBG2BgR6KZa83PTclw4U5n2wAllU= github.com/otiai10/copy v1.14.0/go.mod h1:ECfuL02W+/FkTWZWgQqXPWZgW9oeKCSQ5qVfSc4qc4w= @@ -429,20 +429,20 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= -github.com/patrickcping/pingone-go-sdk-v2 v0.12.8 h1:H2Ao3AnTcZy6sVIM1EsUxxI9Jcp68CUtRD++wM0YEoU= -github.com/patrickcping/pingone-go-sdk-v2 v0.12.8/go.mod h1:2/daXohYVj3lkcVI+OHoFyp7pePbcDSibNHFNIA/vmo= -github.com/patrickcping/pingone-go-sdk-v2/authorize v0.7.0 h1:e36HmxvHy3zmt9oKHlTTgImSt1Q71RT05i6Kp4EwxWU= -github.com/patrickcping/pingone-go-sdk-v2/authorize v0.7.0/go.mod h1:2PDrgC1ufXk2IDIk4JQHx6r34r2xpkbnzKIpXFv8gYs= -github.com/patrickcping/pingone-go-sdk-v2/credentials v0.10.0 h1:NziAU4J3b18hw/4L+4TpCOBS+kd9srQR2R3xP0aEbNw= -github.com/patrickcping/pingone-go-sdk-v2/credentials v0.10.0/go.mod h1:yRGf7+tsB3/AQYsNjIIs4ScJhR885mvDYMgwHiQeMl0= -github.com/patrickcping/pingone-go-sdk-v2/management v0.48.0 h1:bbgLieYsigArtPUmT80sfxaZkG660+NhuFnOkA2vxU4= -github.com/patrickcping/pingone-go-sdk-v2/management v0.48.0/go.mod h1:oLB/jjAkn4oEA60nC5/0KAobvcNJbflOWnVaS6lKxv8= -github.com/patrickcping/pingone-go-sdk-v2/mfa v0.22.0 h1:ldFQInE64TGiJp61ApCJ+NtUGV3Z3VneYpomZHJbyo0= -github.com/patrickcping/pingone-go-sdk-v2/mfa v0.22.0/go.mod h1:Q+Ym6kktv5Y6VnVhDt//lWoOhmIKfyjo6ejRx5mLttY= -github.com/patrickcping/pingone-go-sdk-v2/risk v0.18.0 h1:+Ogq2g0s0i+SU/NoJg9+pL5+3iPyK9tFUWrDC3scHR8= -github.com/patrickcping/pingone-go-sdk-v2/risk v0.18.0/go.mod h1:ppwkDT/w2/2y2aFH+hFQgziLMsWvz2MEZvwYexREqRk= -github.com/patrickcping/pingone-go-sdk-v2/verify v0.8.0 h1:FsssxnJ/VSIxXtdvZlDn555nY+Yn1ndsg9IITyXYBbM= -github.com/patrickcping/pingone-go-sdk-v2/verify v0.8.0/go.mod h1:bCq5fHv9mSdNsm/XiT5jb3YgYnQb8F824EYfq9eAJl4= +github.com/patrickcping/pingone-go-sdk-v2 v0.12.9 h1:EznRTRLzpgHeqkBtXHBrwjIMlfLamqOurODgIKNyoBY= +github.com/patrickcping/pingone-go-sdk-v2 v0.12.9/go.mod h1:ZA09d5Rw6Mp7MBT7iJageVfzU1k6yjEjsQCLpIlFyRQ= +github.com/patrickcping/pingone-go-sdk-v2/authorize v0.8.0 h1:gEPzZToJlBcJh2Ft12dP1GCSGzsNFQFEHS7Bql86RQk= +github.com/patrickcping/pingone-go-sdk-v2/authorize v0.8.0/go.mod h1:2PDrgC1ufXk2IDIk4JQHx6r34r2xpkbnzKIpXFv8gYs= +github.com/patrickcping/pingone-go-sdk-v2/credentials v0.11.0 h1:pLiiBkROks/40vhFWJEcr/tiIEqqYdP4FWsHtfCLdIs= +github.com/patrickcping/pingone-go-sdk-v2/credentials v0.11.0/go.mod h1:yRGf7+tsB3/AQYsNjIIs4ScJhR885mvDYMgwHiQeMl0= +github.com/patrickcping/pingone-go-sdk-v2/management v0.49.0 h1:F1zE2PhxgZCu08TObPylcnXzKqdbaAXkDODWegTE7WM= +github.com/patrickcping/pingone-go-sdk-v2/management v0.49.0/go.mod h1:oLB/jjAkn4oEA60nC5/0KAobvcNJbflOWnVaS6lKxv8= +github.com/patrickcping/pingone-go-sdk-v2/mfa v0.23.0 h1:k133OY6PNO3tgNK3LBoEI+Uf9bRNKsvAkMMVUf99/Q0= +github.com/patrickcping/pingone-go-sdk-v2/mfa v0.23.0/go.mod h1:Q+Ym6kktv5Y6VnVhDt//lWoOhmIKfyjo6ejRx5mLttY= +github.com/patrickcping/pingone-go-sdk-v2/risk v0.19.0 h1:qGdwnfjsexHhTUAyBaUzheyeKWhR3Q8groqVpprzzOw= +github.com/patrickcping/pingone-go-sdk-v2/risk v0.19.0/go.mod h1:ppwkDT/w2/2y2aFH+hFQgziLMsWvz2MEZvwYexREqRk= +github.com/patrickcping/pingone-go-sdk-v2/verify v0.9.0 h1:Gnxvi7yx4NSBNOqBBydUPoR9Flp/dnnXj3129+ub9WY= +github.com/patrickcping/pingone-go-sdk-v2/verify v0.9.0/go.mod h1:bCq5fHv9mSdNsm/XiT5jb3YgYnQb8F824EYfq9eAJl4= github.com/pavius/impi v0.0.3 h1:DND6MzU+BLABhOZXbELR3FU8b+zDgcq4dOCNLhiTYuI= github.com/pavius/impi v0.0.3/go.mod h1:x/hU0bfdWIhuOT1SKwiJg++yvkk6EuOtJk8WtDZqgr8= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= @@ -456,8 +456,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/polyfloyd/go-errorlint v1.7.0 h1:Zp6lzCK4hpBDj8y8a237YK4EPrMXQWvOe3nGoH4pFrU= -github.com/polyfloyd/go-errorlint v1.7.0/go.mod h1:dGWKu85mGHnegQ2SWpEybFityCg3j7ZbwsVUxAOk9gY= +github.com/polyfloyd/go-errorlint v1.7.1 h1:RyLVXIbosq1gBdk/pChWA8zWYLsq9UEw7a1L5TVMCnA= +github.com/polyfloyd/go-errorlint v1.7.1/go.mod h1:aXjNb1x2TNhoLsk26iv1yl7a+zTnXPhwEMtEXukiLR8= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -520,10 +520,8 @@ github.com/sashamelentyev/interfacebloat v1.1.0 h1:xdRdJp0irL086OyW1H/RTZTr1h/tM github.com/sashamelentyev/interfacebloat v1.1.0/go.mod h1:+Y9yU5YdTkrNvoX0xHc84dxiN1iBi9+G8zZIhPVoNjQ= github.com/sashamelentyev/usestdlibvars v1.28.0 h1:jZnudE2zKCtYlGzLVreNp5pmCdOxXUzwsMDBkR21cyQ= github.com/sashamelentyev/usestdlibvars v1.28.0/go.mod h1:9nl0jgOfHKWNFS43Ojw0i7aRoS4j6EBye3YBhmAIRF8= -github.com/securego/gosec/v2 v2.21.4 h1:Le8MSj0PDmOnHJgUATjD96PaXRvCpKC+DGJvwyy0Mlk= -github.com/securego/gosec/v2 v2.21.4/go.mod h1:Jtb/MwRQfRxCXyCm1rfM1BEiiiTfUOdyzzAhlr6lUTA= -github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= -github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= +github.com/securego/gosec/v2 v2.22.1 h1:IcBt3TpI5Y9VN1YlwjSpM2cHu0i3Iw52QM+PQeg7jN8= +github.com/securego/gosec/v2 v2.22.1/go.mod h1:4bb95X4Jz7VSEPdVjC0hD7C/yR6kdeUBvCPOy9gDQ0g= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= @@ -541,12 +539,12 @@ github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9yS github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/sourcegraph/go-diff v0.7.0 h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0= github.com/sourcegraph/go-diff v0.7.0/go.mod h1:iBszgVvyxdc8SFZ7gm69go2KDdt3ag071iBaWPF6cjs= -github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= -github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= +github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= +github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= -github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= -github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= +github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= +github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -574,8 +572,8 @@ github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOf github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= -github.com/tdakkota/asciicheck v0.3.0 h1:LqDGgZdholxZMaJgpM6b0U9CFIjDCbFdUF00bDnBKOQ= -github.com/tdakkota/asciicheck v0.3.0/go.mod h1:KoJKXuX/Z/lt6XzLo8WMBfQGzak0SrAKZlvRr4tg8Ac= +github.com/tdakkota/asciicheck v0.4.0 h1:VZ13Itw4k1i7d+dpDSNS8Op645XgGHpkCEh/WHicgWw= +github.com/tdakkota/asciicheck v0.4.0/go.mod h1:0k7M3rCfRXb0Z6bwgvkEIMleKH3kXNz9UqJ9Xuqopr8= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= github.com/tenntenn/modver v1.0.1/go.mod h1:bePIyQPb7UeioSRkw3Q0XeMhYZSMx9B8ePqg6SAMGH0= github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpRQGxTSkNYKJ51yaw6ChIqO+Je8UqsTKN/cDag= @@ -596,8 +594,8 @@ github.com/ultraware/whitespace v0.2.0 h1:TYowo2m9Nfj1baEQBjuHzvMRbp19i+RCcRYrSW github.com/ultraware/whitespace v0.2.0/go.mod h1:XcP1RLD81eV4BW8UhQlpaR+SDc2givTvyI8a586WjW8= github.com/uudashr/gocognit v1.2.0 h1:3BU9aMr1xbhPlvJLSydKwdLN3tEUUrzPSSM8S4hDYRA= github.com/uudashr/gocognit v1.2.0/go.mod h1:k/DdKPI6XBZO1q7HgoV2juESI2/Ofj9AcHPZhBBdrTU= -github.com/uudashr/iface v1.3.0 h1:zwPch0fs9tdh9BmL5kcgSpvnObV+yHjO4JjVBl8IA10= -github.com/uudashr/iface v1.3.0/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= +github.com/uudashr/iface v1.3.1 h1:bA51vmVx1UIhiIsQFSNq6GZ6VPTk3WNMZgRiCe9R29U= +github.com/uudashr/iface v1.3.1/go.mod h1:4QvspiRd3JLPAEXBQ9AiZpLbJlrWWgRChOKDJEuQTdg= github.com/xen0n/gosmopolitan v1.2.2 h1:/p2KTnMzwRexIW8GlKawsTWOxn7UHA+jCMF/V8HHtvU= github.com/xen0n/gosmopolitan v1.2.2/go.mod h1:7XX7Mj61uLYrj0qmeN0zi7XDon9JRAEhYQqAPLVNTeg= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= @@ -619,8 +617,8 @@ go-simpler.org/assert v0.9.0 h1:PfpmcSvL7yAnWyChSjOz6Sp6m9j5lyK8Ok9pEL31YkQ= go-simpler.org/assert v0.9.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28= go-simpler.org/musttag v0.13.0 h1:Q/YAW0AHvaoaIbsPj3bvEI5/QFP7w696IMUpnKXQfCE= go-simpler.org/musttag v0.13.0/go.mod h1:FTzIGeK6OkKlUDVpj0iQUXZLUO1Js9+mvykDQy9C5yM= -go-simpler.org/sloglint v0.7.2 h1:Wc9Em/Zeuu7JYpl+oKoYOsQSy2X560aVueCW/m6IijY= -go-simpler.org/sloglint v0.7.2/go.mod h1:US+9C80ppl7VsThQclkM7BkCHQAzuz8kHLsW3ppuluo= +go-simpler.org/sloglint v0.9.0 h1:/40NQtjRx9txvsB/RN022KsUJU+zaaSb/9q9BSefSrE= +go-simpler.org/sloglint v0.9.0/go.mod h1:G/OrAF6uxj48sHahCzrbarVMptL2kjWTaUeC8+fOGww= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= @@ -659,8 +657,8 @@ golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWB golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= golang.org/x/exp/typeparams v0.0.0-20220428152302-39d4317da171/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/exp/typeparams v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= -golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f h1:WTyX8eCCyfdqiPYkRGm0MqElSfYFH3yR1+rl/mct9sA= -golang.org/x/exp/typeparams v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= +golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac h1:TSSpLIG4v+p0rPv1pNOQtl1I8knsO4S9trOxNMOLVP4= +golang.org/x/exp/typeparams v0.0.0-20250210185358-939b2ce775ac/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -690,8 +688,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= -golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.23.0 h1:Zb7khfcRGKk+kqfxFaP5tZqCnDZMjC5VtUBs87Hr6QM= +golang.org/x/mod v0.23.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -727,22 +725,21 @@ golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qx golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= -golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8= +golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20191202225959-858c2ad4c8b6/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= -golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.26.0 h1:afQXWNNaeC4nvZ0Ed9XvCCzXM6UHJG7iCg0W4fPqSBE= +golang.org/x/oauth2 v0.26.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -758,8 +755,8 @@ golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= -golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= -golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.11.0 h1:GGz8+XQP4FvTTrjZPzNKTMFtSXH80RAzG+5ghFPgK9w= +golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -808,18 +805,16 @@ golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc= +golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo= @@ -833,13 +828,12 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM= +golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -849,7 +843,6 @@ golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3 golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190321232350-e250d351ecad/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190506145303-2d16b83fe98c/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -857,7 +850,6 @@ golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20190910044552-dd2b5c81c578/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -897,13 +889,12 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= -golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k= golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.7.0/go.mod h1:4pg6aUX35JBAogB10C9AtvVL+qowtN4pT3CGSQex14s= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= -golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= -golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= +golang.org/x/tools v0.30.0 h1:BgcpHewrV5AUp2G9MebG4XPFI1E2W41zU1SaqVA9vJY= +golang.org/x/tools v0.30.0/go.mod h1:c347cR/OJfw5TI+GfX7RUPNMdDRRbjvYTS0jPyvsVtY= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -983,8 +974,8 @@ google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGj google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +google.golang.org/protobuf v1.36.4 h1:6A3ZDJHn/eNqc1i+IdefRzy/9PokBTPvcqMySR7NNIM= +google.golang.org/protobuf v1.36.4/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -1011,8 +1002,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.5.1 h1:4bH5o3b5ZULQ4UrBmP+63W9r7qIkqJClEA9ko5YKx+I= -honnef.co/go/tools v0.5.1/go.mod h1:e9irvo83WDG9/irijV44wr3tbhcFeRnfpVlRqVwpzMs= +honnef.co/go/tools v0.6.0 h1:TAODvD3knlq75WCp2nyGJtT4LeRV/o7NN9nYPeVJXf8= +honnef.co/go/tools v0.6.0/go.mod h1:3puzxxljPCe8RGJX7BIy1plGbxEOZni5mR2aXe3/uk4= mvdan.cc/gofumpt v0.7.0 h1:bg91ttqXmi9y2xawvkuMXyvAA/1ZGJqYAEGjXuP0JXU= mvdan.cc/gofumpt v0.7.0/go.mod h1:txVFJy/Sc/mvaycET54pV8SW8gWxTlUuGHVEcncmNUo= mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f h1:lMpcwN6GxNbWtbpI1+xzFLSW8XzX0u72NttUGVFjO3U= diff --git a/internal/tools/tools.go b/internal/tools/tools.go deleted file mode 100644 index c2eeb598..00000000 --- a/internal/tools/tools.go +++ /dev/null @@ -1,12 +0,0 @@ -//go:build tools -// +build tools - -package tools - -// Manage tool dependencies via go.mod. -// -//nolint:all -import ( - _ "github.com/golangci/golangci-lint/cmd/golangci-lint" - _ "github.com/pavius/impi" -) From 9426731d327f42f7b3e41e41e6d94e9a0df89afa Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Thu, 20 Feb 2025 09:28:17 -0700 Subject: [PATCH 10/18] Use common reflect value extraction function, move MFA resource functions back into ExportableResource type, compact fields output in prints --- cmd/platform/export_test.go | 17 +++++ internal/connector/common/resources_common.go | 63 ++++++++++++------- ...pingone_mfa_application_push_credential.go | 16 ++--- .../resources/pingone_mfa_device_policy.go | 8 +-- .../mfa/resources/pingone_mfa_fido2_policy.go | 8 +-- .../mfa/resources/pingone_mfa_settings.go | 8 +-- .../resources/pingone_gateway_credential.go | 2 +- internal/output/output.go | 4 +- 8 files changed, 79 insertions(+), 47 deletions(-) diff --git a/cmd/platform/export_test.go b/cmd/platform/export_test.go index ce4892c2..45e60dfd 100644 --- a/cmd/platform/export_test.go +++ b/cmd/platform/export_test.go @@ -197,6 +197,23 @@ func TestPlatformExportCmd_PingFederateBasicAuthFlagsRequiredTogether(t *testing testutils.CheckExpectedError(t, err, &expectedErrorPattern) } +// Test Platform Export Command fails when provided invalid PingOne Client Credential flags +func TestPlatformExportCmd_PingOneClientCredentialFlagsInvalid(t *testing.T) { + outputDir := t.TempDir() + + expectedErrorPattern := `^test$` + err := testutils_cobra.ExecutePingcli(t, "platform", "export", + "--output-directory", outputDir, + "--overwrite", + "--services", "pingone-protect", + "--pingone-worker-environment-id", os.Getenv(options.PingOneAuthenticationWorkerEnvironmentIDOption.EnvVar), + "--pingone-worker-client-id", os.Getenv(options.PingOneAuthenticationWorkerClientIDOption.EnvVar), + "--pingone-worker-client-secret", "invalid", + "--pingone-region-code", os.Getenv(options.PingOneRegionCodeOption.EnvVar), + ) + testutils.CheckExpectedError(t, err, &expectedErrorPattern) +} + // Test Platform Export Command fails when provided invalid PingFederate Basic Auth flags func TestPlatformExportCmd_PingFederateBasicAuthFlagsInvalid(t *testing.T) { outputDir := t.TempDir() diff --git a/internal/connector/common/resources_common.go b/internal/connector/common/resources_common.go index 8a28afd4..0d77cee1 100644 --- a/internal/connector/common/resources_common.go +++ b/internal/connector/common/resources_common.go @@ -118,15 +118,12 @@ func GetManagementAPIObjectsFromIterator[T any](iter management.EntityArrayPaged return nil, nilErr } - reflectValues := reflect.ValueOf(embedded).MethodByName(extractionFuncName).Call(nil) - for _, rValue := range reflectValues { - apiObject, apiObjectOk := rValue.Interface().(T) - if !apiObjectOk { - output.SystemError(fmt.Sprintf("Failed to cast reflect value to %s", resourceType), nil) - } - - apiObjects = append(apiObjects, apiObject) + apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) + if err != nil { + output.SystemError(err.Error(), nil) } + + apiObjects = append(apiObjects, apiObject...) } return apiObjects, nil @@ -156,15 +153,12 @@ func GetMfaAPIObjectsFromIterator[T any](iter mfa.EntityArrayPagedIterator, clie return nil, nilErr } - reflectValues := reflect.ValueOf(embedded).MethodByName(extractionFuncName).Call(nil) - for _, rValue := range reflectValues { - apiObject, apiObjectOk := rValue.Interface().(T) - if !apiObjectOk { - output.SystemError(fmt.Sprintf("Failed to cast reflect value to %s", resourceType), nil) - } - - apiObjects = append(apiObjects, apiObject) + apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) + if err != nil { + output.SystemError(err.Error(), nil) } + + apiObjects = append(apiObjects, apiObject...) } return apiObjects, nil @@ -194,16 +188,37 @@ func GetRiskAPIObjectsFromIterator[T any](iter risk.EntityArrayPagedIterator, cl return nil, nilErr } - reflectValues := reflect.ValueOf(embedded).MethodByName(extractionFuncName).Call(nil) - for _, rValue := range reflectValues { - apiObject, apiObjectOk := rValue.Interface().(T) - if !apiObjectOk { - output.SystemError(fmt.Sprintf("Failed to cast reflect value to %s", resourceType), nil) - } - - apiObjects = append(apiObjects, apiObject) + apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) + if err != nil { + output.SystemError(err.Error(), nil) } + + apiObjects = append(apiObjects, apiObject...) } return apiObjects, nil } + +func getAPIObjectFromEmbedded[T any](embedded reflect.Value, extractionFuncName, resourceType string) ([]T, error) { + embeddedExtractionFunc := embedded.MethodByName(extractionFuncName) + if !embeddedExtractionFunc.IsValid() { + return nil, fmt.Errorf("failed to find extraction function '%s' for resource '%s'", extractionFuncName, resourceType) + } + + reflectValues := embeddedExtractionFunc.Call(nil) + if len(reflectValues) == 0 { + return nil, fmt.Errorf("failed to get reflect value from embedded. embedded is empty") + } + + rInterface := reflectValues[0].Interface() + if rInterface == nil { + return []T{}, nil + } + + apiObject, apiObjectOk := rInterface.([]T) + if !apiObjectOk { + return nil, fmt.Errorf("failed to cast reflect value to %s", resourceType) + } + + return apiObject, nil +} diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go b/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go index 7c8bcd94..20d951d3 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go @@ -36,13 +36,13 @@ func (r *PingOneMFAApplicationPushCredentialResource) ExportAll() (*[]connector. importBlocks := []connector.ImportBlock{} - applicationData, err := getOIDCApplicationData(r.clientInfo, r.ResourceType()) + applicationData, err := r.getOIDCApplicationData() if err != nil { return nil, err } for appId, appName := range applicationData { - pushCredData, err := getPushCredentialData(r.clientInfo, r.ResourceType(), appId) + pushCredData, err := r.getPushCredentialData(appId) if err != nil { return nil, err } @@ -71,11 +71,11 @@ func (r *PingOneMFAApplicationPushCredentialResource) ExportAll() (*[]connector. return &importBlocks, nil } -func getOIDCApplicationData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneMFAApplicationPushCredentialResource) getOIDCApplicationData() (map[string]string, error) { applicationData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } @@ -98,11 +98,11 @@ func getOIDCApplicationData(clientInfo *connector.PingOneClientInfo, resourceTyp return applicationData, nil } -func getPushCredentialData(clientInfo *connector.PingOneClientInfo, resourceType, applicationId string) (map[string]string, error) { +func (r *PingOneMFAApplicationPushCredentialResource) getPushCredentialData(applicationId string) (map[string]string, error) { mfaPushCredentialData := make(map[string]string) - iter := clientInfo.ApiClient.MFAAPIClient.ApplicationsApplicationMFAPushCredentialsApi.ReadAllMFAPushCredentials(clientInfo.Context, clientInfo.ExportEnvironmentID, applicationId).Execute() - mfaPushCredentials, err := common.GetMfaAPIObjectsFromIterator[mfa.MFAPushCredentialResponse](iter, "ReadAllMFAPushCredentials", "GetPushCredentials", resourceType) + iter := r.clientInfo.ApiClient.MFAAPIClient.ApplicationsApplicationMFAPushCredentialsApi.ReadAllMFAPushCredentials(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, applicationId).Execute() + mfaPushCredentials, err := common.GetMfaAPIObjectsFromIterator[mfa.MFAPushCredentialResponse](iter, "ReadAllMFAPushCredentials", "GetPushCredentials", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go b/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go index 02c8eab2..10a02c79 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go @@ -35,7 +35,7 @@ func (r *PingOneMFADevicePolicyResource) ExportAll() (*[]connector.ImportBlock, importBlocks := []connector.ImportBlock{} - deviceAuthPolicyData, err := getDeviceAuthPolicyData(r.clientInfo, r.ResourceType()) + deviceAuthPolicyData, err := r.getDeviceAuthPolicyData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneMFADevicePolicyResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func getDeviceAuthPolicyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneMFADevicePolicyResource) getDeviceAuthPolicyData() (map[string]string, error) { deviceAuthPolicyData := make(map[string]string) - iter := clientInfo.ApiClient.MFAAPIClient.DeviceAuthenticationPolicyApi.ReadDeviceAuthenticationPolicies(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - deviceAuthPolicies, err := common.GetMfaAPIObjectsFromIterator[mfa.DeviceAuthenticationPolicy](iter, "ReadDeviceAuthenticationPolicies", "GetDeviceAuthenticationPolicies", resourceType) + iter := r.clientInfo.ApiClient.MFAAPIClient.DeviceAuthenticationPolicyApi.ReadDeviceAuthenticationPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + deviceAuthPolicies, err := common.GetMfaAPIObjectsFromIterator[mfa.DeviceAuthenticationPolicy](iter, "ReadDeviceAuthenticationPolicies", "GetDeviceAuthenticationPolicies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go b/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go index 5854790f..4e9f5c6b 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go @@ -35,7 +35,7 @@ func (r *PingOneMFAFido2PolicyResource) ExportAll() (*[]connector.ImportBlock, e importBlocks := []connector.ImportBlock{} - fido2PolicyData, err := getFido2PolicyData(r.clientInfo, r.ResourceType()) + fido2PolicyData, err := r.getFido2PolicyData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneMFAFido2PolicyResource) ExportAll() (*[]connector.ImportBlock, e return &importBlocks, nil } -func getFido2PolicyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneMFAFido2PolicyResource) getFido2PolicyData() (map[string]string, error) { fido2PolicyData := make(map[string]string) - iter := clientInfo.ApiClient.MFAAPIClient.FIDO2PolicyApi.ReadFIDO2Policies(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - fido2Policies, err := common.GetMfaAPIObjectsFromIterator[mfa.FIDO2Policy](iter, "ReadFIDO2Policies", "GetFido2Policies", resourceType) + iter := r.clientInfo.ApiClient.MFAAPIClient.FIDO2PolicyApi.ReadFIDO2Policies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + fido2Policies, err := common.GetMfaAPIObjectsFromIterator[mfa.FIDO2Policy](iter, "ReadFIDO2Policies", "GetFido2Policies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go b/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go index 5608d2cb..ccb7be74 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go @@ -32,7 +32,7 @@ func (r *PingOneMFASettingsResource) ExportAll() (*[]connector.ImportBlock, erro importBlocks := []connector.ImportBlock{} - ok, err := checkMFASettingsData(r.clientInfo, r.ResourceType()) + ok, err := r.checkMFASettingsData() if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (r *PingOneMFASettingsResource) ExportAll() (*[]connector.ImportBlock, erro return &importBlocks, nil } -func checkMFASettingsData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { - _, response, err := clientInfo.ApiClient.MFAAPIClient.MFASettingsApi.ReadMFASettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadMFASettings", resourceType) +func (r *PingOneMFASettingsResource) checkMFASettingsData() (bool, error) { + _, response, err := r.clientInfo.ApiClient.MFAAPIClient.MFASettingsApi.ReadMFASettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadMFASettings", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go index 50c2fa0b..d050cac3 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go @@ -73,7 +73,7 @@ func getGatewayCredentialData(clientInfo *connector.PingOneClientInfo, resourceT gatewayCredentialData := []string{} iter := clientInfo.ApiClient.ManagementAPIClient.GatewayCredentialsApi.ReadAllGatewayCredentials(clientInfo.Context, clientInfo.ExportEnvironmentID, gatewayId).Execute() - gatewayCredentials, err := common.GetManagementAPIObjectsFromIterator[management.GatewayCredential](iter, "ReadAllGatewayCredentials", "GetGatewayCredentials", resourceType) + gatewayCredentials, err := common.GetManagementAPIObjectsFromIterator[management.GatewayCredential](iter, "ReadAllGatewayCredentials", "GetCredentials", resourceType) if err != nil { return nil, err } diff --git a/internal/output/output.go b/internal/output/output.go index 78b54f57..80430690 100644 --- a/internal/output/output.go +++ b/internal/output/output.go @@ -119,10 +119,10 @@ func printText(message string, fields map[string]interface{}, colorFunc func(for switch typedValue := v.(type) { // If the value is a json.RawMessage, print it as a string case json.RawMessage: - fmt.Println(cyan("%s: \n%s", k, typedValue)) + fmt.Println(cyan("%s: %s", k, typedValue)) l.Info().Msg(cyan("%s: %s", k, typedValue)) default: - fmt.Println(cyan("%s: \n%v", k, v)) + fmt.Println(cyan("%s: %v", k, v)) l.Info().Msg(cyan("%s: %v", k, v)) } } From 6dd6e33c358bc4766a25673cbdbc8c961cf8b0ed Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Thu, 20 Feb 2025 09:44:07 -0700 Subject: [PATCH 11/18] Pass PF resource data by value to avoid nil dereference --- .../pingfederate_authentication_api_application.go | 6 +++--- .../pingfederate_authentication_policies_fragment.go | 6 +++--- .../pingfederate_authentication_policy_contract.go | 6 +++--- .../resources/pingfederate_authentication_selector.go | 6 +++--- .../pingfederate/resources/pingfederate_captcha_provider.go | 6 +++--- .../pingfederate/resources/pingfederate_certificate_ca.go | 6 +++--- ...pingfederate_certificates_revocation_ocsp_certificate.go | 6 +++--- .../pingfederate/resources/pingfederate_data_store.go | 6 +++--- .../resources/pingfederate_identity_store_provisioner.go | 6 +++--- .../pingfederate/resources/pingfederate_idp_adapter.go | 6 +++--- .../resources/pingfederate_idp_sp_connection.go | 6 +++--- .../pingfederate_idp_sts_request_parameters_contract.go | 6 +++--- .../resources/pingfederate_idp_to_sp_adapter_mapping.go | 6 +++--- .../resources/pingfederate_idp_token_processor.go | 6 +++--- .../pingfederate/resources/pingfederate_kerberos_realm.go | 6 +++--- ...rate_keypairs_oauth_openid_connect_additional_key_set.go | 6 +++--- .../pingfederate_keypairs_signing_key_rotation_settings.go | 6 +++--- .../resources/pingfederate_local_identity_profile.go | 6 +++--- .../pingfederate/resources/pingfederate_metadata_url.go | 6 +++--- .../resources/pingfederate_notification_publisher.go | 6 +++--- .../resources/pingfederate_oauth_access_token_manager.go | 6 +++--- .../resources/pingfederate_oauth_access_token_mapping.go | 6 +++--- ...federate_oauth_authentication_policy_contract_mapping.go | 6 +++--- .../pingfederate_oauth_ciba_server_policy_request_policy.go | 6 +++--- .../pingfederate/resources/pingfederate_oauth_client.go | 6 +++--- .../pingfederate_oauth_client_registration_policy.go | 6 +++--- .../resources/pingfederate_oauth_idp_adapter_mapping.go | 6 +++--- .../pingfederate/resources/pingfederate_oauth_issuer.go | 6 +++--- ...federate_oauth_token_exchange_token_generator_mapping.go | 6 +++--- .../resources/pingfederate_openid_connect_policy.go | 6 +++--- .../resources/pingfederate_password_credential_validator.go | 6 +++--- .../resources/pingfederate_pingone_connection.go | 6 +++--- .../pingfederate/resources/pingfederate_secret_manager.go | 6 +++--- ...ver_settings_ws_trust_sts_settings_issuer_certificate.go | 6 +++--- .../resources/pingfederate_session_authentication_policy.go | 6 +++--- .../pingfederate/resources/pingfederate_sp_adapter.go | 6 +++--- ...ingfederate_sp_authentication_policy_contract_mapping.go | 6 +++--- .../resources/pingfederate_sp_idp_connection.go | 6 +++--- ...ngfederate_token_processor_to_token_generator_mapping.go | 6 +++--- 39 files changed, 117 insertions(+), 117 deletions(-) diff --git a/internal/connector/pingfederate/resources/pingfederate_authentication_api_application.go b/internal/connector/pingfederate/resources/pingfederate_authentication_api_application.go index b2a3140f..1bde0167 100644 --- a/internal/connector/pingfederate/resources/pingfederate_authentication_api_application.go +++ b/internal/connector/pingfederate/resources/pingfederate_authentication_api_application.go @@ -37,7 +37,7 @@ func (r *PingFederateAuthenticationApiApplicationResource) ExportAll() (*[]conne return nil, err } - for appId, appName := range *applicationData { + for appId, appName := range applicationData { commentData := map[string]string{ "Authentication API Application ID": appId, "Authentication API Application Name": appName, @@ -57,7 +57,7 @@ func (r *PingFederateAuthenticationApiApplicationResource) ExportAll() (*[]conne return &importBlocks, nil } -func (r *PingFederateAuthenticationApiApplicationResource) getApplicationData() (*map[string]string, error) { +func (r *PingFederateAuthenticationApiApplicationResource) getApplicationData() (map[string]string, error) { applicationData := make(map[string]string) authnApiApplications, response, err := r.clientInfo.ApiClient.AuthenticationApiAPI.GetAuthenticationApiApplications(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateAuthenticationApiApplicationResource) getApplicationData() } } - return &applicationData, nil + return applicationData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_authentication_policies_fragment.go b/internal/connector/pingfederate/resources/pingfederate_authentication_policies_fragment.go index 8f65dc1b..66132c30 100644 --- a/internal/connector/pingfederate/resources/pingfederate_authentication_policies_fragment.go +++ b/internal/connector/pingfederate/resources/pingfederate_authentication_policies_fragment.go @@ -37,7 +37,7 @@ func (r *PingFederateAuthenticationPoliciesFragmentResource) ExportAll() (*[]con return nil, err } - for fragmentId, fragmentName := range *fragmentData { + for fragmentId, fragmentName := range fragmentData { commentData := map[string]string{ "Authentication Policies Fragment ID": fragmentId, "Authentication Policies Fragment Name": fragmentName, @@ -57,7 +57,7 @@ func (r *PingFederateAuthenticationPoliciesFragmentResource) ExportAll() (*[]con return &importBlocks, nil } -func (r *PingFederateAuthenticationPoliciesFragmentResource) getFragmentData() (*map[string]string, error) { +func (r *PingFederateAuthenticationPoliciesFragmentResource) getFragmentData() (map[string]string, error) { fragmentData := make(map[string]string) authnPoliciesFragments, response, err := r.clientInfo.ApiClient.AuthenticationPoliciesAPI.GetFragments(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateAuthenticationPoliciesFragmentResource) getFragmentData() ( } } - return &fragmentData, nil + return fragmentData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_authentication_policy_contract.go b/internal/connector/pingfederate/resources/pingfederate_authentication_policy_contract.go index cbf24c2f..ce43e22d 100644 --- a/internal/connector/pingfederate/resources/pingfederate_authentication_policy_contract.go +++ b/internal/connector/pingfederate/resources/pingfederate_authentication_policy_contract.go @@ -37,7 +37,7 @@ func (r *PingFederateAuthenticationPolicyContractResource) ExportAll() (*[]conne return nil, err } - for authnPolicyContractId, authnPolicyContractName := range *authenticationPolicyContractData { + for authnPolicyContractId, authnPolicyContractName := range authenticationPolicyContractData { commentData := map[string]string{ "Authentication Policy Contract ID": authnPolicyContractId, "Authentication Policy Contract Name": authnPolicyContractName, @@ -57,7 +57,7 @@ func (r *PingFederateAuthenticationPolicyContractResource) ExportAll() (*[]conne return &importBlocks, nil } -func (r *PingFederateAuthenticationPolicyContractResource) getAuthenticationPolicyContractData() (*map[string]string, error) { +func (r *PingFederateAuthenticationPolicyContractResource) getAuthenticationPolicyContractData() (map[string]string, error) { authenticationPolicyContractData := make(map[string]string) authnPolicyContracts, response, err := r.clientInfo.ApiClient.AuthenticationPolicyContractsAPI.GetAuthenticationPolicyContracts(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateAuthenticationPolicyContractResource) getAuthenticationPoli } } - return &authenticationPolicyContractData, nil + return authenticationPolicyContractData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_authentication_selector.go b/internal/connector/pingfederate/resources/pingfederate_authentication_selector.go index 1efca450..8036160f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_authentication_selector.go +++ b/internal/connector/pingfederate/resources/pingfederate_authentication_selector.go @@ -37,7 +37,7 @@ func (r *PingFederateAuthenticationSelectorResource) ExportAll() (*[]connector.I return nil, err } - for authnSelectorId, authnSelectorName := range *authenticationSelectorData { + for authnSelectorId, authnSelectorName := range authenticationSelectorData { commentData := map[string]string{ "Authentication Selector ID": authnSelectorId, "Authentication Selector Name": authnSelectorName, @@ -57,7 +57,7 @@ func (r *PingFederateAuthenticationSelectorResource) ExportAll() (*[]connector.I return &importBlocks, nil } -func (r *PingFederateAuthenticationSelectorResource) getAuthenticationSelectorData() (*map[string]string, error) { +func (r *PingFederateAuthenticationSelectorResource) getAuthenticationSelectorData() (map[string]string, error) { authenticationSelectorData := make(map[string]string) authnSelectors, response, err := r.clientInfo.ApiClient.AuthenticationSelectorsAPI.GetAuthenticationSelectors(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateAuthenticationSelectorResource) getAuthenticationSelectorDa } } - return &authenticationSelectorData, nil + return authenticationSelectorData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_captcha_provider.go b/internal/connector/pingfederate/resources/pingfederate_captcha_provider.go index 9dc64b44..c77b87e1 100644 --- a/internal/connector/pingfederate/resources/pingfederate_captcha_provider.go +++ b/internal/connector/pingfederate/resources/pingfederate_captcha_provider.go @@ -37,7 +37,7 @@ func (r *PingFederateCaptchaProviderResource) ExportAll() (*[]connector.ImportBl return nil, err } - for captchaProviderId, captchaProviderName := range *captchaProviderData { + for captchaProviderId, captchaProviderName := range captchaProviderData { commentData := map[string]string{ "Captcha Provider ID": captchaProviderId, "Captcha Provider Name": captchaProviderId, @@ -57,7 +57,7 @@ func (r *PingFederateCaptchaProviderResource) ExportAll() (*[]connector.ImportBl return &importBlocks, nil } -func (r *PingFederateCaptchaProviderResource) getCaptchaProviderData() (*map[string]string, error) { +func (r *PingFederateCaptchaProviderResource) getCaptchaProviderData() (map[string]string, error) { captchaProviderData := make(map[string]string) captchaProviders, response, err := r.clientInfo.ApiClient.CaptchaProvidersAPI.GetCaptchaProviders(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateCaptchaProviderResource) getCaptchaProviderData() (*map[str } } - return &captchaProviderData, nil + return captchaProviderData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_certificate_ca.go b/internal/connector/pingfederate/resources/pingfederate_certificate_ca.go index d7018fe5..f0d39c55 100644 --- a/internal/connector/pingfederate/resources/pingfederate_certificate_ca.go +++ b/internal/connector/pingfederate/resources/pingfederate_certificate_ca.go @@ -39,7 +39,7 @@ func (r *PingFederateCertificateCAResource) ExportAll() (*[]connector.ImportBloc return nil, err } - for certViewId, certViewInfo := range *trustedCAData { + for certViewId, certViewInfo := range trustedCAData { certViewIssuerDN := certViewInfo[0] certViewSerialNumber := certViewInfo[1] @@ -63,7 +63,7 @@ func (r *PingFederateCertificateCAResource) ExportAll() (*[]connector.ImportBloc return &importBlocks, nil } -func (r *PingFederateCertificateCAResource) getTrustedCAData() (*map[string][]string, error) { +func (r *PingFederateCertificateCAResource) getTrustedCAData() (map[string][]string, error) { trustedCAData := make(map[string][]string) certViews, response, err := r.clientInfo.ApiClient.CertificatesCaAPI.GetTrustedCAs(r.clientInfo.Context).Execute() @@ -94,5 +94,5 @@ func (r *PingFederateCertificateCAResource) getTrustedCAData() (*map[string][]st } } - return &trustedCAData, nil + return trustedCAData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_certificates_revocation_ocsp_certificate.go b/internal/connector/pingfederate/resources/pingfederate_certificates_revocation_ocsp_certificate.go index fc41319a..42c553d6 100644 --- a/internal/connector/pingfederate/resources/pingfederate_certificates_revocation_ocsp_certificate.go +++ b/internal/connector/pingfederate/resources/pingfederate_certificates_revocation_ocsp_certificate.go @@ -39,7 +39,7 @@ func (r *PingFederateCertificatesRevocationOCSPCertificateResource) ExportAll() return nil, err } - for ocspCertificateId, ocspCertificateInfo := range *ocspCertificateData { + for ocspCertificateId, ocspCertificateInfo := range ocspCertificateData { ocspCertificateIssuerDN := ocspCertificateInfo[0] ocspCertificateSerialNumber := ocspCertificateInfo[1] @@ -63,7 +63,7 @@ func (r *PingFederateCertificatesRevocationOCSPCertificateResource) ExportAll() return &importBlocks, nil } -func (r *PingFederateCertificatesRevocationOCSPCertificateResource) getOcspCertificateData() (*map[string][]string, error) { +func (r *PingFederateCertificatesRevocationOCSPCertificateResource) getOcspCertificateData() (map[string][]string, error) { ocspCertificateData := make(map[string][]string) ocspCertificates, response, err := r.clientInfo.ApiClient.CertificatesRevocationAPI.GetOcspCertificates(r.clientInfo.Context).Execute() @@ -94,5 +94,5 @@ func (r *PingFederateCertificatesRevocationOCSPCertificateResource) getOcspCerti } } - return &ocspCertificateData, nil + return ocspCertificateData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_data_store.go b/internal/connector/pingfederate/resources/pingfederate_data_store.go index c0e9b225..889abc13 100644 --- a/internal/connector/pingfederate/resources/pingfederate_data_store.go +++ b/internal/connector/pingfederate/resources/pingfederate_data_store.go @@ -39,7 +39,7 @@ func (r *PingFederateDataStoreResource) ExportAll() (*[]connector.ImportBlock, e return nil, err } - for dataStoreId, dataStoreType := range *dataStoreData { + for dataStoreId, dataStoreType := range dataStoreData { commentData := map[string]string{ "Data Store ID": dataStoreId, "Data Store Type": dataStoreType, @@ -59,7 +59,7 @@ func (r *PingFederateDataStoreResource) ExportAll() (*[]connector.ImportBlock, e return &importBlocks, nil } -func (r *PingFederateDataStoreResource) getDataStoreData() (*map[string]string, error) { +func (r *PingFederateDataStoreResource) getDataStoreData() (map[string]string, error) { dataStoreData := make(map[string]string) dataStores, response, err := r.clientInfo.ApiClient.DataStoresAPI.GetDataStores(r.clientInfo.Context).Execute() @@ -89,5 +89,5 @@ func (r *PingFederateDataStoreResource) getDataStoreData() (*map[string]string, } } - return &dataStoreData, nil + return dataStoreData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_identity_store_provisioner.go b/internal/connector/pingfederate/resources/pingfederate_identity_store_provisioner.go index 6bef5746..e4446ffa 100644 --- a/internal/connector/pingfederate/resources/pingfederate_identity_store_provisioner.go +++ b/internal/connector/pingfederate/resources/pingfederate_identity_store_provisioner.go @@ -37,7 +37,7 @@ func (r *PingFederateIdentityStoreProvisionerResource) ExportAll() (*[]connector return nil, err } - for identityStoreProvisionerId, identityStoreProvisionerName := range *identityStoreProvisionerData { + for identityStoreProvisionerId, identityStoreProvisionerName := range identityStoreProvisionerData { commentData := map[string]string{ "Identity Store Provisioner ID": identityStoreProvisionerId, "Identity Store Provisioner Name": identityStoreProvisionerName, @@ -57,7 +57,7 @@ func (r *PingFederateIdentityStoreProvisionerResource) ExportAll() (*[]connector return &importBlocks, nil } -func (r *PingFederateIdentityStoreProvisionerResource) getIdentityStoreProvisionerData() (*map[string]string, error) { +func (r *PingFederateIdentityStoreProvisionerResource) getIdentityStoreProvisionerData() (map[string]string, error) { identityStoreProvisionerData := make(map[string]string) identityStoreProvisioners, response, err := r.clientInfo.ApiClient.IdentityStoreProvisionersAPI.GetIdentityStoreProvisioners(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateIdentityStoreProvisionerResource) getIdentityStoreProvision } } - return &identityStoreProvisionerData, nil + return identityStoreProvisionerData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_adapter.go b/internal/connector/pingfederate/resources/pingfederate_idp_adapter.go index fab1e2f1..c341d4ef 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_adapter.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_adapter.go @@ -37,7 +37,7 @@ func (r *PingFederateIDPAdapterResource) ExportAll() (*[]connector.ImportBlock, return nil, err } - for idpAdapterId, idpAdapterName := range *idpAdapterData { + for idpAdapterId, idpAdapterName := range idpAdapterData { commentData := map[string]string{ "IDP Adapter ID": idpAdapterId, "IDP Adapter Name": idpAdapterName, @@ -57,7 +57,7 @@ func (r *PingFederateIDPAdapterResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingFederateIDPAdapterResource) getIDPAdapterData() (*map[string]string, error) { +func (r *PingFederateIDPAdapterResource) getIDPAdapterData() (map[string]string, error) { idpAdapterData := make(map[string]string) idpAdapters, response, err := r.clientInfo.ApiClient.IdpAdaptersAPI.GetIdpAdapters(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateIDPAdapterResource) getIDPAdapterData() (*map[string]string } } - return &idpAdapterData, nil + return idpAdapterData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_sp_connection.go b/internal/connector/pingfederate/resources/pingfederate_idp_sp_connection.go index 761d3e92..01666e50 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_sp_connection.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_sp_connection.go @@ -37,7 +37,7 @@ func (r *PingFederateIDPSPConnectionResource) ExportAll() (*[]connector.ImportBl return nil, err } - for spConnectionId, spConnectionName := range *spConnectionData { + for spConnectionId, spConnectionName := range spConnectionData { commentData := map[string]string{ "IDP SP Connection ID": spConnectionId, "IDP SP Connection Name": spConnectionName, @@ -57,7 +57,7 @@ func (r *PingFederateIDPSPConnectionResource) ExportAll() (*[]connector.ImportBl return &importBlocks, nil } -func (r *PingFederateIDPSPConnectionResource) getSpConnectionData() (*map[string]string, error) { +func (r *PingFederateIDPSPConnectionResource) getSpConnectionData() (map[string]string, error) { spConnectionData := make(map[string]string) spConnections, response, err := r.clientInfo.ApiClient.IdpSpConnectionsAPI.GetSpConnections(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateIDPSPConnectionResource) getSpConnectionData() (*map[string } } - return &spConnectionData, nil + return spConnectionData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_sts_request_parameters_contract.go b/internal/connector/pingfederate/resources/pingfederate_idp_sts_request_parameters_contract.go index 582c7b96..8afc529b 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_sts_request_parameters_contract.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_sts_request_parameters_contract.go @@ -37,7 +37,7 @@ func (r *PingFederateIdpStsRequestParametersContractResource) ExportAll() (*[]co return nil, err } - for stsRequestParamContractId, stsRequestParamContractName := range *stsRequestParamContractData { + for stsRequestParamContractId, stsRequestParamContractName := range stsRequestParamContractData { commentData := map[string]string{ "IDP STS Request Parameters Contract ID": stsRequestParamContractId, "IDP STS Request Parameters Contract Name": stsRequestParamContractName, @@ -57,7 +57,7 @@ func (r *PingFederateIdpStsRequestParametersContractResource) ExportAll() (*[]co return &importBlocks, nil } -func (r *PingFederateIdpStsRequestParametersContractResource) getStsRequestParamContractData() (*map[string]string, error) { +func (r *PingFederateIdpStsRequestParametersContractResource) getStsRequestParamContractData() (map[string]string, error) { stsRequestParamContractData := make(map[string]string) stsRequestParamContracts, response, err := r.clientInfo.ApiClient.IdpStsRequestParametersContractsAPI.GetStsRequestParamContracts(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateIdpStsRequestParametersContractResource) getStsRequestParam } } - return &stsRequestParamContractData, nil + return stsRequestParamContractData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_to_sp_adapter_mapping.go b/internal/connector/pingfederate/resources/pingfederate_idp_to_sp_adapter_mapping.go index bb68046e..b8a68a6d 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_to_sp_adapter_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_to_sp_adapter_mapping.go @@ -39,7 +39,7 @@ func (r *PingFederateIdpToSpAdapterMappingResource) ExportAll() (*[]connector.Im return nil, err } - for idpToSpAdapterMappingSourceId, idpToSpAdapterMappingTargetId := range *idpToSpAdapterMappingData { + for idpToSpAdapterMappingSourceId, idpToSpAdapterMappingTargetId := range idpToSpAdapterMappingData { commentData := map[string]string{ "IDP To SP Adapter Mapping IDP ID": idpToSpAdapterMappingSourceId, "IDP To SP Adapter Mapping SP ID": idpToSpAdapterMappingTargetId, @@ -59,7 +59,7 @@ func (r *PingFederateIdpToSpAdapterMappingResource) ExportAll() (*[]connector.Im return &importBlocks, nil } -func (r *PingFederateIdpToSpAdapterMappingResource) getIdpToSpAdapterMappingData() (*map[string]string, error) { +func (r *PingFederateIdpToSpAdapterMappingResource) getIdpToSpAdapterMappingData() (map[string]string, error) { idpToSpAdapterMappingData := make(map[string]string) idpToSpAdapterMappings, response, err := r.clientInfo.ApiClient.IdpToSpAdapterMappingAPI.GetIdpToSpAdapterMappings(r.clientInfo.Context).Execute() @@ -89,5 +89,5 @@ func (r *PingFederateIdpToSpAdapterMappingResource) getIdpToSpAdapterMappingData } } - return &idpToSpAdapterMappingData, nil + return idpToSpAdapterMappingData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_idp_token_processor.go b/internal/connector/pingfederate/resources/pingfederate_idp_token_processor.go index b1118f76..70f411c2 100644 --- a/internal/connector/pingfederate/resources/pingfederate_idp_token_processor.go +++ b/internal/connector/pingfederate/resources/pingfederate_idp_token_processor.go @@ -37,7 +37,7 @@ func (r *PingFederateIdpTokenProcessorResource) ExportAll() (*[]connector.Import return nil, err } - for tokenProcessorId, tokenProcessorName := range *tokenProcessorData { + for tokenProcessorId, tokenProcessorName := range tokenProcessorData { commentData := map[string]string{ "IDP Token Processor ID": tokenProcessorId, "IDP Token Processor Name": tokenProcessorName, @@ -57,7 +57,7 @@ func (r *PingFederateIdpTokenProcessorResource) ExportAll() (*[]connector.Import return &importBlocks, nil } -func (r *PingFederateIdpTokenProcessorResource) getTokenProcessorData() (*map[string]string, error) { +func (r *PingFederateIdpTokenProcessorResource) getTokenProcessorData() (map[string]string, error) { tokenProcessorData := make(map[string]string) tokenProcessors, response, err := r.clientInfo.ApiClient.IdpTokenProcessorsAPI.GetTokenProcessors(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateIdpTokenProcessorResource) getTokenProcessorData() (*map[st } } - return &tokenProcessorData, nil + return tokenProcessorData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_kerberos_realm.go b/internal/connector/pingfederate/resources/pingfederate_kerberos_realm.go index b2d48d09..90556baa 100644 --- a/internal/connector/pingfederate/resources/pingfederate_kerberos_realm.go +++ b/internal/connector/pingfederate/resources/pingfederate_kerberos_realm.go @@ -37,7 +37,7 @@ func (r *PingFederateKerberosRealmResource) ExportAll() (*[]connector.ImportBloc return nil, err } - for kerberosRealmId, kerberosRealmName := range *kerberosRealmData { + for kerberosRealmId, kerberosRealmName := range kerberosRealmData { commentData := map[string]string{ "Kerberos Realm ID": kerberosRealmId, "Kerberos Realm Name": kerberosRealmName, @@ -57,7 +57,7 @@ func (r *PingFederateKerberosRealmResource) ExportAll() (*[]connector.ImportBloc return &importBlocks, nil } -func (r *PingFederateKerberosRealmResource) getKerberosRealmData() (*map[string]string, error) { +func (r *PingFederateKerberosRealmResource) getKerberosRealmData() (map[string]string, error) { kerberosRealmData := make(map[string]string) kerberosRealms, response, err := r.clientInfo.ApiClient.KerberosRealmsAPI.GetKerberosRealms(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateKerberosRealmResource) getKerberosRealmData() (*map[string] } } - return &kerberosRealmData, nil + return kerberosRealmData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_keypairs_oauth_openid_connect_additional_key_set.go b/internal/connector/pingfederate/resources/pingfederate_keypairs_oauth_openid_connect_additional_key_set.go index 4d290b95..a501e2c3 100644 --- a/internal/connector/pingfederate/resources/pingfederate_keypairs_oauth_openid_connect_additional_key_set.go +++ b/internal/connector/pingfederate/resources/pingfederate_keypairs_oauth_openid_connect_additional_key_set.go @@ -37,7 +37,7 @@ func (r *PingFederateKeypairsOauthOpenidConnectAdditionalKeySetResource) ExportA return nil, err } - for keySetId, keySetName := range *keySetData { + for keySetId, keySetName := range keySetData { commentData := map[string]string{ "Keypairs OAuth OpenID Connect Addition Key Set ID": keySetId, "Keypairs OAuth OpenID Connect Addition Key Set Name": keySetName, @@ -57,7 +57,7 @@ func (r *PingFederateKeypairsOauthOpenidConnectAdditionalKeySetResource) ExportA return &importBlocks, nil } -func (r *PingFederateKeypairsOauthOpenidConnectAdditionalKeySetResource) getKeySetData() (*map[string]string, error) { +func (r *PingFederateKeypairsOauthOpenidConnectAdditionalKeySetResource) getKeySetData() (map[string]string, error) { keySetData := make(map[string]string) keySets, response, err := r.clientInfo.ApiClient.KeyPairsOauthOpenIdConnectAPI.GetKeySets(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateKeypairsOauthOpenidConnectAdditionalKeySetResource) getKeyS } } - return &keySetData, nil + return keySetData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_keypairs_signing_key_rotation_settings.go b/internal/connector/pingfederate/resources/pingfederate_keypairs_signing_key_rotation_settings.go index 673ff4d2..91e5c34d 100644 --- a/internal/connector/pingfederate/resources/pingfederate_keypairs_signing_key_rotation_settings.go +++ b/internal/connector/pingfederate/resources/pingfederate_keypairs_signing_key_rotation_settings.go @@ -39,7 +39,7 @@ func (r *PingFederateKeypairsSigningKeyRotationSettingsResource) ExportAll() (*[ return nil, err } - for signingKeyPairId, signingKeyPairInfo := range *signingKeyPairData { + for signingKeyPairId, signingKeyPairInfo := range signingKeyPairData { signingKeyPairIssuerDN := signingKeyPairInfo[0] signingKeyPairSerialNumber := signingKeyPairInfo[1] @@ -63,7 +63,7 @@ func (r *PingFederateKeypairsSigningKeyRotationSettingsResource) ExportAll() (*[ return &importBlocks, nil } -func (r *PingFederateKeypairsSigningKeyRotationSettingsResource) getSigningKeyPairData() (*map[string][]string, error) { +func (r *PingFederateKeypairsSigningKeyRotationSettingsResource) getSigningKeyPairData() (map[string][]string, error) { signingKeyPairData := make(map[string][]string) signingKeyPairs, response, err := r.clientInfo.ApiClient.KeyPairsSigningAPI.GetSigningKeyPairs(r.clientInfo.Context).Execute() @@ -98,5 +98,5 @@ func (r *PingFederateKeypairsSigningKeyRotationSettingsResource) getSigningKeyPa } } - return &signingKeyPairData, nil + return signingKeyPairData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_local_identity_profile.go b/internal/connector/pingfederate/resources/pingfederate_local_identity_profile.go index 39212b08..40607f08 100644 --- a/internal/connector/pingfederate/resources/pingfederate_local_identity_profile.go +++ b/internal/connector/pingfederate/resources/pingfederate_local_identity_profile.go @@ -37,7 +37,7 @@ func (r *PingFederateLocalIdentityProfileResource) ExportAll() (*[]connector.Imp return nil, err } - for identityProfileId, identityProfileName := range *identityProfileData { + for identityProfileId, identityProfileName := range identityProfileData { commentData := map[string]string{ "Local Identity Profile ID": identityProfileId, "Local Identity Profile Name": identityProfileName, @@ -57,7 +57,7 @@ func (r *PingFederateLocalIdentityProfileResource) ExportAll() (*[]connector.Imp return &importBlocks, nil } -func (r *PingFederateLocalIdentityProfileResource) getIdentityProfileData() (*map[string]string, error) { +func (r *PingFederateLocalIdentityProfileResource) getIdentityProfileData() (map[string]string, error) { identityProfileData := make(map[string]string) identityProfiles, response, err := r.clientInfo.ApiClient.LocalIdentityIdentityProfilesAPI.GetIdentityProfiles(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateLocalIdentityProfileResource) getIdentityProfileData() (*ma } } - return &identityProfileData, nil + return identityProfileData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_metadata_url.go b/internal/connector/pingfederate/resources/pingfederate_metadata_url.go index 765506ae..5eabc773 100644 --- a/internal/connector/pingfederate/resources/pingfederate_metadata_url.go +++ b/internal/connector/pingfederate/resources/pingfederate_metadata_url.go @@ -37,7 +37,7 @@ func (r *PingFederateMetadataUrlResource) ExportAll() (*[]connector.ImportBlock, return nil, err } - for metadataUrlId, metadataUrlName := range *metadataUrlData { + for metadataUrlId, metadataUrlName := range metadataUrlData { commentData := map[string]string{ "Metadata URL ID": metadataUrlId, "Metadata URL Name": metadataUrlName, @@ -57,7 +57,7 @@ func (r *PingFederateMetadataUrlResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingFederateMetadataUrlResource) getMetadataUrlData() (*map[string]string, error) { +func (r *PingFederateMetadataUrlResource) getMetadataUrlData() (map[string]string, error) { metadataUrlData := make(map[string]string) metadataUrls, response, err := r.clientInfo.ApiClient.MetadataUrlsAPI.GetMetadataUrls(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateMetadataUrlResource) getMetadataUrlData() (*map[string]stri } } - return &metadataUrlData, nil + return metadataUrlData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_notification_publisher.go b/internal/connector/pingfederate/resources/pingfederate_notification_publisher.go index 3ba3cdca..a8b5c3dd 100644 --- a/internal/connector/pingfederate/resources/pingfederate_notification_publisher.go +++ b/internal/connector/pingfederate/resources/pingfederate_notification_publisher.go @@ -37,7 +37,7 @@ func (r *PingFederateNotificationPublisherResource) ExportAll() (*[]connector.Im return nil, err } - for notificationPublisherId, notificationPublisherName := range *notificationPublisherData { + for notificationPublisherId, notificationPublisherName := range notificationPublisherData { commentData := map[string]string{ "Notification Publisher ID": notificationPublisherId, "Notification Publisher Name": notificationPublisherName, @@ -57,7 +57,7 @@ func (r *PingFederateNotificationPublisherResource) ExportAll() (*[]connector.Im return &importBlocks, nil } -func (r *PingFederateNotificationPublisherResource) getNotificationPublisherData() (*map[string]string, error) { +func (r *PingFederateNotificationPublisherResource) getNotificationPublisherData() (map[string]string, error) { notificationPublisherData := make(map[string]string) notificationPublishers, response, err := r.clientInfo.ApiClient.NotificationPublishersAPI.GetNotificationPublishers(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateNotificationPublisherResource) getNotificationPublisherData } } - return ¬ificationPublisherData, nil + return notificationPublisherData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_manager.go b/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_manager.go index 43826155..bc9aaf3c 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_manager.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_manager.go @@ -37,7 +37,7 @@ func (r *PingFederateOAuthAccessTokenManagerResource) ExportAll() (*[]connector. return nil, err } - for tokenManagerId, tokenManagerName := range *tokenManagerData { + for tokenManagerId, tokenManagerName := range tokenManagerData { commentData := map[string]string{ "OAuth Access Token Manager ID": tokenManagerId, "OAuth Access Token Manager Name": tokenManagerName, @@ -57,7 +57,7 @@ func (r *PingFederateOAuthAccessTokenManagerResource) ExportAll() (*[]connector. return &importBlocks, nil } -func (r *PingFederateOAuthAccessTokenManagerResource) getTokenManagerData() (*map[string]string, error) { +func (r *PingFederateOAuthAccessTokenManagerResource) getTokenManagerData() (map[string]string, error) { tokenManagerData := make(map[string]string) tokenManagers, response, err := r.clientInfo.ApiClient.OauthAccessTokenManagersAPI.GetTokenManagers(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateOAuthAccessTokenManagerResource) getTokenManagerData() (*ma } } - return &tokenManagerData, nil + return tokenManagerData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_mapping.go b/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_mapping.go index e345a2ff..e0a7532e 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_access_token_mapping.go @@ -39,7 +39,7 @@ func (r *PingFederateOAuthAccessTokenMappingResource) ExportAll() (*[]connector. return nil, err } - for mappingId, mappingContextType := range *mappingData { + for mappingId, mappingContextType := range mappingData { commentData := map[string]string{ "OAuth Access Token Mapping ID": mappingId, "OAuth Access Token Mapping Context Type": mappingContextType, @@ -59,7 +59,7 @@ func (r *PingFederateOAuthAccessTokenMappingResource) ExportAll() (*[]connector. return &importBlocks, nil } -func (r *PingFederateOAuthAccessTokenMappingResource) getMappingData() (*map[string]string, error) { +func (r *PingFederateOAuthAccessTokenMappingResource) getMappingData() (map[string]string, error) { mappingData := make(map[string]string) mappings, response, err := r.clientInfo.ApiClient.OauthAccessTokenMappingsAPI.GetMappings(r.clientInfo.Context).Execute() @@ -84,5 +84,5 @@ func (r *PingFederateOAuthAccessTokenMappingResource) getMappingData() (*map[str } } - return &mappingData, nil + return mappingData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_authentication_policy_contract_mapping.go b/internal/connector/pingfederate/resources/pingfederate_oauth_authentication_policy_contract_mapping.go index 84480963..fba59194 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_authentication_policy_contract_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_authentication_policy_contract_mapping.go @@ -39,7 +39,7 @@ func (r *PingFederateOAuthAuthenticationPolicyContractMappingResource) ExportAll return nil, err } - for _, mappingId := range *apcToPersistentGrantMappingData { + for _, mappingId := range apcToPersistentGrantMappingData { commentData := map[string]string{ "Authentication Policy Contract Mapping ID": mappingId, "Resource Type": r.ResourceType(), @@ -58,7 +58,7 @@ func (r *PingFederateOAuthAuthenticationPolicyContractMappingResource) ExportAll return &importBlocks, nil } -func (r *PingFederateOAuthAuthenticationPolicyContractMappingResource) getApcToPersistentGrantMappingData() (*[]string, error) { +func (r *PingFederateOAuthAuthenticationPolicyContractMappingResource) getApcToPersistentGrantMappingData() ([]string, error) { apcToPersistentGrantMappingData := []string{} apcToPersistentGrantMappings, response, err := r.clientInfo.ApiClient.OauthAuthenticationPolicyContractMappingsAPI.GetApcMappings(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateOAuthAuthenticationPolicyContractMappingResource) getApcToP } } - return &apcToPersistentGrantMappingData, nil + return apcToPersistentGrantMappingData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_ciba_server_policy_request_policy.go b/internal/connector/pingfederate/resources/pingfederate_oauth_ciba_server_policy_request_policy.go index 9e3701db..c413b3f3 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_ciba_server_policy_request_policy.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_ciba_server_policy_request_policy.go @@ -37,7 +37,7 @@ func (r *PingFederateOAuthCibaServerPolicyRequestPolicyResource) ExportAll() (*[ return nil, err } - for requestPolicyId, requestPolicyName := range *oauthClientData { + for requestPolicyId, requestPolicyName := range oauthClientData { commentData := map[string]string{ "OAuth CIBA Server Policy Request Policy ID": requestPolicyId, "OAuth CIBA Server Policy Request Policy Name": requestPolicyName, @@ -57,7 +57,7 @@ func (r *PingFederateOAuthCibaServerPolicyRequestPolicyResource) ExportAll() (*[ return &importBlocks, nil } -func (r *PingFederateOAuthCibaServerPolicyRequestPolicyResource) getRequestPolicyData() (*map[string]string, error) { +func (r *PingFederateOAuthCibaServerPolicyRequestPolicyResource) getRequestPolicyData() (map[string]string, error) { requestPolicyData := make(map[string]string) requestPolicies, response, err := r.clientInfo.ApiClient.OauthCibaServerPolicyAPI.GetCibaServerPolicies(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateOAuthCibaServerPolicyRequestPolicyResource) getRequestPolic } } - return &requestPolicyData, nil + return requestPolicyData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_client.go b/internal/connector/pingfederate/resources/pingfederate_oauth_client.go index 8ae27378..ce364a4e 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_client.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_client.go @@ -37,7 +37,7 @@ func (r *PingFederateOAuthClientResource) ExportAll() (*[]connector.ImportBlock, return nil, err } - for oauthClientId, oauthClientName := range *oauthClientData { + for oauthClientId, oauthClientName := range oauthClientData { commentData := map[string]string{ "OAuth Client ID": oauthClientId, "OAuth Client Name": oauthClientName, @@ -57,7 +57,7 @@ func (r *PingFederateOAuthClientResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingFederateOAuthClientResource) getOAuthClientData() (*map[string]string, error) { +func (r *PingFederateOAuthClientResource) getOAuthClientData() (map[string]string, error) { oauthClientData := make(map[string]string) clients, response, err := r.clientInfo.ApiClient.OauthClientsAPI.GetOauthClients(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateOAuthClientResource) getOAuthClientData() (*map[string]stri } } - return &oauthClientData, nil + return oauthClientData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_client_registration_policy.go b/internal/connector/pingfederate/resources/pingfederate_oauth_client_registration_policy.go index 3e35883e..b69c201f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_client_registration_policy.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_client_registration_policy.go @@ -37,7 +37,7 @@ func (r *PingFederateOAuthClientRegistrationPolicyResource) ExportAll() (*[]conn return nil, err } - for clientRegistrationPolicyId, clientRegistrationPolicyName := range *clientRegistrationPolicyData { + for clientRegistrationPolicyId, clientRegistrationPolicyName := range clientRegistrationPolicyData { commentData := map[string]string{ "OAuth Client Registration Policy ID": clientRegistrationPolicyId, "OAuth Client Registration Policy Name": clientRegistrationPolicyName, @@ -57,7 +57,7 @@ func (r *PingFederateOAuthClientRegistrationPolicyResource) ExportAll() (*[]conn return &importBlocks, nil } -func (r *PingFederateOAuthClientRegistrationPolicyResource) getClientRegistrationPolicyData() (*map[string]string, error) { +func (r *PingFederateOAuthClientRegistrationPolicyResource) getClientRegistrationPolicyData() (map[string]string, error) { clientRegistrationPolicyData := make(map[string]string) clientRegistrationPolicies, response, err := r.clientInfo.ApiClient.OauthClientRegistrationPoliciesAPI.GetDynamicClientRegistrationPolicies(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateOAuthClientRegistrationPolicyResource) getClientRegistratio } } - return &clientRegistrationPolicyData, nil + return clientRegistrationPolicyData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_idp_adapter_mapping.go b/internal/connector/pingfederate/resources/pingfederate_oauth_idp_adapter_mapping.go index 5accc77f..992530d9 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_idp_adapter_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_idp_adapter_mapping.go @@ -39,7 +39,7 @@ func (r *PingFederateOAuthIdpAdapterMappingResource) ExportAll() (*[]connector.I return nil, err } - for _, idpAdapterMappingId := range *idpAdapterMappingData { + for _, idpAdapterMappingId := range idpAdapterMappingData { commentData := map[string]string{ "OAuth IDP Adapter Mapping ID": idpAdapterMappingId, "Resource Type": r.ResourceType(), @@ -58,7 +58,7 @@ func (r *PingFederateOAuthIdpAdapterMappingResource) ExportAll() (*[]connector.I return &importBlocks, nil } -func (r *PingFederateOAuthIdpAdapterMappingResource) getIdpAdapterMappingData() (*[]string, error) { +func (r *PingFederateOAuthIdpAdapterMappingResource) getIdpAdapterMappingData() ([]string, error) { idpAdapterMappingData := []string{} idpAdapterMappings, response, err := r.clientInfo.ApiClient.OauthIdpAdapterMappingsAPI.GetIdpAdapterMappings(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateOAuthIdpAdapterMappingResource) getIdpAdapterMappingData() } } - return &idpAdapterMappingData, nil + return idpAdapterMappingData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_issuer.go b/internal/connector/pingfederate/resources/pingfederate_oauth_issuer.go index 28ed3f8f..e71d5c4b 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_issuer.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_issuer.go @@ -37,7 +37,7 @@ func (r *PingFederateOAuthIssuerResource) ExportAll() (*[]connector.ImportBlock, return nil, err } - for oauthIssuerId, oauthIssuerName := range *oauthIssuerData { + for oauthIssuerId, oauthIssuerName := range oauthIssuerData { commentData := map[string]string{ "OAuth Issuer ID": oauthIssuerId, "OAuth Issuer Name": oauthIssuerName, @@ -57,7 +57,7 @@ func (r *PingFederateOAuthIssuerResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func (r *PingFederateOAuthIssuerResource) getOAuthIssuerData() (*map[string]string, error) { +func (r *PingFederateOAuthIssuerResource) getOAuthIssuerData() (map[string]string, error) { issuerData := make(map[string]string) issuers, response, err := r.clientInfo.ApiClient.OauthIssuersAPI.GetOauthIssuers(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateOAuthIssuerResource) getOAuthIssuerData() (*map[string]stri } } - return &issuerData, nil + return issuerData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_token_generator_mapping.go b/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_token_generator_mapping.go index 0c9248be..3b2a01d2 100644 --- a/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_token_generator_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_oauth_token_exchange_token_generator_mapping.go @@ -39,7 +39,7 @@ func (r *PingFederateOAuthTokenExchangeTokenGeneratorMappingResource) ExportAll( return nil, err } - for mappingId, mappingInfo := range *processorPolicyToGeneratorMappingData { + for mappingId, mappingInfo := range processorPolicyToGeneratorMappingData { sourceId := mappingInfo[0] targetId := mappingInfo[1] @@ -63,7 +63,7 @@ func (r *PingFederateOAuthTokenExchangeTokenGeneratorMappingResource) ExportAll( return &importBlocks, nil } -func (r *PingFederateOAuthTokenExchangeTokenGeneratorMappingResource) getProcessorPolicyToGeneratorMappingData() (*map[string][]string, error) { +func (r *PingFederateOAuthTokenExchangeTokenGeneratorMappingResource) getProcessorPolicyToGeneratorMappingData() (map[string][]string, error) { processorPolicyToGeneratorMappingData := make(map[string][]string) processorPolicyToGeneratorMappings, response, err := r.clientInfo.ApiClient.OauthTokenExchangeTokenGeneratorMappingsAPI.GetTokenGeneratorMappings(r.clientInfo.Context).Execute() @@ -94,5 +94,5 @@ func (r *PingFederateOAuthTokenExchangeTokenGeneratorMappingResource) getProcess } } - return &processorPolicyToGeneratorMappingData, nil + return processorPolicyToGeneratorMappingData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_openid_connect_policy.go b/internal/connector/pingfederate/resources/pingfederate_openid_connect_policy.go index 2e4d0772..5ba764bd 100644 --- a/internal/connector/pingfederate/resources/pingfederate_openid_connect_policy.go +++ b/internal/connector/pingfederate/resources/pingfederate_openid_connect_policy.go @@ -37,7 +37,7 @@ func (r *PingFederateOpenIDConnectPolicyResource) ExportAll() (*[]connector.Impo return nil, err } - for oidcPolicyId, oidcPolicyName := range *oidcPolicyData { + for oidcPolicyId, oidcPolicyName := range oidcPolicyData { commentData := map[string]string{ "OpenID Connect Policy ID": oidcPolicyId, "OpenID Connect Policy Name": oidcPolicyName, @@ -57,7 +57,7 @@ func (r *PingFederateOpenIDConnectPolicyResource) ExportAll() (*[]connector.Impo return &importBlocks, nil } -func (r *PingFederateOpenIDConnectPolicyResource) getOIDCPolicyData() (*map[string]string, error) { +func (r *PingFederateOpenIDConnectPolicyResource) getOIDCPolicyData() (map[string]string, error) { oidcPolicyData := make(map[string]string) oidcPolicies, response, err := r.clientInfo.ApiClient.OauthOpenIdConnectAPI.GetOIDCPolicies(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateOpenIDConnectPolicyResource) getOIDCPolicyData() (*map[stri } } - return &oidcPolicyData, nil + return oidcPolicyData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_password_credential_validator.go b/internal/connector/pingfederate/resources/pingfederate_password_credential_validator.go index db143878..6f1ec62f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_password_credential_validator.go +++ b/internal/connector/pingfederate/resources/pingfederate_password_credential_validator.go @@ -37,7 +37,7 @@ func (r *PingFederatePasswordCredentialValidatorResource) ExportAll() (*[]connec return nil, err } - for passwordCredentialValidatorId, passwordCredentialValidatorName := range *passwordCredentialValidatorData { + for passwordCredentialValidatorId, passwordCredentialValidatorName := range passwordCredentialValidatorData { commentData := map[string]string{ "Password Credential Validator ID": passwordCredentialValidatorId, "Password Credential Validator Name": passwordCredentialValidatorName, @@ -57,7 +57,7 @@ func (r *PingFederatePasswordCredentialValidatorResource) ExportAll() (*[]connec return &importBlocks, nil } -func (r *PingFederatePasswordCredentialValidatorResource) getPasswordCredentialValidatorData() (*map[string]string, error) { +func (r *PingFederatePasswordCredentialValidatorResource) getPasswordCredentialValidatorData() (map[string]string, error) { passwordCredentialValidatorData := make(map[string]string) passwordCredentialValidators, response, err := r.clientInfo.ApiClient.PasswordCredentialValidatorsAPI.GetPasswordCredentialValidators(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederatePasswordCredentialValidatorResource) getPasswordCredentialV } } - return &passwordCredentialValidatorData, nil + return passwordCredentialValidatorData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_pingone_connection.go b/internal/connector/pingfederate/resources/pingfederate_pingone_connection.go index cd21cef2..60456858 100644 --- a/internal/connector/pingfederate/resources/pingfederate_pingone_connection.go +++ b/internal/connector/pingfederate/resources/pingfederate_pingone_connection.go @@ -37,7 +37,7 @@ func (r *PingFederatePingOneConnectionResource) ExportAll() (*[]connector.Import return nil, err } - for pingoneConnectionId, pingoneConnectionName := range *pingoneConnectionData { + for pingoneConnectionId, pingoneConnectionName := range pingoneConnectionData { commentData := map[string]string{ "PingOne Connection ID": pingoneConnectionId, "PingOne Connection Name": pingoneConnectionName, @@ -57,7 +57,7 @@ func (r *PingFederatePingOneConnectionResource) ExportAll() (*[]connector.Import return &importBlocks, nil } -func (r *PingFederatePingOneConnectionResource) getPingOneConnectionData() (*map[string]string, error) { +func (r *PingFederatePingOneConnectionResource) getPingOneConnectionData() (map[string]string, error) { pingoneConnectionData := make(map[string]string) pingoneConnections, response, err := r.clientInfo.ApiClient.PingOneConnectionsAPI.GetPingOneConnections(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederatePingOneConnectionResource) getPingOneConnectionData() (*map } } - return &pingoneConnectionData, nil + return pingoneConnectionData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_secret_manager.go b/internal/connector/pingfederate/resources/pingfederate_secret_manager.go index efab1640..5c86f73d 100644 --- a/internal/connector/pingfederate/resources/pingfederate_secret_manager.go +++ b/internal/connector/pingfederate/resources/pingfederate_secret_manager.go @@ -37,7 +37,7 @@ func (r *PingFederateSecretManagerResource) ExportAll() (*[]connector.ImportBloc return nil, err } - for secretManagerId, secretManagerName := range *secretManagerData { + for secretManagerId, secretManagerName := range secretManagerData { commentData := map[string]string{ "Resource Type": r.ResourceType(), "Secret Manager ID": secretManagerId, @@ -57,7 +57,7 @@ func (r *PingFederateSecretManagerResource) ExportAll() (*[]connector.ImportBloc return &importBlocks, nil } -func (r *PingFederateSecretManagerResource) getSecretManagerData() (*map[string]string, error) { +func (r *PingFederateSecretManagerResource) getSecretManagerData() (map[string]string, error) { secretManagerData := make(map[string]string) secretManagers, response, err := r.clientInfo.ApiClient.SecretManagersAPI.GetSecretManagers(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateSecretManagerResource) getSecretManagerData() (*map[string] } } - return &secretManagerData, nil + return secretManagerData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_server_settings_ws_trust_sts_settings_issuer_certificate.go b/internal/connector/pingfederate/resources/pingfederate_server_settings_ws_trust_sts_settings_issuer_certificate.go index 696ee8fa..ba952a50 100644 --- a/internal/connector/pingfederate/resources/pingfederate_server_settings_ws_trust_sts_settings_issuer_certificate.go +++ b/internal/connector/pingfederate/resources/pingfederate_server_settings_ws_trust_sts_settings_issuer_certificate.go @@ -39,7 +39,7 @@ func (r *PingFederateServerSettingsWsTrustStsSettingsIssuerCertificateResource) return nil, err } - for issuerCertId, issuerCertInfo := range *issuerCertsData { + for issuerCertId, issuerCertInfo := range issuerCertsData { issuerCertDN := issuerCertInfo[0] issuerCertSerialNumber := issuerCertInfo[1] @@ -63,7 +63,7 @@ func (r *PingFederateServerSettingsWsTrustStsSettingsIssuerCertificateResource) return &importBlocks, nil } -func (r *PingFederateServerSettingsWsTrustStsSettingsIssuerCertificateResource) getIssuerCertsData() (*map[string][]string, error) { +func (r *PingFederateServerSettingsWsTrustStsSettingsIssuerCertificateResource) getIssuerCertsData() (map[string][]string, error) { issuerCertsData := make(map[string][]string) issuerCerts, response, err := r.clientInfo.ApiClient.ServerSettingsAPI.GetCerts(r.clientInfo.Context).Execute() @@ -98,5 +98,5 @@ func (r *PingFederateServerSettingsWsTrustStsSettingsIssuerCertificateResource) } } - return &issuerCertsData, nil + return issuerCertsData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_session_authentication_policy.go b/internal/connector/pingfederate/resources/pingfederate_session_authentication_policy.go index 32cf7834..20a6dafd 100644 --- a/internal/connector/pingfederate/resources/pingfederate_session_authentication_policy.go +++ b/internal/connector/pingfederate/resources/pingfederate_session_authentication_policy.go @@ -39,7 +39,7 @@ func (r *PingFederateSessionAuthenticationPolicyResource) ExportAll() (*[]connec return nil, err } - for policyId, policyInfo := range *authenticationSessionPolicyData { + for policyId, policyInfo := range authenticationSessionPolicyData { authSourceType := policyInfo[0] authSourceRefId := policyInfo[1] @@ -63,7 +63,7 @@ func (r *PingFederateSessionAuthenticationPolicyResource) ExportAll() (*[]connec return &importBlocks, nil } -func (r *PingFederateSessionAuthenticationPolicyResource) getAuthenticationSessionPolicyData() (*map[string][]string, error) { +func (r *PingFederateSessionAuthenticationPolicyResource) getAuthenticationSessionPolicyData() (map[string][]string, error) { authenticationSessionPolicyData := make(map[string][]string) authenticationSessionPolicies, response, err := r.clientInfo.ApiClient.SessionAPI.GetSourcePolicies(r.clientInfo.Context).Execute() @@ -102,5 +102,5 @@ func (r *PingFederateSessionAuthenticationPolicyResource) getAuthenticationSessi } } - return &authenticationSessionPolicyData, nil + return authenticationSessionPolicyData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_sp_adapter.go b/internal/connector/pingfederate/resources/pingfederate_sp_adapter.go index 2dd6687e..0c28d70f 100644 --- a/internal/connector/pingfederate/resources/pingfederate_sp_adapter.go +++ b/internal/connector/pingfederate/resources/pingfederate_sp_adapter.go @@ -37,7 +37,7 @@ func (r *PingFederateSpAdapterResource) ExportAll() (*[]connector.ImportBlock, e return nil, err } - for spAdapterId, spAdapterName := range *spAdaptersData { + for spAdapterId, spAdapterName := range spAdaptersData { commentData := map[string]string{ "Resource Type": r.ResourceType(), "SP Adapter ID": spAdapterId, @@ -57,7 +57,7 @@ func (r *PingFederateSpAdapterResource) ExportAll() (*[]connector.ImportBlock, e return &importBlocks, nil } -func (r *PingFederateSpAdapterResource) getSpAdaptersData() (*map[string]string, error) { +func (r *PingFederateSpAdapterResource) getSpAdaptersData() (map[string]string, error) { spAdaptersData := make(map[string]string) spAdapters, response, err := r.clientInfo.ApiClient.SpAdaptersAPI.GetSpAdapters(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateSpAdapterResource) getSpAdaptersData() (*map[string]string, } } - return &spAdaptersData, nil + return spAdaptersData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_sp_authentication_policy_contract_mapping.go b/internal/connector/pingfederate/resources/pingfederate_sp_authentication_policy_contract_mapping.go index 9e9209ab..7b441384 100644 --- a/internal/connector/pingfederate/resources/pingfederate_sp_authentication_policy_contract_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_sp_authentication_policy_contract_mapping.go @@ -39,7 +39,7 @@ func (r *PingFederateSPAuthenticationPolicyContractMappingResource) ExportAll() return nil, err } - for apcToSpAdapterMappingId, apcToSpAdapterMappingInfo := range *apcToSpAdapterMappingData { + for apcToSpAdapterMappingId, apcToSpAdapterMappingInfo := range apcToSpAdapterMappingData { apcToSpAdapterMappingSourceID := apcToSpAdapterMappingInfo[0] apcToSpAdapterMappingTargetID := apcToSpAdapterMappingInfo[1] @@ -63,7 +63,7 @@ func (r *PingFederateSPAuthenticationPolicyContractMappingResource) ExportAll() return &importBlocks, nil } -func (r *PingFederateSPAuthenticationPolicyContractMappingResource) getApcToSpAdapterMappingData() (*map[string][]string, error) { +func (r *PingFederateSPAuthenticationPolicyContractMappingResource) getApcToSpAdapterMappingData() (map[string][]string, error) { apcToSpAdapterMappingData := make(map[string][]string) apcToSpAdapterMappings, response, err := r.clientInfo.ApiClient.SpAuthenticationPolicyContractMappingsAPI.GetApcToSpAdapterMappings(r.clientInfo.Context).Execute() @@ -94,5 +94,5 @@ func (r *PingFederateSPAuthenticationPolicyContractMappingResource) getApcToSpAd } } - return &apcToSpAdapterMappingData, nil + return apcToSpAdapterMappingData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_sp_idp_connection.go b/internal/connector/pingfederate/resources/pingfederate_sp_idp_connection.go index 8ad209c2..0150b0a2 100644 --- a/internal/connector/pingfederate/resources/pingfederate_sp_idp_connection.go +++ b/internal/connector/pingfederate/resources/pingfederate_sp_idp_connection.go @@ -37,7 +37,7 @@ func (r *PingFederateSpIdpConnectionResource) ExportAll() (*[]connector.ImportBl return nil, err } - for idpConnectionId, idpConnectionName := range *idpConnectionData { + for idpConnectionId, idpConnectionName := range idpConnectionData { commentData := map[string]string{ "Resource Type": r.ResourceType(), "SP IDP Connection ID": idpConnectionId, @@ -57,7 +57,7 @@ func (r *PingFederateSpIdpConnectionResource) ExportAll() (*[]connector.ImportBl return &importBlocks, nil } -func (r *PingFederateSpIdpConnectionResource) getIdpConnectionData() (*map[string]string, error) { +func (r *PingFederateSpIdpConnectionResource) getIdpConnectionData() (map[string]string, error) { idpConnectionData := make(map[string]string) idpConnections, response, err := r.clientInfo.ApiClient.SpIdpConnectionsAPI.GetConnections(r.clientInfo.Context).Execute() @@ -87,5 +87,5 @@ func (r *PingFederateSpIdpConnectionResource) getIdpConnectionData() (*map[strin } } - return &idpConnectionData, nil + return idpConnectionData, nil } diff --git a/internal/connector/pingfederate/resources/pingfederate_token_processor_to_token_generator_mapping.go b/internal/connector/pingfederate/resources/pingfederate_token_processor_to_token_generator_mapping.go index 5aec4c8f..320c4912 100644 --- a/internal/connector/pingfederate/resources/pingfederate_token_processor_to_token_generator_mapping.go +++ b/internal/connector/pingfederate/resources/pingfederate_token_processor_to_token_generator_mapping.go @@ -39,7 +39,7 @@ func (r *PingFederateTokenProcessorToTokenGeneratorMappingResource) ExportAll() return nil, err } - for tokenToTokenMappingId, tokenToTokenMappingInfo := range *tokenToTokenMappingsData { + for tokenToTokenMappingId, tokenToTokenMappingInfo := range tokenToTokenMappingsData { tokenToTokenMappingSourceId := tokenToTokenMappingInfo[0] tokenToTokenMappingTargetId := tokenToTokenMappingInfo[1] @@ -63,7 +63,7 @@ func (r *PingFederateTokenProcessorToTokenGeneratorMappingResource) ExportAll() return &importBlocks, nil } -func (r *PingFederateTokenProcessorToTokenGeneratorMappingResource) getTokenToTokenMappingsData() (*map[string][]string, error) { +func (r *PingFederateTokenProcessorToTokenGeneratorMappingResource) getTokenToTokenMappingsData() (map[string][]string, error) { tokenToTokenMappingsData := make(map[string][]string) tokenToTokenMappings, response, err := r.clientInfo.ApiClient.TokenProcessorToTokenGeneratorMappingsAPI.GetTokenToTokenMappings(r.clientInfo.Context).Execute() @@ -94,5 +94,5 @@ func (r *PingFederateTokenProcessorToTokenGeneratorMappingResource) getTokenToTo } } - return &tokenToTokenMappingsData, nil + return tokenToTokenMappingsData, nil } From 8df93e0d7c6d794e85328ea7608abe965b2faf72 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Thu, 20 Feb 2025 12:21:18 -0700 Subject: [PATCH 12/18] move management resource functions back into ExportableResource type --- .../platform/resources/pingone_agreement.go | 8 +-- .../pingone_agreement_localization.go | 39 ++++++++++--- ...pingone_agreement_localization_revision.go | 56 +++++++++++++++++-- .../resources/pingone_branding_settings.go | 8 +-- .../resources/pingone_branding_theme.go | 8 +-- .../pingone_branding_theme_default.go | 21 ++++--- .../platform/resources/pingone_certificate.go | 12 ++-- .../resources/pingone_custom_domain.go | 12 ++-- .../platform/resources/pingone_environment.go | 8 +-- .../platform/resources/pingone_form.go | 8 +-- .../resources/pingone_forms_recaptcha_v2.go | 8 +-- .../platform/resources/pingone_gateway.go | 8 +-- .../resources/pingone_gateway_credential.go | 49 ++++++++++++++-- .../pingone_gateway_role_assignment.go | 53 ++++++++++++++---- .../pingone_identity_propagation_plan.go | 8 +-- .../pingone/platform/resources/pingone_key.go | 12 ++-- .../resources/pingone_key_rotation_policy.go | 8 +-- .../platform/resources/pingone_language.go | 8 +-- .../resources/pingone_language_update.go | 16 +++--- .../resources/pingone_notification_policy.go | 8 +-- .../pingone_notification_settings.go | 8 +-- .../pingone_notification_settings_email.go | 8 +-- .../pingone_notification_template_content.go | 24 ++++---- .../pingone_phone_delivery_settings.go | 8 +-- .../resources/pingone_system_application.go | 8 +-- .../pingone_trusted_email_address.go | 31 ++++++++-- .../resources/pingone_trusted_email_domain.go | 8 +-- .../platform/resources/pingone_webhook.go | 8 +-- 28 files changed, 309 insertions(+), 152 deletions(-) diff --git a/internal/connector/pingone/platform/resources/pingone_agreement.go b/internal/connector/pingone/platform/resources/pingone_agreement.go index 3c7737f4..9fd4ca54 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement.go @@ -35,7 +35,7 @@ func (r *PingOneAgreementResource) ExportAll() (*[]connector.ImportBlock, error) importBlocks := []connector.ImportBlock{} - agreementData, err := getAgreementData(r.clientInfo, r.ResourceType()) + agreementData, err := r.getAgreementData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneAgreementResource) ExportAll() (*[]connector.ImportBlock, error) return &importBlocks, nil } -func getAgreementData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneAgreementResource) getAgreementData() (map[string]string, error) { agreementData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - agreements, err := common.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + agreements, err := common.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_agreement_localization.go b/internal/connector/pingone/platform/resources/pingone_agreement_localization.go index e8742ad5..1b71b67a 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement_localization.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement_localization.go @@ -35,13 +35,13 @@ func (r *PingOneAgreementLocalizationResource) ExportAll() (*[]connector.ImportB importBlocks := []connector.ImportBlock{} - agreementData, err := getAgreementData(r.clientInfo, r.ResourceType()) + agreementData, err := r.getAgreementData() if err != nil { return nil, err } for agreementId, agreementName := range agreementData { - agreementLocalizationData, err := getAgreementLocalizationData(r.clientInfo, r.ResourceType(), agreementId) + agreementLocalizationData, err := r.getAgreementLocalizationData(agreementId) if err != nil { return nil, err } @@ -70,19 +70,40 @@ func (r *PingOneAgreementLocalizationResource) ExportAll() (*[]connector.ImportB return &importBlocks, nil } -func getAgreementLocalizationData(clientInfo *connector.PingOneClientInfo, resourceType, agreementId string) (map[string]string, error) { +func (r *PingOneAgreementLocalizationResource) getAgreementData() (map[string]string, error) { + agreementData := make(map[string]string) + + iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + agreements, err := common.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) + if err != nil { + return nil, err + } + + for _, agreement := range agreements { + agreementId, agreementIdOk := agreement.GetIdOk() + agreementName, agreementNameOk := agreement.GetNameOk() + + if agreementIdOk && agreementNameOk { + agreementData[*agreementId] = *agreementName + } + } + + return agreementData, nil +} + +func (r *PingOneAgreementLocalizationResource) getAgreementLocalizationData(agreementId string) (map[string]string, error) { agreementLocalizationData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(clientInfo.Context, clientInfo.ExportEnvironmentID, agreementId).Execute() - agreementLocalizations, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadAllAgreementLanguages", "GetLanguages", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId).Execute() + languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadAllAgreementLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } - for _, agreementLocalization := range agreementLocalizations { - if agreementLocalization.AgreementLanguage != nil { - agreementLocalizationId, agreementLocalizationIdOk := agreementLocalization.AgreementLanguage.GetIdOk() - agreementLocalizationLocale, agreementLocalizationLocaleOk := agreementLocalization.AgreementLanguage.GetLocaleOk() + for _, languageInner := range languageInners { + if languageInner.AgreementLanguage != nil { + agreementLocalizationId, agreementLocalizationIdOk := languageInner.AgreementLanguage.GetIdOk() + agreementLocalizationLocale, agreementLocalizationLocaleOk := languageInner.AgreementLanguage.GetLocaleOk() if agreementLocalizationIdOk && agreementLocalizationLocaleOk { agreementLocalizationData[*agreementLocalizationId] = *agreementLocalizationLocale diff --git a/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go b/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go index cce92692..b0c07521 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go @@ -35,19 +35,19 @@ func (r *PingOneAgreementLocalizationRevisionResource) ExportAll() (*[]connector importBlocks := []connector.ImportBlock{} - agreementData, err := getAgreementData(r.clientInfo, r.ResourceType()) + agreementData, err := r.getAgreementData() if err != nil { return nil, err } for agreementId, agreementName := range agreementData { - agreementLocalizationData, err := getAgreementLocalizationData(r.clientInfo, r.ResourceType(), agreementId) + agreementLocalizationData, err := r.getAgreementLanguageData(agreementId) if err != nil { return nil, err } for agreementLocalizationId, agreementLocalizationLocale := range agreementLocalizationData { - agreementLocalizationRevisionData, err := getAgreementLocalizationRevisionData(r.clientInfo, r.ResourceType(), agreementId, agreementLocalizationId) + agreementLocalizationRevisionData, err := r.getAgreementLocalizationRevisionData(agreementId, agreementLocalizationId) if err != nil { return nil, err } @@ -78,11 +78,55 @@ func (r *PingOneAgreementLocalizationRevisionResource) ExportAll() (*[]connector return &importBlocks, nil } -func getAgreementLocalizationRevisionData(clientInfo *connector.PingOneClientInfo, resourceType, agreementId, agreementLocalizationId string) ([]string, error) { +func (r *PingOneAgreementLocalizationRevisionResource) getAgreementData() (map[string]string, error) { + agreementData := make(map[string]string) + + iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + agreements, err := common.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) + if err != nil { + return nil, err + } + + for _, agreement := range agreements { + agreementId, agreementIdOk := agreement.GetIdOk() + agreementName, agreementNameOk := agreement.GetNameOk() + + if agreementIdOk && agreementNameOk { + agreementData[*agreementId] = *agreementName + } + } + + return agreementData, nil +} + +func (r *PingOneAgreementLocalizationRevisionResource) getAgreementLanguageData(agreementId string) (map[string]string, error) { + agreementLanguageData := make(map[string]string) + + iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId).Execute() + languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadAllAgreementLanguages", "GetLanguages", r.ResourceType()) + if err != nil { + return nil, err + } + + for _, languageInner := range languageInners { + if languageInner.AgreementLanguage != nil { + agreementLanguageLocale, agreementLanguageLocaleOk := languageInner.AgreementLanguage.GetLocaleOk() + agreementLanguageId, agreementLanguageIdOk := languageInner.AgreementLanguage.GetIdOk() + + if agreementLanguageLocaleOk && agreementLanguageIdOk { + agreementLanguageData[*agreementLanguageId] = *agreementLanguageLocale + } + } + } + + return agreementLanguageData, nil +} + +func (r *PingOneAgreementLocalizationRevisionResource) getAgreementLocalizationRevisionData(agreementId, agreementLocalizationId string) ([]string, error) { agreementLocalizationRevisionData := []string{} - iter := clientInfo.ApiClient.ManagementAPIClient.AgreementRevisionsResourcesApi.ReadAllAgreementLanguageRevisions(clientInfo.Context, clientInfo.ExportEnvironmentID, agreementId, agreementLocalizationId).Execute() - agreementLocalizationRevisions, err := common.GetManagementAPIObjectsFromIterator[management.AgreementLanguageRevision](iter, "ReadAllAgreementLanguageRevisions", "GetRevisions", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementRevisionsResourcesApi.ReadAllAgreementLanguageRevisions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId, agreementLocalizationId).Execute() + agreementLocalizationRevisions, err := common.GetManagementAPIObjectsFromIterator[management.AgreementLanguageRevision](iter, "ReadAllAgreementLanguageRevisions", "GetRevisions", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_settings.go b/internal/connector/pingone/platform/resources/pingone_branding_settings.go index 65b41c84..78eaf8b3 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_settings.go @@ -32,7 +32,7 @@ func (r *PingOneBrandingSettingsResource) ExportAll() (*[]connector.ImportBlock, importBlocks := []connector.ImportBlock{} - ok, err := checkBrandingSettingsData(r.clientInfo, r.ResourceType()) + ok, err := r.checkBrandingSettingsData() if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (r *PingOneBrandingSettingsResource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func checkBrandingSettingsData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { - _, response, err := clientInfo.ApiClient.ManagementAPIClient.BrandingSettingsApi.ReadBrandingSettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadBrandingSettings", resourceType) +func (r *PingOneBrandingSettingsResource) checkBrandingSettingsData() (bool, error) { + _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.BrandingSettingsApi.ReadBrandingSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadBrandingSettings", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme.go b/internal/connector/pingone/platform/resources/pingone_branding_theme.go index d0ca2573..7b209275 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme.go @@ -35,7 +35,7 @@ func (r *PingOneBrandingThemeResource) ExportAll() (*[]connector.ImportBlock, er importBlocks := []connector.ImportBlock{} - brandingThemeData, err := getBrandingThemeData(r.clientInfo, r.ResourceType()) + brandingThemeData, err := r.getBrandingThemeData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneBrandingThemeResource) ExportAll() (*[]connector.ImportBlock, er return &importBlocks, nil } -func getBrandingThemeData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneBrandingThemeResource) getBrandingThemeData() (map[string]string, error) { brandingThemeData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - brandingThemes, err := common.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + brandingThemes, err := common.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go index d842e89b..4fbf1a14 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go @@ -35,20 +35,23 @@ func (r *PingOneBrandingThemeDefaultResource) ExportAll() (*[]connector.ImportBl importBlocks := []connector.ImportBlock{} - defaultBrandingThemeName, err := getDefaultBrandingThemeName(r.clientInfo, r.ResourceType()) + defaultBrandingThemeName, err := r.getDefaultBrandingThemeName() if err != nil { return nil, err } + if defaultBrandingThemeName == nil { + return &importBlocks, nil + } commentData := map[string]string{ - "Default Branding Theme Name": defaultBrandingThemeName, + "Default Branding Theme Name": *defaultBrandingThemeName, "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), } importBlock := connector.ImportBlock{ ResourceType: r.ResourceType(), - ResourceName: fmt.Sprintf("%s_default_theme", defaultBrandingThemeName), + ResourceName: fmt.Sprintf("%s_default_theme", *defaultBrandingThemeName), ResourceID: r.clientInfo.ExportEnvironmentID, CommentInformation: common.GenerateCommentInformation(commentData), } @@ -58,11 +61,11 @@ func (r *PingOneBrandingThemeDefaultResource) ExportAll() (*[]connector.ImportBl return &importBlocks, nil } -func getDefaultBrandingThemeName(clientInfo *connector.PingOneClientInfo, resourceType string) (string, error) { - iter := clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - brandingThemes, err := common.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", resourceType) +func (r *PingOneBrandingThemeDefaultResource) getDefaultBrandingThemeName() (*string, error) { + iter := r.clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + brandingThemes, err := common.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", r.ResourceType()) if err != nil { - return "", err + return nil, err } for _, brandingTheme := range brandingThemes { @@ -75,12 +78,12 @@ func getDefaultBrandingThemeName(clientInfo *connector.PingOneClientInfo, resour brandingThemeName, brandingThemeNameOk := brandingThemeConfiguration.GetNameOk() if brandingThemeNameOk { - return *brandingThemeName, nil + return brandingThemeName, nil } } } } - return "", fmt.Errorf("failed to export resource '%s'. No default branding theme found", resourceType) + return nil, fmt.Errorf("failed to export resource '%s'. No default branding theme found", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_certificate.go b/internal/connector/pingone/platform/resources/pingone_certificate.go index 5817651a..9b6fcfc8 100644 --- a/internal/connector/pingone/platform/resources/pingone_certificate.go +++ b/internal/connector/pingone/platform/resources/pingone_certificate.go @@ -34,7 +34,7 @@ func (r *PingOneCertificateResource) ExportAll() (*[]connector.ImportBlock, erro importBlocks := []connector.ImportBlock{} - certificateData, err := getCertificateData(r.clientInfo, r.ResourceType()) + certificateData, err := r.getCertificateData() if err != nil { return nil, err } @@ -60,12 +60,12 @@ func (r *PingOneCertificateResource) ExportAll() (*[]connector.ImportBlock, erro return &importBlocks, nil } -func getCertificateData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneCertificateResource) getCertificateData() (map[string]string, error) { certificateData := make(map[string]string) // TODO: Implement pagination once supported in the PingOne Go Client SDK - entityArray, response, err := clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetCertificates(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "GetCertificates", resourceType) + entityArray, response, err := r.clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetCertificates(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + ok, err := common.HandleClientResponse(response, err, "GetCertificates", r.ResourceType()) if err != nil { return nil, err } @@ -74,12 +74,12 @@ func getCertificateData(clientInfo *connector.PingOneClientInfo, resourceType st } if entityArray == nil { - return nil, common.DataNilError(resourceType, response) + return nil, common.DataNilError(r.ResourceType(), response) } embedded, embeddedOk := entityArray.GetEmbeddedOk() if !embeddedOk { - return nil, common.DataNilError(resourceType, response) + return nil, common.DataNilError(r.ResourceType(), response) } for _, certificate := range embedded.GetCertificates() { diff --git a/internal/connector/pingone/platform/resources/pingone_custom_domain.go b/internal/connector/pingone/platform/resources/pingone_custom_domain.go index f09bd290..5a93d7a0 100644 --- a/internal/connector/pingone/platform/resources/pingone_custom_domain.go +++ b/internal/connector/pingone/platform/resources/pingone_custom_domain.go @@ -35,12 +35,12 @@ func (r *PingOneCustomDomainResource) ExportAll() (*[]connector.ImportBlock, err importBlocks := []connector.ImportBlock{} - domainData, err := getCustomDomainData(r.clientInfo, r.ResourceType()) + domainData, err := r.getCustomDomainData() if err != nil { return nil, err } - for domainId, domainName := range *domainData { + for domainId, domainName := range domainData { commentData := map[string]string{ "Custom Domain ID": domainId, "Custom Domain Name": domainName, @@ -61,11 +61,11 @@ func (r *PingOneCustomDomainResource) ExportAll() (*[]connector.ImportBlock, err return &importBlocks, nil } -func getCustomDomainData(clientInfo *connector.PingOneClientInfo, resourceType string) (*map[string]string, error) { +func (r *PingOneCustomDomainResource) getCustomDomainData() (map[string]string, error) { domainData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.CustomDomainsApi.ReadAllDomains(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - customDomains, err := common.GetManagementAPIObjectsFromIterator[management.CustomDomain](iter, "ReadAllDomains", "GetCustomDomains", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.CustomDomainsApi.ReadAllDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + customDomains, err := common.GetManagementAPIObjectsFromIterator[management.CustomDomain](iter, "ReadAllDomains", "GetCustomDomains", r.ResourceType()) if err != nil { return nil, err } @@ -79,5 +79,5 @@ func getCustomDomainData(clientInfo *connector.PingOneClientInfo, resourceType s } } - return &domainData, nil + return domainData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_environment.go b/internal/connector/pingone/platform/resources/pingone_environment.go index 75e7ecf8..6d2f3460 100644 --- a/internal/connector/pingone/platform/resources/pingone_environment.go +++ b/internal/connector/pingone/platform/resources/pingone_environment.go @@ -32,7 +32,7 @@ func (r *PingOneEnvironmentResource) ExportAll() (*[]connector.ImportBlock, erro importBlocks := []connector.ImportBlock{} - ok, err := checkEnvironmentData(r.clientInfo, r.ResourceType()) + ok, err := r.checkEnvironmentData() if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (r *PingOneEnvironmentResource) ExportAll() (*[]connector.ImportBlock, erro return &importBlocks, nil } -func checkEnvironmentData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { - _, response, err := clientInfo.ApiClient.ManagementAPIClient.EnvironmentsApi.ReadOneEnvironment(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadOneEnvironment", resourceType) +func (r *PingOneEnvironmentResource) checkEnvironmentData() (bool, error) { + _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.EnvironmentsApi.ReadOneEnvironment(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadOneEnvironment", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_form.go b/internal/connector/pingone/platform/resources/pingone_form.go index 413365ab..4415b372 100644 --- a/internal/connector/pingone/platform/resources/pingone_form.go +++ b/internal/connector/pingone/platform/resources/pingone_form.go @@ -35,7 +35,7 @@ func (r *PingOneFormResource) ExportAll() (*[]connector.ImportBlock, error) { importBlocks := []connector.ImportBlock{} - formData, err := getFormData(r.clientInfo, r.ResourceType()) + formData, err := r.getFormData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneFormResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func getFormData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneFormResource) getFormData() (map[string]string, error) { formData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.FormManagementApi.ReadAllForms(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - forms, err := common.GetManagementAPIObjectsFromIterator[management.Form](iter, "ReadAllForms", "GetForms", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.FormManagementApi.ReadAllForms(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + forms, err := common.GetManagementAPIObjectsFromIterator[management.Form](iter, "ReadAllForms", "GetForms", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go b/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go index 653e6670..506efc2d 100644 --- a/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go +++ b/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go @@ -32,7 +32,7 @@ func (r *PingOneFormRecaptchaV2Resource) ExportAll() (*[]connector.ImportBlock, importBlocks := []connector.ImportBlock{} - ok, err := checkFormRecaptchaV2Data(r.clientInfo, r.ResourceType()) + ok, err := r.checkFormRecaptchaV2Data() if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (r *PingOneFormRecaptchaV2Resource) ExportAll() (*[]connector.ImportBlock, return &importBlocks, nil } -func checkFormRecaptchaV2Data(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { - _, response, err := clientInfo.ApiClient.ManagementAPIClient.RecaptchaConfigurationApi.ReadRecaptchaConfiguration(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadRecaptchaConfiguration", resourceType) +func (r *PingOneFormRecaptchaV2Resource) checkFormRecaptchaV2Data() (bool, error) { + _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.RecaptchaConfigurationApi.ReadRecaptchaConfiguration(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadRecaptchaConfiguration", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway.go b/internal/connector/pingone/platform/resources/pingone_gateway.go index 928d0761..caa4e07f 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway.go @@ -35,7 +35,7 @@ func (r *PingOneGatewayResource) ExportAll() (*[]connector.ImportBlock, error) { importBlocks := []connector.ImportBlock{} - gatewayData, err := getGatewayData(r.clientInfo, r.ResourceType()) + gatewayData, err := r.getGatewayData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneGatewayResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func getGatewayData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneGatewayResource) getGatewayData() (map[string]string, error) { gatewayData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - gateways, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + gateways, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go index d050cac3..5dc4c4f6 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go @@ -35,13 +35,13 @@ func (r *PingOneGatewayCredentialResource) ExportAll() (*[]connector.ImportBlock importBlocks := []connector.ImportBlock{} - gatewayData, err := getGatewayData(r.clientInfo, r.ResourceType()) + gatewayData, err := r.getGatewayData() if err != nil { return nil, err } for gatewayId, gatewayName := range gatewayData { - gatewayCredentialData, err := getGatewayCredentialData(r.clientInfo, r.ResourceType(), gatewayId) + gatewayCredentialData, err := r.getGatewayCredentialData(gatewayId) if err != nil { return nil, err } @@ -69,11 +69,50 @@ func (r *PingOneGatewayCredentialResource) ExportAll() (*[]connector.ImportBlock return &importBlocks, nil } -func getGatewayCredentialData(clientInfo *connector.PingOneClientInfo, resourceType, gatewayId string) ([]string, error) { +func (r *PingOneGatewayCredentialResource) getGatewayData() (map[string]string, error) { + gatewayData := make(map[string]string) + + iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + gatewayInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) + if err != nil { + return nil, err + } + + for _, gatewayInner := range gatewayInners { + var ( + gatewayId *string + gatewayIdOk bool + gatewayName *string + gatewayNameOk bool + ) + + switch { + case gatewayInner.Gateway != nil: + gatewayId, gatewayIdOk = gatewayInner.Gateway.GetIdOk() + gatewayName, gatewayNameOk = gatewayInner.Gateway.GetNameOk() + case gatewayInner.GatewayTypeLDAP != nil: + gatewayId, gatewayIdOk = gatewayInner.GatewayTypeLDAP.GetIdOk() + gatewayName, gatewayNameOk = gatewayInner.GatewayTypeLDAP.GetNameOk() + case gatewayInner.GatewayTypeRADIUS != nil: + gatewayId, gatewayIdOk = gatewayInner.GatewayTypeRADIUS.GetIdOk() + gatewayName, gatewayNameOk = gatewayInner.GatewayTypeRADIUS.GetNameOk() + default: + continue + } + + if gatewayIdOk && gatewayNameOk { + gatewayData[*gatewayId] = *gatewayName + } + } + + return gatewayData, nil +} + +func (r *PingOneGatewayCredentialResource) getGatewayCredentialData(gatewayId string) ([]string, error) { gatewayCredentialData := []string{} - iter := clientInfo.ApiClient.ManagementAPIClient.GatewayCredentialsApi.ReadAllGatewayCredentials(clientInfo.Context, clientInfo.ExportEnvironmentID, gatewayId).Execute() - gatewayCredentials, err := common.GetManagementAPIObjectsFromIterator[management.GatewayCredential](iter, "ReadAllGatewayCredentials", "GetCredentials", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewayCredentialsApi.ReadAllGatewayCredentials(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, gatewayId).Execute() + gatewayCredentials, err := common.GetManagementAPIObjectsFromIterator[management.GatewayCredential](iter, "ReadAllGatewayCredentials", "GetCredentials", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go index 085d5ba0..534b3f9d 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go @@ -35,24 +35,25 @@ func (r *PingOneGatewayRoleAssignmentResource) ExportAll() (*[]connector.ImportB importBlocks := []connector.ImportBlock{} - gatewayData, err := getGatewayData(r.clientInfo, r.ResourceType()) + gatewayData, err := r.getGatewayData() if err != nil { return nil, err } - //TODO: Only PingFederate Connections have role assignments - for gatewayId, gatewayName := range gatewayData { - gatewayRoleAssignmentData, err := getGatewayRoleAssignmentData(r.clientInfo, r.ResourceType(), gatewayId) + gatewayRoleAssignmentData, err := r.getGatewayRoleAssignmentData(gatewayId) if err != nil { return nil, err } for roleAssignmentId, roleId := range gatewayRoleAssignmentData { - roleName, err := getRoleAssignmentRoleName(r.clientInfo, r.ResourceType(), roleId) + roleName, err := r.getRoleAssignmentRoleName(roleId) if err != nil { return nil, err } + if roleName == nil { + continue + } commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, @@ -77,11 +78,39 @@ func (r *PingOneGatewayRoleAssignmentResource) ExportAll() (*[]connector.ImportB return &importBlocks, nil } -func getGatewayRoleAssignmentData(clientInfo *connector.PingOneClientInfo, resourceType, gatewayId string) (map[string]string, error) { +func (r *PingOneGatewayRoleAssignmentResource) getGatewayData() (map[string]string, error) { + gatewayData := make(map[string]string) + + iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + gatewayInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) + if err != nil { + return nil, err + } + + for _, gatewayInner := range gatewayInners { + // Only PingFederate Connections have role assignments + if gatewayInner.Gateway != nil { + gatewayType, gatewayTypeOk := gatewayInner.Gateway.GetTypeOk() + + if gatewayTypeOk && *gatewayType == management.ENUMGATEWAYTYPE_PING_FEDERATE { + gatewayId, gatewayIdOk := gatewayInner.Gateway.GetIdOk() + gatewayName, gatewayNameOk := gatewayInner.Gateway.GetNameOk() + + if gatewayIdOk && gatewayNameOk { + gatewayData[*gatewayId] = *gatewayName + } + } + } + } + + return gatewayData, nil +} + +func (r *PingOneGatewayRoleAssignmentResource) getGatewayRoleAssignmentData(gatewayId string) (map[string]string, error) { gatewayRoleAssignmentData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.GatewayRoleAssignmentsApi.ReadGatewayRoleAssignments(clientInfo.Context, clientInfo.ExportEnvironmentID, gatewayId).Execute() - gatewayRoleAssignments, err := common.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadGatewayRoleAssignments", "GetRoleAssignments", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewayRoleAssignmentsApi.ReadGatewayRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, gatewayId).Execute() + gatewayRoleAssignments, err := common.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadGatewayRoleAssignments", "GetRoleAssignments", r.ResourceType()) if err != nil { return nil, err } @@ -101,9 +130,9 @@ func getGatewayRoleAssignmentData(clientInfo *connector.PingOneClientInfo, resou return gatewayRoleAssignmentData, nil } -func getRoleAssignmentRoleName(clientInfo *connector.PingOneClientInfo, resourceType, roleId string) (*management.EnumRoleName, error) { - role, resp, err := clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(clientInfo.Context, roleId).Execute() - ok, err := common.CheckSingletonResource(resp, err, "ReadOneRole", resourceType) +func (r *PingOneGatewayRoleAssignmentResource) getRoleAssignmentRoleName(roleId string) (*management.EnumRoleName, error) { + role, resp, err := r.clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(r.clientInfo.Context, roleId).Execute() + ok, err := common.CheckSingletonResource(resp, err, "ReadOneRole", r.ResourceType()) if err != nil { return nil, err } @@ -118,5 +147,5 @@ func getRoleAssignmentRoleName(clientInfo *connector.PingOneClientInfo, resource } } - return nil, fmt.Errorf("failed to export resource '%s'. No role name found for Role ID '%s'", resourceType, roleId) + return nil, fmt.Errorf("failed to export resource '%s'. No role name found for Role ID '%s'", r.ResourceType(), roleId) } diff --git a/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go b/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go index b5de2148..4e5a65e4 100644 --- a/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go +++ b/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go @@ -35,7 +35,7 @@ func (r *PingOneIdentityPropagationPlanResource) ExportAll() (*[]connector.Impor importBlocks := []connector.ImportBlock{} - planData, err := getIdentityPropagationPlanData(r.clientInfo, r.ResourceType()) + planData, err := r.getIdentityPropagationPlanData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneIdentityPropagationPlanResource) ExportAll() (*[]connector.Impor return &importBlocks, nil } -func getIdentityPropagationPlanData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneIdentityPropagationPlanResource) getIdentityPropagationPlanData() (map[string]string, error) { identityPropagationPlanData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.IdentityPropagationPlansApi.ReadAllPlans(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - identityPropagationPlans, err := common.GetManagementAPIObjectsFromIterator[management.IdentityPropagationPlan](iter, "ReadAllPlans", "GetPlans", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityPropagationPlansApi.ReadAllPlans(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + identityPropagationPlans, err := common.GetManagementAPIObjectsFromIterator[management.IdentityPropagationPlan](iter, "ReadAllPlans", "GetPlans", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_key.go b/internal/connector/pingone/platform/resources/pingone_key.go index d180a36c..fb204331 100644 --- a/internal/connector/pingone/platform/resources/pingone_key.go +++ b/internal/connector/pingone/platform/resources/pingone_key.go @@ -34,7 +34,7 @@ func (r *PingOneKeyResource) ExportAll() (*[]connector.ImportBlock, error) { importBlocks := []connector.ImportBlock{} - keyData, err := getKeyData(r.clientInfo, r.ResourceType()) + keyData, err := r.getKeyData() if err != nil { return nil, err } @@ -64,13 +64,13 @@ func (r *PingOneKeyResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func getKeyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string][]string, error) { +func (r *PingOneKeyResource) getKeyData() (map[string][]string, error) { keyData := make(map[string][]string) // TODO: Implement pagination once supported in the PingOne Go Client SDK - entityArray, response, err := clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetKeys(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() + entityArray, response, err := r.clientInfo.ApiClient.ManagementAPIClient.CertificateManagementApi.GetKeys(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - ok, err := common.HandleClientResponse(response, err, "GetKeys", resourceType) + ok, err := common.HandleClientResponse(response, err, "GetKeys", r.ResourceType()) if err != nil { return nil, err } @@ -79,12 +79,12 @@ func getKeyData(clientInfo *connector.PingOneClientInfo, resourceType string) (m } if entityArray == nil { - return nil, common.DataNilError(resourceType, response) + return nil, common.DataNilError(r.ResourceType(), response) } embedded, embeddedOk := entityArray.GetEmbeddedOk() if !embeddedOk { - return nil, common.DataNilError(resourceType, response) + return nil, common.DataNilError(r.ResourceType(), response) } for _, key := range embedded.GetKeys() { diff --git a/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go b/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go index 51b918b2..1b979892 100644 --- a/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go +++ b/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go @@ -35,7 +35,7 @@ func (r *PingOneKeyRotationPolicyResource) ExportAll() (*[]connector.ImportBlock importBlocks := []connector.ImportBlock{} - keyRotationPolicyData, err := getKeyRotationPolicyData(r.clientInfo, r.ResourceType()) + keyRotationPolicyData, err := r.getKeyRotationPolicyData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneKeyRotationPolicyResource) ExportAll() (*[]connector.ImportBlock return &importBlocks, nil } -func getKeyRotationPolicyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneKeyRotationPolicyResource) getKeyRotationPolicyData() (map[string]string, error) { keyRotationPolicyData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.KeyRotationPoliciesApi.GetKeyRotationPolicies(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - keyRotationPolicies, err := common.GetManagementAPIObjectsFromIterator[management.KeyRotationPolicy](iter, "GetKeyRotationPolicies", "GetKeyRotationPolicies", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.KeyRotationPoliciesApi.GetKeyRotationPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + keyRotationPolicies, err := common.GetManagementAPIObjectsFromIterator[management.KeyRotationPolicy](iter, "GetKeyRotationPolicies", "GetKeyRotationPolicies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_language.go b/internal/connector/pingone/platform/resources/pingone_language.go index 82413b03..a33423a1 100644 --- a/internal/connector/pingone/platform/resources/pingone_language.go +++ b/internal/connector/pingone/platform/resources/pingone_language.go @@ -35,7 +35,7 @@ func (r *PingOneLanguageResource) ExportAll() (*[]connector.ImportBlock, error) importBlocks := []connector.ImportBlock{} - languageData, err := getLanguageData(r.clientInfo, r.ResourceType()) + languageData, err := r.getLanguageData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneLanguageResource) ExportAll() (*[]connector.ImportBlock, error) return &importBlocks, nil } -func getLanguageData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneLanguageResource) getLanguageData() (map[string]string, error) { languageData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_language_update.go b/internal/connector/pingone/platform/resources/pingone_language_update.go index 45e067fc..80d8577f 100644 --- a/internal/connector/pingone/platform/resources/pingone_language_update.go +++ b/internal/connector/pingone/platform/resources/pingone_language_update.go @@ -35,12 +35,12 @@ func (r *PingOneLanguageUpdateResource) ExportAll() (*[]connector.ImportBlock, e importBlocks := []connector.ImportBlock{} - languageData, err := getLanguageUpdateData(r.clientInfo, r.ResourceType()) + languageUpdateData, err := r.getLanguageUpdateData() if err != nil { return nil, err } - for languageId, languageName := range languageData { + for languageId, languageName := range languageUpdateData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Language ID": languageId, @@ -61,11 +61,11 @@ func (r *PingOneLanguageUpdateResource) ExportAll() (*[]connector.ImportBlock, e return &importBlocks, nil } -func getLanguageUpdateData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { - languageData := make(map[string]string) +func (r *PingOneLanguageUpdateResource) getLanguageUpdateData() (map[string]string, error) { + languageUpdateData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } @@ -87,12 +87,12 @@ func getLanguageUpdateData(clientInfo *connector.PingOneClientInfo, resourceType languageName, languageNameOk := languageInner.Language.GetNameOk() if languageIdOk && languageNameOk { - languageData[*languageId] = *languageName + languageUpdateData[*languageId] = *languageName } } } } } - return languageData, nil + return languageUpdateData, nil } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_policy.go b/internal/connector/pingone/platform/resources/pingone_notification_policy.go index 8ea56401..7d1a0bd0 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_policy.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_policy.go @@ -35,7 +35,7 @@ func (r *PingOneNotificationPolicyResource) ExportAll() (*[]connector.ImportBloc importBlocks := []connector.ImportBlock{} - notificationPolicyData, err := getNotificationPolicyData(r.clientInfo, r.ResourceType()) + notificationPolicyData, err := r.getNotificationPolicyData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneNotificationPolicyResource) ExportAll() (*[]connector.ImportBloc return &importBlocks, nil } -func getNotificationPolicyData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneNotificationPolicyResource) getNotificationPolicyData() (map[string]string, error) { notificationPolicyData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.NotificationsPoliciesApi.ReadAllNotificationsPolicies(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - notificationPolicies, err := common.GetManagementAPIObjectsFromIterator[management.NotificationsPolicy](iter, "ReadAllNotificationsPolicies", "GetNotificationsPolicies", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsPoliciesApi.ReadAllNotificationsPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + notificationPolicies, err := common.GetManagementAPIObjectsFromIterator[management.NotificationsPolicy](iter, "ReadAllNotificationsPolicies", "GetNotificationsPolicies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_settings.go b/internal/connector/pingone/platform/resources/pingone_notification_settings.go index 4ada4421..fca24054 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_settings.go @@ -32,7 +32,7 @@ func (r *PingOneNotificationSettingsResource) ExportAll() (*[]connector.ImportBl importBlocks := []connector.ImportBlock{} - ok, err := checkNotificationSettingsData(r.clientInfo, r.ResourceType()) + ok, err := r.checkNotificationSettingsData() if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (r *PingOneNotificationSettingsResource) ExportAll() (*[]connector.ImportBl return &importBlocks, nil } -func checkNotificationSettingsData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { - _, response, err := clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsApi.ReadNotificationsSettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadNotificationsSettings", resourceType) +func (r *PingOneNotificationSettingsResource) checkNotificationSettingsData() (bool, error) { + _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsApi.ReadNotificationsSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadNotificationsSettings", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go b/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go index b272b543..0220c40b 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go @@ -32,7 +32,7 @@ func (r *PingOneNotificationSettingsEmailResource) ExportAll() (*[]connector.Imp importBlocks := []connector.ImportBlock{} - ok, err := checkNotificationSettingsEmailData(r.clientInfo, r.ResourceType()) + ok, err := r.checkNotificationSettingsEmailData() if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (r *PingOneNotificationSettingsEmailResource) ExportAll() (*[]connector.Imp return &importBlocks, nil } -func checkNotificationSettingsEmailData(clientInfo *connector.PingOneClientInfo, resourceType string) (bool, error) { - _, response, err := clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsSMTPApi.ReadEmailNotificationsSettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadEmailNotificationsSettings", resourceType) +func (r *PingOneNotificationSettingsEmailResource) checkNotificationSettingsEmailData() (bool, error) { + _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsSMTPApi.ReadEmailNotificationsSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + return common.CheckSingletonResource(response, err, "ReadEmailNotificationsSettings", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_template_content.go b/internal/connector/pingone/platform/resources/pingone_notification_template_content.go index a17e804a..235f40e5 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_template_content.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_template_content.go @@ -45,18 +45,18 @@ func (r *PingOneNotificationTemplateContentResource) ExportAll() (*[]connector.I importBlocks := []connector.ImportBlock{} - enabledLocales, err := getEnabledLocales(r.clientInfo, r.ResourceType()) + enabledLocales, err := r.getEnabledLocales() if err != nil { return nil, err } - templateNames, err := getTemplateNames(r.clientInfo, r.ResourceType()) + templateNames, err := r.getTemplateNames() if err != nil { return nil, err } for _, templateName := range templateNames { - templateContentData, err := getTemplateContentData(r.clientInfo, r.ResourceType(), templateName) + templateContentData, err := r.getTemplateContentData(templateName) if err != nil { return nil, err } @@ -98,11 +98,11 @@ func (r *PingOneNotificationTemplateContentResource) ExportAll() (*[]connector.I return &importBlocks, nil } -func getEnabledLocales(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]bool, error) { +func (r *PingOneNotificationTemplateContentResource) getEnabledLocales() (map[string]bool, error) { enabledLocales := make(map[string]bool) - iter := clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } @@ -121,11 +121,11 @@ func getEnabledLocales(clientInfo *connector.PingOneClientInfo, resourceType str return enabledLocales, nil } -func getTemplateNames(clientInfo *connector.PingOneClientInfo, resourceType string) ([]management.EnumTemplateName, error) { +func (r *PingOneNotificationTemplateContentResource) getTemplateNames() ([]management.EnumTemplateName, error) { templateNames := []management.EnumTemplateName{} for _, templateName := range management.AllowedEnumTemplateNameEnumValues { - _, response, err := clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadOneTemplate(clientInfo.Context, clientInfo.ExportEnvironmentID, templateName).Execute() + _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadOneTemplate(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, templateName).Execute() // When PingOne services are not enabled in an environment, // the response code for the templates related to that service is // 400 Bad Request - "CONSTRAINT_VIOLATION" @@ -142,7 +142,7 @@ func getTemplateNames(clientInfo *connector.PingOneClientInfo, resourceType stri } // Handle all other errors or bad responses - ok, err := common.HandleClientResponse(response, err, "ReadOneTemplate", resourceType) + ok, err := common.HandleClientResponse(response, err, "ReadOneTemplate", r.ResourceType()) if err != nil { return nil, err } @@ -156,11 +156,11 @@ func getTemplateNames(clientInfo *connector.PingOneClientInfo, resourceType stri return templateNames, nil } -func getTemplateContentData(clientInfo *connector.PingOneClientInfo, resourceType string, templateName management.EnumTemplateName) ([]NotificationTemplateContentData, error) { +func (r *PingOneNotificationTemplateContentResource) getTemplateContentData(templateName management.EnumTemplateName) ([]NotificationTemplateContentData, error) { templateContentData := []NotificationTemplateContentData{} - iter := clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadAllTemplateContents(clientInfo.Context, clientInfo.ExportEnvironmentID, templateName).Execute() - templateContents, err := common.GetManagementAPIObjectsFromIterator[management.TemplateContent](iter, "ReadAllTemplateContents", "GetContents", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadAllTemplateContents(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, templateName).Execute() + templateContents, err := common.GetManagementAPIObjectsFromIterator[management.TemplateContent](iter, "ReadAllTemplateContents", "GetContents", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go b/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go index 36180d4e..baab177f 100644 --- a/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go @@ -35,7 +35,7 @@ func (r *PingOnePhoneDeliverySettingsResource) ExportAll() (*[]connector.ImportB importBlocks := []connector.ImportBlock{} - phoneDeliverySettingsData, err := getPhoneDeliverySettingsData(r.clientInfo, r.ResourceType()) + phoneDeliverySettingsData, err := r.getPhoneDeliverySettingsData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOnePhoneDeliverySettingsResource) ExportAll() (*[]connector.ImportB return &importBlocks, nil } -func getPhoneDeliverySettingsData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOnePhoneDeliverySettingsResource) getPhoneDeliverySettingsData() (map[string]string, error) { phoneDeliverySettingsData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.PhoneDeliverySettingsApi.ReadAllPhoneDeliverySettings(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - phoneDeliverySettings, err := common.GetManagementAPIObjectsFromIterator[management.NotificationsSettingsPhoneDeliverySettings](iter, "ReadAllPhoneDeliverySettings", "GetPhoneDeliverySettings", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.PhoneDeliverySettingsApi.ReadAllPhoneDeliverySettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + phoneDeliverySettings, err := common.GetManagementAPIObjectsFromIterator[management.NotificationsSettingsPhoneDeliverySettings](iter, "ReadAllPhoneDeliverySettings", "GetPhoneDeliverySettings", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_system_application.go b/internal/connector/pingone/platform/resources/pingone_system_application.go index b243fb37..743ee127 100644 --- a/internal/connector/pingone/platform/resources/pingone_system_application.go +++ b/internal/connector/pingone/platform/resources/pingone_system_application.go @@ -35,7 +35,7 @@ func (r *PingOneSystemApplicationResource) ExportAll() (*[]connector.ImportBlock importBlocks := []connector.ImportBlock{} - applicationData, err := getSystemApplicationData(r.clientInfo, r.ResourceType()) + applicationData, err := r.getSystemApplicationData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneSystemApplicationResource) ExportAll() (*[]connector.ImportBlock return &importBlocks, nil } -func getSystemApplicationData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneSystemApplicationResource) getSystemApplicationData() (map[string]string, error) { applicationData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go b/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go index 6f0fcd6f..9af55c37 100644 --- a/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go +++ b/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go @@ -35,13 +35,13 @@ func (r *PingOneTrustedEmailAddressResource) ExportAll() (*[]connector.ImportBlo importBlocks := []connector.ImportBlock{} - trustedEmailDomainData, err := getTrustedEmailDomainData(r.clientInfo, r.ResourceType()) + trustedEmailDomainData, err := r.getTrustedEmailDomainData() if err != nil { return nil, err } for trustedEmailDomainId, trustedEmailDomainName := range trustedEmailDomainData { - trustedEmailAddressData, err := getTrustedEmailAddressData(r.clientInfo, r.ResourceType(), trustedEmailDomainId) + trustedEmailAddressData, err := r.getTrustedEmailAddressData(trustedEmailDomainId) if err != nil { return nil, err } @@ -70,11 +70,32 @@ func (r *PingOneTrustedEmailAddressResource) ExportAll() (*[]connector.ImportBlo return &importBlocks, nil } -func getTrustedEmailAddressData(clientInfo *connector.PingOneClientInfo, resourceType, trustedEmailDomainId string) (map[string]string, error) { +func (r *PingOneTrustedEmailAddressResource) getTrustedEmailDomainData() (map[string]string, error) { + trustedEmailDomainData := make(map[string]string) + + iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + trustedEmailDomains, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomain](iter, "ReadAllTrustedEmailDomains", "GetEmailDomains", r.ResourceType()) + if err != nil { + return nil, err + } + + for _, trustedEmailDomain := range trustedEmailDomains { + trustedEmailDomainId, trustedEmailDomainIdOk := trustedEmailDomain.GetIdOk() + trustedEmailDomainName, trustedEmailDomainNameOk := trustedEmailDomain.GetDomainNameOk() + + if trustedEmailDomainIdOk && trustedEmailDomainNameOk { + trustedEmailDomainData[*trustedEmailDomainId] = *trustedEmailDomainName + } + } + + return trustedEmailDomainData, nil +} + +func (r *PingOneTrustedEmailAddressResource) getTrustedEmailAddressData(trustedEmailDomainId string) (map[string]string, error) { trustedEmailAddressData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.TrustedEmailAddressesApi.ReadAllTrustedEmailAddresses(clientInfo.Context, clientInfo.ExportEnvironmentID, trustedEmailDomainId).Execute() - trustedEmailAddresses, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomainTrustedEmail](iter, "ReadAllTrustedEmailAddresses", "GetTrustedEmails", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailAddressesApi.ReadAllTrustedEmailAddresses(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, trustedEmailDomainId).Execute() + trustedEmailAddresses, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomainTrustedEmail](iter, "ReadAllTrustedEmailAddresses", "GetTrustedEmails", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go b/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go index f22752e8..97091a7d 100644 --- a/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go +++ b/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go @@ -35,7 +35,7 @@ func (r *PingOneTrustedEmailDomainResource) ExportAll() (*[]connector.ImportBloc importBlocks := []connector.ImportBlock{} - trustedEmailDomainData, err := getTrustedEmailDomainData(r.clientInfo, r.ResourceType()) + trustedEmailDomainData, err := r.getTrustedEmailDomainData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneTrustedEmailDomainResource) ExportAll() (*[]connector.ImportBloc return &importBlocks, nil } -func getTrustedEmailDomainData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneTrustedEmailDomainResource) getTrustedEmailDomainData() (map[string]string, error) { trustedEmailDomainData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - trustedEmailDomains, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomain](iter, "ReadAllTrustedEmailDomains", "GetEmailDomains", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + trustedEmailDomains, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomain](iter, "ReadAllTrustedEmailDomains", "GetEmailDomains", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_webhook.go b/internal/connector/pingone/platform/resources/pingone_webhook.go index 9d380f1d..4293287c 100644 --- a/internal/connector/pingone/platform/resources/pingone_webhook.go +++ b/internal/connector/pingone/platform/resources/pingone_webhook.go @@ -35,7 +35,7 @@ func (r *PingOneWebhookResource) ExportAll() (*[]connector.ImportBlock, error) { importBlocks := []connector.ImportBlock{} - subscriptionData, err := getSubscriptionData(r.clientInfo, r.ResourceType()) + subscriptionData, err := r.getSubscriptionData() if err != nil { return nil, err } @@ -61,11 +61,11 @@ func (r *PingOneWebhookResource) ExportAll() (*[]connector.ImportBlock, error) { return &importBlocks, nil } -func getSubscriptionData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneWebhookResource) getSubscriptionData() (map[string]string, error) { subscriptionData := make(map[string]string) - iter := clientInfo.ApiClient.ManagementAPIClient.SubscriptionsWebhooksApi.ReadAllSubscriptions(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - subscriptions, err := common.GetManagementAPIObjectsFromIterator[management.Subscription](iter, "ReadAllSubscriptions", "GetSubscriptions", resourceType) + iter := r.clientInfo.ApiClient.ManagementAPIClient.SubscriptionsWebhooksApi.ReadAllSubscriptions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + subscriptions, err := common.GetManagementAPIObjectsFromIterator[management.Subscription](iter, "ReadAllSubscriptions", "GetSubscriptions", r.ResourceType()) if err != nil { return nil, err } From ac03fc62880bc793163d75b574fc8cd8c6ce7610 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Thu, 20 Feb 2025 12:23:47 -0700 Subject: [PATCH 13/18] move risk resource functions back into ExportableResource type --- .../pingone/protect/resources/pingone_risk_policy.go | 10 +++++----- .../protect/resources/pingone_risk_predictor.go | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/internal/connector/pingone/protect/resources/pingone_risk_policy.go b/internal/connector/pingone/protect/resources/pingone_risk_policy.go index 04f1673f..b4a3e204 100644 --- a/internal/connector/pingone/protect/resources/pingone_risk_policy.go +++ b/internal/connector/pingone/protect/resources/pingone_risk_policy.go @@ -35,12 +35,12 @@ func (r *PingOneRiskPolicyResource) ExportAll() (*[]connector.ImportBlock, error importBlocks := []connector.ImportBlock{} - ristPolicySetData, err := getRiskPolicySetData(r.clientInfo, r.ResourceType()) + riskPolicySetData, err := r.getRiskPolicySetData() if err != nil { return nil, err } - for riskPolicySetId, riskPolicySetName := range ristPolicySetData { + for riskPolicySetId, riskPolicySetName := range riskPolicySetData { commentData := map[string]string{ "Export Environment ID": r.clientInfo.ExportEnvironmentID, "Resource Type": r.ResourceType(), @@ -61,11 +61,11 @@ func (r *PingOneRiskPolicyResource) ExportAll() (*[]connector.ImportBlock, error return &importBlocks, nil } -func getRiskPolicySetData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string]string, error) { +func (r *PingOneRiskPolicyResource) getRiskPolicySetData() (map[string]string, error) { riskPolicySetData := make(map[string]string) - iter := clientInfo.ApiClient.RiskAPIClient.RiskPoliciesApi.ReadRiskPolicySets(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - riskPolicySets, err := common.GetRiskAPIObjectsFromIterator[risk.RiskPolicySet](iter, "ReadRiskPolicySets", "GetRiskPolicySets", resourceType) + iter := r.clientInfo.ApiClient.RiskAPIClient.RiskPoliciesApi.ReadRiskPolicySets(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + riskPolicySets, err := common.GetRiskAPIObjectsFromIterator[risk.RiskPolicySet](iter, "ReadRiskPolicySets", "GetRiskPolicySets", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/protect/resources/pingone_risk_predictor.go b/internal/connector/pingone/protect/resources/pingone_risk_predictor.go index 2b5de564..26adf6d3 100644 --- a/internal/connector/pingone/protect/resources/pingone_risk_predictor.go +++ b/internal/connector/pingone/protect/resources/pingone_risk_predictor.go @@ -35,7 +35,7 @@ func (r *PingOneRiskPredictorResource) ExportAll() (*[]connector.ImportBlock, er importBlocks := []connector.ImportBlock{} - riskPredictorData, err := getRiskPredictorData(r.clientInfo, r.ResourceType()) + riskPredictorData, err := r.getRiskPredictorData() if err != nil { return nil, err } @@ -65,11 +65,11 @@ func (r *PingOneRiskPredictorResource) ExportAll() (*[]connector.ImportBlock, er return &importBlocks, nil } -func getRiskPredictorData(clientInfo *connector.PingOneClientInfo, resourceType string) (map[string][]string, error) { +func (r *PingOneRiskPredictorResource) getRiskPredictorData() (map[string][]string, error) { riskPredictorData := make(map[string][]string) - iter := clientInfo.ApiClient.RiskAPIClient.RiskAdvancedPredictorsApi.ReadAllRiskPredictors(clientInfo.Context, clientInfo.ExportEnvironmentID).Execute() - riskPredictors, err := common.GetRiskAPIObjectsFromIterator[risk.RiskPredictor](iter, "ReadAllRiskPredictors", "GetRiskPredictors", resourceType) + iter := r.clientInfo.ApiClient.RiskAPIClient.RiskAdvancedPredictorsApi.ReadAllRiskPredictors(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() + riskPredictors, err := common.GetRiskAPIObjectsFromIterator[risk.RiskPredictor](iter, "ReadAllRiskPredictors", "GetRiskPredictors", r.ResourceType()) if err != nil { return nil, err } From 67d3c988db377a5f7993bb5e4165f6217a762903 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Thu, 20 Feb 2025 13:04:32 -0700 Subject: [PATCH 14/18] Add check to PF version api endpoint to verify valid PF client configuration --- .golangci.yml | 3 +-- cmd/platform/export_test.go | 10 +++++----- internal/commands/platform/export_internal.go | 15 +++++++++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 0c5d8f8c..f41f34c1 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,9 +1,8 @@ # Options for analysis running. run: - print-resources-usage: true timeout: 30m # Use all default linters + those defined here linters: enable: - - gosec \ No newline at end of file + - gosec diff --git a/cmd/platform/export_test.go b/cmd/platform/export_test.go index 45e60dfd..523d9b88 100644 --- a/cmd/platform/export_test.go +++ b/cmd/platform/export_test.go @@ -201,7 +201,7 @@ func TestPlatformExportCmd_PingFederateBasicAuthFlagsRequiredTogether(t *testing func TestPlatformExportCmd_PingOneClientCredentialFlagsInvalid(t *testing.T) { outputDir := t.TempDir() - expectedErrorPattern := `^test$` + expectedErrorPattern := `^failed to initialize pingone API client\. Check worker client ID, worker client secret, worker environment ID, and pingone region code configuration values\. oauth2: \"invalid_client\" \"Request denied: Unsupported authentication method \(Correlation ID: .*\)\"$` err := testutils_cobra.ExecutePingcli(t, "platform", "export", "--output-directory", outputDir, "--overwrite", @@ -218,7 +218,7 @@ func TestPlatformExportCmd_PingOneClientCredentialFlagsInvalid(t *testing.T) { func TestPlatformExportCmd_PingFederateBasicAuthFlagsInvalid(t *testing.T) { outputDir := t.TempDir() - expectedErrorPattern := `^failed to export 'pingfederate' service: failed to export resource .*\. err: .* Request for resource '.*' was not successful\.\s+Response Code: 401 Unauthorized\s+Response Body: {{"resultId":"invalid_credentials","message":"The credentials you provided were not recognized\."}}\s+Error: 401 Unauthorized$` + expectedErrorPattern := `^failed to initialize PingFederate Go Client. Check authentication type and credentials$` err := testutils_cobra.ExecutePingcli(t, "platform", "export", "--output-directory", outputDir, "--overwrite", @@ -259,7 +259,7 @@ func TestPlatformExportCmd_PingFederateClientCredentialsAuthFlagsRequiredTogethe func TestPlatformExportCmd_PingFederateClientCredentialsAuthFlagsInvalid(t *testing.T) { outputDir := t.TempDir() - expectedErrorPattern := `^failed to export 'pingfederate' service: failed to export resource .*\. err: .* Request for resource '.*' was not successful\. Response is nil\. Error: oauth2: "invalid_client" "Invalid client or client credentials\."$` + expectedErrorPattern := `^failed to initialize PingFederate Go Client. Check authentication type and credentials$` err := testutils_cobra.ExecutePingcli(t, "platform", "export", "--output-directory", outputDir, "--overwrite", @@ -276,7 +276,7 @@ func TestPlatformExportCmd_PingFederateClientCredentialsAuthFlagsInvalid(t *test func TestPlatformExportCmd_PingFederateClientCredentialsAuthFlagsInvalidTokenURL(t *testing.T) { outputDir := t.TempDir() - expectedErrorPattern := `(?s)^failed to export 'pingfederate' service: failed to export resource.*\. err:.*Request for resource '.*' was not successful\. Response is nil\. Error: oauth2: cannot fetch token: 404 Not Found\s+Response: \\s+.*$` + expectedErrorPattern := `^failed to initialize PingFederate Go Client. Check authentication type and credentials$` err := testutils_cobra.ExecutePingcli(t, "platform", "export", "--output-directory", outputDir, "--overwrite", @@ -325,7 +325,7 @@ func TestPlatformExportCmd_PingFederateTrustAllTLSFlag(t *testing.T) { func TestPlatformExportCmd_PingFederateTrustAllTLSFlagFalse(t *testing.T) { outputDir := t.TempDir() - expectedErrorPattern := `^failed to export '.*' service: failed to export resource .*\. err: .* Request for resource '.*' was not successful\. Response is nil\. Error: Get "https.*": tls: failed to verify certificate: x509: certificate signed by unknown authority$` + expectedErrorPattern := `^failed to initialize PingFederate Go Client. Check authentication type and credentials$` err := testutils_cobra.ExecutePingcli(t, "platform", "export", "--output-directory", outputDir, "--overwrite", diff --git a/internal/commands/platform/export_internal.go b/internal/commands/platform/export_internal.go index 9df593cf..d1d692c3 100644 --- a/internal/commands/platform/export_internal.go +++ b/internal/commands/platform/export_internal.go @@ -212,6 +212,13 @@ func initPingFederateServices(ctx context.Context, pingcliVersion string) (err e return fmt.Errorf("failed to initialize PingFederate services. unrecognized authentication type '%s'", authType) } + // Test PF API client with create Context Auth + _, response, err := pingfederateApiClient.VersionAPI.GetVersion(pingfederateContext).Execute() + ok, err := common.HandleClientResponse(response, err, "GetVersion", "pingfederate_client_init") + if err != nil || !ok { + return fmt.Errorf("failed to initialize PingFederate Go Client. Check authentication type and credentials") + } + return nil } @@ -347,8 +354,8 @@ func createOrValidateOutputDir(outputDir string, overwriteExport bool) (resolved // Check if outputDir is empty if outputDir == "" { - return "", fmt.Errorf("Failed to export services. The output directory is not set. Specify the output directory "+ - "via the '--%s' flag, '%s' environment variable, or key '%s' in the configuration file.", + return "", fmt.Errorf("failed to export services. The output directory is not set. Specify the output directory "+ + "via the '--%s' flag, '%s' environment variable, or key '%s' in the configuration file", options.PlatformExportOutputDirectoryOption.CobraParamName, options.PlatformExportOutputDirectoryOption.EnvVar, options.PlatformExportOutputDirectoryOption.ViperKey) @@ -408,7 +415,7 @@ func getPingOneExportEnvID() (err error) { return err } if pingoneExportEnvID == "" { - return fmt.Errorf("failed to determine pingone export environment ID.") + return fmt.Errorf("failed to determine pingone export environment ID") } output.Warn("No target PingOne export environment ID specified. Defaulting export environment ID to the Worker App environment ID.", nil) @@ -435,7 +442,7 @@ func validatePingOneExportEnvID(ctx context.Context) (err error) { return err } if !ok { - return fmt.Errorf("failed to validate pingone environment ID '%s'.", pingoneExportEnvID) + return fmt.Errorf("failed to validate pingone environment ID '%s'", pingoneExportEnvID) } if environment == nil { From 1c140d602e45f4c1d1bf726c93cc12cd153c19fa Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Fri, 21 Feb 2025 14:07:33 -0700 Subject: [PATCH 15/18] PR review changes --- Makefile | 2 +- internal/connector/common/resources_common.go | 153 ----------------- internal/connector/pingone/common.go | 162 ++++++++++++++++++ 3 files changed, 163 insertions(+), 154 deletions(-) create mode 100644 internal/connector/pingone/common.go diff --git a/Makefile b/Makefile index 3d3e4fc1..126f6e67 100644 --- a/Makefile +++ b/Makefile @@ -34,7 +34,7 @@ starttestcontainer: --env-file "${HOME}/.pingidentity/config" \ -v $$(pwd)/server-profiles/shared-profile:/opt/in \ -v $$(pwd)/server-profiles/12.2/data.json:/opt/in/instance/bulk-config/data.json \ - pingidentity/pingfederate:latest + pingidentity/pingfederate:12.2.0-latest # Wait for the instance to become ready sleep 1 duration=0 diff --git a/internal/connector/common/resources_common.go b/internal/connector/common/resources_common.go index 0d77cee1..bc7938a9 100644 --- a/internal/connector/common/resources_common.go +++ b/internal/connector/common/resources_common.go @@ -4,12 +4,8 @@ import ( "fmt" "maps" "net/http" - "reflect" "slices" - "github.com/patrickcping/pingone-go-sdk-v2/management" - "github.com/patrickcping/pingone-go-sdk-v2/mfa" - "github.com/patrickcping/pingone-go-sdk-v2/risk" "github.com/pingidentity/pingcli/internal/output" ) @@ -73,152 +69,3 @@ func GenerateCommentInformation(data map[string]string) string { return commentInformation } - -func CheckSingletonResource(response *http.Response, err error, apiFuncName, resourceType string) (bool, error) { - ok, err := HandleClientResponse(response, err, "ReadBrandingSettings", resourceType) - if err != nil { - return false, err - } - if !ok { - return false, nil - } - - if response.StatusCode == 204 { - output.Warn("API client 204 No Content response.", map[string]interface{}{ - "api_function": apiFuncName, - "resource": resourceType, - }) - return false, nil - } - - return true, nil -} - -func GetManagementAPIObjectsFromIterator[T any](iter management.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { - apiObjects := []T{} - - for cursor, err := range iter { - ok, err := HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) - if err != nil { - return nil, err - } - // A warning was given when handling the client response. Return nil apiObjects to skip export of resource - if !ok { - return nil, nil - } - - nilErr := DataNilError(resourceType, cursor.HTTPResponse) - - if cursor.EntityArray == nil { - return nil, nilErr - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, nilErr - } - - apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) - if err != nil { - output.SystemError(err.Error(), nil) - } - - apiObjects = append(apiObjects, apiObject...) - } - - return apiObjects, nil -} - -func GetMfaAPIObjectsFromIterator[T any](iter mfa.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { - apiObjects := []T{} - - for cursor, err := range iter { - ok, err := HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) - if err != nil { - return nil, err - } - // A warning was given when handling the client response. Return nil apiObjects to skip export of resource - if !ok { - return nil, nil - } - - nilErr := DataNilError(resourceType, cursor.HTTPResponse) - - if cursor.EntityArray == nil { - return nil, nilErr - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, nilErr - } - - apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) - if err != nil { - output.SystemError(err.Error(), nil) - } - - apiObjects = append(apiObjects, apiObject...) - } - - return apiObjects, nil -} - -func GetRiskAPIObjectsFromIterator[T any](iter risk.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { - apiObjects := []T{} - - for cursor, err := range iter { - ok, err := HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) - if err != nil { - return nil, err - } - // A warning was given when handling the client response. Return nil apiObjects to skip export of resource - if !ok { - return nil, nil - } - - nilErr := DataNilError(resourceType, cursor.HTTPResponse) - - if cursor.EntityArray == nil { - return nil, nilErr - } - - embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() - if !embeddedOk { - return nil, nilErr - } - - apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) - if err != nil { - output.SystemError(err.Error(), nil) - } - - apiObjects = append(apiObjects, apiObject...) - } - - return apiObjects, nil -} - -func getAPIObjectFromEmbedded[T any](embedded reflect.Value, extractionFuncName, resourceType string) ([]T, error) { - embeddedExtractionFunc := embedded.MethodByName(extractionFuncName) - if !embeddedExtractionFunc.IsValid() { - return nil, fmt.Errorf("failed to find extraction function '%s' for resource '%s'", extractionFuncName, resourceType) - } - - reflectValues := embeddedExtractionFunc.Call(nil) - if len(reflectValues) == 0 { - return nil, fmt.Errorf("failed to get reflect value from embedded. embedded is empty") - } - - rInterface := reflectValues[0].Interface() - if rInterface == nil { - return []T{}, nil - } - - apiObject, apiObjectOk := rInterface.([]T) - if !apiObjectOk { - return nil, fmt.Errorf("failed to cast reflect value to %s", resourceType) - } - - return apiObject, nil -} diff --git a/internal/connector/pingone/common.go b/internal/connector/pingone/common.go new file mode 100644 index 00000000..548b04e2 --- /dev/null +++ b/internal/connector/pingone/common.go @@ -0,0 +1,162 @@ +package pingone + +import ( + "fmt" + "net/http" + "reflect" + + "github.com/patrickcping/pingone-go-sdk-v2/management" + "github.com/patrickcping/pingone-go-sdk-v2/mfa" + "github.com/patrickcping/pingone-go-sdk-v2/risk" + "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/output" +) + +func CheckSingletonResource(response *http.Response, err error, apiFuncName, resourceType string) (bool, error) { + ok, err := common.HandleClientResponse(response, err, apiFuncName, resourceType) + if err != nil { + return false, err + } + if !ok { + return false, nil + } + + if response.StatusCode == 204 { + output.Warn("API client 204 No Content response.", map[string]interface{}{ + "api_function": apiFuncName, + "resource": resourceType, + }) + return false, nil + } + + return true, nil +} + +func GetManagementAPIObjectsFromIterator[T any](iter management.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { + apiObjects := []T{} + + for cursor, err := range iter { + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) + if err != nil { + return nil, err + } + // A warning was given when handling the client response. Return nil apiObjects to skip export of resource + if !ok { + return nil, nil + } + + nilErr := common.DataNilError(resourceType, cursor.HTTPResponse) + + if cursor.EntityArray == nil { + return nil, nilErr + } + + embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() + if !embeddedOk { + return nil, nilErr + } + + apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) + if err != nil { + output.SystemError(err.Error(), nil) + } + + apiObjects = append(apiObjects, apiObject...) + } + + return apiObjects, nil +} + +func GetMfaAPIObjectsFromIterator[T any](iter mfa.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { + apiObjects := []T{} + + for cursor, err := range iter { + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) + if err != nil { + return nil, err + } + // A warning was given when handling the client response. Return nil apiObjects to skip export of resource + if !ok { + return nil, nil + } + + nilErr := common.DataNilError(resourceType, cursor.HTTPResponse) + + if cursor.EntityArray == nil { + return nil, nilErr + } + + embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() + if !embeddedOk { + return nil, nilErr + } + + apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) + if err != nil { + output.SystemError(err.Error(), nil) + } + + apiObjects = append(apiObjects, apiObject...) + } + + return apiObjects, nil +} + +func GetRiskAPIObjectsFromIterator[T any](iter risk.EntityArrayPagedIterator, clientFuncName, extractionFuncName, resourceType string) ([]T, error) { + apiObjects := []T{} + + for cursor, err := range iter { + ok, err := common.HandleClientResponse(cursor.HTTPResponse, err, clientFuncName, resourceType) + if err != nil { + return nil, err + } + // A warning was given when handling the client response. Return nil apiObjects to skip export of resource + if !ok { + return nil, nil + } + + nilErr := common.DataNilError(resourceType, cursor.HTTPResponse) + + if cursor.EntityArray == nil { + return nil, nilErr + } + + embedded, embeddedOk := cursor.EntityArray.GetEmbeddedOk() + if !embeddedOk { + return nil, nilErr + } + + apiObject, err := getAPIObjectFromEmbedded[T](reflect.ValueOf(embedded), extractionFuncName, resourceType) + if err != nil { + output.SystemError(err.Error(), nil) + } + + apiObjects = append(apiObjects, apiObject...) + } + + return apiObjects, nil +} + +func getAPIObjectFromEmbedded[T any](embedded reflect.Value, extractionFuncName, resourceType string) ([]T, error) { + embeddedExtractionFunc := embedded.MethodByName(extractionFuncName) + if !embeddedExtractionFunc.IsValid() { + return nil, fmt.Errorf("failed to find extraction function '%s' for resource '%s'", extractionFuncName, resourceType) + } + + reflectValues := embeddedExtractionFunc.Call(nil) + if len(reflectValues) == 0 { + return nil, fmt.Errorf("failed to get reflect value from embedded. embedded is empty") + } + + rInterface := reflectValues[0].Interface() + if rInterface == nil { + return []T{}, nil + } + + apiObject, apiObjectOk := rInterface.([]T) + if !apiObjectOk { + return nil, fmt.Errorf("failed to cast reflect value to %s", resourceType) + } + + return apiObject, nil +} From 0185ae815e2ff79639bab9db86d48444be5c7aa2 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Fri, 21 Feb 2025 14:16:26 -0700 Subject: [PATCH 16/18] Use pingone package for API object extraction --- .../resources/pingone_mfa_application_push_credential.go | 5 +++-- .../pingone/mfa/resources/pingone_mfa_device_policy.go | 3 ++- .../pingone/mfa/resources/pingone_mfa_fido2_policy.go | 3 ++- .../pingone/mfa/resources/pingone_mfa_settings.go | 3 ++- .../pingone/platform/resources/pingone_agreement.go | 3 ++- .../platform/resources/pingone_agreement_localization.go | 5 +++-- .../resources/pingone_agreement_localization_revision.go | 7 ++++--- .../platform/resources/pingone_branding_settings.go | 3 ++- .../pingone/platform/resources/pingone_branding_theme.go | 3 ++- .../platform/resources/pingone_branding_theme_default.go | 3 ++- .../pingone/platform/resources/pingone_custom_domain.go | 3 ++- .../pingone/platform/resources/pingone_environment.go | 3 ++- .../connector/pingone/platform/resources/pingone_form.go | 3 ++- .../platform/resources/pingone_forms_recaptcha_v2.go | 3 ++- .../pingone/platform/resources/pingone_gateway.go | 3 ++- .../platform/resources/pingone_gateway_credential.go | 5 +++-- .../platform/resources/pingone_gateway_role_assignment.go | 7 ++++--- .../resources/pingone_identity_propagation_plan.go | 3 ++- .../platform/resources/pingone_key_rotation_policy.go | 3 ++- .../pingone/platform/resources/pingone_language.go | 3 ++- .../pingone/platform/resources/pingone_language_update.go | 3 ++- .../platform/resources/pingone_notification_policy.go | 3 ++- .../platform/resources/pingone_notification_settings.go | 3 ++- .../resources/pingone_notification_settings_email.go | 3 ++- .../resources/pingone_notification_template_content.go | 5 +++-- .../platform/resources/pingone_phone_delivery_settings.go | 3 ++- .../platform/resources/pingone_system_application.go | 3 ++- .../platform/resources/pingone_trusted_email_address.go | 5 +++-- .../platform/resources/pingone_trusted_email_domain.go | 3 ++- .../pingone/platform/resources/pingone_webhook.go | 3 ++- .../pingone/protect/resources/pingone_risk_policy.go | 3 ++- .../pingone/protect/resources/pingone_risk_predictor.go | 3 ++- .../connector/pingone/sso/resources/pingone_application.go | 3 ++- .../sso/resources/pingone_application_attribute_mapping.go | 5 +++-- .../pingone_application_flow_policy_assignment.go | 7 ++++--- .../sso/resources/pingone_application_resource_grant.go | 7 ++++--- .../sso/resources/pingone_application_role_assignment.go | 7 ++++--- .../pingone/sso/resources/pingone_application_secret.go | 5 +++-- .../pingone_application_sign_on_policy_assignment.go | 7 ++++--- internal/connector/pingone/sso/resources/pingone_group.go | 3 ++- .../pingone/sso/resources/pingone_group_nesting.go | 5 +++-- .../pingone/sso/resources/pingone_group_role_assignment.go | 5 +++-- .../pingone/sso/resources/pingone_identity_provider.go | 3 ++- .../sso/resources/pingone_identity_provider_attribute.go | 5 +++-- .../pingone/sso/resources/pingone_password_policy.go | 3 ++- .../connector/pingone/sso/resources/pingone_population.go | 3 ++- .../pingone/sso/resources/pingone_population_default.go | 5 +++-- .../connector/pingone/sso/resources/pingone_resource.go | 3 ++- .../pingone/sso/resources/pingone_resource_attribute.go | 5 +++-- .../pingone/sso/resources/pingone_resource_scope.go | 5 +++-- .../pingone/sso/resources/pingone_resource_scope_openid.go | 5 +++-- .../sso/resources/pingone_resource_scope_pingone_api.go | 5 +++-- .../pingone/sso/resources/pingone_schema_attribute.go | 5 +++-- .../pingone/sso/resources/pingone_sign_on_policy.go | 3 ++- .../pingone/sso/resources/pingone_sign_on_policy_action.go | 5 +++-- 55 files changed, 139 insertions(+), 84 deletions(-) diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go b/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go index 20d951d3..bcd10ebc 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_application_push_credential.go @@ -7,6 +7,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/mfa" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -75,7 +76,7 @@ func (r *PingOneMFAApplicationPushCredentialResource) getOIDCApplicationData() ( applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } @@ -102,7 +103,7 @@ func (r *PingOneMFAApplicationPushCredentialResource) getPushCredentialData(appl mfaPushCredentialData := make(map[string]string) iter := r.clientInfo.ApiClient.MFAAPIClient.ApplicationsApplicationMFAPushCredentialsApi.ReadAllMFAPushCredentials(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, applicationId).Execute() - mfaPushCredentials, err := common.GetMfaAPIObjectsFromIterator[mfa.MFAPushCredentialResponse](iter, "ReadAllMFAPushCredentials", "GetPushCredentials", r.ResourceType()) + mfaPushCredentials, err := pingone.GetMfaAPIObjectsFromIterator[mfa.MFAPushCredentialResponse](iter, "ReadAllMFAPushCredentials", "GetPushCredentials", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go b/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go index 10a02c79..85a9fe7d 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_device_policy.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/mfa" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneMFADevicePolicyResource) getDeviceAuthPolicyData() (map[string]s deviceAuthPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.MFAAPIClient.DeviceAuthenticationPolicyApi.ReadDeviceAuthenticationPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - deviceAuthPolicies, err := common.GetMfaAPIObjectsFromIterator[mfa.DeviceAuthenticationPolicy](iter, "ReadDeviceAuthenticationPolicies", "GetDeviceAuthenticationPolicies", r.ResourceType()) + deviceAuthPolicies, err := pingone.GetMfaAPIObjectsFromIterator[mfa.DeviceAuthenticationPolicy](iter, "ReadDeviceAuthenticationPolicies", "GetDeviceAuthenticationPolicies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go b/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go index 4e9f5c6b..23148310 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_fido2_policy.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/mfa" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneMFAFido2PolicyResource) getFido2PolicyData() (map[string]string, fido2PolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.MFAAPIClient.FIDO2PolicyApi.ReadFIDO2Policies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - fido2Policies, err := common.GetMfaAPIObjectsFromIterator[mfa.FIDO2Policy](iter, "ReadFIDO2Policies", "GetFido2Policies", r.ResourceType()) + fido2Policies, err := pingone.GetMfaAPIObjectsFromIterator[mfa.FIDO2Policy](iter, "ReadFIDO2Policies", "GetFido2Policies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go b/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go index ccb7be74..a1c654ca 100644 --- a/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go +++ b/internal/connector/pingone/mfa/resources/pingone_mfa_settings.go @@ -3,6 +3,7 @@ package resources import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -59,5 +60,5 @@ func (r *PingOneMFASettingsResource) ExportAll() (*[]connector.ImportBlock, erro func (r *PingOneMFASettingsResource) checkMFASettingsData() (bool, error) { _, response, err := r.clientInfo.ApiClient.MFAAPIClient.MFASettingsApi.ReadMFASettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadMFASettings", r.ResourceType()) + return pingone.CheckSingletonResource(response, err, "ReadMFASettings", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_agreement.go b/internal/connector/pingone/platform/resources/pingone_agreement.go index 9fd4ca54..7f021327 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneAgreementResource) getAgreementData() (map[string]string, error) agreementData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - agreements, err := common.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) + agreements, err := pingone.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_agreement_localization.go b/internal/connector/pingone/platform/resources/pingone_agreement_localization.go index 1b71b67a..e3f8efdf 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement_localization.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement_localization.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneAgreementLocalizationResource) getAgreementData() (map[string]st agreementData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - agreements, err := common.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) + agreements, err := pingone.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) if err != nil { return nil, err } @@ -95,7 +96,7 @@ func (r *PingOneAgreementLocalizationResource) getAgreementLocalizationData(agre agreementLocalizationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId).Execute() - languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadAllAgreementLanguages", "GetLanguages", r.ResourceType()) + languageInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadAllAgreementLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go b/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go index b0c07521..1bcb9ab7 100644 --- a/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go +++ b/internal/connector/pingone/platform/resources/pingone_agreement_localization_revision.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -82,7 +83,7 @@ func (r *PingOneAgreementLocalizationRevisionResource) getAgreementData() (map[s agreementData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementsResourcesApi.ReadAllAgreements(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - agreements, err := common.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) + agreements, err := pingone.GetManagementAPIObjectsFromIterator[management.Agreement](iter, "ReadAllAgreements", "GetAgreements", r.ResourceType()) if err != nil { return nil, err } @@ -103,7 +104,7 @@ func (r *PingOneAgreementLocalizationRevisionResource) getAgreementLanguageData( agreementLanguageData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementLanguagesResourcesApi.ReadAllAgreementLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId).Execute() - languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadAllAgreementLanguages", "GetLanguages", r.ResourceType()) + languageInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadAllAgreementLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } @@ -126,7 +127,7 @@ func (r *PingOneAgreementLocalizationRevisionResource) getAgreementLocalizationR agreementLocalizationRevisionData := []string{} iter := r.clientInfo.ApiClient.ManagementAPIClient.AgreementRevisionsResourcesApi.ReadAllAgreementLanguageRevisions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, agreementId, agreementLocalizationId).Execute() - agreementLocalizationRevisions, err := common.GetManagementAPIObjectsFromIterator[management.AgreementLanguageRevision](iter, "ReadAllAgreementLanguageRevisions", "GetRevisions", r.ResourceType()) + agreementLocalizationRevisions, err := pingone.GetManagementAPIObjectsFromIterator[management.AgreementLanguageRevision](iter, "ReadAllAgreementLanguageRevisions", "GetRevisions", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_settings.go b/internal/connector/pingone/platform/resources/pingone_branding_settings.go index 78eaf8b3..a66264ec 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_settings.go @@ -3,6 +3,7 @@ package resources import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -59,5 +60,5 @@ func (r *PingOneBrandingSettingsResource) ExportAll() (*[]connector.ImportBlock, func (r *PingOneBrandingSettingsResource) checkBrandingSettingsData() (bool, error) { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.BrandingSettingsApi.ReadBrandingSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadBrandingSettings", r.ResourceType()) + return pingone.CheckSingletonResource(response, err, "ReadBrandingSettings", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme.go b/internal/connector/pingone/platform/resources/pingone_branding_theme.go index 7b209275..1bab57a9 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneBrandingThemeResource) getBrandingThemeData() (map[string]string brandingThemeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - brandingThemes, err := common.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", r.ResourceType()) + brandingThemes, err := pingone.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go index 4fbf1a14..dae07a20 100644 --- a/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go +++ b/internal/connector/pingone/platform/resources/pingone_branding_theme_default.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -63,7 +64,7 @@ func (r *PingOneBrandingThemeDefaultResource) ExportAll() (*[]connector.ImportBl func (r *PingOneBrandingThemeDefaultResource) getDefaultBrandingThemeName() (*string, error) { iter := r.clientInfo.ApiClient.ManagementAPIClient.BrandingThemesApi.ReadBrandingThemes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - brandingThemes, err := common.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", r.ResourceType()) + brandingThemes, err := pingone.GetManagementAPIObjectsFromIterator[management.BrandingTheme](iter, "ReadBrandingThemes", "GetThemes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_custom_domain.go b/internal/connector/pingone/platform/resources/pingone_custom_domain.go index 5a93d7a0..d7d77c11 100644 --- a/internal/connector/pingone/platform/resources/pingone_custom_domain.go +++ b/internal/connector/pingone/platform/resources/pingone_custom_domain.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneCustomDomainResource) getCustomDomainData() (map[string]string, domainData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.CustomDomainsApi.ReadAllDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - customDomains, err := common.GetManagementAPIObjectsFromIterator[management.CustomDomain](iter, "ReadAllDomains", "GetCustomDomains", r.ResourceType()) + customDomains, err := pingone.GetManagementAPIObjectsFromIterator[management.CustomDomain](iter, "ReadAllDomains", "GetCustomDomains", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_environment.go b/internal/connector/pingone/platform/resources/pingone_environment.go index 6d2f3460..eb599ede 100644 --- a/internal/connector/pingone/platform/resources/pingone_environment.go +++ b/internal/connector/pingone/platform/resources/pingone_environment.go @@ -3,6 +3,7 @@ package resources import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -59,5 +60,5 @@ func (r *PingOneEnvironmentResource) ExportAll() (*[]connector.ImportBlock, erro func (r *PingOneEnvironmentResource) checkEnvironmentData() (bool, error) { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.EnvironmentsApi.ReadOneEnvironment(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadOneEnvironment", r.ResourceType()) + return pingone.CheckSingletonResource(response, err, "ReadOneEnvironment", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_form.go b/internal/connector/pingone/platform/resources/pingone_form.go index 4415b372..cf6b0546 100644 --- a/internal/connector/pingone/platform/resources/pingone_form.go +++ b/internal/connector/pingone/platform/resources/pingone_form.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneFormResource) getFormData() (map[string]string, error) { formData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.FormManagementApi.ReadAllForms(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - forms, err := common.GetManagementAPIObjectsFromIterator[management.Form](iter, "ReadAllForms", "GetForms", r.ResourceType()) + forms, err := pingone.GetManagementAPIObjectsFromIterator[management.Form](iter, "ReadAllForms", "GetForms", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go b/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go index 506efc2d..0e811c94 100644 --- a/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go +++ b/internal/connector/pingone/platform/resources/pingone_forms_recaptcha_v2.go @@ -3,6 +3,7 @@ package resources import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -59,5 +60,5 @@ func (r *PingOneFormRecaptchaV2Resource) ExportAll() (*[]connector.ImportBlock, func (r *PingOneFormRecaptchaV2Resource) checkFormRecaptchaV2Data() (bool, error) { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.RecaptchaConfigurationApi.ReadRecaptchaConfiguration(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadRecaptchaConfiguration", r.ResourceType()) + return pingone.CheckSingletonResource(response, err, "ReadRecaptchaConfiguration", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway.go b/internal/connector/pingone/platform/resources/pingone_gateway.go index caa4e07f..1fdb0d2f 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneGatewayResource) getGatewayData() (map[string]string, error) { gatewayData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - gateways, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) + gateways, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go index 5dc4c4f6..ef4d93a7 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_credential.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_credential.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -73,7 +74,7 @@ func (r *PingOneGatewayCredentialResource) getGatewayData() (map[string]string, gatewayData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - gatewayInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) + gatewayInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) if err != nil { return nil, err } @@ -112,7 +113,7 @@ func (r *PingOneGatewayCredentialResource) getGatewayCredentialData(gatewayId st gatewayCredentialData := []string{} iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewayCredentialsApi.ReadAllGatewayCredentials(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, gatewayId).Execute() - gatewayCredentials, err := common.GetManagementAPIObjectsFromIterator[management.GatewayCredential](iter, "ReadAllGatewayCredentials", "GetCredentials", r.ResourceType()) + gatewayCredentials, err := pingone.GetManagementAPIObjectsFromIterator[management.GatewayCredential](iter, "ReadAllGatewayCredentials", "GetCredentials", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go index 534b3f9d..e01a4170 100644 --- a/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go +++ b/internal/connector/pingone/platform/resources/pingone_gateway_role_assignment.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -82,7 +83,7 @@ func (r *PingOneGatewayRoleAssignmentResource) getGatewayData() (map[string]stri gatewayData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewaysApi.ReadAllGateways(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - gatewayInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) + gatewayInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedGatewaysInner](iter, "ReadAllGateways", "GetGateways", r.ResourceType()) if err != nil { return nil, err } @@ -110,7 +111,7 @@ func (r *PingOneGatewayRoleAssignmentResource) getGatewayRoleAssignmentData(gate gatewayRoleAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GatewayRoleAssignmentsApi.ReadGatewayRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, gatewayId).Execute() - gatewayRoleAssignments, err := common.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadGatewayRoleAssignments", "GetRoleAssignments", r.ResourceType()) + gatewayRoleAssignments, err := pingone.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadGatewayRoleAssignments", "GetRoleAssignments", r.ResourceType()) if err != nil { return nil, err } @@ -132,7 +133,7 @@ func (r *PingOneGatewayRoleAssignmentResource) getGatewayRoleAssignmentData(gate func (r *PingOneGatewayRoleAssignmentResource) getRoleAssignmentRoleName(roleId string) (*management.EnumRoleName, error) { role, resp, err := r.clientInfo.ApiClient.ManagementAPIClient.RolesApi.ReadOneRole(r.clientInfo.Context, roleId).Execute() - ok, err := common.CheckSingletonResource(resp, err, "ReadOneRole", r.ResourceType()) + ok, err := pingone.CheckSingletonResource(resp, err, "ReadOneRole", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go b/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go index 4e5a65e4..f69c73ba 100644 --- a/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go +++ b/internal/connector/pingone/platform/resources/pingone_identity_propagation_plan.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneIdentityPropagationPlanResource) getIdentityPropagationPlanData( identityPropagationPlanData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityPropagationPlansApi.ReadAllPlans(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - identityPropagationPlans, err := common.GetManagementAPIObjectsFromIterator[management.IdentityPropagationPlan](iter, "ReadAllPlans", "GetPlans", r.ResourceType()) + identityPropagationPlans, err := pingone.GetManagementAPIObjectsFromIterator[management.IdentityPropagationPlan](iter, "ReadAllPlans", "GetPlans", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go b/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go index 1b979892..97328065 100644 --- a/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go +++ b/internal/connector/pingone/platform/resources/pingone_key_rotation_policy.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneKeyRotationPolicyResource) getKeyRotationPolicyData() (map[strin keyRotationPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.KeyRotationPoliciesApi.GetKeyRotationPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - keyRotationPolicies, err := common.GetManagementAPIObjectsFromIterator[management.KeyRotationPolicy](iter, "GetKeyRotationPolicies", "GetKeyRotationPolicies", r.ResourceType()) + keyRotationPolicies, err := pingone.GetManagementAPIObjectsFromIterator[management.KeyRotationPolicy](iter, "GetKeyRotationPolicies", "GetKeyRotationPolicies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_language.go b/internal/connector/pingone/platform/resources/pingone_language.go index a33423a1..953c6094 100644 --- a/internal/connector/pingone/platform/resources/pingone_language.go +++ b/internal/connector/pingone/platform/resources/pingone_language.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneLanguageResource) getLanguageData() (map[string]string, error) { languageData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) + languageInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_language_update.go b/internal/connector/pingone/platform/resources/pingone_language_update.go index 80d8577f..e3673928 100644 --- a/internal/connector/pingone/platform/resources/pingone_language_update.go +++ b/internal/connector/pingone/platform/resources/pingone_language_update.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneLanguageUpdateResource) getLanguageUpdateData() (map[string]stri languageUpdateData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) + languageInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_policy.go b/internal/connector/pingone/platform/resources/pingone_notification_policy.go index 7d1a0bd0..976e7819 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_policy.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_policy.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneNotificationPolicyResource) getNotificationPolicyData() (map[str notificationPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsPoliciesApi.ReadAllNotificationsPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - notificationPolicies, err := common.GetManagementAPIObjectsFromIterator[management.NotificationsPolicy](iter, "ReadAllNotificationsPolicies", "GetNotificationsPolicies", r.ResourceType()) + notificationPolicies, err := pingone.GetManagementAPIObjectsFromIterator[management.NotificationsPolicy](iter, "ReadAllNotificationsPolicies", "GetNotificationsPolicies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_settings.go b/internal/connector/pingone/platform/resources/pingone_notification_settings.go index fca24054..fd63d9b6 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_settings.go @@ -3,6 +3,7 @@ package resources import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -59,5 +60,5 @@ func (r *PingOneNotificationSettingsResource) ExportAll() (*[]connector.ImportBl func (r *PingOneNotificationSettingsResource) checkNotificationSettingsData() (bool, error) { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsApi.ReadNotificationsSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadNotificationsSettings", r.ResourceType()) + return pingone.CheckSingletonResource(response, err, "ReadNotificationsSettings", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go b/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go index 0220c40b..b630c860 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_settings_email.go @@ -3,6 +3,7 @@ package resources import ( "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -59,5 +60,5 @@ func (r *PingOneNotificationSettingsEmailResource) ExportAll() (*[]connector.Imp func (r *PingOneNotificationSettingsEmailResource) checkNotificationSettingsEmailData() (bool, error) { _, response, err := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsSettingsSMTPApi.ReadEmailNotificationsSettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - return common.CheckSingletonResource(response, err, "ReadEmailNotificationsSettings", r.ResourceType()) + return pingone.CheckSingletonResource(response, err, "ReadEmailNotificationsSettings", r.ResourceType()) } diff --git a/internal/connector/pingone/platform/resources/pingone_notification_template_content.go b/internal/connector/pingone/platform/resources/pingone_notification_template_content.go index 235f40e5..954debb8 100644 --- a/internal/connector/pingone/platform/resources/pingone_notification_template_content.go +++ b/internal/connector/pingone/platform/resources/pingone_notification_template_content.go @@ -8,6 +8,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" "github.com/pingidentity/pingcli/internal/output" ) @@ -102,7 +103,7 @@ func (r *PingOneNotificationTemplateContentResource) getEnabledLocales() (map[st enabledLocales := make(map[string]bool) iter := r.clientInfo.ApiClient.ManagementAPIClient.LanguagesApi.ReadLanguages(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - languageInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) + languageInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedLanguagesInner](iter, "ReadLanguages", "GetLanguages", r.ResourceType()) if err != nil { return nil, err } @@ -160,7 +161,7 @@ func (r *PingOneNotificationTemplateContentResource) getTemplateContentData(temp templateContentData := []NotificationTemplateContentData{} iter := r.clientInfo.ApiClient.ManagementAPIClient.NotificationsTemplatesApi.ReadAllTemplateContents(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, templateName).Execute() - templateContents, err := common.GetManagementAPIObjectsFromIterator[management.TemplateContent](iter, "ReadAllTemplateContents", "GetContents", r.ResourceType()) + templateContents, err := pingone.GetManagementAPIObjectsFromIterator[management.TemplateContent](iter, "ReadAllTemplateContents", "GetContents", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go b/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go index baab177f..d0cb292e 100644 --- a/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go +++ b/internal/connector/pingone/platform/resources/pingone_phone_delivery_settings.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOnePhoneDeliverySettingsResource) getPhoneDeliverySettingsData() (m phoneDeliverySettingsData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.PhoneDeliverySettingsApi.ReadAllPhoneDeliverySettings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - phoneDeliverySettings, err := common.GetManagementAPIObjectsFromIterator[management.NotificationsSettingsPhoneDeliverySettings](iter, "ReadAllPhoneDeliverySettings", "GetPhoneDeliverySettings", r.ResourceType()) + phoneDeliverySettings, err := pingone.GetManagementAPIObjectsFromIterator[management.NotificationsSettingsPhoneDeliverySettings](iter, "ReadAllPhoneDeliverySettings", "GetPhoneDeliverySettings", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_system_application.go b/internal/connector/pingone/platform/resources/pingone_system_application.go index 743ee127..2940630f 100644 --- a/internal/connector/pingone/platform/resources/pingone_system_application.go +++ b/internal/connector/pingone/platform/resources/pingone_system_application.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneSystemApplicationResource) getSystemApplicationData() (map[strin applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go b/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go index 9af55c37..a418d891 100644 --- a/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go +++ b/internal/connector/pingone/platform/resources/pingone_trusted_email_address.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneTrustedEmailAddressResource) getTrustedEmailDomainData() (map[st trustedEmailDomainData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - trustedEmailDomains, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomain](iter, "ReadAllTrustedEmailDomains", "GetEmailDomains", r.ResourceType()) + trustedEmailDomains, err := pingone.GetManagementAPIObjectsFromIterator[management.EmailDomain](iter, "ReadAllTrustedEmailDomains", "GetEmailDomains", r.ResourceType()) if err != nil { return nil, err } @@ -95,7 +96,7 @@ func (r *PingOneTrustedEmailAddressResource) getTrustedEmailAddressData(trustedE trustedEmailAddressData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailAddressesApi.ReadAllTrustedEmailAddresses(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, trustedEmailDomainId).Execute() - trustedEmailAddresses, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomainTrustedEmail](iter, "ReadAllTrustedEmailAddresses", "GetTrustedEmails", r.ResourceType()) + trustedEmailAddresses, err := pingone.GetManagementAPIObjectsFromIterator[management.EmailDomainTrustedEmail](iter, "ReadAllTrustedEmailAddresses", "GetTrustedEmails", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go b/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go index 97091a7d..9ae6df09 100644 --- a/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go +++ b/internal/connector/pingone/platform/resources/pingone_trusted_email_domain.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneTrustedEmailDomainResource) getTrustedEmailDomainData() (map[str trustedEmailDomainData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.TrustedEmailDomainsApi.ReadAllTrustedEmailDomains(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - trustedEmailDomains, err := common.GetManagementAPIObjectsFromIterator[management.EmailDomain](iter, "ReadAllTrustedEmailDomains", "GetEmailDomains", r.ResourceType()) + trustedEmailDomains, err := pingone.GetManagementAPIObjectsFromIterator[management.EmailDomain](iter, "ReadAllTrustedEmailDomains", "GetEmailDomains", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/platform/resources/pingone_webhook.go b/internal/connector/pingone/platform/resources/pingone_webhook.go index 4293287c..3e9e0f73 100644 --- a/internal/connector/pingone/platform/resources/pingone_webhook.go +++ b/internal/connector/pingone/platform/resources/pingone_webhook.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneWebhookResource) getSubscriptionData() (map[string]string, error subscriptionData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SubscriptionsWebhooksApi.ReadAllSubscriptions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - subscriptions, err := common.GetManagementAPIObjectsFromIterator[management.Subscription](iter, "ReadAllSubscriptions", "GetSubscriptions", r.ResourceType()) + subscriptions, err := pingone.GetManagementAPIObjectsFromIterator[management.Subscription](iter, "ReadAllSubscriptions", "GetSubscriptions", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/protect/resources/pingone_risk_policy.go b/internal/connector/pingone/protect/resources/pingone_risk_policy.go index b4a3e204..32ed7fcb 100644 --- a/internal/connector/pingone/protect/resources/pingone_risk_policy.go +++ b/internal/connector/pingone/protect/resources/pingone_risk_policy.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/risk" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneRiskPolicyResource) getRiskPolicySetData() (map[string]string, e riskPolicySetData := make(map[string]string) iter := r.clientInfo.ApiClient.RiskAPIClient.RiskPoliciesApi.ReadRiskPolicySets(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - riskPolicySets, err := common.GetRiskAPIObjectsFromIterator[risk.RiskPolicySet](iter, "ReadRiskPolicySets", "GetRiskPolicySets", r.ResourceType()) + riskPolicySets, err := pingone.GetRiskAPIObjectsFromIterator[risk.RiskPolicySet](iter, "ReadRiskPolicySets", "GetRiskPolicySets", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/protect/resources/pingone_risk_predictor.go b/internal/connector/pingone/protect/resources/pingone_risk_predictor.go index 26adf6d3..c2d1cf54 100644 --- a/internal/connector/pingone/protect/resources/pingone_risk_predictor.go +++ b/internal/connector/pingone/protect/resources/pingone_risk_predictor.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/risk" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -69,7 +70,7 @@ func (r *PingOneRiskPredictorResource) getRiskPredictorData() (map[string][]stri riskPredictorData := make(map[string][]string) iter := r.clientInfo.ApiClient.RiskAPIClient.RiskAdvancedPredictorsApi.ReadAllRiskPredictors(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - riskPredictors, err := common.GetRiskAPIObjectsFromIterator[risk.RiskPredictor](iter, "ReadAllRiskPredictors", "GetRiskPredictors", r.ResourceType()) + riskPredictors, err := pingone.GetRiskAPIObjectsFromIterator[risk.RiskPredictor](iter, "ReadAllRiskPredictors", "GetRiskPredictors", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_application.go b/internal/connector/pingone/sso/resources/pingone_application.go index 5e3587e9..91ca6a58 100644 --- a/internal/connector/pingone/sso/resources/pingone_application.go +++ b/internal/connector/pingone/sso/resources/pingone_application.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneApplicationResource) getApplicationData() (map[string]string, er applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go b/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go index a3279cb8..847109de 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go +++ b/internal/connector/pingone/sso/resources/pingone_application_attribute_mapping.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneApplicationAttributeMappingResource) getApplicationData() (map[s applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } @@ -110,7 +111,7 @@ func (r *PingOneApplicationAttributeMappingResource) getApplicationAttributeMapp applicationAttributeMappingData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationAttributeMappingApi.ReadAllApplicationAttributeMappings(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() - attributeMappingInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllApplicationAttributeMappings", "GetAttributes", r.ResourceType()) + attributeMappingInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllApplicationAttributeMappings", "GetAttributes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go index 3c11ba6c..96211e7e 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_flow_policy_assignment.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -82,7 +83,7 @@ func (r *PingOneApplicationFlowPolicyAssignmentResource) getApplicationData() (m applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } @@ -121,7 +122,7 @@ func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyAssignment flowPolicyAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationFlowPolicyAssignmentsApi.ReadAllFlowPolicyAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() - flowPolicyAssignments, err := common.GetManagementAPIObjectsFromIterator[management.FlowPolicyAssignment](iter, "ReadAllFlowPolicyAssignments", "GetFlowPolicyAssignments", r.ResourceType()) + flowPolicyAssignments, err := pingone.GetManagementAPIObjectsFromIterator[management.FlowPolicyAssignment](iter, "ReadAllFlowPolicyAssignments", "GetFlowPolicyAssignments", r.ResourceType()) if err != nil { return nil, err } @@ -161,5 +162,5 @@ func (r *PingOneApplicationFlowPolicyAssignmentResource) getFlowPolicyName(flowP } } - return "", false, fmt.Errorf("Unable to get Flow Policy Name for Flow Policy ID: %s", flowPolicyId) + return "", false, fmt.Errorf("unable to get Flow Policy Name for Flow Policy ID: %s", flowPolicyId) } diff --git a/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go b/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go index 8f86855c..891eb8d7 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go +++ b/internal/connector/pingone/sso/resources/pingone_application_resource_grant.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -82,7 +83,7 @@ func (r *PingOneApplicationResourceGrantResource) getApplicationData() (map[stri applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } @@ -121,7 +122,7 @@ func (r *PingOneApplicationResourceGrantResource) getApplicationGrantData(appId applicationGrantData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationResourceGrantsApi.ReadAllApplicationGrants(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() - applicationGrants, err := common.GetManagementAPIObjectsFromIterator[management.ApplicationResourceGrant](iter, "ReadAllApplicationGrants", "GetGrants", r.ResourceType()) + applicationGrants, err := pingone.GetManagementAPIObjectsFromIterator[management.ApplicationResourceGrant](iter, "ReadAllApplicationGrants", "GetGrants", r.ResourceType()) if err != nil { return nil, err } @@ -159,5 +160,5 @@ func (r *PingOneApplicationResourceGrantResource) getGrantResourceName(grantReso } } - return "", false, fmt.Errorf("Unable to get resource name for grant resource ID: %s", grantResourceId) + return "", false, fmt.Errorf("unable to get resource name for grant resource ID: %s", grantResourceId) } diff --git a/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go index 949ab640..f3ca158a 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_role_assignment.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -82,7 +83,7 @@ func (r *PingOneApplicationRoleAssignmentResource) getApplicationData() (map[str applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } @@ -136,7 +137,7 @@ func (r *PingOneApplicationRoleAssignmentResource) getApplicationRoleAssignmentD applicationRoleAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationRoleAssignmentsApi.ReadApplicationRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() - applicationRoleAssignments, err := common.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadApplicationRoleAssignments", "GetRoleAssignments", r.ResourceType()) + applicationRoleAssignments, err := pingone.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadApplicationRoleAssignments", "GetRoleAssignments", r.ResourceType()) if err != nil { return nil, err } @@ -174,5 +175,5 @@ func (r *PingOneApplicationRoleAssignmentResource) getRoleName(roleId string) (m } } - return "", false, fmt.Errorf("Unable to get role name for role ID: %s", roleId) + return "", false, fmt.Errorf("unable to get role name for role ID: %s", roleId) } diff --git a/internal/connector/pingone/sso/resources/pingone_application_secret.go b/internal/connector/pingone/sso/resources/pingone_application_secret.go index 206cce11..8354ba01 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_secret.go +++ b/internal/connector/pingone/sso/resources/pingone_application_secret.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" "github.com/pingidentity/pingcli/internal/output" ) @@ -75,7 +76,7 @@ func (r *PingOneApplicationSecretResource) getApplicationData() (map[string]stri applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } @@ -121,7 +122,7 @@ func (r *PingOneApplicationSecretResource) checkApplicationSecretData(appId stri if response.StatusCode == 403 { return false, nil } else { - return false, fmt.Errorf("Error: Expected 403 Forbidden response - worker apps cannot read their own secret\n%s Response Code: %s\nResponse Body: %s", "ReadApplicationSecret", response.Status, response.Body) + return false, fmt.Errorf("error: Expected 403 Forbidden response - worker apps cannot read their own secret\n%s Response Code: %s\nResponse Body: %s", "ReadApplicationSecret", response.Status, response.Body) } } diff --git a/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go b/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go index 1dc6ae1d..8aa47086 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_application_sign_on_policy_assignment.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -82,7 +83,7 @@ func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationData() applicationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationsApi.ReadAllApplications(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - applications, err := common.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) + applications, err := pingone.GetManagementAPIObjectsFromIterator[management.ReadOneApplication200Response](iter, "ReadAllApplications", "GetApplications", r.ResourceType()) if err != nil { return nil, err } @@ -121,7 +122,7 @@ func (r *PingOneApplicationSignOnPolicyAssignmentResource) getApplicationSignOnP signOnPolicyAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ApplicationSignOnPolicyAssignmentsApi.ReadAllSignOnPolicyAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, appId).Execute() - signOnPolicyAssignments, err := common.GetManagementAPIObjectsFromIterator[management.SignOnPolicyAssignment](iter, "ReadAllSignOnPolicyAssignments", "GetSignOnPolicyAssignments", r.ResourceType()) + signOnPolicyAssignments, err := pingone.GetManagementAPIObjectsFromIterator[management.SignOnPolicyAssignment](iter, "ReadAllSignOnPolicyAssignments", "GetSignOnPolicyAssignments", r.ResourceType()) if err != nil { return nil, err } @@ -160,5 +161,5 @@ func (r *PingOneApplicationSignOnPolicyAssignmentResource) getSignOnPolicyName(s } } - return "", false, fmt.Errorf("Unable to get sign-on policy name for sign-on policy ID: %s", signOnPolicyId) + return "", false, fmt.Errorf("unable to get sign-on policy name for sign-on policy ID: %s", signOnPolicyId) } diff --git a/internal/connector/pingone/sso/resources/pingone_group.go b/internal/connector/pingone/sso/resources/pingone_group.go index 4bbfba89..3d6b9153 100644 --- a/internal/connector/pingone/sso/resources/pingone_group.go +++ b/internal/connector/pingone/sso/resources/pingone_group.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneGroupResource) getGroupData() (map[string]string, error) { groupData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - groups, err := common.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) + groups, err := pingone.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_group_nesting.go b/internal/connector/pingone/sso/resources/pingone_group_nesting.go index cc99aca0..3958b257 100644 --- a/internal/connector/pingone/sso/resources/pingone_group_nesting.go +++ b/internal/connector/pingone/sso/resources/pingone_group_nesting.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneGroupNestingResource) getGroupData() (map[string]string, error) groupData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - groups, err := common.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) + groups, err := pingone.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) if err != nil { return nil, err } @@ -95,7 +96,7 @@ func (r *PingOneGroupNestingResource) getGroupNestingData(parentGroupId string) groupNestingData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadGroupNesting(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, parentGroupId).Execute() - groupNestings, err := common.GetManagementAPIObjectsFromIterator[management.GroupMembership](iter, "ReadGroupNesting", "GetGroupMemberships", r.ResourceType()) + groupNestings, err := pingone.GetManagementAPIObjectsFromIterator[management.GroupMembership](iter, "ReadGroupNesting", "GetGroupMemberships", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go b/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go index 15384167..6951abff 100644 --- a/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go +++ b/internal/connector/pingone/sso/resources/pingone_group_role_assignment.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -82,7 +83,7 @@ func (r *PingOneGroupRoleAssignmentResource) getGroupData() (map[string]string, groupData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupsApi.ReadAllGroups(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - groups, err := common.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) + groups, err := pingone.GetManagementAPIObjectsFromIterator[management.Group](iter, "ReadAllGroups", "GetGroups", r.ResourceType()) if err != nil { return nil, err } @@ -103,7 +104,7 @@ func (r *PingOneGroupRoleAssignmentResource) getGroupRoleAssignmentData(groupId groupRoleAssignmentData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.GroupRoleAssignmentsApi.ReadGroupRoleAssignments(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, groupId).Execute() - roleAssignments, err := common.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadGroupRoleAssignments", "GetRoleAssignments", r.ResourceType()) + roleAssignments, err := pingone.GetManagementAPIObjectsFromIterator[management.RoleAssignment](iter, "ReadGroupRoleAssignments", "GetRoleAssignments", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_identity_provider.go b/internal/connector/pingone/sso/resources/pingone_identity_provider.go index 446250c0..c8bab690 100644 --- a/internal/connector/pingone/sso/resources/pingone_identity_provider.go +++ b/internal/connector/pingone/sso/resources/pingone_identity_provider.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneIdentityProviderResource) getIdentityProviderData() (map[string] identityProviderData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProvidersApi.ReadAllIdentityProviders(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - identityProviders, err := common.GetManagementAPIObjectsFromIterator[management.IdentityProvider](iter, "ReadAllIdentityProviders", "GetIdentityProviders", r.ResourceType()) + identityProviders, err := pingone.GetManagementAPIObjectsFromIterator[management.IdentityProvider](iter, "ReadAllIdentityProviders", "GetIdentityProviders", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go b/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go index ddc87010..34912a9c 100644 --- a/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_identity_provider_attribute.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderData() (ma identityProviderData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProvidersApi.ReadAllIdentityProviders(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - identityProviders, err := common.GetManagementAPIObjectsFromIterator[management.IdentityProvider](iter, "ReadAllIdentityProviders", "GetIdentityProviders", r.ResourceType()) + identityProviders, err := pingone.GetManagementAPIObjectsFromIterator[management.IdentityProvider](iter, "ReadAllIdentityProviders", "GetIdentityProviders", r.ResourceType()) if err != nil { return nil, err } @@ -122,7 +123,7 @@ func (r *PingOneIdentityProviderAttributeResource) getIdentityProviderAttributeD identityProviderAttributeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.IdentityProviderAttributesApi.ReadAllIdentityProviderAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, idpId).Execute() - attributeInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllIdentityProviderAttributes", "GetAttributes", r.ResourceType()) + attributeInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllIdentityProviderAttributes", "GetAttributes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_password_policy.go b/internal/connector/pingone/sso/resources/pingone_password_policy.go index 6b265b8d..4c3dd4af 100644 --- a/internal/connector/pingone/sso/resources/pingone_password_policy.go +++ b/internal/connector/pingone/sso/resources/pingone_password_policy.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOnePasswordPolicyResource) getPasswordPolicyData() (map[string]stri passwordPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.PasswordPoliciesApi.ReadAllPasswordPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - passwordPolicies, err := common.GetManagementAPIObjectsFromIterator[management.PasswordPolicy](iter, "ReadAllPasswordPolicies", "GetPasswordPolicies", r.ResourceType()) + passwordPolicies, err := pingone.GetManagementAPIObjectsFromIterator[management.PasswordPolicy](iter, "ReadAllPasswordPolicies", "GetPasswordPolicies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_population.go b/internal/connector/pingone/sso/resources/pingone_population.go index 478927c9..cd83c8a3 100644 --- a/internal/connector/pingone/sso/resources/pingone_population.go +++ b/internal/connector/pingone/sso/resources/pingone_population.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOnePopulationResource) getPopulationData() (map[string]string, erro populationData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.PopulationsApi.ReadAllPopulations(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - populations, err := common.GetManagementAPIObjectsFromIterator[management.Population](iter, "ReadAllPopulations", "GetPopulations", r.ResourceType()) + populations, err := pingone.GetManagementAPIObjectsFromIterator[management.Population](iter, "ReadAllPopulations", "GetPopulations", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_population_default.go b/internal/connector/pingone/sso/resources/pingone_population_default.go index ffad3fef..bd8319aa 100644 --- a/internal/connector/pingone/sso/resources/pingone_population_default.go +++ b/internal/connector/pingone/sso/resources/pingone_population_default.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -60,7 +61,7 @@ func (r *PingOnePopulationDefaultResource) ExportAll() (*[]connector.ImportBlock func (r *PingOnePopulationDefaultResource) getDefaultPopulationName() (*string, error) { iter := r.clientInfo.ApiClient.ManagementAPIClient.PopulationsApi.ReadAllPopulations(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - populations, err := common.GetManagementAPIObjectsFromIterator[management.Population](iter, "ReadAllPopulations", "GetPopulations", r.ResourceType()) + populations, err := pingone.GetManagementAPIObjectsFromIterator[management.Population](iter, "ReadAllPopulations", "GetPopulations", r.ResourceType()) if err != nil { return nil, err } @@ -77,5 +78,5 @@ func (r *PingOnePopulationDefaultResource) getDefaultPopulationName() (*string, } } - return nil, fmt.Errorf("Unable to find the name of the default population") + return nil, fmt.Errorf("unable to find the name of the default population") } diff --git a/internal/connector/pingone/sso/resources/pingone_resource.go b/internal/connector/pingone/sso/resources/pingone_resource.go index 17b2605a..ccd51362 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource.go +++ b/internal/connector/pingone/sso/resources/pingone_resource.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneResourceResource) getResourceData() (map[string]string, error) { resourceData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + resourceInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_resource_attribute.go b/internal/connector/pingone/sso/resources/pingone_resource_attribute.go index 5045ae1a..39dba1b2 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_attribute.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -77,7 +78,7 @@ func (r *PingOneResourceAttributeResource) getResourceData() (map[string][]strin resourceData := make(map[string][]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + resourceInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) if err != nil { return nil, err } @@ -101,7 +102,7 @@ func (r *PingOneResourceAttributeResource) getResourceAttributeData(resourceId s resourceAttributeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceAttributesApi.ReadAllResourceAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() - attributeInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllResourceAttributes", "GetAttributes", r.ResourceType()) + attributeInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllResourceAttributes", "GetAttributes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope.go b/internal/connector/pingone/sso/resources/pingone_resource_scope.go index 6cf45770..33a50eb5 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneResourceScopeResource) getResourceData() (map[string]string, err resourceData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + resourceInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) if err != nil { return nil, err } @@ -98,7 +99,7 @@ func (r *PingOneResourceScopeResource) getResourceScopeData(resourceId string) ( resourceScopeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() - resourceScopes, err := common.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) + resourceScopes, err := pingone.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go b/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go index 853b8cea..bfc5663e 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope_openid.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -73,7 +74,7 @@ func (r *PingOneResourceScopeOpenIdResource) getResourceData() (map[string]strin resourceData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + resourceInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) if err != nil { return nil, err } @@ -97,7 +98,7 @@ func (r *PingOneResourceScopeOpenIdResource) getResourceScopeData(resourceId str resourceScopeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() - resourceScopes, err := common.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) + resourceScopes, err := pingone.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go b/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go index 4e6f1e30..9f356be3 100644 --- a/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go +++ b/internal/connector/pingone/sso/resources/pingone_resource_scope_pingone_api.go @@ -7,6 +7,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneResourceScopePingOneApiResource) getResourceData() (map[string]s resourceData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourcesApi.ReadAllResources(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - resourceInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) + resourceInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedResourcesInner](iter, "ReadAllResources", "GetResources", r.ResourceType()) if err != nil { return nil, err } @@ -98,7 +99,7 @@ func (r *PingOneResourceScopePingOneApiResource) getResourceScopeData(resourceId resourceScopeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.ResourceScopesApi.ReadAllResourceScopes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, resourceId).Execute() - resourceScopes, err := common.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) + resourceScopes, err := pingone.GetManagementAPIObjectsFromIterator[management.ResourceScope](iter, "ReadAllResourceScopes", "GetScopes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_schema_attribute.go b/internal/connector/pingone/sso/resources/pingone_schema_attribute.go index 83326310..2cb67f13 100644 --- a/internal/connector/pingone/sso/resources/pingone_schema_attribute.go +++ b/internal/connector/pingone/sso/resources/pingone_schema_attribute.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneSchemaAttributeResource) getSchemaData() (map[string]string, err schemaData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SchemasApi.ReadAllSchemas(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - schemas, err := common.GetManagementAPIObjectsFromIterator[management.Schema](iter, "ReadAllSchemas", "GetSchemas", r.ResourceType()) + schemas, err := pingone.GetManagementAPIObjectsFromIterator[management.Schema](iter, "ReadAllSchemas", "GetSchemas", r.ResourceType()) if err != nil { return nil, err } @@ -94,7 +95,7 @@ func (r *PingOneSchemaAttributeResource) getSchemaAttributeData(schemaId string) schemaAttributeData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SchemasApi.ReadAllSchemaAttributes(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, schemaId).Execute() - attributeInners, err := common.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllSchemaAttributes", "GetAttributes", r.ResourceType()) + attributeInners, err := pingone.GetManagementAPIObjectsFromIterator[management.EntityArrayEmbeddedAttributesInner](iter, "ReadAllSchemaAttributes", "GetAttributes", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go b/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go index 3d510233..8af1bd60 100644 --- a/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go +++ b/internal/connector/pingone/sso/resources/pingone_sign_on_policy.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -65,7 +66,7 @@ func (r *PingOneSignOnPolicyResource) getSignOnPolicyData() (map[string]string, signOnPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPoliciesApi.ReadAllSignOnPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - signOnPolicies, err := common.GetManagementAPIObjectsFromIterator[management.SignOnPolicy](iter, "ReadAllSignOnPolicies", "GetSignOnPolicies", r.ResourceType()) + signOnPolicies, err := pingone.GetManagementAPIObjectsFromIterator[management.SignOnPolicy](iter, "ReadAllSignOnPolicies", "GetSignOnPolicies", r.ResourceType()) if err != nil { return nil, err } diff --git a/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go b/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go index e0857fa4..f8943054 100644 --- a/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go +++ b/internal/connector/pingone/sso/resources/pingone_sign_on_policy_action.go @@ -6,6 +6,7 @@ import ( "github.com/patrickcping/pingone-go-sdk-v2/management" "github.com/pingidentity/pingcli/internal/connector" "github.com/pingidentity/pingcli/internal/connector/common" + "github.com/pingidentity/pingcli/internal/connector/pingone" "github.com/pingidentity/pingcli/internal/logger" ) @@ -74,7 +75,7 @@ func (r *PingOneSignOnPolicyActionResource) getSignOnPolicyData() (map[string]st signOnPolicyData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPoliciesApi.ReadAllSignOnPolicies(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID).Execute() - signOnPolicies, err := common.GetManagementAPIObjectsFromIterator[management.SignOnPolicy](iter, "ReadAllSignOnPolicies", "GetSignOnPolicies", r.ResourceType()) + signOnPolicies, err := pingone.GetManagementAPIObjectsFromIterator[management.SignOnPolicy](iter, "ReadAllSignOnPolicies", "GetSignOnPolicies", r.ResourceType()) if err != nil { return nil, err } @@ -95,7 +96,7 @@ func (r *PingOneSignOnPolicyActionResource) getSignOnPolicyActionData(signOnPoli signOnPolicyActionData := make(map[string]string) iter := r.clientInfo.ApiClient.ManagementAPIClient.SignOnPolicyActionsApi.ReadAllSignOnPolicyActions(r.clientInfo.Context, r.clientInfo.ExportEnvironmentID, signOnPolicyId).Execute() - signOnPolicyActions, err := common.GetManagementAPIObjectsFromIterator[management.SignOnPolicyAction](iter, "ReadAllSignOnPolicyActions", "GetActions", r.ResourceType()) + signOnPolicyActions, err := pingone.GetManagementAPIObjectsFromIterator[management.SignOnPolicyAction](iter, "ReadAllSignOnPolicyActions", "GetActions", r.ResourceType()) if err != nil { return nil, err } From d512f73d39dc77fa09b63513fb56e972f8e71524 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Fri, 21 Feb 2025 14:43:10 -0700 Subject: [PATCH 17/18] Standarize Response error and warning output --- cmd/platform/export_test.go | 2 +- internal/connector/common/resources_common.go | 14 +++++++------- internal/connector/pingone/common.go | 6 ++++-- .../sso/resources/pingone_application_secret.go | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmd/platform/export_test.go b/cmd/platform/export_test.go index 523d9b88..cd6f00d4 100644 --- a/cmd/platform/export_test.go +++ b/cmd/platform/export_test.go @@ -325,7 +325,7 @@ func TestPlatformExportCmd_PingFederateTrustAllTLSFlag(t *testing.T) { func TestPlatformExportCmd_PingFederateTrustAllTLSFlagFalse(t *testing.T) { outputDir := t.TempDir() - expectedErrorPattern := `^failed to initialize PingFederate Go Client. Check authentication type and credentials$` + expectedErrorPattern := `^to initialize PingFederate Go Client. Check authentication type and credentials$` err := testutils_cobra.ExecutePingcli(t, "platform", "export", "--output-directory", outputDir, "--overwrite", diff --git a/internal/connector/common/resources_common.go b/internal/connector/common/resources_common.go index bc7938a9..dbb84b37 100644 --- a/internal/connector/common/resources_common.go +++ b/internal/connector/common/resources_common.go @@ -17,9 +17,9 @@ func HandleClientResponse(response *http.Response, err error, apiFunctionName st if err != nil { // Only warn the user on client error and skip export of resource output.Warn("API client error.", map[string]interface{}{ - "api_function": apiFunctionName, - "error": err, - "resource": resourceType, + "API Function Name": apiFunctionName, + "Resource Type": resourceType, + "Client Error": err, }) return false, nil @@ -33,10 +33,10 @@ func HandleClientResponse(response *http.Response, err error, apiFunctionName st // When the client returns forbidden, warn user and skip export of resource if response.StatusCode == 403 { output.Warn("API client 403 forbidden response.", map[string]interface{}{ - "api_function": apiFunctionName, - "resource": resourceType, - "response_code": response.StatusCode, - "response_body": response.Body, + "API Function Name": apiFunctionName, + "Resource Type": resourceType, + "Response Code": response.StatusCode, + "Response Body": response.Body, }) return false, nil diff --git a/internal/connector/pingone/common.go b/internal/connector/pingone/common.go index 548b04e2..122a7e63 100644 --- a/internal/connector/pingone/common.go +++ b/internal/connector/pingone/common.go @@ -23,8 +23,10 @@ func CheckSingletonResource(response *http.Response, err error, apiFuncName, res if response.StatusCode == 204 { output.Warn("API client 204 No Content response.", map[string]interface{}{ - "api_function": apiFuncName, - "resource": resourceType, + "API Function Name": apiFuncName, + "Resource Type": resourceType, + "Response Code": response.Status, + "Response Body": response.Body, }) return false, nil } diff --git a/internal/connector/pingone/sso/resources/pingone_application_secret.go b/internal/connector/pingone/sso/resources/pingone_application_secret.go index 8354ba01..2dff1ddd 100644 --- a/internal/connector/pingone/sso/resources/pingone_application_secret.go +++ b/internal/connector/pingone/sso/resources/pingone_application_secret.go @@ -131,7 +131,7 @@ func (r *PingOneApplicationSecretResource) checkApplicationSecretData(appId stri if err != nil || response.StatusCode >= 300 || response.StatusCode < 200 { output.Warn("Failed to read secret for application", map[string]interface{}{ "Application ID": appId, - "API function name": "ReadApplicationSecret", + "API Function Name": "ReadApplicationSecret", "Response Code": response.Status, "Response Body": response.Body, }) From e7a7884d0058257443f313351045de9af21f4812 Mon Sep 17 00:00:00 2001 From: Erik Ostien Date: Fri, 21 Feb 2025 14:51:27 -0700 Subject: [PATCH 18/18] Fix broken test --- cmd/platform/export_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/platform/export_test.go b/cmd/platform/export_test.go index cd6f00d4..523d9b88 100644 --- a/cmd/platform/export_test.go +++ b/cmd/platform/export_test.go @@ -325,7 +325,7 @@ func TestPlatformExportCmd_PingFederateTrustAllTLSFlag(t *testing.T) { func TestPlatformExportCmd_PingFederateTrustAllTLSFlagFalse(t *testing.T) { outputDir := t.TempDir() - expectedErrorPattern := `^to initialize PingFederate Go Client. Check authentication type and credentials$` + expectedErrorPattern := `^failed to initialize PingFederate Go Client. Check authentication type and credentials$` err := testutils_cobra.ExecutePingcli(t, "platform", "export", "--output-directory", outputDir, "--overwrite",