capo-codecatalyst 0.1.0__tar.gz
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.
- capo_codecatalyst-0.1.0/LICENSE +21 -0
- capo_codecatalyst-0.1.0/PKG-INFO +82 -0
- capo_codecatalyst-0.1.0/README.md +60 -0
- capo_codecatalyst-0.1.0/pyproject.toml +52 -0
- capo_codecatalyst-0.1.0/setup.cfg +4 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/__init__.py +51 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_async.py +25 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_auth/_identity.py +14 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_auth/_providers.py +154 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_auth/_signers.py +43 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_auth/_sigv4.py +434 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_auth/_zapros_handler.py +80 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_iter.py +113 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/create_access_token.py +153 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/create_dev_environment.py +165 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/create_project.py +158 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/create_source_repository.py +159 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/create_source_repository_branch.py +165 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/delete_access_token.py +146 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/delete_dev_environment.py +159 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/delete_project.py +155 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/delete_source_repository.py +155 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/delete_space.py +152 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_dev_environment.py +159 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_project.py +153 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_source_repository.py +156 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_source_repository_clone_urls.py +157 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_space.py +152 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_subscription.py +155 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_user_details.py +157 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_workflow.py +159 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/get_workflow_run.py +161 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_access_tokens.py +153 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_dev_environment_sessions.py +164 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_dev_environments.py +156 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_event_logs.py +160 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_projects.py +158 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_source_repositories.py +159 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_source_repository_branches.py +164 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_spaces.py +155 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_workflow_runs.py +166 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/list_workflows.py +168 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/start_dev_environment.py +160 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/start_dev_environment_session.py +163 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/start_workflow_run.py +160 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/stop_dev_environment.py +155 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/stop_dev_environment_session.py +156 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/update_dev_environment.py +164 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/update_project.py +159 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/update_space.py +156 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_operations/code_catalyst/verify_session.py +146 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_pagination.py +21 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_protocol/__init__.py +1 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_protocol/errors.py +93 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_protocol/eventstream.py +238 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_protocol/serialize.py +47 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_protocol/xml.py +33 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_resources/code_catalyst/access_token.py +359 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_resources/code_catalyst/space.py +578 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_rule_engine/__init__.py +0 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_rule_engine/_aws_partition.py +160 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_rule_engine/_endpoint_rule_set.py +98 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_rule_engine/_endpoint_runtime.py +389 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_services/_aws_config.py +156 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_services/_pipeline.py +195 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_services/async_code_catalyst.py +214 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/_services/code_catalyst.py +212 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/errors/__init__.py +33 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/errors/_base.py +94 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/errors/access_denied_exception.py +47 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/errors/conflict_exception.py +45 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/errors/resource_not_found_exception.py +47 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/errors/service_quota_exceeded_exception.py +49 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/errors/throttling_exception.py +45 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/errors/validation_exception.py +45 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/py.typed +0 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/_prelude/blob.py +12 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/_prelude/timestamp.py +17 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/access_token_id.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/access_token_name.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/access_token_secret.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/access_token_summaries.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/access_token_summary.py +54 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/client_token.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/comparison_operator.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_access_token_request.py +46 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_access_token_response.py +63 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_dev_environment_request.py +123 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_dev_environment_response.py +52 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_project_request.py +43 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_project_response.py +49 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_source_repository_branch_request.py +38 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_source_repository_branch_response.py +60 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_source_repository_request.py +38 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/create_source_repository_response.py +57 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_access_token_request.py +24 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_access_token_response.py +18 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_dev_environment_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_dev_environment_response.py +46 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_project_request.py +26 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_project_response.py +44 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_source_repository_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_source_repository_response.py +48 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_space_request.py +24 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/delete_space_response.py +37 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_access_details.py +38 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_repository_summaries.py +39 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_repository_summary.py +42 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_session_configuration.py +56 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_session_summary.py +71 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_session_type.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_sessions_summary_list.py +37 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_status.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_summary.py +163 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/dev_environment_summary_list.py +33 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/email_address.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/event_log_entries.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/event_log_entry.py +174 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/event_payload.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/execute_command_session_configuration.py +53 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/execute_command_session_configuration_arguments.py +14 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/filter.py +50 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/filter_key.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/filters.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_dev_environment_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_dev_environment_response.py +169 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_project_request.py +26 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_project_response.py +49 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_source_repository_clone_urls_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_source_repository_clone_urls_response.py +28 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_source_repository_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_source_repository_response.py +88 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_space_request.py +24 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_space_response.py +51 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_subscription_request.py +24 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_subscription_response.py +59 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_user_details_request.py +21 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_user_details_response.py +60 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_workflow_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_workflow_response.py +136 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_workflow_run_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/get_workflow_run_response.py +127 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/ide.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/ide_configuration.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/ide_configuration_list.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/ides.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/inactivity_timeout_minutes.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/instance_type.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_access_tokens_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_access_tokens_response.py +45 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_dev_environment_sessions_request.py +41 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_dev_environment_sessions_response.py +49 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_dev_environments_request.py +57 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_dev_environments_response.py +49 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_event_logs_request.py +75 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_event_logs_response.py +45 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_projects_request.py +53 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_projects_response.py +42 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_source_repositories_item.py +81 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_source_repositories_items.py +35 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_source_repositories_request.py +38 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_source_repositories_response.py +48 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_source_repository_branches_item.py +60 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_source_repository_branches_items.py +39 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_source_repository_branches_request.py +41 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_source_repository_branches_response.py +51 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_spaces_request.py +23 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_spaces_response.py +42 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_workflow_runs_request.py +54 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_workflow_runs_response.py +44 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_workflows_request.py +51 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/list_workflows_response.py +42 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/name_string.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/operation_type.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/persistent_storage.py +26 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/persistent_storage_configuration.py +28 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/project_description.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/project_display_name.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/project_information.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/project_list_filter.py +54 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/project_list_filters.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/project_summaries.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/project_summary.py +38 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/region_string.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/repositories_input.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/repository_input.py +40 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/sensitive_string.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/source_repository_branch_ref_string.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/source_repository_branch_string.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/source_repository_description_string.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/source_repository_id_string.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/source_repository_name_string.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/space_description.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/space_summaries.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/space_summary.py +51 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/start_dev_environment_request.py +63 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/start_dev_environment_response.py +54 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/start_dev_environment_session_request.py +52 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/start_dev_environment_session_response.py +77 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/start_workflow_run_request.py +35 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/start_workflow_run_response.py +53 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/status_reason.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/stop_dev_environment_request.py +29 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/stop_dev_environment_response.py +54 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/stop_dev_environment_session_request.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/stop_dev_environment_session_response.py +59 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/string_list.py +14 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/timestamp.py +20 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/update_dev_environment_request.py +76 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/update_dev_environment_response.py +93 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/update_project_request.py +35 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/update_project_response.py +46 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/update_space_request.py +33 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/update_space_response.py +40 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/user_identity.py +50 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/user_type.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/uuid.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/verify_session_response.py +23 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_definition.py +26 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_definition_summary.py +26 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_run_mode.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_run_sort_criteria.py +18 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_run_sort_criteria_list.py +35 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_run_status.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_run_status_reason.py +18 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_run_status_reasons.py +35 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_run_summaries.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_run_summary.py +119 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_sort_criteria.py +18 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_sort_criteria_list.py +33 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_status.py +5 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_summaries.py +31 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst/types/workflow_summary.py +123 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst.egg-info/PKG-INFO +82 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst.egg-info/SOURCES.txt +237 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst.egg-info/dependency_links.txt +1 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst.egg-info/requires.txt +1 -0
- capo_codecatalyst-0.1.0/src/capo_codecatalyst.egg-info/top_level.txt +1 -0
- capo_codecatalyst-0.1.0/tests/test_sigv4.py +557 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Karen Petrosyan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: capo-codecatalyst
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for Codecatalyst.
|
|
5
|
+
Classifier: Development Status :: 4 - Beta
|
|
6
|
+
Classifier: Intended Audience :: Developers
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: zapros>=0.13.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# Getting Started
|
|
24
|
+
|
|
25
|
+
## Installation
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
pip install capo-codecatalyst
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from capo_codecatalyst import AsyncCodeCatalystClient
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
async def main():
|
|
38
|
+
async with AsyncCodeCatalystClient() as code_catalyst:
|
|
39
|
+
# Example: call the get_user_details operation
|
|
40
|
+
response = await code_catalyst.get_user_details()
|
|
41
|
+
print(response["user_id"])
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Error Handling
|
|
45
|
+
|
|
46
|
+
The SDK raises exceptions for errors returned by the API. Catch them to handle failures gracefully.
|
|
47
|
+
|
|
48
|
+
```python
|
|
49
|
+
from capo_codecatalyst import AsyncCodeCatalystClient
|
|
50
|
+
from capo_codecatalyst.error import AccessDeniedException
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
async def main():
|
|
54
|
+
async with AsyncCodeCatalystClient() as code_catalyst:
|
|
55
|
+
try:
|
|
56
|
+
await code_catalyst.get_user_details()
|
|
57
|
+
except AccessDeniedException as e:
|
|
58
|
+
print(f"Error: {e}")
|
|
59
|
+
print(e.data) # additional error data
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Retrying
|
|
63
|
+
|
|
64
|
+
The SDK retries failed operations automatically. Retry behaviour follows the Smithy specification: errors are retried based on their `is_retryable` and `is_throttling_error` attributes. Throttling errors use a longer base delay. Network-level failures (connection errors and timeouts) are also retried. Non-retryable errors, such as client errors without the `@retryable` trait, are raised immediately without further attempts.
|
|
65
|
+
|
|
66
|
+
The number of attempts defaults to 3 and can be changed at the client level via `retry_max_attempts`, or per call via `config_overrides`.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
from capo_codecatalyst import AsyncCodeCatalystClient
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
async def main():
|
|
73
|
+
async with AsyncCodeCatalystClient() as code_catalyst:
|
|
74
|
+
# Default: 3 attempts for every operation
|
|
75
|
+
response = await code_catalyst.get_user_details()
|
|
76
|
+
|
|
77
|
+
# Override per operation
|
|
78
|
+
response = await code_catalyst.get_user_details(config_overrides={"retry_max_attempts": 5})
|
|
79
|
+
|
|
80
|
+
# Disable retries for this call
|
|
81
|
+
response = await code_catalyst.get_user_details(config_overrides={"retry_max_attempts": 1})
|
|
82
|
+
```
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Getting Started
|
|
2
|
+
|
|
3
|
+
## Installation
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
pip install capo-codecatalyst
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
from capo_codecatalyst import AsyncCodeCatalystClient
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
async def main():
|
|
16
|
+
async with AsyncCodeCatalystClient() as code_catalyst:
|
|
17
|
+
# Example: call the get_user_details operation
|
|
18
|
+
response = await code_catalyst.get_user_details()
|
|
19
|
+
print(response["user_id"])
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Error Handling
|
|
23
|
+
|
|
24
|
+
The SDK raises exceptions for errors returned by the API. Catch them to handle failures gracefully.
|
|
25
|
+
|
|
26
|
+
```python
|
|
27
|
+
from capo_codecatalyst import AsyncCodeCatalystClient
|
|
28
|
+
from capo_codecatalyst.error import AccessDeniedException
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
async def main():
|
|
32
|
+
async with AsyncCodeCatalystClient() as code_catalyst:
|
|
33
|
+
try:
|
|
34
|
+
await code_catalyst.get_user_details()
|
|
35
|
+
except AccessDeniedException as e:
|
|
36
|
+
print(f"Error: {e}")
|
|
37
|
+
print(e.data) # additional error data
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Retrying
|
|
41
|
+
|
|
42
|
+
The SDK retries failed operations automatically. Retry behaviour follows the Smithy specification: errors are retried based on their `is_retryable` and `is_throttling_error` attributes. Throttling errors use a longer base delay. Network-level failures (connection errors and timeouts) are also retried. Non-retryable errors, such as client errors without the `@retryable` trait, are raised immediately without further attempts.
|
|
43
|
+
|
|
44
|
+
The number of attempts defaults to 3 and can be changed at the client level via `retry_max_attempts`, or per call via `config_overrides`.
|
|
45
|
+
|
|
46
|
+
```python
|
|
47
|
+
from capo_codecatalyst import AsyncCodeCatalystClient
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
async def main():
|
|
51
|
+
async with AsyncCodeCatalystClient() as code_catalyst:
|
|
52
|
+
# Default: 3 attempts for every operation
|
|
53
|
+
response = await code_catalyst.get_user_details()
|
|
54
|
+
|
|
55
|
+
# Override per operation
|
|
56
|
+
response = await code_catalyst.get_user_details(config_overrides={"retry_max_attempts": 5})
|
|
57
|
+
|
|
58
|
+
# Disable retries for this call
|
|
59
|
+
response = await code_catalyst.get_user_details(config_overrides={"retry_max_attempts": 1})
|
|
60
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "capo-codecatalyst"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Python SDK for Codecatalyst."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
classifiers = [
|
|
8
|
+
"Development Status :: 4 - Beta",
|
|
9
|
+
"Intended Audience :: Developers",
|
|
10
|
+
"License :: OSI Approved :: MIT License",
|
|
11
|
+
"Operating System :: OS Independent",
|
|
12
|
+
"Programming Language :: Python :: 3",
|
|
13
|
+
"Programming Language :: Python :: 3.10",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Programming Language :: Python :: 3.14",
|
|
18
|
+
"Topic :: Software Development :: Code Generators",
|
|
19
|
+
"Typing :: Typed",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"zapros>=0.13.0",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[tool.pytest.ini_options]
|
|
26
|
+
pythonpath = ["src"]
|
|
27
|
+
testpaths = ["tests"]
|
|
28
|
+
|
|
29
|
+
[tool.ty.environment]
|
|
30
|
+
python-version = "3.14"
|
|
31
|
+
root = ["./src"]
|
|
32
|
+
|
|
33
|
+
[tool.ty.src]
|
|
34
|
+
include = ["src", "tests"]
|
|
35
|
+
|
|
36
|
+
[tool.ty.rules]
|
|
37
|
+
missing-typed-dict-key = "ignore"
|
|
38
|
+
unused-type-ignore-comment = "ignore"
|
|
39
|
+
|
|
40
|
+
[tool.ruff.lint]
|
|
41
|
+
select = ["E", "F", "I"]
|
|
42
|
+
ignore = ["E501", "E741"]
|
|
43
|
+
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
dev = [
|
|
46
|
+
"inline-snapshot>=0.33.0",
|
|
47
|
+
# TODO: fix for 0.0.69
|
|
48
|
+
"ty==0.0.68",
|
|
49
|
+
"pytest>=9.0.3",
|
|
50
|
+
"ruff>=0.15.14",
|
|
51
|
+
"trio",
|
|
52
|
+
]
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from . import _iter as _iter
|
|
4
|
+
from . import _protocol as _protocol
|
|
5
|
+
from ._auth._identity import BearerToken as BearerToken
|
|
6
|
+
from ._auth._identity import Identity as Identity
|
|
7
|
+
from ._auth._providers import (
|
|
8
|
+
BearerTokenProvider as BearerTokenProvider,
|
|
9
|
+
)
|
|
10
|
+
from ._auth._providers import (
|
|
11
|
+
CachedProvider as CachedProvider,
|
|
12
|
+
)
|
|
13
|
+
from ._auth._providers import (
|
|
14
|
+
ChainedProvider as ChainedProvider,
|
|
15
|
+
)
|
|
16
|
+
from ._auth._providers import (
|
|
17
|
+
IdentityNotFound as IdentityNotFound,
|
|
18
|
+
)
|
|
19
|
+
from ._auth._providers import (
|
|
20
|
+
IdentityProvider as IdentityProvider,
|
|
21
|
+
)
|
|
22
|
+
from ._auth._providers import (
|
|
23
|
+
SsoTokenCacheProvider as SsoTokenCacheProvider,
|
|
24
|
+
)
|
|
25
|
+
from ._auth._providers import (
|
|
26
|
+
StaticBearerTokenProvider as StaticBearerTokenProvider,
|
|
27
|
+
)
|
|
28
|
+
from ._auth._signers import HttpBearerSigner as HttpBearerSigner
|
|
29
|
+
from ._auth._signers import Signer as Signer
|
|
30
|
+
from ._services._pipeline import (
|
|
31
|
+
AsyncOperationOptions as AsyncOperationOptions,
|
|
32
|
+
)
|
|
33
|
+
from ._services._pipeline import (
|
|
34
|
+
AsyncOperationRequest as AsyncOperationRequest,
|
|
35
|
+
)
|
|
36
|
+
from ._services._pipeline import (
|
|
37
|
+
AsyncOperationResponse as AsyncOperationResponse,
|
|
38
|
+
)
|
|
39
|
+
from ._services._pipeline import (
|
|
40
|
+
OperationOptions as OperationOptions,
|
|
41
|
+
)
|
|
42
|
+
from ._services._pipeline import (
|
|
43
|
+
OperationRequest as OperationRequest,
|
|
44
|
+
)
|
|
45
|
+
from ._services._pipeline import (
|
|
46
|
+
OperationResponse as OperationResponse,
|
|
47
|
+
)
|
|
48
|
+
from ._services.async_code_catalyst import (
|
|
49
|
+
AsyncCodeCatalystClient as AsyncCodeCatalystClient,
|
|
50
|
+
)
|
|
51
|
+
from ._services.code_catalyst import CodeCatalystClient as CodeCatalystClient
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
|
+
|
|
6
|
+
if TYPE_CHECKING:
|
|
7
|
+
import trio
|
|
8
|
+
else:
|
|
9
|
+
try:
|
|
10
|
+
import trio
|
|
11
|
+
except ImportError:
|
|
12
|
+
trio = None
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def in_trio_run() -> bool:
|
|
16
|
+
if trio is None:
|
|
17
|
+
return False
|
|
18
|
+
return trio.lowlevel.in_trio_run()
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
async def anysleep(delay: float) -> None:
|
|
22
|
+
if in_trio_run():
|
|
23
|
+
await trio.sleep(delay)
|
|
24
|
+
else:
|
|
25
|
+
await asyncio.sleep(delay)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
from typing import TypedDict
|
|
5
|
+
|
|
6
|
+
from typing_extensions import NotRequired
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Identity(TypedDict):
|
|
10
|
+
expiration: NotRequired[datetime | None]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BearerToken(Identity):
|
|
14
|
+
token: str
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from abc import abstractmethod
|
|
5
|
+
from datetime import datetime, timezone
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Generic, TypeVar
|
|
8
|
+
|
|
9
|
+
from capo_codecatalyst._auth._identity import (
|
|
10
|
+
BearerToken,
|
|
11
|
+
Identity,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class IdentityNotFound(Exception):
|
|
16
|
+
"""Raised when a provider cannot resolve an identity. Chain continues."""
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
IdentityT = TypeVar("IdentityT", bound="Identity")
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class IdentityProvider(Generic[IdentityT]):
|
|
23
|
+
@abstractmethod
|
|
24
|
+
def resolve_identity(self) -> IdentityT:
|
|
25
|
+
raise NotImplementedError
|
|
26
|
+
|
|
27
|
+
async def aresolve_identity(self) -> IdentityT:
|
|
28
|
+
# default: no network I/O, reuse the sync resolution
|
|
29
|
+
return self.resolve_identity()
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ChainedProvider(IdentityProvider[IdentityT]):
|
|
33
|
+
"""Try each provider in order; first non-`IdentityNotFound` wins."""
|
|
34
|
+
|
|
35
|
+
def __init__(self, *providers: IdentityProvider[IdentityT]) -> None:
|
|
36
|
+
if not providers:
|
|
37
|
+
raise ValueError("ChainedProvider requires at least one provider")
|
|
38
|
+
self._providers = providers
|
|
39
|
+
|
|
40
|
+
def resolve_identity(self) -> IdentityT:
|
|
41
|
+
errors: list[str] = []
|
|
42
|
+
for p in self._providers:
|
|
43
|
+
try:
|
|
44
|
+
return p.resolve_identity()
|
|
45
|
+
except IdentityNotFound as e:
|
|
46
|
+
errors.append(f"{type(p).__name__}: {e}")
|
|
47
|
+
raise IdentityNotFound("no provider succeeded: " + "; ".join(errors))
|
|
48
|
+
|
|
49
|
+
async def aresolve_identity(self) -> IdentityT:
|
|
50
|
+
errors: list[str] = []
|
|
51
|
+
for p in self._providers:
|
|
52
|
+
try:
|
|
53
|
+
return await p.aresolve_identity()
|
|
54
|
+
except IdentityNotFound as e:
|
|
55
|
+
errors.append(f"{type(p).__name__}: {e}")
|
|
56
|
+
raise IdentityNotFound("no provider succeeded: " + "; ".join(errors))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class CachedProvider(IdentityProvider[IdentityT]):
|
|
60
|
+
"""Cache an identity until its `expiration` (minus skew) elapses."""
|
|
61
|
+
|
|
62
|
+
_SKEW_SECONDS = 60
|
|
63
|
+
|
|
64
|
+
def __init__(self, inner: IdentityProvider[IdentityT]) -> None:
|
|
65
|
+
self._inner = inner
|
|
66
|
+
self._cached: IdentityT | None = None
|
|
67
|
+
|
|
68
|
+
def resolve_identity(self) -> IdentityT:
|
|
69
|
+
if self._cached is not None and not self._expired(self._cached):
|
|
70
|
+
return self._cached
|
|
71
|
+
self._cached = self._inner.resolve_identity()
|
|
72
|
+
return self._cached
|
|
73
|
+
|
|
74
|
+
async def aresolve_identity(self) -> IdentityT:
|
|
75
|
+
if self._cached is not None and not self._expired(self._cached):
|
|
76
|
+
return self._cached
|
|
77
|
+
self._cached = await self._inner.aresolve_identity()
|
|
78
|
+
return self._cached
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def _expired(cls, ident: Identity) -> bool:
|
|
82
|
+
exp = ident.get("expiration")
|
|
83
|
+
if exp is None:
|
|
84
|
+
return False
|
|
85
|
+
return (exp - datetime.now(timezone.utc)).total_seconds() <= cls._SKEW_SECONDS
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class BearerTokenProvider(IdentityProvider[BearerToken]):
|
|
89
|
+
"""Base class for providers that resolve a `BearerToken`."""
|
|
90
|
+
|
|
91
|
+
@abstractmethod
|
|
92
|
+
def resolve_identity(self) -> BearerToken:
|
|
93
|
+
raise NotImplementedError
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class StaticBearerTokenProvider(BearerTokenProvider):
|
|
97
|
+
def __init__(self, token: str) -> None:
|
|
98
|
+
self._token: BearerToken = {"token": token}
|
|
99
|
+
|
|
100
|
+
def resolve_identity(self) -> BearerToken:
|
|
101
|
+
return self._token
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class SsoTokenCacheProvider(BearerTokenProvider):
|
|
105
|
+
"""Read a token cached by `aws sso login` from ~/.aws/sso/cache/."""
|
|
106
|
+
|
|
107
|
+
def __init__(
|
|
108
|
+
self, cache_dir: Path | None = None, session_name: str | None = None
|
|
109
|
+
) -> None:
|
|
110
|
+
self._cache_dir = cache_dir or (Path.home() / ".aws" / "sso" / "cache")
|
|
111
|
+
self._session_name = session_name
|
|
112
|
+
|
|
113
|
+
def resolve_identity(self) -> BearerToken:
|
|
114
|
+
if not self._cache_dir.is_dir():
|
|
115
|
+
raise IdentityNotFound(f"SSO cache dir missing: {self._cache_dir}")
|
|
116
|
+
|
|
117
|
+
entry = self._select_entry()
|
|
118
|
+
if entry is None:
|
|
119
|
+
raise IdentityNotFound("no usable SSO cache entry")
|
|
120
|
+
|
|
121
|
+
token = entry.get("accessToken")
|
|
122
|
+
if not isinstance(token, str) or not token:
|
|
123
|
+
raise IdentityNotFound("SSO cache entry has no accessToken")
|
|
124
|
+
|
|
125
|
+
out: BearerToken = {"token": token}
|
|
126
|
+
exp = entry.get("expiresAt")
|
|
127
|
+
if isinstance(exp, str):
|
|
128
|
+
out["expiration"] = _parse_iso8601(exp)
|
|
129
|
+
return out
|
|
130
|
+
|
|
131
|
+
def _select_entry(self) -> dict[str, object] | None:
|
|
132
|
+
candidates: list[tuple[float, dict[str, object]]] = []
|
|
133
|
+
for path in self._cache_dir.glob("*.json"):
|
|
134
|
+
try:
|
|
135
|
+
data: dict[str, object] = json.loads(path.read_text())
|
|
136
|
+
except (OSError, json.JSONDecodeError):
|
|
137
|
+
continue
|
|
138
|
+
if self._session_name and data.get("sessionName") != self._session_name:
|
|
139
|
+
continue
|
|
140
|
+
if "accessToken" not in data:
|
|
141
|
+
continue
|
|
142
|
+
candidates.append((path.stat().st_mtime, data))
|
|
143
|
+
if not candidates:
|
|
144
|
+
return None
|
|
145
|
+
return max(candidates, key=lambda x: x[0])[1]
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
def _parse_iso8601(value: str) -> datetime:
|
|
149
|
+
# tolerate trailing 'Z'
|
|
150
|
+
return datetime.fromisoformat(value.replace("Z", "+00:00"))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def default_bearer_token_provider() -> IdentityProvider[BearerToken]:
|
|
154
|
+
return CachedProvider(SsoTokenCacheProvider())
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import Generic, TypeVar
|
|
5
|
+
|
|
6
|
+
from zapros import Request
|
|
7
|
+
|
|
8
|
+
from capo_codecatalyst._auth._identity import BearerToken, Identity
|
|
9
|
+
from capo_codecatalyst._auth._providers import IdentityProvider
|
|
10
|
+
|
|
11
|
+
IdentityT = TypeVar("IdentityT", bound="Identity")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class Signer(ABC, Generic[IdentityT]):
|
|
15
|
+
"""Per-request request signer. Holds an IdentityProvider plus static config."""
|
|
16
|
+
|
|
17
|
+
def __init__(self, provider: IdentityProvider[IdentityT]) -> None:
|
|
18
|
+
self.provider = provider
|
|
19
|
+
|
|
20
|
+
@abstractmethod
|
|
21
|
+
async def asign(self, req: Request) -> Request: ...
|
|
22
|
+
@abstractmethod
|
|
23
|
+
def sign(self, req: Request) -> Request: ...
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class HttpBearerSigner(Signer[BearerToken]):
|
|
27
|
+
"""smithy.api#httpBearerAuth — RFC 6750 ``Authorization: Bearer <token>``."""
|
|
28
|
+
|
|
29
|
+
async def asign(self, req: Request) -> Request:
|
|
30
|
+
t = await self.provider.aresolve_identity()
|
|
31
|
+
headers = req.headers.copy()
|
|
32
|
+
headers["Authorization"] = f"Bearer {t['token']}"
|
|
33
|
+
return Request(
|
|
34
|
+
req.url, req.method, headers, body=req.body or b"", context=req.context
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
def sign(self, req: Request) -> Request:
|
|
38
|
+
t = self.provider.resolve_identity()
|
|
39
|
+
headers = req.headers.copy()
|
|
40
|
+
headers["Authorization"] = f"Bearer {t['token']}"
|
|
41
|
+
return Request(
|
|
42
|
+
req.url, req.method, headers, body=req.body or b"", context=req.context
|
|
43
|
+
)
|