qontract-reconcile 0.10.2.dev349__py3-none-any.whl → 0.10.2.dev414__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qontract_reconcile-0.10.2.dev349.dist-info → qontract_reconcile-0.10.2.dev414.dist-info}/METADATA +12 -11
- {qontract_reconcile-0.10.2.dev349.dist-info → qontract_reconcile-0.10.2.dev414.dist-info}/RECORD +356 -350
- reconcile/acs_rbac.py +2 -2
- reconcile/aus/advanced_upgrade_service.py +15 -12
- reconcile/aus/base.py +26 -27
- reconcile/aus/cluster_version_data.py +15 -5
- reconcile/aus/models.py +1 -1
- reconcile/automated_actions/config/integration.py +15 -3
- reconcile/aws_account_manager/integration.py +8 -8
- reconcile/aws_account_manager/reconciler.py +3 -3
- reconcile/aws_ami_cleanup/integration.py +8 -12
- reconcile/aws_ami_share.py +69 -62
- reconcile/aws_cloudwatch_log_retention/integration.py +155 -126
- reconcile/aws_ecr_image_pull_secrets.py +2 -2
- reconcile/aws_iam_keys.py +7 -41
- reconcile/aws_saml_idp/integration.py +12 -4
- reconcile/aws_saml_roles/integration.py +32 -25
- reconcile/aws_version_sync/integration.py +6 -12
- reconcile/change_owners/bundle.py +3 -3
- reconcile/change_owners/change_log_tracking.py +3 -2
- reconcile/change_owners/change_owners.py +1 -1
- reconcile/change_owners/diff.py +2 -4
- reconcile/checkpoint.py +11 -3
- reconcile/cli.py +33 -8
- reconcile/dashdotdb_dora.py +5 -12
- reconcile/dashdotdb_slo.py +1 -1
- reconcile/database_access_manager.py +123 -117
- reconcile/dynatrace_token_provider/integration.py +1 -1
- reconcile/endpoints_discovery/integration.py +4 -1
- reconcile/endpoints_discovery/merge_request.py +1 -1
- reconcile/endpoints_discovery/merge_request_manager.py +9 -11
- reconcile/external_resources/factories.py +5 -12
- reconcile/external_resources/integration.py +1 -1
- reconcile/external_resources/manager.py +24 -10
- reconcile/external_resources/meta.py +0 -1
- reconcile/external_resources/metrics.py +1 -1
- reconcile/external_resources/model.py +13 -13
- reconcile/external_resources/reconciler.py +7 -4
- reconcile/external_resources/secrets_sync.py +6 -8
- reconcile/external_resources/state.py +60 -17
- reconcile/fleet_labeler/integration.py +1 -1
- reconcile/gabi_authorized_users.py +8 -5
- reconcile/gcp_image_mirror.py +2 -2
- reconcile/github_org.py +1 -1
- reconcile/github_owners.py +4 -0
- reconcile/gitlab_housekeeping.py +13 -15
- reconcile/gitlab_members.py +6 -12
- reconcile/gitlab_mr_sqs_consumer.py +2 -2
- reconcile/gitlab_owners.py +15 -11
- reconcile/gitlab_permissions.py +8 -12
- reconcile/glitchtip_project_alerts/integration.py +3 -1
- reconcile/gql_definitions/acs/acs_instances.py +5 -5
- reconcile/gql_definitions/acs/acs_policies.py +5 -5
- reconcile/gql_definitions/acs/acs_rbac.py +5 -5
- reconcile/gql_definitions/advanced_upgrade_service/aus_clusters.py +5 -5
- reconcile/gql_definitions/advanced_upgrade_service/aus_organization.py +5 -5
- reconcile/gql_definitions/app_interface_metrics_exporter/onboarding_status.py +5 -5
- reconcile/gql_definitions/app_sre_tekton_access_revalidation/roles.py +5 -5
- reconcile/gql_definitions/app_sre_tekton_access_revalidation/users.py +5 -5
- reconcile/gql_definitions/automated_actions/instance.py +46 -7
- reconcile/gql_definitions/aws_account_manager/aws_accounts.py +5 -5
- reconcile/gql_definitions/aws_ami_cleanup/aws_accounts.py +15 -5
- reconcile/gql_definitions/aws_cloudwatch_log_retention/aws_accounts.py +27 -66
- reconcile/gql_definitions/aws_saml_idp/aws_accounts.py +15 -5
- reconcile/gql_definitions/aws_saml_roles/aws_accounts.py +15 -5
- reconcile/gql_definitions/aws_saml_roles/roles.py +5 -5
- reconcile/gql_definitions/aws_version_sync/clusters.py +5 -5
- reconcile/gql_definitions/aws_version_sync/namespaces.py +5 -5
- reconcile/gql_definitions/change_owners/queries/change_types.py +5 -5
- reconcile/gql_definitions/change_owners/queries/self_service_roles.py +5 -5
- reconcile/gql_definitions/cluster_auth_rhidp/clusters.py +5 -5
- reconcile/gql_definitions/common/alerting_services_settings.py +5 -5
- reconcile/gql_definitions/common/app_code_component_repos.py +5 -5
- reconcile/gql_definitions/common/app_interface_custom_messages.py +5 -5
- reconcile/gql_definitions/common/app_interface_dms_settings.py +5 -5
- reconcile/gql_definitions/common/app_interface_repo_settings.py +5 -5
- reconcile/gql_definitions/common/app_interface_roles.py +5 -5
- reconcile/gql_definitions/common/app_interface_state_settings.py +5 -5
- reconcile/gql_definitions/common/app_interface_vault_settings.py +5 -5
- reconcile/gql_definitions/common/app_quay_repos_escalation_policies.py +5 -5
- reconcile/gql_definitions/common/apps.py +5 -5
- reconcile/gql_definitions/common/aws_vpc_requests.py +15 -5
- reconcile/gql_definitions/common/aws_vpcs.py +5 -5
- reconcile/gql_definitions/common/clusters.py +7 -5
- reconcile/gql_definitions/common/clusters_minimal.py +5 -5
- reconcile/gql_definitions/common/clusters_with_dms.py +5 -5
- reconcile/gql_definitions/common/clusters_with_peering.py +5 -5
- reconcile/gql_definitions/common/github_orgs.py +5 -5
- reconcile/gql_definitions/common/jira_settings.py +5 -5
- reconcile/gql_definitions/common/jiralert_settings.py +5 -5
- reconcile/gql_definitions/common/ldap_settings.py +5 -5
- reconcile/gql_definitions/common/namespaces.py +5 -5
- reconcile/gql_definitions/common/namespaces_minimal.py +7 -5
- reconcile/gql_definitions/common/ocm_env_telemeter.py +5 -5
- reconcile/gql_definitions/common/ocm_environments.py +5 -5
- reconcile/gql_definitions/common/pagerduty_instances.py +5 -5
- reconcile/gql_definitions/common/pgp_reencryption_settings.py +5 -5
- reconcile/gql_definitions/common/pipeline_providers.py +5 -5
- reconcile/gql_definitions/common/quay_instances.py +5 -5
- reconcile/gql_definitions/common/quay_orgs.py +5 -5
- reconcile/gql_definitions/common/reserved_networks.py +5 -5
- reconcile/gql_definitions/common/rhcs_provider_settings.py +5 -5
- reconcile/gql_definitions/common/saas_files.py +5 -5
- reconcile/gql_definitions/common/saas_target_namespaces.py +5 -5
- reconcile/gql_definitions/common/saasherder_settings.py +5 -5
- reconcile/gql_definitions/common/slack_workspaces.py +5 -5
- reconcile/gql_definitions/common/smtp_client_settings.py +5 -5
- reconcile/gql_definitions/common/state_aws_account.py +5 -5
- reconcile/gql_definitions/common/users.py +5 -5
- reconcile/gql_definitions/common/users_with_paths.py +5 -5
- reconcile/gql_definitions/cost_report/app_names.py +5 -5
- reconcile/gql_definitions/cost_report/cost_namespaces.py +5 -5
- reconcile/gql_definitions/cost_report/settings.py +5 -5
- reconcile/gql_definitions/dashdotdb_slo/slo_documents_query.py +5 -5
- reconcile/gql_definitions/dynatrace_token_provider/dynatrace_bootstrap_tokens.py +5 -5
- reconcile/gql_definitions/dynatrace_token_provider/token_specs.py +5 -5
- reconcile/gql_definitions/email_sender/apps.py +5 -5
- reconcile/gql_definitions/email_sender/emails.py +5 -5
- reconcile/gql_definitions/email_sender/users.py +5 -5
- reconcile/gql_definitions/endpoints_discovery/apps.py +5 -5
- reconcile/gql_definitions/external_resources/aws_accounts.py +5 -5
- reconcile/gql_definitions/external_resources/external_resources_modules.py +5 -5
- reconcile/gql_definitions/external_resources/external_resources_namespaces.py +89 -6
- reconcile/gql_definitions/external_resources/external_resources_settings.py +7 -5
- reconcile/gql_definitions/external_resources/fragments/external_resources_module_overrides.py +5 -5
- reconcile/gql_definitions/fleet_labeler/fleet_labels.py +5 -5
- reconcile/gql_definitions/fragments/aus_organization.py +5 -5
- reconcile/gql_definitions/fragments/aws_account_common.py +7 -5
- reconcile/gql_definitions/fragments/aws_account_managed.py +5 -5
- reconcile/gql_definitions/fragments/aws_account_sso.py +5 -5
- reconcile/gql_definitions/fragments/aws_infra_management_account.py +5 -5
- reconcile/gql_definitions/fragments/aws_organization.py +33 -0
- reconcile/gql_definitions/fragments/aws_vpc.py +5 -5
- reconcile/gql_definitions/fragments/aws_vpc_request.py +7 -5
- reconcile/gql_definitions/fragments/container_image_mirror.py +5 -5
- reconcile/gql_definitions/fragments/deploy_resources.py +5 -5
- reconcile/gql_definitions/fragments/disable.py +5 -5
- reconcile/gql_definitions/fragments/email_service.py +5 -5
- reconcile/gql_definitions/fragments/email_user.py +5 -5
- reconcile/gql_definitions/fragments/jumphost_common_fields.py +5 -5
- reconcile/gql_definitions/fragments/membership_source.py +5 -5
- reconcile/gql_definitions/fragments/minimal_ocm_organization.py +5 -5
- reconcile/gql_definitions/fragments/oc_connection_cluster.py +5 -5
- reconcile/gql_definitions/fragments/ocm_environment.py +5 -5
- reconcile/gql_definitions/fragments/pipeline_provider_retention.py +5 -5
- reconcile/gql_definitions/fragments/prometheus_instance.py +5 -5
- reconcile/gql_definitions/fragments/resource_limits_requirements.py +5 -5
- reconcile/gql_definitions/fragments/resource_requests_requirements.py +5 -5
- reconcile/gql_definitions/fragments/resource_values.py +5 -5
- reconcile/gql_definitions/fragments/saas_slo_document.py +5 -5
- reconcile/gql_definitions/fragments/saas_target_namespace.py +5 -5
- reconcile/gql_definitions/fragments/serviceaccount_token.py +5 -5
- reconcile/gql_definitions/fragments/terraform_state.py +5 -5
- reconcile/gql_definitions/fragments/upgrade_policy.py +5 -5
- reconcile/gql_definitions/fragments/user.py +5 -5
- reconcile/gql_definitions/fragments/vault_secret.py +5 -5
- reconcile/gql_definitions/gcp/gcp_docker_repos.py +5 -5
- reconcile/gql_definitions/gcp/gcp_projects.py +5 -5
- reconcile/gql_definitions/gitlab_members/gitlab_instances.py +5 -5
- reconcile/gql_definitions/gitlab_members/permissions.py +5 -5
- reconcile/gql_definitions/glitchtip/glitchtip_instance.py +5 -5
- reconcile/gql_definitions/glitchtip/glitchtip_project.py +5 -5
- reconcile/gql_definitions/glitchtip_project_alerts/glitchtip_project.py +5 -5
- reconcile/gql_definitions/integrations/integrations.py +5 -5
- reconcile/gql_definitions/introspection.json +2137 -1053
- reconcile/gql_definitions/jenkins_configs/jenkins_configs.py +5 -5
- reconcile/gql_definitions/jenkins_configs/jenkins_instances.py +5 -5
- reconcile/gql_definitions/jira/jira_servers.py +5 -5
- reconcile/gql_definitions/jira_permissions_validator/jira_boards_for_permissions_validator.py +9 -5
- reconcile/gql_definitions/jumphosts/jumphosts.py +5 -5
- reconcile/gql_definitions/ldap_groups/roles.py +5 -5
- reconcile/gql_definitions/ldap_groups/settings.py +5 -5
- reconcile/gql_definitions/maintenance/maintenances.py +5 -5
- reconcile/gql_definitions/membershipsources/roles.py +5 -5
- reconcile/gql_definitions/ocm_labels/clusters.py +5 -5
- reconcile/gql_definitions/ocm_labels/organizations.py +5 -5
- reconcile/gql_definitions/openshift_cluster_bots/clusters.py +5 -5
- reconcile/gql_definitions/openshift_groups/managed_groups.py +5 -5
- reconcile/gql_definitions/openshift_groups/managed_roles.py +5 -5
- reconcile/gql_definitions/openshift_serviceaccount_tokens/tokens.py +5 -5
- reconcile/gql_definitions/quay_membership/quay_membership.py +5 -5
- reconcile/gql_definitions/rhcs/certs.py +5 -5
- reconcile/gql_definitions/rhidp/organizations.py +5 -5
- reconcile/gql_definitions/service_dependencies/jenkins_instance_fragment.py +5 -5
- reconcile/gql_definitions/service_dependencies/service_dependencies.py +5 -5
- reconcile/gql_definitions/sharding/aws_accounts.py +5 -5
- reconcile/gql_definitions/sharding/ocm_organization.py +5 -5
- reconcile/gql_definitions/skupper_network/site_controller_template.py +5 -5
- reconcile/gql_definitions/skupper_network/skupper_networks.py +5 -5
- reconcile/gql_definitions/slack_usergroups/clusters.py +5 -5
- reconcile/gql_definitions/slack_usergroups/permissions.py +5 -5
- reconcile/gql_definitions/slack_usergroups/users.py +5 -5
- reconcile/gql_definitions/slo_documents/slo_documents.py +5 -5
- reconcile/gql_definitions/status_board/status_board.py +5 -5
- reconcile/gql_definitions/statuspage/statuspages.py +5 -5
- reconcile/gql_definitions/templating/template_collection.py +5 -5
- reconcile/gql_definitions/templating/templates.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_dns/app_interface_cloudflare_dns_settings.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_dns/terraform_cloudflare_zones.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_resources/terraform_cloudflare_accounts.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_resources/terraform_cloudflare_resources.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_users/app_interface_setting_cloudflare_and_vault.py +5 -5
- reconcile/gql_definitions/terraform_cloudflare_users/terraform_cloudflare_roles.py +5 -5
- reconcile/gql_definitions/terraform_init/aws_accounts.py +19 -5
- reconcile/gql_definitions/terraform_repo/terraform_repo.py +5 -5
- reconcile/gql_definitions/terraform_resources/database_access_manager.py +5 -5
- reconcile/gql_definitions/terraform_resources/terraform_resources_namespaces.py +38 -6
- reconcile/gql_definitions/terraform_tgw_attachments/aws_accounts.py +15 -5
- reconcile/gql_definitions/unleash_feature_toggles/feature_toggles.py +5 -5
- reconcile/gql_definitions/vault_instances/vault_instances.py +5 -5
- reconcile/gql_definitions/vault_policies/vault_policies.py +5 -5
- reconcile/gql_definitions/vpc_peerings_validator/vpc_peerings_validator.py +5 -5
- reconcile/gql_definitions/vpc_peerings_validator/vpc_peerings_validator_peered_cluster_fragment.py +5 -5
- reconcile/integrations_manager.py +3 -3
- reconcile/jenkins_worker_fleets.py +10 -8
- reconcile/jira_permissions_validator.py +237 -122
- reconcile/ldap_groups/integration.py +1 -1
- reconcile/ocm/types.py +35 -56
- reconcile/ocm_aws_infrastructure_access.py +1 -1
- reconcile/ocm_clusters.py +4 -4
- reconcile/ocm_labels/integration.py +3 -2
- reconcile/ocm_machine_pools.py +23 -23
- reconcile/openshift_base.py +53 -2
- reconcile/openshift_cluster_bots.py +3 -2
- reconcile/openshift_namespace_labels.py +1 -1
- reconcile/openshift_namespaces.py +97 -101
- reconcile/openshift_resources_base.py +6 -2
- reconcile/openshift_rhcs_certs.py +5 -5
- reconcile/openshift_rolebindings.py +7 -11
- reconcile/openshift_saas_deploy.py +6 -7
- reconcile/openshift_saas_deploy_change_tester.py +9 -7
- reconcile/openshift_saas_deploy_trigger_cleaner.py +3 -5
- reconcile/openshift_serviceaccount_tokens.py +2 -2
- reconcile/openshift_upgrade_watcher.py +4 -4
- reconcile/oum/labelset.py +5 -3
- reconcile/oum/models.py +1 -4
- reconcile/prometheus_rules_tester/integration.py +3 -3
- reconcile/quay_mirror.py +1 -1
- reconcile/queries.py +131 -1
- reconcile/rhidp/common.py +3 -5
- reconcile/rhidp/sso_client/base.py +1 -1
- reconcile/saas_auto_promotions_manager/merge_request_manager/renderer.py +1 -1
- reconcile/saas_auto_promotions_manager/subscriber.py +4 -3
- reconcile/skupper_network/integration.py +2 -2
- reconcile/slack_usergroups.py +35 -14
- reconcile/sql_query.py +1 -0
- reconcile/status_board.py +6 -6
- reconcile/statuspage/atlassian.py +7 -7
- reconcile/statuspage/integrations/maintenances.py +4 -3
- reconcile/statuspage/page.py +4 -9
- reconcile/statuspage/status.py +5 -8
- reconcile/templates/rosa-classic-cluster-creation.sh.j2 +4 -0
- reconcile/templates/rosa-hcp-cluster-creation.sh.j2 +3 -0
- reconcile/templating/lib/rendering.py +3 -3
- reconcile/templating/renderer.py +4 -3
- reconcile/terraform_aws_route53.py +7 -1
- reconcile/terraform_cloudflare_dns.py +3 -3
- reconcile/terraform_cloudflare_resources.py +5 -5
- reconcile/terraform_cloudflare_users.py +3 -2
- reconcile/terraform_init/integration.py +187 -23
- reconcile/terraform_repo.py +16 -12
- reconcile/terraform_resources.py +17 -7
- reconcile/terraform_tgw_attachments.py +27 -19
- reconcile/terraform_users.py +7 -0
- reconcile/terraform_vpc_peerings.py +14 -3
- reconcile/terraform_vpc_resources/integration.py +10 -1
- reconcile/typed_queries/aws_account_tags.py +41 -0
- reconcile/typed_queries/cost_report/app_names.py +1 -1
- reconcile/typed_queries/cost_report/cost_namespaces.py +2 -2
- reconcile/typed_queries/saas_files.py +13 -13
- reconcile/typed_queries/status_board.py +2 -2
- reconcile/unleash_feature_toggles/integration.py +4 -2
- reconcile/utils/acs/base.py +6 -3
- reconcile/utils/acs/policies.py +2 -2
- reconcile/utils/aggregated_list.py +4 -3
- reconcile/utils/aws_api.py +51 -54
- reconcile/utils/aws_api_typed/api.py +38 -9
- reconcile/utils/aws_api_typed/cloudformation.py +149 -0
- reconcile/utils/aws_api_typed/logs.py +73 -0
- reconcile/utils/aws_api_typed/organization.py +4 -2
- reconcile/utils/datetime_util.py +67 -0
- reconcile/utils/deadmanssnitch_api.py +1 -1
- reconcile/utils/differ.py +2 -3
- reconcile/utils/early_exit_cache.py +11 -12
- reconcile/utils/expiration.py +7 -3
- reconcile/utils/external_resource_spec.py +24 -1
- reconcile/utils/filtering.py +1 -1
- reconcile/utils/gitlab_api.py +7 -5
- reconcile/utils/glitchtip/client.py +6 -2
- reconcile/utils/glitchtip/models.py +25 -28
- reconcile/utils/gql.py +4 -7
- reconcile/utils/helm.py +2 -1
- reconcile/utils/helpers.py +1 -1
- reconcile/utils/instrumented_wrappers.py +1 -1
- reconcile/utils/internal_groups/client.py +2 -2
- reconcile/utils/internal_groups/models.py +8 -17
- reconcile/utils/jinja2/utils.py +6 -101
- reconcile/utils/jira_client.py +82 -63
- reconcile/utils/jjb_client.py +9 -12
- reconcile/utils/jobcontroller/controller.py +1 -1
- reconcile/utils/jobcontroller/models.py +17 -1
- reconcile/utils/json.py +70 -0
- reconcile/utils/membershipsources/app_interface_resolver.py +4 -2
- reconcile/utils/membershipsources/models.py +16 -23
- reconcile/utils/membershipsources/resolver.py +4 -2
- reconcile/utils/merge_request_manager/merge_request_manager.py +4 -4
- reconcile/utils/merge_request_manager/parser.py +6 -6
- reconcile/utils/metrics.py +5 -5
- reconcile/utils/models.py +304 -82
- reconcile/utils/mr/app_interface_reporter.py +2 -2
- reconcile/utils/mr/base.py +2 -2
- reconcile/utils/mr/notificator.py +3 -3
- reconcile/utils/mr/update_access_report_base.py +3 -4
- reconcile/utils/mr/user_maintenance.py +3 -2
- reconcile/utils/oc.py +118 -97
- reconcile/utils/oc_filters.py +3 -3
- reconcile/utils/ocm/addons.py +0 -1
- reconcile/utils/ocm/base.py +17 -20
- reconcile/utils/ocm/cluster_groups.py +1 -1
- reconcile/utils/ocm/identity_providers.py +2 -2
- reconcile/utils/ocm/labels.py +1 -1
- reconcile/utils/ocm/products.py +9 -3
- reconcile/utils/ocm/search_filters.py +3 -6
- reconcile/utils/ocm/service_log.py +4 -6
- reconcile/utils/ocm/sre_capability_labels.py +20 -13
- reconcile/utils/openshift_resource.py +10 -5
- reconcile/utils/output.py +3 -2
- reconcile/utils/pagerduty_api.py +10 -7
- reconcile/utils/promotion_state.py +6 -11
- reconcile/utils/raw_github_api.py +1 -1
- reconcile/utils/rhcsv2_certs.py +1 -4
- reconcile/utils/runtime/integration.py +2 -3
- reconcile/utils/runtime/runner.py +2 -2
- reconcile/utils/saasherder/interfaces.py +13 -20
- reconcile/utils/saasherder/models.py +25 -21
- reconcile/utils/saasherder/saasherder.py +35 -24
- reconcile/utils/slack_api.py +26 -4
- reconcile/utils/sloth.py +171 -2
- reconcile/utils/sqs_gateway.py +2 -1
- reconcile/utils/state.py +2 -1
- reconcile/utils/structs.py +1 -1
- reconcile/utils/terraform_client.py +5 -4
- reconcile/utils/terrascript_aws_client.py +171 -114
- reconcile/utils/unleash/server.py +2 -8
- reconcile/utils/vault.py +5 -12
- reconcile/utils/vcs.py +8 -8
- reconcile/vault_replication.py +107 -42
- tools/app_interface_reporter.py +4 -4
- tools/cli_commands/cost_report/cost_management_api.py +3 -3
- tools/cli_commands/cost_report/view.py +7 -6
- tools/cli_commands/erv2.py +3 -1
- tools/cli_commands/systems_and_tools.py +5 -1
- tools/qontract_cli.py +31 -18
- tools/template_validation.py +3 -1
- {qontract_reconcile-0.10.2.dev349.dist-info → qontract_reconcile-0.10.2.dev414.dist-info}/WHEEL +0 -0
- {qontract_reconcile-0.10.2.dev349.dist-info → qontract_reconcile-0.10.2.dev414.dist-info}/entry_points.txt +0 -0
|
@@ -2,31 +2,41 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import re
|
|
5
|
-
import typing
|
|
6
5
|
from collections import defaultdict
|
|
7
6
|
from datetime import UTC, datetime, timedelta
|
|
8
|
-
from enum import Enum
|
|
9
7
|
from typing import TYPE_CHECKING
|
|
10
8
|
|
|
11
|
-
from botocore.exceptions import ClientError
|
|
12
9
|
from pydantic import BaseModel
|
|
13
10
|
|
|
14
|
-
from reconcile import queries
|
|
15
11
|
from reconcile.gql_definitions.aws_cloudwatch_log_retention.aws_accounts import (
|
|
16
12
|
AWSAccountCleanupOptionCloudWatchV1,
|
|
17
13
|
AWSAccountV1,
|
|
18
14
|
)
|
|
15
|
+
from reconcile.typed_queries.app_interface_vault_settings import (
|
|
16
|
+
get_app_interface_vault_settings,
|
|
17
|
+
)
|
|
18
|
+
from reconcile.typed_queries.aws_account_tags import get_aws_account_tags
|
|
19
19
|
from reconcile.typed_queries.aws_cloudwatch_log_retention.aws_accounts import (
|
|
20
20
|
get_aws_accounts,
|
|
21
21
|
)
|
|
22
|
+
from reconcile.typed_queries.external_resources import get_settings
|
|
22
23
|
from reconcile.utils import gql
|
|
23
|
-
from reconcile.utils.
|
|
24
|
+
from reconcile.utils.aws_api_typed.api import AWSApi, AWSStaticCredentials
|
|
25
|
+
from reconcile.utils.datetime_util import utc_now
|
|
26
|
+
from reconcile.utils.differ import diff_mappings
|
|
27
|
+
from reconcile.utils.secret_reader import create_secret_reader
|
|
28
|
+
from reconcile.utils.state import init_state
|
|
29
|
+
|
|
30
|
+
TAGS_KEY = "tags.json"
|
|
24
31
|
|
|
25
32
|
if TYPE_CHECKING:
|
|
26
33
|
from collections.abc import Iterable
|
|
27
34
|
|
|
28
35
|
from mypy_boto3_logs.type_defs import LogGroupTypeDef
|
|
29
36
|
|
|
37
|
+
from reconcile.utils.aws_api_typed.logs import AWSApiLogs
|
|
38
|
+
from reconcile.utils.gql import GqlApi
|
|
39
|
+
|
|
30
40
|
|
|
31
41
|
QONTRACT_INTEGRATION = "aws_cloudwatch_log_retention"
|
|
32
42
|
MANAGED_BY_INTEGRATION_KEY = "managed_by_integration"
|
|
@@ -35,7 +45,7 @@ DEFAULT_RETENTION_IN_DAYS = 90
|
|
|
35
45
|
|
|
36
46
|
|
|
37
47
|
class AWSCloudwatchCleanupOption(BaseModel):
|
|
38
|
-
regex:
|
|
48
|
+
regex: re.Pattern
|
|
39
49
|
retention_in_days: int
|
|
40
50
|
delete_empty_log_group: bool
|
|
41
51
|
|
|
@@ -67,16 +77,6 @@ def get_desired_cleanup_options_by_region(
|
|
|
67
77
|
return result
|
|
68
78
|
|
|
69
79
|
|
|
70
|
-
def create_awsapi_client(accounts: list[AWSAccountV1], thread_pool_size: int) -> AWSApi:
|
|
71
|
-
settings = queries.get_secret_reader_settings()
|
|
72
|
-
return AWSApi(
|
|
73
|
-
thread_pool_size,
|
|
74
|
-
[account.dict(by_alias=True) for account in accounts],
|
|
75
|
-
settings=settings,
|
|
76
|
-
init_users=False,
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
|
|
80
80
|
def is_empty(log_group: LogGroupTypeDef) -> bool:
|
|
81
81
|
return log_group["storedBytes"] == 0
|
|
82
82
|
|
|
@@ -85,47 +85,32 @@ def is_longer_than_retention(
|
|
|
85
85
|
log_group: LogGroupTypeDef,
|
|
86
86
|
desired_retention_days: int,
|
|
87
87
|
) -> bool:
|
|
88
|
-
return
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
class TagStatus(Enum):
|
|
94
|
-
NOT_SET = "NOT_SET"
|
|
95
|
-
MANAGED_BY_CURRENT_INTEGRATION = "MANAGED_BY_CURRENT_INTEGRATION"
|
|
96
|
-
MANAGED_BY_OTHER_INTEGRATION = "MANAGED_BY_OTHER_INTEGRATION"
|
|
88
|
+
return (
|
|
89
|
+
datetime.fromtimestamp(log_group["creationTime"] / 1000, tz=UTC)
|
|
90
|
+
+ timedelta(days=desired_retention_days)
|
|
91
|
+
< utc_now()
|
|
92
|
+
)
|
|
97
93
|
|
|
98
94
|
|
|
99
|
-
def
|
|
100
|
-
log_group: LogGroupTypeDef,
|
|
101
|
-
account_name: str,
|
|
102
|
-
region: str,
|
|
103
|
-
aws_api: AWSApi,
|
|
104
|
-
) -> TagStatus:
|
|
105
|
-
tags = aws_api.get_cloudwatch_log_group_tags(
|
|
106
|
-
account_name,
|
|
107
|
-
log_group["arn"],
|
|
108
|
-
region,
|
|
109
|
-
)
|
|
95
|
+
def _is_managed_by_other_integration(tags: dict[str, str]) -> bool:
|
|
110
96
|
managed_by_integration = tags.get(MANAGED_BY_INTEGRATION_KEY)
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
return TagStatus.MANAGED_BY_OTHER_INTEGRATION
|
|
97
|
+
return (
|
|
98
|
+
managed_by_integration is not None
|
|
99
|
+
and managed_by_integration != QONTRACT_INTEGRATION
|
|
100
|
+
)
|
|
116
101
|
|
|
117
102
|
|
|
118
103
|
def _reconcile_log_group(
|
|
119
104
|
dry_run: bool,
|
|
120
|
-
|
|
105
|
+
log_group: LogGroupTypeDef,
|
|
121
106
|
desired_cleanup_options: Iterable[AWSCloudwatchCleanupOption],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
107
|
+
desired_tags: dict[str, str],
|
|
108
|
+
last_tags: dict[str, str],
|
|
109
|
+
aws_api_logs: AWSApiLogs,
|
|
125
110
|
) -> None:
|
|
126
|
-
current_retention_in_days =
|
|
127
|
-
log_group_name =
|
|
128
|
-
log_group_arn =
|
|
111
|
+
current_retention_in_days = log_group.get("retentionInDays")
|
|
112
|
+
log_group_name = log_group["logGroupName"]
|
|
113
|
+
log_group_arn = log_group["arn"]
|
|
129
114
|
|
|
130
115
|
desired_cleanup_option = _find_desired_cleanup_option(
|
|
131
116
|
log_group_name, desired_cleanup_options
|
|
@@ -133,54 +118,66 @@ def _reconcile_log_group(
|
|
|
133
118
|
|
|
134
119
|
if (
|
|
135
120
|
desired_cleanup_option.delete_empty_log_group
|
|
136
|
-
and is_empty(
|
|
121
|
+
and is_empty(log_group)
|
|
137
122
|
and is_longer_than_retention(
|
|
138
|
-
|
|
123
|
+
log_group, desired_cleanup_option.retention_in_days
|
|
139
124
|
)
|
|
140
125
|
):
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
!= TagStatus.MANAGED_BY_OTHER_INTEGRATION
|
|
144
|
-
):
|
|
126
|
+
tags = aws_api_logs.get_tags(log_group_arn)
|
|
127
|
+
if not _is_managed_by_other_integration(tags):
|
|
145
128
|
logging.info(
|
|
146
129
|
"Deleting empty log group %s",
|
|
147
130
|
log_group_arn,
|
|
148
131
|
)
|
|
149
132
|
if not dry_run:
|
|
150
|
-
|
|
133
|
+
aws_api_logs.delete_log_group(log_group_name)
|
|
151
134
|
return
|
|
152
135
|
|
|
153
|
-
if
|
|
136
|
+
if (
|
|
137
|
+
current_retention_in_days == desired_cleanup_option.retention_in_days
|
|
138
|
+
and last_tags == desired_tags
|
|
139
|
+
):
|
|
154
140
|
return
|
|
155
141
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
142
|
+
current_tags = aws_api_logs.get_tags(log_group_arn)
|
|
143
|
+
if _is_managed_by_other_integration(current_tags):
|
|
144
|
+
return
|
|
145
|
+
|
|
146
|
+
diff_result = diff_mappings(
|
|
147
|
+
current=current_tags,
|
|
148
|
+
desired=desired_tags,
|
|
149
|
+
)
|
|
150
|
+
if to_delete := diff_result.delete.keys() & last_tags.keys():
|
|
151
|
+
logging.info(
|
|
152
|
+
"Deleting tags %s for log group %s",
|
|
153
|
+
to_delete,
|
|
154
|
+
log_group_arn,
|
|
155
|
+
)
|
|
156
|
+
if not dry_run:
|
|
157
|
+
aws_api_logs.delete_tags(
|
|
165
158
|
log_group_arn,
|
|
159
|
+
to_delete,
|
|
166
160
|
)
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
161
|
+
if diff_result.add or diff_result.change:
|
|
162
|
+
logging.info(
|
|
163
|
+
"Setting tags %s for log group %s",
|
|
164
|
+
desired_tags,
|
|
165
|
+
log_group_arn,
|
|
166
|
+
)
|
|
167
|
+
if not dry_run:
|
|
168
|
+
aws_api_logs.set_tags(log_group_arn, desired_tags)
|
|
171
169
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
)
|
|
177
|
-
if not dry_run:
|
|
178
|
-
awsapi.set_cloudwatch_log_retention(
|
|
179
|
-
account_name,
|
|
180
|
-
log_group_name,
|
|
170
|
+
if current_retention_in_days != desired_cleanup_option.retention_in_days:
|
|
171
|
+
logging.info(
|
|
172
|
+
"Setting %s retention days to %d",
|
|
173
|
+
log_group_arn,
|
|
181
174
|
desired_cleanup_option.retention_in_days,
|
|
182
|
-
region,
|
|
183
175
|
)
|
|
176
|
+
if not dry_run:
|
|
177
|
+
aws_api_logs.put_retention_policy(
|
|
178
|
+
log_group_name,
|
|
179
|
+
desired_cleanup_option.retention_in_days,
|
|
180
|
+
)
|
|
184
181
|
|
|
185
182
|
|
|
186
183
|
def _find_desired_cleanup_option(
|
|
@@ -191,60 +188,63 @@ def _find_desired_cleanup_option(
|
|
|
191
188
|
Find the first cleanup option that regex matches the log group name.
|
|
192
189
|
If no match is found, return the default cleanup option.
|
|
193
190
|
|
|
194
|
-
:
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
Args:
|
|
192
|
+
log_group_name: The name of the log group.
|
|
193
|
+
desired_cleanup_options: A list of desired cleanup options.
|
|
194
|
+
Returns:
|
|
195
|
+
The matching cleanup option or the default one.
|
|
197
196
|
"""
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
197
|
+
for option in desired_cleanup_options:
|
|
198
|
+
if option.regex.match(log_group_name):
|
|
199
|
+
return option
|
|
200
|
+
return DEFAULT_AWS_CLOUDWATCH_CLEANUP_OPTION
|
|
202
201
|
|
|
203
202
|
|
|
204
203
|
def _reconcile_log_groups(
|
|
205
204
|
dry_run: bool,
|
|
206
205
|
aws_account: AWSAccountV1,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
last_tags: dict[str, str],
|
|
207
|
+
default_tags: dict[str, str],
|
|
208
|
+
automation_token: dict[str, str],
|
|
209
|
+
) -> dict[str, str]:
|
|
210
|
+
desired_tags = (
|
|
211
|
+
default_tags | get_aws_account_tags(aws_account.organization) | MANAGED_TAG
|
|
212
212
|
)
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
213
|
+
for (
|
|
214
|
+
region,
|
|
215
|
+
desired_cleanup_options,
|
|
216
|
+
) in get_desired_cleanup_options_by_region(aws_account).items():
|
|
217
|
+
aws_credentials = AWSStaticCredentials(
|
|
218
|
+
access_key_id=automation_token["aws_access_key_id"],
|
|
219
|
+
secret_access_key=automation_token["aws_secret_access_key"],
|
|
220
|
+
region=region,
|
|
221
|
+
)
|
|
222
|
+
with AWSApi(aws_credentials) as aws_api:
|
|
223
|
+
aws_api_logs = aws_api.logs
|
|
224
|
+
try:
|
|
225
|
+
for log_group in aws_api_logs.get_log_groups():
|
|
226
|
+
_reconcile_log_group(
|
|
227
|
+
dry_run=dry_run,
|
|
228
|
+
log_group=log_group,
|
|
229
|
+
desired_cleanup_options=desired_cleanup_options,
|
|
230
|
+
desired_tags=desired_tags,
|
|
231
|
+
last_tags=last_tags,
|
|
232
|
+
aws_api_logs=aws_api_logs,
|
|
233
|
+
)
|
|
234
|
+
except aws_api_logs.client.exceptions.ClientError as e:
|
|
235
|
+
logging.error(
|
|
236
|
+
"Error reconciling log groups for %s: %s",
|
|
237
|
+
aws_account.name,
|
|
238
|
+
e,
|
|
229
239
|
)
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
logging.info(
|
|
233
|
-
"Access denied for aws account %s. Skipping...",
|
|
234
|
-
account_name,
|
|
235
|
-
)
|
|
236
|
-
else:
|
|
237
|
-
logging.error(
|
|
238
|
-
"Error reconciling log groups for %s: %s",
|
|
239
|
-
account_name,
|
|
240
|
-
e,
|
|
241
|
-
)
|
|
240
|
+
return last_tags
|
|
241
|
+
return desired_tags
|
|
242
242
|
|
|
243
243
|
|
|
244
|
-
def get_active_aws_accounts() -> list[AWSAccountV1]:
|
|
244
|
+
def get_active_aws_accounts(gql_api: GqlApi) -> list[AWSAccountV1]:
|
|
245
245
|
return [
|
|
246
246
|
account
|
|
247
|
-
for account in get_aws_accounts(
|
|
247
|
+
for account in get_aws_accounts(gql_api)
|
|
248
248
|
if not (
|
|
249
249
|
account.disable
|
|
250
250
|
and account.disable.integrations
|
|
@@ -253,8 +253,37 @@ def get_active_aws_accounts() -> list[AWSAccountV1]:
|
|
|
253
253
|
]
|
|
254
254
|
|
|
255
255
|
|
|
256
|
-
def
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
256
|
+
def get_default_tags(gql_api: GqlApi) -> dict[str, str]:
|
|
257
|
+
try:
|
|
258
|
+
return get_settings(gql_api.query).default_tags
|
|
259
|
+
except ValueError:
|
|
260
|
+
# no settings found
|
|
261
|
+
return {}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
def run(dry_run: bool) -> None:
|
|
265
|
+
gql_api = gql.get_api()
|
|
266
|
+
aws_accounts = get_active_aws_accounts(gql_api)
|
|
267
|
+
vault_settings = get_app_interface_vault_settings(query_func=gql_api.query)
|
|
268
|
+
secret_reader = create_secret_reader(use_vault=vault_settings.vault)
|
|
269
|
+
default_tags = get_default_tags(gql_api)
|
|
270
|
+
|
|
271
|
+
with init_state(
|
|
272
|
+
integration=QONTRACT_INTEGRATION,
|
|
273
|
+
secret_reader=secret_reader,
|
|
274
|
+
) as state:
|
|
275
|
+
last_tags = state.get(TAGS_KEY, {})
|
|
276
|
+
desired_tags = {
|
|
277
|
+
aws_account.name: _reconcile_log_groups(
|
|
278
|
+
dry_run=dry_run,
|
|
279
|
+
aws_account=aws_account,
|
|
280
|
+
last_tags=last_tags.get(aws_account.name, {}),
|
|
281
|
+
default_tags=default_tags,
|
|
282
|
+
automation_token=secret_reader.read_all_secret(
|
|
283
|
+
aws_account.automation_token
|
|
284
|
+
),
|
|
285
|
+
)
|
|
286
|
+
for aws_account in aws_accounts
|
|
287
|
+
}
|
|
288
|
+
if not dry_run and desired_tags != last_tags:
|
|
289
|
+
state.add(TAGS_KEY, desired_tags, force=True)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import base64
|
|
2
|
-
import json
|
|
3
2
|
import logging
|
|
4
3
|
from collections.abc import Mapping
|
|
5
4
|
from typing import Any
|
|
6
5
|
|
|
7
6
|
from reconcile import queries
|
|
8
7
|
from reconcile.utils.aws_api import AWSApi
|
|
8
|
+
from reconcile.utils.json import json_dumps
|
|
9
9
|
from reconcile.utils.vault import VaultClient
|
|
10
10
|
|
|
11
11
|
QONTRACT_INTEGRATION = "aws-ecr-image-pull-secrets"
|
|
@@ -35,7 +35,7 @@ def construct_dockercfg_secret_data(data: Mapping[str, Any]) -> dict[str, str]:
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
return {".dockerconfigjson": enc_dec(
|
|
38
|
+
return {".dockerconfigjson": enc_dec(json_dumps(data))}
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
def construct_basic_auth_secret_data(data: Mapping[str, Any]) -> dict[str, str]:
|
reconcile/aws_iam_keys.py
CHANGED
|
@@ -17,7 +17,7 @@ QONTRACT_INTEGRATION = "aws-iam-keys"
|
|
|
17
17
|
def filter_accounts(
|
|
18
18
|
accounts: Iterable[dict[str, Any]], account_name: str | None
|
|
19
19
|
) -> list[dict[str, Any]]:
|
|
20
|
-
accounts = [a for a in accounts if a.get("deleteKeys")
|
|
20
|
+
accounts = [a for a in accounts if a.get("deleteKeys")]
|
|
21
21
|
if account_name:
|
|
22
22
|
accounts = [a for a in accounts if a["name"] == account_name]
|
|
23
23
|
return accounts
|
|
@@ -31,43 +31,17 @@ def get_keys_to_delete(accounts: Iterable[dict[str, Any]]) -> dict[str, list[str
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
def
|
|
35
|
-
return {
|
|
36
|
-
account["name"]: account["disableKeys"]
|
|
37
|
-
for account in accounts
|
|
38
|
-
if account.get("disableKeys")
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
def should_run(
|
|
43
|
-
state: State,
|
|
44
|
-
keys_to_delete: dict[str, list[str]],
|
|
45
|
-
keys_to_disable: dict[str, list[str]] | None = None,
|
|
46
|
-
) -> bool:
|
|
34
|
+
def should_run(state: State, keys_to_delete: dict[str, list[str]]) -> bool:
|
|
47
35
|
for account_name, keys in keys_to_delete.items():
|
|
48
36
|
if state.get(account_name, []) != keys:
|
|
49
37
|
return True
|
|
50
|
-
if keys_to_disable:
|
|
51
|
-
for account_name, keys in keys_to_disable.items():
|
|
52
|
-
disable_state_key = f"{account_name}_disable"
|
|
53
|
-
if state.get(disable_state_key, []) != keys:
|
|
54
|
-
return True
|
|
55
38
|
return False
|
|
56
39
|
|
|
57
40
|
|
|
58
|
-
def update_state(
|
|
59
|
-
state: State,
|
|
60
|
-
keys_to_update: dict[str, list[str]],
|
|
61
|
-
keys_to_disable: dict[str, list[str]] | None = None,
|
|
62
|
-
) -> None:
|
|
41
|
+
def update_state(state: State, keys_to_update: dict[str, list[str]]) -> None:
|
|
63
42
|
for account_name, keys in keys_to_update.items():
|
|
64
43
|
if state.get(account_name, []) != keys:
|
|
65
44
|
state.add(account_name, keys, force=True)
|
|
66
|
-
if keys_to_disable:
|
|
67
|
-
for account_name, keys in keys_to_disable.items():
|
|
68
|
-
disable_state_key = f"{account_name}_disable"
|
|
69
|
-
if state.get(disable_state_key, []) != keys:
|
|
70
|
-
state.add(disable_state_key, keys, force=True)
|
|
71
45
|
|
|
72
46
|
|
|
73
47
|
def init_tf_working_dirs(
|
|
@@ -91,6 +65,7 @@ def init_tf_working_dirs(
|
|
|
91
65
|
thread_pool_size,
|
|
92
66
|
accounts,
|
|
93
67
|
settings=settings,
|
|
68
|
+
default_tags=None,
|
|
94
69
|
)
|
|
95
70
|
return ts.dump()
|
|
96
71
|
|
|
@@ -122,8 +97,7 @@ def run(
|
|
|
122
97
|
if defer:
|
|
123
98
|
defer(state.cleanup)
|
|
124
99
|
keys_to_delete = get_keys_to_delete(accounts)
|
|
125
|
-
|
|
126
|
-
if not should_run(state, keys_to_delete, keys_to_disable):
|
|
100
|
+
if not should_run(state, keys_to_delete):
|
|
127
101
|
logging.debug("nothing to do here")
|
|
128
102
|
# using return because terraform-resources
|
|
129
103
|
# may be the calling entity, and has more to do
|
|
@@ -137,10 +111,6 @@ def run(
|
|
|
137
111
|
error, service_account_recycle_complete = aws.delete_keys(
|
|
138
112
|
dry_run, keys_to_delete, working_dirs, disable_service_account_keys
|
|
139
113
|
)
|
|
140
|
-
if keys_to_disable:
|
|
141
|
-
disable_error = aws.disable_keys(dry_run, keys_to_disable)
|
|
142
|
-
# combine errors from both operations
|
|
143
|
-
error = error or disable_error
|
|
144
114
|
if error:
|
|
145
115
|
sys.exit(1)
|
|
146
116
|
|
|
@@ -149,12 +119,8 @@ def run(
|
|
|
149
119
|
and not disable_service_account_keys
|
|
150
120
|
and service_account_recycle_complete
|
|
151
121
|
):
|
|
152
|
-
update_state(state, keys_to_delete
|
|
122
|
+
update_state(state, keys_to_delete)
|
|
153
123
|
|
|
154
124
|
|
|
155
125
|
def early_exit_desired_state(*args: Any, **kwargs: Any) -> dict[str, Any]:
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
"keys": get_keys_to_delete(accounts),
|
|
159
|
-
"disable_keys": get_keys_to_disable(accounts),
|
|
160
|
-
}
|
|
126
|
+
return {"keys": get_keys_to_delete(queries.get_aws_accounts(terraform_state=True))}
|
|
@@ -19,6 +19,7 @@ from reconcile.gql_definitions.aws_saml_idp.aws_accounts import (
|
|
|
19
19
|
query as aws_accounts_query,
|
|
20
20
|
)
|
|
21
21
|
from reconcile.status import ExitCodes
|
|
22
|
+
from reconcile.typed_queries.external_resources import get_settings
|
|
22
23
|
from reconcile.utils import gql
|
|
23
24
|
from reconcile.utils.aws_api import AWSApi
|
|
24
25
|
from reconcile.utils.constants import DEFAULT_THREAD_POOL_SIZE
|
|
@@ -81,7 +82,7 @@ class AwsSamlIdpIntegration(QontractReconcileIntegration[AwsSamlIdpIntegrationPa
|
|
|
81
82
|
if not query_func:
|
|
82
83
|
query_func = gql.get_api().query
|
|
83
84
|
return {
|
|
84
|
-
"accounts": [c.
|
|
85
|
+
"accounts": [c.model_dump() for c in self.get_aws_accounts(query_func)],
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
def get_aws_accounts(
|
|
@@ -124,20 +125,27 @@ class AwsSamlIdpIntegration(QontractReconcileIntegration[AwsSamlIdpIntegrationPa
|
|
|
124
125
|
aws_accounts = self.get_aws_accounts(
|
|
125
126
|
gql_api.query, account_name=self.params.account_name
|
|
126
127
|
)
|
|
127
|
-
aws_accounts_dict = [
|
|
128
|
-
|
|
128
|
+
aws_accounts_dict = [
|
|
129
|
+
account.model_dump(by_alias=True) for account in aws_accounts
|
|
130
|
+
]
|
|
131
|
+
try:
|
|
132
|
+
default_tags = get_settings().default_tags
|
|
133
|
+
except ValueError:
|
|
134
|
+
# no external resources settings found
|
|
135
|
+
default_tags = None
|
|
129
136
|
ts = TerrascriptClient(
|
|
130
137
|
self.name.replace("-", "_"),
|
|
131
138
|
"",
|
|
132
139
|
self.params.thread_pool_size,
|
|
133
140
|
aws_accounts_dict,
|
|
134
141
|
secret_reader=self.secret_reader,
|
|
142
|
+
default_tags=default_tags,
|
|
135
143
|
)
|
|
136
144
|
|
|
137
145
|
for saml_idp_config in self.build_saml_idp_config(
|
|
138
146
|
aws_accounts,
|
|
139
147
|
saml_idp_name=self.params.saml_idp_name,
|
|
140
|
-
saml_metadata=self.get_saml_metadata(self.params.saml_metadata_url),
|
|
148
|
+
saml_metadata=self.get_saml_metadata(str(self.params.saml_metadata_url)),
|
|
141
149
|
):
|
|
142
150
|
ts.populate_saml_idp(
|
|
143
151
|
account_name=saml_idp_config.account_name,
|