From ee69097e970f5962f02e1dfb3a95afa3aab83032 Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Date: Tue, 5 May 2026 12:35:00 +0530 Subject: [PATCH 1/6] feat: commit generated Rust SDK at sdks/rust for downstream consumers Adds the smithy-rs generated kronos_sdk crate at a stable path so external Rust services (e.g. aarokya) can depend on it via a Cargo git dep without needing the Smithy CLI, JVM, or Juspay's Maven mirror in their build. - sdks/rust/: 216 generated files (kronos_sdk v0.1.0, MSRV 1.82) - Cargo.toml: exclude sdks/rust from workspace (different MSRV + heavy AWS smithy runtime stack that server crates do not need) - justfile: smithy-build now validates, regenerates, and syncs sdks/rust in one command; new smithy-validate and smithy-check (CI drift guard) recipes - sdks/rust/README.md: DO NOT EDIT warning + regeneration instructions --- Cargo.toml | 6 + justfile | 21 +- sdks/rust/Cargo.toml | 43 + sdks/rust/README.md | 32 + sdks/rust/src/auth_plugin.rs | 41 + sdks/rust/src/client.rs | 177 +++ sdks/rust/src/client/cancel_execution.rs | 16 + sdks/rust/src/client/cancel_job.rs | 16 + sdks/rust/src/client/create_endpoint.rs | 21 + sdks/rust/src/client/create_job.rs | 24 + sdks/rust/src/client/create_payload_spec.rs | 17 + sdks/rust/src/client/customize.rs | 141 ++ sdks/rust/src/client/customize/internal.rs | 18 + sdks/rust/src/client/delete_endpoint.rs | 15 + sdks/rust/src/client/delete_payload_spec.rs | 15 + sdks/rust/src/client/get_endpoint.rs | 16 + sdks/rust/src/client/get_execution.rs | 16 + sdks/rust/src/client/get_job.rs | 16 + sdks/rust/src/client/get_job_status.rs | 16 + sdks/rust/src/client/get_job_versions.rs | 16 + sdks/rust/src/client/get_payload_spec.rs | 16 + sdks/rust/src/client/list_endpoints.rs | 18 + .../src/client/list_execution_attempts.rs | 19 + sdks/rust/src/client/list_execution_logs.rs | 19 + sdks/rust/src/client/list_job_executions.rs | 20 + sdks/rust/src/client/list_jobs.rs | 21 + sdks/rust/src/client/list_payload_specs.rs | 18 + sdks/rust/src/client/update_endpoint.rs | 20 + sdks/rust/src/client/update_job.rs | 21 + sdks/rust/src/client/update_payload_spec.rs | 17 + sdks/rust/src/config.rs | 1139 +++++++++++++++++ sdks/rust/src/config/endpoint.rs | 89 ++ sdks/rust/src/config/http.rs | 4 + sdks/rust/src/config/interceptors.rs | 12 + sdks/rust/src/config/retry.rs | 8 + sdks/rust/src/config/timeout.rs | 3 + sdks/rust/src/error.rs | 31 + sdks/rust/src/error/sealed_unhandled.rs | 21 + sdks/rust/src/error_meta.rs | 618 +++++++++ sdks/rust/src/json_errors.rs | 212 +++ sdks/rust/src/lib.rs | 136 ++ sdks/rust/src/meta.rs | 5 + sdks/rust/src/operation.rs | 68 + sdks/rust/src/operation/cancel_execution.rs | 364 ++++++ .../_cancel_execution_input.rs | 99 ++ .../_cancel_execution_output.rs | 58 + .../operation/cancel_execution/builders.rs | 141 ++ sdks/rust/src/operation/cancel_job.rs | 364 ++++++ .../operation/cancel_job/_cancel_job_input.rs | 99 ++ .../cancel_job/_cancel_job_output.rs | 58 + .../rust/src/operation/cancel_job/builders.rs | 141 ++ sdks/rust/src/operation/create_endpoint.rs | 378 ++++++ .../create_endpoint/_create_endpoint_input.rs | 211 +++ .../_create_endpoint_output.rs | 58 + .../src/operation/create_endpoint/builders.rs | 211 +++ sdks/rust/src/operation/create_job.rs | 394 ++++++ .../operation/create_job/_create_job_input.rs | 276 ++++ .../create_job/_create_job_output.rs | 58 + .../rust/src/operation/create_job/builders.rs | 253 ++++ .../rust/src/operation/create_payload_spec.rs | 362 ++++++ .../_create_payload_spec_input.rs | 122 ++ .../_create_payload_spec_output.rs | 58 + .../operation/create_payload_spec/builders.rs | 155 +++ sdks/rust/src/operation/delete_endpoint.rs | 348 +++++ .../delete_endpoint/_delete_endpoint_input.rs | 99 ++ .../_delete_endpoint_output.rs | 26 + .../src/operation/delete_endpoint/builders.rs | 141 ++ .../rust/src/operation/delete_payload_spec.rs | 348 +++++ .../_delete_payload_spec_input.rs | 99 ++ .../_delete_payload_spec_output.rs | 26 + .../operation/delete_payload_spec/builders.rs | 141 ++ sdks/rust/src/operation/get_endpoint.rs | 348 +++++ .../get_endpoint/_get_endpoint_input.rs | 99 ++ .../get_endpoint/_get_endpoint_output.rs | 58 + .../src/operation/get_endpoint/builders.rs | 141 ++ sdks/rust/src/operation/get_execution.rs | 348 +++++ .../get_execution/_get_execution_input.rs | 99 ++ .../get_execution/_get_execution_output.rs | 58 + .../src/operation/get_execution/builders.rs | 141 ++ sdks/rust/src/operation/get_job.rs | 348 +++++ .../src/operation/get_job/_get_job_input.rs | 99 ++ .../src/operation/get_job/_get_job_output.rs | 58 + sdks/rust/src/operation/get_job/builders.rs | 141 ++ sdks/rust/src/operation/get_job_status.rs | 348 +++++ .../get_job_status/_get_job_status_input.rs | 99 ++ .../get_job_status/_get_job_status_output.rs | 58 + .../src/operation/get_job_status/builders.rs | 141 ++ sdks/rust/src/operation/get_job_versions.rs | 348 +++++ .../_get_job_versions_input.rs | 99 ++ .../_get_job_versions_output.rs | 62 + .../operation/get_job_versions/builders.rs | 141 ++ sdks/rust/src/operation/get_payload_spec.rs | 348 +++++ .../_get_payload_spec_input.rs | 99 ++ .../_get_payload_spec_output.rs | 58 + .../operation/get_payload_spec/builders.rs | 141 ++ sdks/rust/src/operation/list_endpoints.rs | 341 +++++ .../list_endpoints/_list_endpoints_input.rs | 120 ++ .../list_endpoints/_list_endpoints_output.rs | 84 ++ .../src/operation/list_endpoints/builders.rs | 155 +++ .../src/operation/list_execution_attempts.rs | 363 ++++++ .../_list_execution_attempts_input.rs | 143 +++ .../_list_execution_attempts_output.rs | 84 ++ .../list_execution_attempts/builders.rs | 169 +++ .../rust/src/operation/list_execution_logs.rs | 363 ++++++ .../_list_execution_logs_input.rs | 143 +++ .../_list_execution_logs_output.rs | 84 ++ .../operation/list_execution_logs/builders.rs | 169 +++ .../rust/src/operation/list_job_executions.rs | 368 ++++++ .../_list_job_executions_input.rs | 165 +++ .../_list_job_executions_output.rs | 84 ++ .../operation/list_job_executions/builders.rs | 183 +++ sdks/rust/src/operation/list_jobs.rs | 356 ++++++ .../operation/list_jobs/_list_jobs_input.rs | 186 +++ .../operation/list_jobs/_list_jobs_output.rs | 84 ++ sdks/rust/src/operation/list_jobs/builders.rs | 197 +++ sdks/rust/src/operation/list_payload_specs.rs | 341 +++++ .../_list_payload_specs_input.rs | 120 ++ .../_list_payload_specs_output.rs | 84 ++ .../operation/list_payload_specs/builders.rs | 155 +++ sdks/rust/src/operation/update_endpoint.rs | 384 ++++++ .../update_endpoint/_update_endpoint_input.rs | 187 +++ .../_update_endpoint_output.rs | 58 + .../src/operation/update_endpoint/builders.rs | 197 +++ sdks/rust/src/operation/update_job.rs | 384 ++++++ .../operation/update_job/_update_job_input.rs | 209 +++ .../update_job/_update_job_output.rs | 58 + .../rust/src/operation/update_job/builders.rs | 211 +++ .../rust/src/operation/update_payload_spec.rs | 368 ++++++ .../_update_payload_spec_input.rs | 122 ++ .../_update_payload_spec_output.rs | 58 + .../operation/update_payload_spec/builders.rs | 155 +++ sdks/rust/src/primitives.rs | 9 + sdks/rust/src/primitives/event_stream.rs | 3 + .../src/primitives/sealed_enum_unknown.rs | 20 + sdks/rust/src/protocol_serde.rs | 129 ++ .../protocol_serde/shape_attempt_resource.rs | 93 ++ .../shape_attempt_resource_list.rs | 30 + .../protocol_serde/shape_cancel_execution.rs | 164 +++ .../src/protocol_serde/shape_cancel_job.rs | 164 +++ .../protocol_serde/shape_conflict_error.rs | 36 + .../protocol_serde/shape_create_endpoint.rs | 188 +++ .../shape_create_endpoint_input.rs | 29 + .../src/protocol_serde/shape_create_job.rs | 204 +++ .../protocol_serde/shape_create_job_input.rs | 35 + .../shape_create_payload_spec.rs | 172 +++ .../shape_create_payload_spec_input.rs | 14 + .../protocol_serde/shape_delete_endpoint.rs | 121 ++ .../shape_delete_payload_spec.rs | 121 ++ .../src/protocol_serde/shape_endpoint_list.rs | 30 + .../protocol_serde/shape_endpoint_resource.rs | 83 ++ .../src/protocol_serde/shape_error_detail.rs | 54 + .../shape_execution_log_list.rs | 30 + .../shape_execution_log_resource.rs | 75 ++ .../shape_execution_resource.rs | 141 ++ .../shape_execution_resource_list.rs | 30 + .../protocol_serde/shape_execution_summary.rs | 69 + .../src/protocol_serde/shape_get_endpoint.rs | 148 +++ .../src/protocol_serde/shape_get_execution.rs | 148 +++ sdks/rust/src/protocol_serde/shape_get_job.rs | 148 +++ .../protocol_serde/shape_get_job_status.rs | 148 +++ .../protocol_serde/shape_get_job_versions.rs | 148 +++ .../protocol_serde/shape_get_payload_spec.rs | 148 +++ .../protocol_serde/shape_internal_error.rs | 36 + .../shape_invalid_request_error.rs | 36 + .../src/protocol_serde/shape_job_resource.rs | 164 +++ .../shape_job_status_response.rs | 50 + .../src/protocol_serde/shape_job_summary.rs | 75 ++ .../protocol_serde/shape_job_summary_list.rs | 30 + .../protocol_serde/shape_job_version_list.rs | 30 + .../protocol_serde/shape_list_endpoints.rs | 141 ++ .../shape_list_execution_attempts.rs | 157 +++ .../shape_list_execution_logs.rs | 157 +++ .../shape_list_job_executions.rs | 157 +++ .../src/protocol_serde/shape_list_jobs.rs | 141 ++ .../shape_list_payload_specs.rs | 141 ++ .../protocol_serde/shape_not_found_error.rs | 36 + .../protocol_serde/shape_payload_spec_list.rs | 30 + .../shape_payload_spec_resource.rs | 51 + .../shape_rate_limited_error.rs | 36 + .../src/protocol_serde/shape_retry_policy.rs | 76 ++ .../shape_unauthorized_error.rs | 36 + .../shape_unprocessable_entity_error.rs | 36 + .../protocol_serde/shape_update_endpoint.rs | 188 +++ .../shape_update_endpoint_input.rs | 23 + .../src/protocol_serde/shape_update_job.rs | 188 +++ .../protocol_serde/shape_update_job_input.rs | 23 + .../shape_update_payload_spec.rs | 172 +++ .../shape_update_payload_spec_input.rs | 11 + sdks/rust/src/sdk_feature_tracker.rs | 222 ++++ sdks/rust/src/serde_util.rs | 227 ++++ sdks/rust/src/serialization_settings.rs | 91 ++ sdks/rust/src/types.rs | 79 ++ sdks/rust/src/types/_attempt_resource.rs | 281 ++++ sdks/rust/src/types/_attempt_status_enum.rs | 107 ++ sdks/rust/src/types/_backoff_type_enum.rs | 113 ++ sdks/rust/src/types/_endpoint_resource.rs | 232 ++++ sdks/rust/src/types/_endpoint_type_enum.rs | 113 ++ sdks/rust/src/types/_error_detail.rs | 107 ++ .../rust/src/types/_execution_log_resource.rs | 193 +++ sdks/rust/src/types/_execution_resource.rs | 428 +++++++ sdks/rust/src/types/_execution_status_enum.rs | 137 ++ sdks/rust/src/types/_execution_summary.rs | 183 +++ sdks/rust/src/types/_job_resource.rs | 484 +++++++ sdks/rust/src/types/_job_status_enum.rs | 107 ++ sdks/rust/src/types/_job_status_response.rs | 107 ++ sdks/rust/src/types/_job_summary.rs | 193 +++ sdks/rust/src/types/_log_level_enum.rs | 119 ++ sdks/rust/src/types/_payload_spec_resource.rs | 139 ++ sdks/rust/src/types/_retry_policy.rs | 116 ++ sdks/rust/src/types/_trigger_type_enum.rs | 113 ++ sdks/rust/src/types/builders.rs | 23 + sdks/rust/src/types/error.rs | 32 + sdks/rust/src/types/error/_conflict_error.rs | 109 ++ sdks/rust/src/types/error/_internal_error.rs | 109 ++ .../src/types/error/_invalid_request_error.rs | 109 ++ sdks/rust/src/types/error/_not_found_error.rs | 109 ++ .../src/types/error/_rate_limited_error.rs | 109 ++ .../src/types/error/_unauthorized_error.rs | 109 ++ .../error/_unprocessable_entity_error.rs | 109 ++ sdks/rust/src/types/error/builders.rs | 15 + 220 files changed, 28993 insertions(+), 2 deletions(-) create mode 100644 sdks/rust/Cargo.toml create mode 100644 sdks/rust/README.md create mode 100644 sdks/rust/src/auth_plugin.rs create mode 100644 sdks/rust/src/client.rs create mode 100644 sdks/rust/src/client/cancel_execution.rs create mode 100644 sdks/rust/src/client/cancel_job.rs create mode 100644 sdks/rust/src/client/create_endpoint.rs create mode 100644 sdks/rust/src/client/create_job.rs create mode 100644 sdks/rust/src/client/create_payload_spec.rs create mode 100644 sdks/rust/src/client/customize.rs create mode 100644 sdks/rust/src/client/customize/internal.rs create mode 100644 sdks/rust/src/client/delete_endpoint.rs create mode 100644 sdks/rust/src/client/delete_payload_spec.rs create mode 100644 sdks/rust/src/client/get_endpoint.rs create mode 100644 sdks/rust/src/client/get_execution.rs create mode 100644 sdks/rust/src/client/get_job.rs create mode 100644 sdks/rust/src/client/get_job_status.rs create mode 100644 sdks/rust/src/client/get_job_versions.rs create mode 100644 sdks/rust/src/client/get_payload_spec.rs create mode 100644 sdks/rust/src/client/list_endpoints.rs create mode 100644 sdks/rust/src/client/list_execution_attempts.rs create mode 100644 sdks/rust/src/client/list_execution_logs.rs create mode 100644 sdks/rust/src/client/list_job_executions.rs create mode 100644 sdks/rust/src/client/list_jobs.rs create mode 100644 sdks/rust/src/client/list_payload_specs.rs create mode 100644 sdks/rust/src/client/update_endpoint.rs create mode 100644 sdks/rust/src/client/update_job.rs create mode 100644 sdks/rust/src/client/update_payload_spec.rs create mode 100644 sdks/rust/src/config.rs create mode 100644 sdks/rust/src/config/endpoint.rs create mode 100644 sdks/rust/src/config/http.rs create mode 100644 sdks/rust/src/config/interceptors.rs create mode 100644 sdks/rust/src/config/retry.rs create mode 100644 sdks/rust/src/config/timeout.rs create mode 100644 sdks/rust/src/error.rs create mode 100644 sdks/rust/src/error/sealed_unhandled.rs create mode 100644 sdks/rust/src/error_meta.rs create mode 100644 sdks/rust/src/json_errors.rs create mode 100644 sdks/rust/src/lib.rs create mode 100644 sdks/rust/src/meta.rs create mode 100644 sdks/rust/src/operation.rs create mode 100644 sdks/rust/src/operation/cancel_execution.rs create mode 100644 sdks/rust/src/operation/cancel_execution/_cancel_execution_input.rs create mode 100644 sdks/rust/src/operation/cancel_execution/_cancel_execution_output.rs create mode 100644 sdks/rust/src/operation/cancel_execution/builders.rs create mode 100644 sdks/rust/src/operation/cancel_job.rs create mode 100644 sdks/rust/src/operation/cancel_job/_cancel_job_input.rs create mode 100644 sdks/rust/src/operation/cancel_job/_cancel_job_output.rs create mode 100644 sdks/rust/src/operation/cancel_job/builders.rs create mode 100644 sdks/rust/src/operation/create_endpoint.rs create mode 100644 sdks/rust/src/operation/create_endpoint/_create_endpoint_input.rs create mode 100644 sdks/rust/src/operation/create_endpoint/_create_endpoint_output.rs create mode 100644 sdks/rust/src/operation/create_endpoint/builders.rs create mode 100644 sdks/rust/src/operation/create_job.rs create mode 100644 sdks/rust/src/operation/create_job/_create_job_input.rs create mode 100644 sdks/rust/src/operation/create_job/_create_job_output.rs create mode 100644 sdks/rust/src/operation/create_job/builders.rs create mode 100644 sdks/rust/src/operation/create_payload_spec.rs create mode 100644 sdks/rust/src/operation/create_payload_spec/_create_payload_spec_input.rs create mode 100644 sdks/rust/src/operation/create_payload_spec/_create_payload_spec_output.rs create mode 100644 sdks/rust/src/operation/create_payload_spec/builders.rs create mode 100644 sdks/rust/src/operation/delete_endpoint.rs create mode 100644 sdks/rust/src/operation/delete_endpoint/_delete_endpoint_input.rs create mode 100644 sdks/rust/src/operation/delete_endpoint/_delete_endpoint_output.rs create mode 100644 sdks/rust/src/operation/delete_endpoint/builders.rs create mode 100644 sdks/rust/src/operation/delete_payload_spec.rs create mode 100644 sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_input.rs create mode 100644 sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_output.rs create mode 100644 sdks/rust/src/operation/delete_payload_spec/builders.rs create mode 100644 sdks/rust/src/operation/get_endpoint.rs create mode 100644 sdks/rust/src/operation/get_endpoint/_get_endpoint_input.rs create mode 100644 sdks/rust/src/operation/get_endpoint/_get_endpoint_output.rs create mode 100644 sdks/rust/src/operation/get_endpoint/builders.rs create mode 100644 sdks/rust/src/operation/get_execution.rs create mode 100644 sdks/rust/src/operation/get_execution/_get_execution_input.rs create mode 100644 sdks/rust/src/operation/get_execution/_get_execution_output.rs create mode 100644 sdks/rust/src/operation/get_execution/builders.rs create mode 100644 sdks/rust/src/operation/get_job.rs create mode 100644 sdks/rust/src/operation/get_job/_get_job_input.rs create mode 100644 sdks/rust/src/operation/get_job/_get_job_output.rs create mode 100644 sdks/rust/src/operation/get_job/builders.rs create mode 100644 sdks/rust/src/operation/get_job_status.rs create mode 100644 sdks/rust/src/operation/get_job_status/_get_job_status_input.rs create mode 100644 sdks/rust/src/operation/get_job_status/_get_job_status_output.rs create mode 100644 sdks/rust/src/operation/get_job_status/builders.rs create mode 100644 sdks/rust/src/operation/get_job_versions.rs create mode 100644 sdks/rust/src/operation/get_job_versions/_get_job_versions_input.rs create mode 100644 sdks/rust/src/operation/get_job_versions/_get_job_versions_output.rs create mode 100644 sdks/rust/src/operation/get_job_versions/builders.rs create mode 100644 sdks/rust/src/operation/get_payload_spec.rs create mode 100644 sdks/rust/src/operation/get_payload_spec/_get_payload_spec_input.rs create mode 100644 sdks/rust/src/operation/get_payload_spec/_get_payload_spec_output.rs create mode 100644 sdks/rust/src/operation/get_payload_spec/builders.rs create mode 100644 sdks/rust/src/operation/list_endpoints.rs create mode 100644 sdks/rust/src/operation/list_endpoints/_list_endpoints_input.rs create mode 100644 sdks/rust/src/operation/list_endpoints/_list_endpoints_output.rs create mode 100644 sdks/rust/src/operation/list_endpoints/builders.rs create mode 100644 sdks/rust/src/operation/list_execution_attempts.rs create mode 100644 sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_input.rs create mode 100644 sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_output.rs create mode 100644 sdks/rust/src/operation/list_execution_attempts/builders.rs create mode 100644 sdks/rust/src/operation/list_execution_logs.rs create mode 100644 sdks/rust/src/operation/list_execution_logs/_list_execution_logs_input.rs create mode 100644 sdks/rust/src/operation/list_execution_logs/_list_execution_logs_output.rs create mode 100644 sdks/rust/src/operation/list_execution_logs/builders.rs create mode 100644 sdks/rust/src/operation/list_job_executions.rs create mode 100644 sdks/rust/src/operation/list_job_executions/_list_job_executions_input.rs create mode 100644 sdks/rust/src/operation/list_job_executions/_list_job_executions_output.rs create mode 100644 sdks/rust/src/operation/list_job_executions/builders.rs create mode 100644 sdks/rust/src/operation/list_jobs.rs create mode 100644 sdks/rust/src/operation/list_jobs/_list_jobs_input.rs create mode 100644 sdks/rust/src/operation/list_jobs/_list_jobs_output.rs create mode 100644 sdks/rust/src/operation/list_jobs/builders.rs create mode 100644 sdks/rust/src/operation/list_payload_specs.rs create mode 100644 sdks/rust/src/operation/list_payload_specs/_list_payload_specs_input.rs create mode 100644 sdks/rust/src/operation/list_payload_specs/_list_payload_specs_output.rs create mode 100644 sdks/rust/src/operation/list_payload_specs/builders.rs create mode 100644 sdks/rust/src/operation/update_endpoint.rs create mode 100644 sdks/rust/src/operation/update_endpoint/_update_endpoint_input.rs create mode 100644 sdks/rust/src/operation/update_endpoint/_update_endpoint_output.rs create mode 100644 sdks/rust/src/operation/update_endpoint/builders.rs create mode 100644 sdks/rust/src/operation/update_job.rs create mode 100644 sdks/rust/src/operation/update_job/_update_job_input.rs create mode 100644 sdks/rust/src/operation/update_job/_update_job_output.rs create mode 100644 sdks/rust/src/operation/update_job/builders.rs create mode 100644 sdks/rust/src/operation/update_payload_spec.rs create mode 100644 sdks/rust/src/operation/update_payload_spec/_update_payload_spec_input.rs create mode 100644 sdks/rust/src/operation/update_payload_spec/_update_payload_spec_output.rs create mode 100644 sdks/rust/src/operation/update_payload_spec/builders.rs create mode 100644 sdks/rust/src/primitives.rs create mode 100644 sdks/rust/src/primitives/event_stream.rs create mode 100644 sdks/rust/src/primitives/sealed_enum_unknown.rs create mode 100644 sdks/rust/src/protocol_serde.rs create mode 100644 sdks/rust/src/protocol_serde/shape_attempt_resource.rs create mode 100644 sdks/rust/src/protocol_serde/shape_attempt_resource_list.rs create mode 100644 sdks/rust/src/protocol_serde/shape_cancel_execution.rs create mode 100644 sdks/rust/src/protocol_serde/shape_cancel_job.rs create mode 100644 sdks/rust/src/protocol_serde/shape_conflict_error.rs create mode 100644 sdks/rust/src/protocol_serde/shape_create_endpoint.rs create mode 100644 sdks/rust/src/protocol_serde/shape_create_endpoint_input.rs create mode 100644 sdks/rust/src/protocol_serde/shape_create_job.rs create mode 100644 sdks/rust/src/protocol_serde/shape_create_job_input.rs create mode 100644 sdks/rust/src/protocol_serde/shape_create_payload_spec.rs create mode 100644 sdks/rust/src/protocol_serde/shape_create_payload_spec_input.rs create mode 100644 sdks/rust/src/protocol_serde/shape_delete_endpoint.rs create mode 100644 sdks/rust/src/protocol_serde/shape_delete_payload_spec.rs create mode 100644 sdks/rust/src/protocol_serde/shape_endpoint_list.rs create mode 100644 sdks/rust/src/protocol_serde/shape_endpoint_resource.rs create mode 100644 sdks/rust/src/protocol_serde/shape_error_detail.rs create mode 100644 sdks/rust/src/protocol_serde/shape_execution_log_list.rs create mode 100644 sdks/rust/src/protocol_serde/shape_execution_log_resource.rs create mode 100644 sdks/rust/src/protocol_serde/shape_execution_resource.rs create mode 100644 sdks/rust/src/protocol_serde/shape_execution_resource_list.rs create mode 100644 sdks/rust/src/protocol_serde/shape_execution_summary.rs create mode 100644 sdks/rust/src/protocol_serde/shape_get_endpoint.rs create mode 100644 sdks/rust/src/protocol_serde/shape_get_execution.rs create mode 100644 sdks/rust/src/protocol_serde/shape_get_job.rs create mode 100644 sdks/rust/src/protocol_serde/shape_get_job_status.rs create mode 100644 sdks/rust/src/protocol_serde/shape_get_job_versions.rs create mode 100644 sdks/rust/src/protocol_serde/shape_get_payload_spec.rs create mode 100644 sdks/rust/src/protocol_serde/shape_internal_error.rs create mode 100644 sdks/rust/src/protocol_serde/shape_invalid_request_error.rs create mode 100644 sdks/rust/src/protocol_serde/shape_job_resource.rs create mode 100644 sdks/rust/src/protocol_serde/shape_job_status_response.rs create mode 100644 sdks/rust/src/protocol_serde/shape_job_summary.rs create mode 100644 sdks/rust/src/protocol_serde/shape_job_summary_list.rs create mode 100644 sdks/rust/src/protocol_serde/shape_job_version_list.rs create mode 100644 sdks/rust/src/protocol_serde/shape_list_endpoints.rs create mode 100644 sdks/rust/src/protocol_serde/shape_list_execution_attempts.rs create mode 100644 sdks/rust/src/protocol_serde/shape_list_execution_logs.rs create mode 100644 sdks/rust/src/protocol_serde/shape_list_job_executions.rs create mode 100644 sdks/rust/src/protocol_serde/shape_list_jobs.rs create mode 100644 sdks/rust/src/protocol_serde/shape_list_payload_specs.rs create mode 100644 sdks/rust/src/protocol_serde/shape_not_found_error.rs create mode 100644 sdks/rust/src/protocol_serde/shape_payload_spec_list.rs create mode 100644 sdks/rust/src/protocol_serde/shape_payload_spec_resource.rs create mode 100644 sdks/rust/src/protocol_serde/shape_rate_limited_error.rs create mode 100644 sdks/rust/src/protocol_serde/shape_retry_policy.rs create mode 100644 sdks/rust/src/protocol_serde/shape_unauthorized_error.rs create mode 100644 sdks/rust/src/protocol_serde/shape_unprocessable_entity_error.rs create mode 100644 sdks/rust/src/protocol_serde/shape_update_endpoint.rs create mode 100644 sdks/rust/src/protocol_serde/shape_update_endpoint_input.rs create mode 100644 sdks/rust/src/protocol_serde/shape_update_job.rs create mode 100644 sdks/rust/src/protocol_serde/shape_update_job_input.rs create mode 100644 sdks/rust/src/protocol_serde/shape_update_payload_spec.rs create mode 100644 sdks/rust/src/protocol_serde/shape_update_payload_spec_input.rs create mode 100644 sdks/rust/src/sdk_feature_tracker.rs create mode 100644 sdks/rust/src/serde_util.rs create mode 100644 sdks/rust/src/serialization_settings.rs create mode 100644 sdks/rust/src/types.rs create mode 100644 sdks/rust/src/types/_attempt_resource.rs create mode 100644 sdks/rust/src/types/_attempt_status_enum.rs create mode 100644 sdks/rust/src/types/_backoff_type_enum.rs create mode 100644 sdks/rust/src/types/_endpoint_resource.rs create mode 100644 sdks/rust/src/types/_endpoint_type_enum.rs create mode 100644 sdks/rust/src/types/_error_detail.rs create mode 100644 sdks/rust/src/types/_execution_log_resource.rs create mode 100644 sdks/rust/src/types/_execution_resource.rs create mode 100644 sdks/rust/src/types/_execution_status_enum.rs create mode 100644 sdks/rust/src/types/_execution_summary.rs create mode 100644 sdks/rust/src/types/_job_resource.rs create mode 100644 sdks/rust/src/types/_job_status_enum.rs create mode 100644 sdks/rust/src/types/_job_status_response.rs create mode 100644 sdks/rust/src/types/_job_summary.rs create mode 100644 sdks/rust/src/types/_log_level_enum.rs create mode 100644 sdks/rust/src/types/_payload_spec_resource.rs create mode 100644 sdks/rust/src/types/_retry_policy.rs create mode 100644 sdks/rust/src/types/_trigger_type_enum.rs create mode 100644 sdks/rust/src/types/builders.rs create mode 100644 sdks/rust/src/types/error.rs create mode 100644 sdks/rust/src/types/error/_conflict_error.rs create mode 100644 sdks/rust/src/types/error/_internal_error.rs create mode 100644 sdks/rust/src/types/error/_invalid_request_error.rs create mode 100644 sdks/rust/src/types/error/_not_found_error.rs create mode 100644 sdks/rust/src/types/error/_rate_limited_error.rs create mode 100644 sdks/rust/src/types/error/_unauthorized_error.rs create mode 100644 sdks/rust/src/types/error/_unprocessable_entity_error.rs create mode 100644 sdks/rust/src/types/error/builders.rs diff --git a/Cargo.toml b/Cargo.toml index 56baf56..cd857c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,12 @@ members = [ "crates/mock-server", "crates/dashboard", ] +exclude = [ + # Generated client SDK — committed for downstream consumers (e.g. aarokya) + # to depend on via `git`. Pins a different MSRV (1.82) and runtime stack + # than the server workspace, so it stays out of the workspace build graph. + "sdks/rust", +] resolver = "2" [workspace.package] diff --git a/justfile b/justfile index 2c76a01..8f5daad 100644 --- a/justfile +++ b/justfile @@ -69,9 +69,20 @@ check: export SMITHY_MAVEN_REPOS := "https://repo.maven.apache.org/maven2|https://sandbox.assets.juspay.in/smithy/m2" -# Generate TypeScript SDK, Rust SDK, and OpenAPI spec from Smithy models -smithy-build: +# Validate Smithy models. Run before regeneration to surface model errors +# with clean messages instead of cryptic codegen failures. +smithy-validate: + cd smithy && smithy validate + +# Full regeneration: validate models, run smithy-build, then sync the +# committed Rust SDK at sdks/rust/. Edit smithy/model/* → run this → +# commit the resulting diff (model + sdks/rust/) in the same PR. +smithy-build: smithy-validate cd smithy && smithy build + # Wipe everything except README.md (which warns "DO NOT EDIT" and must survive regeneration) + find sdks/rust -mindepth 1 -maxdepth 1 ! -name 'README.md' -exec rm -rf {} + + cp -R smithy/build/smithy/source/rust-client-codegen/. sdks/rust/ + @echo "Regenerated sdks/rust. Review with: git diff -- sdks/rust" # Build the generated TypeScript SDK (npm install + compile) build-sdk: smithy-build @@ -84,6 +95,12 @@ cli-install: build-sdk # Regenerate SDK and reinstall CLI (after Smithy model changes) sdk-refresh: build-sdk cli-install +# CI guard: regenerate everything and fail if sdks/rust/ has drifted from +# the model. Keeps the committed SDK honest without trusting contributor discipline. +smithy-check: smithy-build + @git diff --exit-code -- sdks/rust || \ + (echo "ERROR: sdks/rust is out of sync with smithy/model/. Run 'just smithy-build' and commit." && exit 1) + # ─── Run Services ───────────────────────────────────────────── # Run the API server (port 8080) diff --git a/sdks/rust/Cargo.toml b/sdks/rust/Cargo.toml new file mode 100644 index 0000000..3178f57 --- /dev/null +++ b/sdks/rust/Cargo.toml @@ -0,0 +1,43 @@ +# Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +[package] +name = "kronos_sdk" +version = "0.1.0" +authors = ["kronos@example.com"] +description = "Rust SDK for Kronos job scheduling service" +edition = "2021" +rust-version = "1.82.0" + +[package.metadata.smithy] +codegen-version = "18e06e0a61e4ce792a2b17271d25a1f524d90ed4" +[dependencies.aws-smithy-async] +version = "1.2.5" +[dependencies.aws-smithy-http] +version = "0.62.1" +[dependencies.aws-smithy-json] +version = "0.61.3" +[dependencies.aws-smithy-runtime] +version = "1.8.2" +features = ["client", "http-auth"] +[dependencies.aws-smithy-runtime-api] +version = "1.7.4" +features = ["client", "http-02x", "http-auth"] +[dependencies.aws-smithy-types] +version = "1.3.0" +[dependencies.bytes] +version = "1.4.0" +[dependencies.fastrand] +version = "2.0.0" +[dependencies.http] +version = "0.2.9" +[dependencies.tracing] +version = "0.1" +[features] +rt-tokio = ["aws-smithy-async/rt-tokio", "aws-smithy-types/rt-tokio"] +test-util = ["aws-smithy-runtime/test-util"] +behavior-version-latest = [] +rustls = ["aws-smithy-runtime/tls-rustls"] +default-https-client = ["aws-smithy-runtime/default-https-client"] +gated-tests = [] +default = ["rt-tokio", "rustls", "default-https-client"] + + diff --git a/sdks/rust/README.md b/sdks/rust/README.md new file mode 100644 index 0000000..111489d --- /dev/null +++ b/sdks/rust/README.md @@ -0,0 +1,32 @@ +# kronos_sdk (generated) + +**DO NOT EDIT FILES IN THIS DIRECTORY.** + +This crate is generated from `smithy/model/*.smithy` by `smithy-rs`. Every +file here is overwritten on each regeneration — any hand edits will be lost +silently. + +## Updating the SDK + +After changing anything under `smithy/model/`: + +```bash +just smithy-build # validates model, regenerates, syncs sdks/rust/ +git diff -- sdks/rust # review the resulting diff +git add smithy/ sdks/rust/ +git commit # commit model + generated SDK in the same PR +``` + +CI runs `just smithy-check` to fail builds where the committed SDK has +drifted from the model. + +## Why is this committed? + +Downstream Rust consumers (e.g. aarokya) depend on this crate via a Cargo +`git` dep pinned to a kronos commit/tag. Committing the generated output +means those consumers don't need the Smithy CLI, JVM, or Juspay's Maven +mirror to build. + +This crate is excluded from the kronos workspace (`Cargo.toml` → +`[workspace] exclude`) because it targets a different MSRV (1.82) and +pulls a heavy AWS smithy runtime stack that the server crates don't need. diff --git a/sdks/rust/src/auth_plugin.rs b/sdks/rust/src/auth_plugin.rs new file mode 100644 index 0000000..82469a4 --- /dev/null +++ b/sdks/rust/src/auth_plugin.rs @@ -0,0 +1,41 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +use std::borrow::Cow; + +use aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolver; +use aws_smithy_runtime_api::client::auth::AuthSchemeId; +use aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder; +use aws_smithy_runtime_api::client::runtime_plugin::{Order, RuntimePlugin}; + +#[derive(Debug)] +pub(crate) struct DefaultAuthOptionsPlugin { + runtime_components: RuntimeComponentsBuilder, +} + +impl DefaultAuthOptionsPlugin { + pub(crate) fn new(auth_schemes: Vec) -> Self { + let runtime_components = RuntimeComponentsBuilder::new("default_auth_options") + .with_auth_scheme_option_resolver(Some(StaticAuthSchemeOptionResolver::new( + auth_schemes, + ))); + Self { runtime_components } + } +} + +impl RuntimePlugin for DefaultAuthOptionsPlugin { + fn order(&self) -> Order { + Order::Defaults + } + + fn runtime_components( + &self, + _current_components: &RuntimeComponentsBuilder, + ) -> Cow<'_, RuntimeComponentsBuilder> { + Cow::Borrowed(&self.runtime_components) + } +} + diff --git a/sdks/rust/src/client.rs b/sdks/rust/src/client.rs new file mode 100644 index 0000000..6714355 --- /dev/null +++ b/sdks/rust/src/client.rs @@ -0,0 +1,177 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[derive(Debug)] + pub(crate) struct Handle { + pub(crate) conf: crate::Config, + #[allow(dead_code)] // unused when a service does not provide any operations + pub(crate) runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + } + + +/// +/// An ergonomic client for Kronos Task Executor API. +/// +/// This client allows ergonomic access to Kronos Task Executor API. +/// Each method corresponds to an API defined in the service's Smithy model, +/// and the request and response shapes are auto-generated from that same model. +/// +/// Client for calling Kronos Task Executor API. +/// +/// ## Constructing a `Client` +/// +/// A `Client` requires a config in order to be constructed. With the default set of Cargo features, +/// this config will only require an endpoint to produce a functioning client. However, some Smithy +/// features will require additional configuration. For example, `@auth` requires some kind of identity +/// or identity resolver to be configured. The config is used to customize various aspects of the client, +/// such as: +/// +/// - [The underlying HTTP client](crate::config::Builder::http_client) +/// - [Retries](crate::config::Builder::retry_config) +/// - [Timeouts](crate::config::Builder::timeout_config) +/// - [... and more](crate::config::Builder) +/// +/// Below is a minimal example of how to create a client: +/// +/// ```rust,no_run +/// let config = kronos_sdk::Config::builder() +/// .endpoint_url("http://localhost:1234") +/// .build(); +/// let client = kronos_sdk::Client::from_conf(config); +/// ``` +/// +/// _Note:_ Client construction is expensive due to connection thread pool initialization, and should be done +/// once at application start-up. Cloning a client is cheap (it's just an [`Arc`](std::sync::Arc) under the hood), +/// so creating it once at start-up and cloning it around the application as needed is recommended. +/// # Using the `Client` +/// +/// A client has a function for every operation that can be performed by the service. +/// For example, the [`CancelExecution`](crate::operation::cancel_execution) operation has +/// a [`Client::cancel_execution`], function which returns a builder for that operation. +/// The fluent builder ultimately has a `send()` function that returns an async future that +/// returns a result, as illustrated below: +/// +/// ```rust,ignore +/// let result = client.cancel_execution() +/// .org_id("example") +/// .send() +/// .await; +/// ``` +/// +/// The underlying HTTP requests that get made by this can be modified with the `customize_operation` +/// function on the fluent builder. See the [`customize`](crate::client::customize) module for more +/// information. + #[derive(::std::clone::Clone, ::std::fmt::Debug)] + pub struct Client { + handle: ::std::sync::Arc, + } + + impl Client { + /// Creates a new client from the service [`Config`](crate::Config). + /// + /// # Panics + /// + /// This method will panic in the following cases: + /// + /// - Retries or timeouts are enabled without a `sleep_impl` configured. + /// - Identity caching is enabled without a `sleep_impl` and `time_source` configured. + /// - No `behavior_version` is provided. + /// + /// The panic message for each of these will have instructions on how to resolve them. + #[track_caller] + pub fn from_conf(conf: crate::Config) -> Self { + let handle = Handle { + conf: conf.clone(), + runtime_plugins: crate::config::base_client_runtime_plugins(conf), + }; + if let Err(err) = Self::validate_config(&handle) { + panic!("Invalid client configuration: {err}"); + } + Self { + handle: ::std::sync::Arc::new(handle) + } + } + + /// Returns the client's configuration. + pub fn config(&self) -> &crate::Config { + &self.handle.conf + } + + fn validate_config(handle: &Handle) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let mut cfg = ::aws_smithy_types::config_bag::ConfigBag::base(); + handle.runtime_plugins + .apply_client_configuration(&mut cfg)? + .validate_base_client_config(&cfg)?; + Ok(()) + } + } + +mod cancel_execution; + +mod cancel_job; + +mod create_endpoint; + +mod create_job; + +mod create_payload_spec; + +/// Operation customization and supporting types. +/// +/// The underlying HTTP requests made during an operation can be customized +/// by calling the `customize()` method on the builder returned from a client +/// operation call. For example, this can be used to add an additional HTTP header: +/// +/// ```ignore +/// # async fn wrapper() -> ::std::result::Result<(), kronos_sdk::Error> { +/// # let client: kronos_sdk::Client = unimplemented!(); +/// use ::http::header::{HeaderName, HeaderValue}; +/// +/// let result = client.cancel_execution() +/// .customize() +/// .mutate_request(|req| { +/// // Add `x-example-header` with value +/// req.headers_mut() +/// .insert( +/// HeaderName::from_static("x-example-header"), +/// HeaderValue::from_static("1"), +/// ); +/// }) +/// .send() +/// .await; +/// # } +/// ``` +pub mod customize; + +mod delete_endpoint; + +mod delete_payload_spec; + +mod get_endpoint; + +mod get_execution; + +mod get_job; + +mod get_job_status; + +mod get_job_versions; + +mod get_payload_spec; + +mod list_endpoints; + +mod list_execution_attempts; + +mod list_execution_logs; + +mod list_job_executions; + +mod list_jobs; + +mod list_payload_specs; + +mod update_endpoint; + +mod update_job; + +mod update_payload_spec; + diff --git a/sdks/rust/src/client/cancel_execution.rs b/sdks/rust/src/client/cancel_execution.rs new file mode 100644 index 0000000..4607e77 --- /dev/null +++ b/sdks/rust/src/client/cancel_execution.rs @@ -0,0 +1,16 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`CancelExecution`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`execution_id(impl Into)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::execution_id) / [`set_execution_id(Option)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::set_execution_id):
required: **true**
(undocumented)
+ /// - On success, responds with [`CancelExecutionOutput`](crate::operation::cancel_execution::CancelExecutionOutput) with field(s): + /// - [`data(ExecutionResource)`](crate::operation::cancel_execution::CancelExecutionOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::cancel_execution::CancelExecutionError) + pub fn cancel_execution(&self) -> crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder { + crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/cancel_job.rs b/sdks/rust/src/client/cancel_job.rs new file mode 100644 index 0000000..512bba6 --- /dev/null +++ b/sdks/rust/src/client/cancel_job.rs @@ -0,0 +1,16 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`CancelJob`](crate::operation::cancel_job::builders::CancelJobFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`job_id(impl Into)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::job_id) / [`set_job_id(Option)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::set_job_id):
required: **true**
(undocumented)
+ /// - On success, responds with [`CancelJobOutput`](crate::operation::cancel_job::CancelJobOutput) with field(s): + /// - [`data(JobResource)`](crate::operation::cancel_job::CancelJobOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::cancel_job::CancelJobError) + pub fn cancel_job(&self) -> crate::operation::cancel_job::builders::CancelJobFluentBuilder { + crate::operation::cancel_job::builders::CancelJobFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/create_endpoint.rs b/sdks/rust/src/client/create_endpoint.rs new file mode 100644 index 0000000..43b043e --- /dev/null +++ b/sdks/rust/src/client/create_endpoint.rs @@ -0,0 +1,21 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`CreateEndpoint`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`name(impl Into)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::name) / [`set_name(Option)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_name):
required: **true**
(undocumented)
+ /// - [`endpoint_type(EndpointTypeEnum)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::endpoint_type) / [`set_endpoint_type(Option)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_endpoint_type):
required: **true**
(undocumented)
+ /// - [`payload_spec(impl Into)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::payload_spec) / [`set_payload_spec(Option)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_payload_spec):
required: **false**
(undocumented)
+ /// - [`config(impl Into)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::config) / [`set_config(Option)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_config):
required: **false**
(undocumented)
+ /// - [`spec(Document)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::spec) / [`set_spec(Option)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_spec):
required: **true**
(undocumented)
+ /// - [`retry_policy(RetryPolicy)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::retry_policy) / [`set_retry_policy(Option)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_retry_policy):
required: **false**
(undocumented)
+ /// - On success, responds with [`CreateEndpointOutput`](crate::operation::create_endpoint::CreateEndpointOutput) with field(s): + /// - [`data(EndpointResource)`](crate::operation::create_endpoint::CreateEndpointOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::create_endpoint::CreateEndpointError) + pub fn create_endpoint(&self) -> crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder { + crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/create_job.rs b/sdks/rust/src/client/create_job.rs new file mode 100644 index 0000000..8566ca2 --- /dev/null +++ b/sdks/rust/src/client/create_job.rs @@ -0,0 +1,24 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`CreateJob`](crate::operation::create_job::builders::CreateJobFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::create_job::builders::CreateJobFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::create_job::builders::CreateJobFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`endpoint(impl Into)`](crate::operation::create_job::builders::CreateJobFluentBuilder::endpoint) / [`set_endpoint(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_endpoint):
required: **true**
(undocumented)
+ /// - [`trigger(TriggerTypeEnum)`](crate::operation::create_job::builders::CreateJobFluentBuilder::trigger) / [`set_trigger(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_trigger):
required: **true**
(undocumented)
+ /// - [`idempotency_key(impl Into)`](crate::operation::create_job::builders::CreateJobFluentBuilder::idempotency_key) / [`set_idempotency_key(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_idempotency_key):
required: **false**
(undocumented)
+ /// - [`input(Document)`](crate::operation::create_job::builders::CreateJobFluentBuilder::input) / [`set_input(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_input):
required: **false**
(undocumented)
+ /// - [`run_at(DateTime)`](crate::operation::create_job::builders::CreateJobFluentBuilder::run_at) / [`set_run_at(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_run_at):
required: **false**
(undocumented)
+ /// - [`cron(impl Into)`](crate::operation::create_job::builders::CreateJobFluentBuilder::cron) / [`set_cron(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_cron):
required: **false**
(undocumented)
+ /// - [`timezone(impl Into)`](crate::operation::create_job::builders::CreateJobFluentBuilder::timezone) / [`set_timezone(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_timezone):
required: **false**
(undocumented)
+ /// - [`starts_at(DateTime)`](crate::operation::create_job::builders::CreateJobFluentBuilder::starts_at) / [`set_starts_at(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_starts_at):
required: **false**
(undocumented)
+ /// - [`ends_at(DateTime)`](crate::operation::create_job::builders::CreateJobFluentBuilder::ends_at) / [`set_ends_at(Option)`](crate::operation::create_job::builders::CreateJobFluentBuilder::set_ends_at):
required: **false**
(undocumented)
+ /// - On success, responds with [`CreateJobOutput`](crate::operation::create_job::CreateJobOutput) with field(s): + /// - [`data(JobResource)`](crate::operation::create_job::CreateJobOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::create_job::CreateJobError) + pub fn create_job(&self) -> crate::operation::create_job::builders::CreateJobFluentBuilder { + crate::operation::create_job::builders::CreateJobFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/create_payload_spec.rs b/sdks/rust/src/client/create_payload_spec.rs new file mode 100644 index 0000000..f7bfdd9 --- /dev/null +++ b/sdks/rust/src/client/create_payload_spec.rs @@ -0,0 +1,17 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`CreatePayloadSpec`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`name(impl Into)`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::name) / [`set_name(Option)`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::set_name):
required: **true**
(undocumented)
+ /// - [`schema(Document)`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::schema) / [`set_schema(Option)`](crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::set_schema):
required: **true**
(undocumented)
+ /// - On success, responds with [`CreatePayloadSpecOutput`](crate::operation::create_payload_spec::CreatePayloadSpecOutput) with field(s): + /// - [`data(PayloadSpecResource)`](crate::operation::create_payload_spec::CreatePayloadSpecOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::create_payload_spec::CreatePayloadSpecError) + pub fn create_payload_spec(&self) -> crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder { + crate::operation::create_payload_spec::builders::CreatePayloadSpecFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/customize.rs b/sdks/rust/src/client/customize.rs new file mode 100644 index 0000000..dfe2063 --- /dev/null +++ b/sdks/rust/src/client/customize.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + + + + + + + + + + + + + + + + + + + + + + +/// `CustomizableOperation` allows for configuring a single operation invocation before it is sent. + pub struct CustomizableOperation { + customizable_send: B, + config_override: ::std::option::Option, + interceptors: Vec<::aws_smithy_runtime_api::client::interceptors::SharedInterceptor>, + runtime_plugins: Vec<::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin>, + _output: ::std::marker::PhantomData, + _error: ::std::marker::PhantomData, + } + + impl CustomizableOperation { + /// Creates a new `CustomizableOperation` from `customizable_send`. + #[allow(dead_code)] // unused when a service does not provide any operations + pub(crate) fn new(customizable_send: B) -> Self { + Self { + customizable_send, + config_override: ::std::option::Option::None, + interceptors: vec![], + runtime_plugins: vec![], + _output: ::std::marker::PhantomData, + _error: ::std::marker::PhantomData + } + } + + pub(crate) fn execute(self, f: impl ::std::ops::FnOnce(B, crate::config::Builder) -> U) -> U { + let mut config_override = self.config_override.unwrap_or_default(); + self.interceptors.into_iter().for_each(|interceptor| { + config_override.push_interceptor(interceptor); + }); + self.runtime_plugins.into_iter().for_each(|plugin| { + config_override.push_runtime_plugin(plugin); + }); + f(self.customizable_send, config_override) + } + + /// Adds an [interceptor](::aws_smithy_runtime_api::client::interceptors::Intercept) that runs at specific stages of the request execution pipeline. + /// + /// Note that interceptors can also be added to `CustomizableOperation` by `config_override`, + /// `map_request`, and `mutate_request` (the last two are implemented via interceptors under the hood). + /// The order in which those user-specified operation interceptors are invoked should not be relied upon + /// as it is an implementation detail. + pub fn interceptor(mut self, interceptor: impl ::aws_smithy_runtime_api::client::interceptors::Intercept + 'static) -> Self { + self.interceptors.push(::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new(interceptor)); + self + } + + /// Adds a runtime plugin. + #[allow(unused)] + pub(crate) fn runtime_plugin(mut self, runtime_plugin: impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin + 'static) -> Self { + self.runtime_plugins.push(::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin::new(runtime_plugin)); + self + } + + /// Allows for customizing the operation's request. + pub fn map_request(mut self, f: F) -> Self + where + F: ::std::ops::Fn(::aws_smithy_runtime_api::client::orchestrator::HttpRequest) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, MapE> + + ::std::marker::Send + + ::std::marker::Sync + + 'static, + MapE: ::std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, + { + self.interceptors.push( + ::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new( + ::aws_smithy_runtime::client::interceptors::MapRequestInterceptor::new(f), + ), + ); + self + } + + /// Convenience for `map_request` where infallible direct mutation of request is acceptable. + pub fn mutate_request(mut self, f: F) -> Self + where + F: ::std::ops::Fn(&mut ::aws_smithy_runtime_api::client::orchestrator::HttpRequest) + ::std::marker::Send + ::std::marker::Sync + 'static, + { + self.interceptors.push( + ::aws_smithy_runtime_api::client::interceptors::SharedInterceptor::new( + ::aws_smithy_runtime::client::interceptors::MutateRequestInterceptor::new(f), + ), + ); + self + } + + /// Overrides config for a single operation invocation. + /// + /// `config_override` is applied to the operation configuration level. + /// The fields in the builder that are `Some` override those applied to the service + /// configuration level. For instance, + /// + /// | Config A | overridden by Config B | = Config C | + /// |--------------------|------------------------|--------------------| + /// | field_1: None, | field_1: Some(v2), | field_1: Some(v2), | + /// | field_2: Some(v1), | field_2: Some(v2), | field_2: Some(v2), | + /// | field_3: Some(v1), | field_3: None, | field_3: Some(v1), | + pub fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.config_override = Some(config_override.into()); + self + } + + /// Sends the request and returns the response. + pub async fn send( + self, + ) -> crate::client::customize::internal::SendResult + where + E: std::error::Error + ::std::marker::Send + ::std::marker::Sync + 'static, + B: crate::client::customize::internal::CustomizableSend, + { + self.execute(|sender, config|sender.send(config)).await + } + + + } + +pub(crate) mod internal; + diff --git a/sdks/rust/src/client/customize/internal.rs b/sdks/rust/src/client/customize/internal.rs new file mode 100644 index 0000000..ea306a5 --- /dev/null +++ b/sdks/rust/src/client/customize/internal.rs @@ -0,0 +1,18 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub type BoxFuture = ::std::pin::Pin<::std::boxed::Box + ::std::marker::Send>>; + + pub type SendResult = ::std::result::Result< + T, + ::aws_smithy_runtime_api::client::result::SdkError< + E, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse, + >, + >; + + pub trait CustomizableSend: ::std::marker::Send + ::std::marker::Sync { + // Takes an owned `self` as the implementation will internally call methods that take `self`. + // If it took `&self`, that would make this trait object safe, but some implementing types do not + // derive `Clone`, unable to yield `self` from `&self`. + fn send(self, config_override: crate::config::Builder) -> BoxFuture>; + } + diff --git a/sdks/rust/src/client/delete_endpoint.rs b/sdks/rust/src/client/delete_endpoint.rs new file mode 100644 index 0000000..805041e --- /dev/null +++ b/sdks/rust/src/client/delete_endpoint.rs @@ -0,0 +1,15 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`DeleteEndpoint`](crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`name(impl Into)`](crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder::name) / [`set_name(Option)`](crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder::set_name):
required: **true**
(undocumented)
+ /// - On success, responds with [`DeleteEndpointOutput`](crate::operation::delete_endpoint::DeleteEndpointOutput) + /// - On failure, responds with [`SdkError`](crate::operation::delete_endpoint::DeleteEndpointError) + pub fn delete_endpoint(&self) -> crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder { + crate::operation::delete_endpoint::builders::DeleteEndpointFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/delete_payload_spec.rs b/sdks/rust/src/client/delete_payload_spec.rs new file mode 100644 index 0000000..cc182d5 --- /dev/null +++ b/sdks/rust/src/client/delete_payload_spec.rs @@ -0,0 +1,15 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`DeletePayloadSpec`](crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`name(impl Into)`](crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder::name) / [`set_name(Option)`](crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder::set_name):
required: **true**
(undocumented)
+ /// - On success, responds with [`DeletePayloadSpecOutput`](crate::operation::delete_payload_spec::DeletePayloadSpecOutput) + /// - On failure, responds with [`SdkError`](crate::operation::delete_payload_spec::DeletePayloadSpecError) + pub fn delete_payload_spec(&self) -> crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder { + crate::operation::delete_payload_spec::builders::DeletePayloadSpecFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/get_endpoint.rs b/sdks/rust/src/client/get_endpoint.rs new file mode 100644 index 0000000..8e72d73 --- /dev/null +++ b/sdks/rust/src/client/get_endpoint.rs @@ -0,0 +1,16 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`GetEndpoint`](crate::operation::get_endpoint::builders::GetEndpointFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::get_endpoint::builders::GetEndpointFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::get_endpoint::builders::GetEndpointFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::get_endpoint::builders::GetEndpointFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::get_endpoint::builders::GetEndpointFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`name(impl Into)`](crate::operation::get_endpoint::builders::GetEndpointFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_endpoint::builders::GetEndpointFluentBuilder::set_name):
required: **true**
(undocumented)
+ /// - On success, responds with [`GetEndpointOutput`](crate::operation::get_endpoint::GetEndpointOutput) with field(s): + /// - [`data(EndpointResource)`](crate::operation::get_endpoint::GetEndpointOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_endpoint::GetEndpointError) + pub fn get_endpoint(&self) -> crate::operation::get_endpoint::builders::GetEndpointFluentBuilder { + crate::operation::get_endpoint::builders::GetEndpointFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/get_execution.rs b/sdks/rust/src/client/get_execution.rs new file mode 100644 index 0000000..a76c10e --- /dev/null +++ b/sdks/rust/src/client/get_execution.rs @@ -0,0 +1,16 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`GetExecution`](crate::operation::get_execution::builders::GetExecutionFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::get_execution::builders::GetExecutionFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::get_execution::builders::GetExecutionFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::get_execution::builders::GetExecutionFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::get_execution::builders::GetExecutionFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`execution_id(impl Into)`](crate::operation::get_execution::builders::GetExecutionFluentBuilder::execution_id) / [`set_execution_id(Option)`](crate::operation::get_execution::builders::GetExecutionFluentBuilder::set_execution_id):
required: **true**
(undocumented)
+ /// - On success, responds with [`GetExecutionOutput`](crate::operation::get_execution::GetExecutionOutput) with field(s): + /// - [`data(ExecutionResource)`](crate::operation::get_execution::GetExecutionOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_execution::GetExecutionError) + pub fn get_execution(&self) -> crate::operation::get_execution::builders::GetExecutionFluentBuilder { + crate::operation::get_execution::builders::GetExecutionFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/get_job.rs b/sdks/rust/src/client/get_job.rs new file mode 100644 index 0000000..da5fa3b --- /dev/null +++ b/sdks/rust/src/client/get_job.rs @@ -0,0 +1,16 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`GetJob`](crate::operation::get_job::builders::GetJobFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::get_job::builders::GetJobFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::get_job::builders::GetJobFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::get_job::builders::GetJobFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::get_job::builders::GetJobFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`job_id(impl Into)`](crate::operation::get_job::builders::GetJobFluentBuilder::job_id) / [`set_job_id(Option)`](crate::operation::get_job::builders::GetJobFluentBuilder::set_job_id):
required: **true**
(undocumented)
+ /// - On success, responds with [`GetJobOutput`](crate::operation::get_job::GetJobOutput) with field(s): + /// - [`data(JobResource)`](crate::operation::get_job::GetJobOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_job::GetJobError) + pub fn get_job(&self) -> crate::operation::get_job::builders::GetJobFluentBuilder { + crate::operation::get_job::builders::GetJobFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/get_job_status.rs b/sdks/rust/src/client/get_job_status.rs new file mode 100644 index 0000000..120ff61 --- /dev/null +++ b/sdks/rust/src/client/get_job_status.rs @@ -0,0 +1,16 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`GetJobStatus`](crate::operation::get_job_status::builders::GetJobStatusFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::get_job_status::builders::GetJobStatusFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::get_job_status::builders::GetJobStatusFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::get_job_status::builders::GetJobStatusFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::get_job_status::builders::GetJobStatusFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`job_id(impl Into)`](crate::operation::get_job_status::builders::GetJobStatusFluentBuilder::job_id) / [`set_job_id(Option)`](crate::operation::get_job_status::builders::GetJobStatusFluentBuilder::set_job_id):
required: **true**
(undocumented)
+ /// - On success, responds with [`GetJobStatusOutput`](crate::operation::get_job_status::GetJobStatusOutput) with field(s): + /// - [`data(JobStatusResponse)`](crate::operation::get_job_status::GetJobStatusOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_job_status::GetJobStatusError) + pub fn get_job_status(&self) -> crate::operation::get_job_status::builders::GetJobStatusFluentBuilder { + crate::operation::get_job_status::builders::GetJobStatusFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/get_job_versions.rs b/sdks/rust/src/client/get_job_versions.rs new file mode 100644 index 0000000..7be4080 --- /dev/null +++ b/sdks/rust/src/client/get_job_versions.rs @@ -0,0 +1,16 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`GetJobVersions`](crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`job_id(impl Into)`](crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder::job_id) / [`set_job_id(Option)`](crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder::set_job_id):
required: **true**
(undocumented)
+ /// - On success, responds with [`GetJobVersionsOutput`](crate::operation::get_job_versions::GetJobVersionsOutput) with field(s): + /// - [`data(Vec::)`](crate::operation::get_job_versions::GetJobVersionsOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_job_versions::GetJobVersionsError) + pub fn get_job_versions(&self) -> crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder { + crate::operation::get_job_versions::builders::GetJobVersionsFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/get_payload_spec.rs b/sdks/rust/src/client/get_payload_spec.rs new file mode 100644 index 0000000..7b28600 --- /dev/null +++ b/sdks/rust/src/client/get_payload_spec.rs @@ -0,0 +1,16 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`GetPayloadSpec`](crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`name(impl Into)`](crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder::name) / [`set_name(Option)`](crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder::set_name):
required: **true**
(undocumented)
+ /// - On success, responds with [`GetPayloadSpecOutput`](crate::operation::get_payload_spec::GetPayloadSpecOutput) with field(s): + /// - [`data(PayloadSpecResource)`](crate::operation::get_payload_spec::GetPayloadSpecOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::get_payload_spec::GetPayloadSpecError) + pub fn get_payload_spec(&self) -> crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder { + crate::operation::get_payload_spec::builders::GetPayloadSpecFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/list_endpoints.rs b/sdks/rust/src/client/list_endpoints.rs new file mode 100644 index 0000000..d9d9289 --- /dev/null +++ b/sdks/rust/src/client/list_endpoints.rs @@ -0,0 +1,18 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`ListEndpoints`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`cursor(impl Into)`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::cursor) / [`set_cursor(Option)`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::set_cursor):
required: **false**
(undocumented)
+ /// - [`limit(i32)`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::limit) / [`set_limit(Option)`](crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::set_limit):
required: **false**
(undocumented)
+ /// - On success, responds with [`ListEndpointsOutput`](crate::operation::list_endpoints::ListEndpointsOutput) with field(s): + /// - [`data(Vec::)`](crate::operation::list_endpoints::ListEndpointsOutput::data): (undocumented) + /// - [`cursor(Option)`](crate::operation::list_endpoints::ListEndpointsOutput::cursor): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::list_endpoints::ListEndpointsError) + pub fn list_endpoints(&self) -> crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder { + crate::operation::list_endpoints::builders::ListEndpointsFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/list_execution_attempts.rs b/sdks/rust/src/client/list_execution_attempts.rs new file mode 100644 index 0000000..d0cd23c --- /dev/null +++ b/sdks/rust/src/client/list_execution_attempts.rs @@ -0,0 +1,19 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`ListExecutionAttempts`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`cursor(impl Into)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::cursor) / [`set_cursor(Option)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::set_cursor):
required: **false**
(undocumented)
+ /// - [`limit(i32)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::limit) / [`set_limit(Option)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::set_limit):
required: **false**
(undocumented)
+ /// - [`execution_id(impl Into)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::execution_id) / [`set_execution_id(Option)`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::set_execution_id):
required: **true**
(undocumented)
+ /// - On success, responds with [`ListExecutionAttemptsOutput`](crate::operation::list_execution_attempts::ListExecutionAttemptsOutput) with field(s): + /// - [`data(Vec::)`](crate::operation::list_execution_attempts::ListExecutionAttemptsOutput::data): (undocumented) + /// - [`cursor(Option)`](crate::operation::list_execution_attempts::ListExecutionAttemptsOutput::cursor): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::list_execution_attempts::ListExecutionAttemptsError) + pub fn list_execution_attempts(&self) -> crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder { + crate::operation::list_execution_attempts::builders::ListExecutionAttemptsFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/list_execution_logs.rs b/sdks/rust/src/client/list_execution_logs.rs new file mode 100644 index 0000000..189e1d4 --- /dev/null +++ b/sdks/rust/src/client/list_execution_logs.rs @@ -0,0 +1,19 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`ListExecutionLogs`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`cursor(impl Into)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::cursor) / [`set_cursor(Option)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::set_cursor):
required: **false**
(undocumented)
+ /// - [`limit(i32)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::limit) / [`set_limit(Option)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::set_limit):
required: **false**
(undocumented)
+ /// - [`execution_id(impl Into)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::execution_id) / [`set_execution_id(Option)`](crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::set_execution_id):
required: **true**
(undocumented)
+ /// - On success, responds with [`ListExecutionLogsOutput`](crate::operation::list_execution_logs::ListExecutionLogsOutput) with field(s): + /// - [`data(Vec::)`](crate::operation::list_execution_logs::ListExecutionLogsOutput::data): (undocumented) + /// - [`cursor(Option)`](crate::operation::list_execution_logs::ListExecutionLogsOutput::cursor): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::list_execution_logs::ListExecutionLogsError) + pub fn list_execution_logs(&self) -> crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder { + crate::operation::list_execution_logs::builders::ListExecutionLogsFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/list_job_executions.rs b/sdks/rust/src/client/list_job_executions.rs new file mode 100644 index 0000000..3e7c76a --- /dev/null +++ b/sdks/rust/src/client/list_job_executions.rs @@ -0,0 +1,20 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`ListJobExecutions`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`cursor(impl Into)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::cursor) / [`set_cursor(Option)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::set_cursor):
required: **false**
(undocumented)
+ /// - [`limit(i32)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::limit) / [`set_limit(Option)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::set_limit):
required: **false**
(undocumented)
+ /// - [`job_id(impl Into)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::job_id) / [`set_job_id(Option)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::set_job_id):
required: **true**
(undocumented)
+ /// - [`status(ExecutionStatusEnum)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::status) / [`set_status(Option)`](crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::set_status):
required: **false**
(undocumented)
+ /// - On success, responds with [`ListJobExecutionsOutput`](crate::operation::list_job_executions::ListJobExecutionsOutput) with field(s): + /// - [`data(Vec::)`](crate::operation::list_job_executions::ListJobExecutionsOutput::data): (undocumented) + /// - [`cursor(Option)`](crate::operation::list_job_executions::ListJobExecutionsOutput::cursor): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::list_job_executions::ListJobExecutionsError) + pub fn list_job_executions(&self) -> crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder { + crate::operation::list_job_executions::builders::ListJobExecutionsFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/list_jobs.rs b/sdks/rust/src/client/list_jobs.rs new file mode 100644 index 0000000..1ebd692 --- /dev/null +++ b/sdks/rust/src/client/list_jobs.rs @@ -0,0 +1,21 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`ListJobs`](crate::operation::list_jobs::builders::ListJobsFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`cursor(impl Into)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::cursor) / [`set_cursor(Option)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::set_cursor):
required: **false**
(undocumented)
+ /// - [`limit(i32)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::limit) / [`set_limit(Option)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::set_limit):
required: **false**
(undocumented)
+ /// - [`endpoint(impl Into)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::endpoint) / [`set_endpoint(Option)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::set_endpoint):
required: **false**
(undocumented)
+ /// - [`trigger_type(TriggerTypeEnum)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::trigger_type) / [`set_trigger_type(Option)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::set_trigger_type):
required: **false**
(undocumented)
+ /// - [`status(JobStatusEnum)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::status) / [`set_status(Option)`](crate::operation::list_jobs::builders::ListJobsFluentBuilder::set_status):
required: **false**
(undocumented)
+ /// - On success, responds with [`ListJobsOutput`](crate::operation::list_jobs::ListJobsOutput) with field(s): + /// - [`data(Vec::)`](crate::operation::list_jobs::ListJobsOutput::data): (undocumented) + /// - [`cursor(Option)`](crate::operation::list_jobs::ListJobsOutput::cursor): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::list_jobs::ListJobsError) + pub fn list_jobs(&self) -> crate::operation::list_jobs::builders::ListJobsFluentBuilder { + crate::operation::list_jobs::builders::ListJobsFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/list_payload_specs.rs b/sdks/rust/src/client/list_payload_specs.rs new file mode 100644 index 0000000..5a93227 --- /dev/null +++ b/sdks/rust/src/client/list_payload_specs.rs @@ -0,0 +1,18 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`ListPayloadSpecs`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`cursor(impl Into)`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::cursor) / [`set_cursor(Option)`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::set_cursor):
required: **false**
(undocumented)
+ /// - [`limit(i32)`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::limit) / [`set_limit(Option)`](crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::set_limit):
required: **false**
(undocumented)
+ /// - On success, responds with [`ListPayloadSpecsOutput`](crate::operation::list_payload_specs::ListPayloadSpecsOutput) with field(s): + /// - [`data(Vec::)`](crate::operation::list_payload_specs::ListPayloadSpecsOutput::data): (undocumented) + /// - [`cursor(Option)`](crate::operation::list_payload_specs::ListPayloadSpecsOutput::cursor): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::list_payload_specs::ListPayloadSpecsError) + pub fn list_payload_specs(&self) -> crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder { + crate::operation::list_payload_specs::builders::ListPayloadSpecsFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/update_endpoint.rs b/sdks/rust/src/client/update_endpoint.rs new file mode 100644 index 0000000..f39d15e --- /dev/null +++ b/sdks/rust/src/client/update_endpoint.rs @@ -0,0 +1,20 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`UpdateEndpoint`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`name(impl Into)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::name) / [`set_name(Option)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::set_name):
required: **true**
(undocumented)
+ /// - [`spec(Document)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::spec) / [`set_spec(Option)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::set_spec):
required: **false**
(undocumented)
+ /// - [`config(impl Into)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::config) / [`set_config(Option)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::set_config):
required: **false**
(undocumented)
+ /// - [`payload_spec(impl Into)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::payload_spec) / [`set_payload_spec(Option)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::set_payload_spec):
required: **false**
(undocumented)
+ /// - [`retry_policy(RetryPolicy)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::retry_policy) / [`set_retry_policy(Option)`](crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::set_retry_policy):
required: **false**
(undocumented)
+ /// - On success, responds with [`UpdateEndpointOutput`](crate::operation::update_endpoint::UpdateEndpointOutput) with field(s): + /// - [`data(EndpointResource)`](crate::operation::update_endpoint::UpdateEndpointOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::update_endpoint::UpdateEndpointError) + pub fn update_endpoint(&self) -> crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder { + crate::operation::update_endpoint::builders::UpdateEndpointFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/update_job.rs b/sdks/rust/src/client/update_job.rs new file mode 100644 index 0000000..120dab5 --- /dev/null +++ b/sdks/rust/src/client/update_job.rs @@ -0,0 +1,21 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`UpdateJob`](crate::operation::update_job::builders::UpdateJobFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`job_id(impl Into)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::job_id) / [`set_job_id(Option)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::set_job_id):
required: **true**
(undocumented)
+ /// - [`cron(impl Into)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::cron) / [`set_cron(Option)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::set_cron):
required: **false**
(undocumented)
+ /// - [`timezone(impl Into)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::timezone) / [`set_timezone(Option)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::set_timezone):
required: **false**
(undocumented)
+ /// - [`input(Document)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::input) / [`set_input(Option)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::set_input):
required: **false**
(undocumented)
+ /// - [`starts_at(DateTime)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::starts_at) / [`set_starts_at(Option)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::set_starts_at):
required: **false**
(undocumented)
+ /// - [`ends_at(DateTime)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::ends_at) / [`set_ends_at(Option)`](crate::operation::update_job::builders::UpdateJobFluentBuilder::set_ends_at):
required: **false**
(undocumented)
+ /// - On success, responds with [`UpdateJobOutput`](crate::operation::update_job::UpdateJobOutput) with field(s): + /// - [`data(JobResource)`](crate::operation::update_job::UpdateJobOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::update_job::UpdateJobError) + pub fn update_job(&self) -> crate::operation::update_job::builders::UpdateJobFluentBuilder { + crate::operation::update_job::builders::UpdateJobFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/client/update_payload_spec.rs b/sdks/rust/src/client/update_payload_spec.rs new file mode 100644 index 0000000..9baa7e6 --- /dev/null +++ b/sdks/rust/src/client/update_payload_spec.rs @@ -0,0 +1,17 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +impl super::Client { + /// Constructs a fluent builder for the [`UpdatePayloadSpec`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder) operation. + /// + /// - The fluent builder is configurable: + /// - [`org_id(impl Into)`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::org_id) / [`set_org_id(Option)`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::set_org_id):
required: **true**
(undocumented)
+ /// - [`workspace_id(impl Into)`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::workspace_id) / [`set_workspace_id(Option)`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::set_workspace_id):
required: **true**
(undocumented)
+ /// - [`name(impl Into)`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::name) / [`set_name(Option)`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::set_name):
required: **true**
(undocumented)
+ /// - [`schema(Document)`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::schema) / [`set_schema(Option)`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::set_schema):
required: **true**
(undocumented)
+ /// - On success, responds with [`UpdatePayloadSpecOutput`](crate::operation::update_payload_spec::UpdatePayloadSpecOutput) with field(s): + /// - [`data(PayloadSpecResource)`](crate::operation::update_payload_spec::UpdatePayloadSpecOutput::data): (undocumented) + /// - On failure, responds with [`SdkError`](crate::operation::update_payload_spec::UpdatePayloadSpecError) + pub fn update_payload_spec(&self) -> crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder { + crate::operation::update_payload_spec::builders::UpdatePayloadSpecFluentBuilder::new(self.handle.clone()) + } +} + diff --git a/sdks/rust/src/config.rs b/sdks/rust/src/config.rs new file mode 100644 index 0000000..bcfcf8e --- /dev/null +++ b/sdks/rust/src/config.rs @@ -0,0 +1,1139 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// Configuration for a kronos_sdk service client. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct Config { + // Both `config` and `cloneable` are the same config, but the cloneable one + // is kept around so that it is possible to convert back into a builder. This can be + // optimized in the future. + pub(crate) config: crate::config::FrozenLayer, + cloneable: ::aws_smithy_types::config_bag::CloneableLayer, + pub(crate) runtime_components: crate::config::RuntimeComponentsBuilder, + pub(crate) runtime_plugins: ::std::vec::Vec, + behavior_version: ::std::option::Option, +} +impl Config { + /// + /// Constructs a config builder. + ///
+ /// Note that a config created from this builder will not have the same safe defaults as one created by + /// the aws-config crate. + ///
+ /// + pub fn builder() -> Builder { Builder::default() } + /// Converts this config back into a builder so that it can be tweaked. + pub fn to_builder(&self) -> Builder { + Builder { + config: self.cloneable.clone(), + runtime_components: self.runtime_components.clone(), + runtime_plugins: self.runtime_plugins.clone(), + behavior_version: self.behavior_version, + } + } + /// Return a reference to the stalled stream protection configuration contained in this config, if any. + pub fn stalled_stream_protection(&self) -> ::std::option::Option<&crate::config::StalledStreamProtectionConfig> { + self.config.load::() + } + /// Return the [`SharedHttpClient`](crate::config::SharedHttpClient) to use when making requests, if any. + pub fn http_client(&self) -> Option { + self.runtime_components.http_client() + } + /// Returns the endpoint resolver. + pub fn endpoint_resolver(&self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver { + self.runtime_components.endpoint_resolver().expect("resolver defaulted if not set") + } + /// Return a reference to the retry configuration contained in this config, if any. + pub fn retry_config(&self) -> ::std::option::Option<&::aws_smithy_types::retry::RetryConfig> { + self.config.load::<::aws_smithy_types::retry::RetryConfig>() + } + + /// Return a cloned shared async sleep implementation from this config, if any. + pub fn sleep_impl(&self) -> ::std::option::Option { + self.runtime_components.sleep_impl() + } + + /// Return a reference to the timeout configuration contained in this config, if any. + pub fn timeout_config(&self) -> ::std::option::Option<&::aws_smithy_types::timeout::TimeoutConfig> { + self.config.load::<::aws_smithy_types::timeout::TimeoutConfig>() + } + + /// Returns a reference to the retry partition contained in this config, if any. + /// + /// WARNING: This method is unstable and may be removed at any time. Do not rely on this + /// method for anything! + pub fn retry_partition(&self) -> ::std::option::Option<&::aws_smithy_runtime::client::retries::RetryPartition> { + self.config.load::<::aws_smithy_runtime::client::retries::RetryPartition>() + } + /// Returns the configured identity cache for auth. + pub fn identity_cache(&self) -> ::std::option::Option { + self.runtime_components.identity_cache() + } + /// Returns interceptors currently registered by the user. + pub fn interceptors(&self) -> impl Iterator + '_ { + self.runtime_components.interceptors() + } + /// Return time source used for this service. + pub fn time_source(&self) -> ::std::option::Option<::aws_smithy_async::time::SharedTimeSource> { + self.runtime_components.time_source() + } + /// Returns retry classifiers currently registered by the user. + pub fn retry_classifiers(&self) -> impl Iterator + '_ { + self.runtime_components.retry_classifiers() + } +} +/// Builder for creating a `Config`. +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct Builder { + pub(crate) config: ::aws_smithy_types::config_bag::CloneableLayer, + pub(crate) runtime_components: crate::config::RuntimeComponentsBuilder, + pub(crate) runtime_plugins: ::std::vec::Vec, + pub(crate) behavior_version: ::std::option::Option, +} +impl ::std::default::Default for Builder { + fn default() -> Self { + Self { + config: ::std::default::Default::default(), + runtime_components: crate::config::RuntimeComponentsBuilder::new("service config"), + runtime_plugins: ::std::default::Default::default(), + behavior_version: ::std::default::Default::default(), + } + } +} +impl Builder { + /// + /// Constructs a config builder. + ///
+ /// Note that a config created from this builder will not have the same safe defaults as one created by + /// the aws-config crate. + ///
+ /// + pub fn new() -> Self { Self::default() } + /// Constructs a config builder from the given `config_bag`, setting only fields stored in the config bag, + /// but not those in runtime components. + #[allow(unused)] + pub(crate) fn from_config_bag(config_bag: &::aws_smithy_types::config_bag::ConfigBag) -> Self { + let mut builder = Self::new(); + builder.set_stalled_stream_protection(config_bag.load::().cloned()); + builder.set_retry_config(config_bag.load::<::aws_smithy_types::retry::RetryConfig>().cloned()); + builder.set_timeout_config(config_bag.load::<::aws_smithy_types::timeout::TimeoutConfig>().cloned()); + builder.set_retry_partition(config_bag.load::<::aws_smithy_runtime::client::retries::RetryPartition>().cloned()); + builder + } + /// Set the [`StalledStreamProtectionConfig`](crate::config::StalledStreamProtectionConfig) + /// to configure protection for stalled streams. + pub fn stalled_stream_protection( + mut self, + stalled_stream_protection_config: crate::config::StalledStreamProtectionConfig + ) -> Self { + self.set_stalled_stream_protection(::std::option::Option::Some(stalled_stream_protection_config)); + self + } + /// Set the [`StalledStreamProtectionConfig`](crate::config::StalledStreamProtectionConfig) + /// to configure protection for stalled streams. + pub fn set_stalled_stream_protection( + &mut self, + stalled_stream_protection_config: ::std::option::Option + ) -> &mut Self { + self.config.store_or_unset(stalled_stream_protection_config); + self + } + /// Sets the HTTP client to use when making requests. + /// + /// # Examples + /// ```no_run + /// # #[cfg(test)] + /// # mod tests { + /// # #[test] + /// # fn example() { + /// use std::time::Duration; + /// use kronos_sdk::config::Config; + /// use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder; + /// + /// let https_connector = hyper_rustls::HttpsConnectorBuilder::new() + /// .with_webpki_roots() + /// .https_only() + /// .enable_http1() + /// .enable_http2() + /// .build(); + /// let hyper_client = HyperClientBuilder::new().build(https_connector); + /// + /// // This connector can then be given to a generated service Config + /// let config = my_service_client::Config::builder() + /// .endpoint_url("https://example.com") + /// .http_client(hyper_client) + /// .build(); + /// let client = my_service_client::Client::from_conf(config); + /// # } + /// # } + /// ``` + pub fn http_client(mut self, http_client: impl crate::config::HttpClient + 'static) -> Self { + self.set_http_client(::std::option::Option::Some(crate::config::IntoShared::into_shared(http_client))); + self + } + + /// Sets the HTTP client to use when making requests. + /// + /// # Examples + /// ```no_run + /// # #[cfg(test)] + /// # mod tests { + /// # #[test] + /// # fn example() { + /// use std::time::Duration; + /// use kronos_sdk::config::{Builder, Config}; + /// use aws_smithy_runtime::client::http::hyper_014::HyperClientBuilder; + /// + /// fn override_http_client(builder: &mut Builder) { + /// let https_connector = hyper_rustls::HttpsConnectorBuilder::new() + /// .with_webpki_roots() + /// .https_only() + /// .enable_http1() + /// .enable_http2() + /// .build(); + /// let hyper_client = HyperClientBuilder::new().build(https_connector); + /// builder.set_http_client(Some(hyper_client)); + /// } + /// + /// let mut builder = kronos_sdk::Config::builder(); + /// override_http_client(&mut builder); + /// let config = builder.build(); + /// # } + /// # } + /// ``` + pub fn set_http_client(&mut self, http_client: Option) -> &mut Self { + self.runtime_components.set_http_client(http_client); + self + } + /// Sets the bearer token that will be used for HTTP bearer auth. + pub fn bearer_token(self, bearer_token: crate::config::Token) -> Self { + self.bearer_token_resolver(bearer_token) + } + + /// Sets a bearer token provider that will be used for HTTP bearer auth. + pub fn bearer_token_resolver(mut self, bearer_token_resolver: impl crate::config::ResolveIdentity + 'static) -> Self { + self.runtime_components.set_identity_resolver( + ::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID, + ::aws_smithy_runtime_api::shared::IntoShared::<::aws_smithy_runtime_api::client::identity::SharedIdentityResolver>::into_shared(bearer_token_resolver) + ); + self + } + /// Set the endpoint URL to use when making requests. + /// + /// Note: setting an endpoint URL will replace any endpoint resolver that has been set. + /// + /// # Panics + /// Panics if an invalid URL is given. + pub fn endpoint_url(mut self, endpoint_url: impl ::std::convert::Into<::std::string::String>) -> Self { + self.set_endpoint_url(::std::option::Option::Some(endpoint_url.into())); + self + } + + /// Set the endpoint URL to use when making requests. + /// + /// Note: setting an endpoint URL will replace any endpoint resolver that has been set. + /// + /// # Panics + /// Panics if an invalid URL is given. + pub fn set_endpoint_url(&mut self, endpoint_url: ::std::option::Option<::std::string::String>) -> &mut Self { + #[allow(deprecated)] + self.set_endpoint_resolver( + endpoint_url.map(|url| { + ::aws_smithy_runtime_api::shared::IntoShared::into_shared(::aws_smithy_runtime::client::orchestrator::endpoints::StaticUriEndpointResolver::uri(url)) + }) + ); + self + } + /// Sets the endpoint resolver to use when making requests. + /// + /// This service does not define a default endpoint resolver. + /// + /// Note: setting an endpoint resolver will replace any endpoint URL that has been set. + /// This method accepts an endpoint resolver [specific to this service](crate::config::endpoint::ResolveEndpoint). If you want to + /// provide a shared endpoint resolver, use [`Self::set_endpoint_resolver`]. + /// + /// # Examples + /// Create a custom endpoint resolver that resolves a different endpoing per-stage, e.g. staging vs. production. + /// ```no_run + /// use kronos_sdk::config::endpoint::{ResolveEndpoint, EndpointFuture, Params, Endpoint}; + /// #[derive(Debug)] + /// struct StageResolver { stage: String } + /// impl ResolveEndpoint for StageResolver { + /// fn resolve_endpoint(&self, params: &Params) -> EndpointFuture<'_> { + /// let stage = &self.stage; + /// EndpointFuture::ready(Ok(Endpoint::builder().url(format!("{stage}.myservice.com")).build())) + /// } + /// } + /// let resolver = StageResolver { stage: std::env::var("STAGE").unwrap() }; + /// let config = kronos_sdk::Config::builder().endpoint_resolver(resolver).build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + pub fn endpoint_resolver(mut self, endpoint_resolver: impl crate::config::endpoint::ResolveEndpoint + 'static) -> Self { + self.set_endpoint_resolver(::std::option::Option::Some(endpoint_resolver.into_shared_resolver())); + self + } + + /// Sets the endpoint resolver to use when making requests. + /// + /// This service does not define a default endpoint resolver. + pub fn set_endpoint_resolver(&mut self, endpoint_resolver: ::std::option::Option<::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver>) -> &mut Self { + self.runtime_components.set_endpoint_resolver(endpoint_resolver); + self + } + /// Set the retry_config for the builder + /// + /// # Examples + /// ```no_run + /// use kronos_sdk::config::Config; + /// use kronos_sdk::config::retry::RetryConfig; + /// + /// let retry_config = RetryConfig::standard().with_max_attempts(5); + /// let config = Config::builder().retry_config(retry_config).build(); + /// ``` + pub fn retry_config(mut self, retry_config: ::aws_smithy_types::retry::RetryConfig) -> Self { + self.set_retry_config(Some(retry_config)); + self + } + + /// Set the retry_config for the builder + /// + /// # Examples + /// ```no_run + /// use kronos_sdk::config::{Builder, Config}; + /// use kronos_sdk::config::retry::RetryConfig; + /// + /// fn disable_retries(builder: &mut Builder) { + /// let retry_config = RetryConfig::standard().with_max_attempts(1); + /// builder.set_retry_config(Some(retry_config)); + /// } + /// + /// let mut builder = Config::builder(); + /// disable_retries(&mut builder); + /// let config = builder.build(); + /// ``` + pub fn set_retry_config(&mut self, retry_config: ::std::option::Option<::aws_smithy_types::retry::RetryConfig>) -> &mut Self { + retry_config.map(|r| self.config.store_put(r)); + self + } + /// Set the sleep_impl for the builder + /// + /// # Examples + /// + /// ```no_run + /// use kronos_sdk::config::{AsyncSleep, Config, SharedAsyncSleep, Sleep}; + /// + /// #[derive(Debug)] + /// pub struct ForeverSleep; + /// + /// impl AsyncSleep for ForeverSleep { + /// fn sleep(&self, duration: std::time::Duration) -> Sleep { + /// Sleep::new(std::future::pending()) + /// } + /// } + /// + /// let sleep_impl = SharedAsyncSleep::new(ForeverSleep); + /// let config = Config::builder().sleep_impl(sleep_impl).build(); + /// ``` + pub fn sleep_impl(mut self, sleep_impl: impl crate::config::AsyncSleep + 'static) -> Self { + self.set_sleep_impl(Some(::aws_smithy_runtime_api::shared::IntoShared::into_shared(sleep_impl))); + self + } + + /// Set the sleep_impl for the builder + /// + /// # Examples + /// + /// ```no_run + /// use kronos_sdk::config::{AsyncSleep, Builder, Config, SharedAsyncSleep, Sleep}; + /// + /// #[derive(Debug)] + /// pub struct ForeverSleep; + /// + /// impl AsyncSleep for ForeverSleep { + /// fn sleep(&self, duration: std::time::Duration) -> Sleep { + /// Sleep::new(std::future::pending()) + /// } + /// } + /// + /// fn set_never_ending_sleep_impl(builder: &mut Builder) { + /// let sleep_impl = SharedAsyncSleep::new(ForeverSleep); + /// builder.set_sleep_impl(Some(sleep_impl)); + /// } + /// + /// let mut builder = Config::builder(); + /// set_never_ending_sleep_impl(&mut builder); + /// let config = builder.build(); + /// ``` + pub fn set_sleep_impl(&mut self, sleep_impl: ::std::option::Option) -> &mut Self { + self.runtime_components.set_sleep_impl(sleep_impl); + self + } + /// Set the timeout_config for the builder + /// + /// # Examples + /// + /// ```no_run + /// # use std::time::Duration; + /// use kronos_sdk::config::Config; + /// use kronos_sdk::config::timeout::TimeoutConfig; + /// + /// let timeout_config = TimeoutConfig::builder() + /// .operation_attempt_timeout(Duration::from_secs(1)) + /// .build(); + /// let config = Config::builder().timeout_config(timeout_config).build(); + /// ``` + pub fn timeout_config(mut self, timeout_config: ::aws_smithy_types::timeout::TimeoutConfig) -> Self { + self.set_timeout_config(Some(timeout_config)); + self + } + + /// Set the timeout_config for the builder. + /// + /// Setting this to `None` has no effect if another source of configuration has set timeouts. If you + /// are attempting to disable timeouts, use [`TimeoutConfig::disabled`](::aws_smithy_types::timeout::TimeoutConfig::disabled) + /// + /// + /// # Examples + /// + /// ```no_run + /// # use std::time::Duration; + /// use kronos_sdk::config::{Builder, Config}; + /// use kronos_sdk::config::timeout::TimeoutConfig; + /// + /// fn set_request_timeout(builder: &mut Builder) { + /// let timeout_config = TimeoutConfig::builder() + /// .operation_attempt_timeout(Duration::from_secs(1)) + /// .build(); + /// builder.set_timeout_config(Some(timeout_config)); + /// } + /// + /// let mut builder = Config::builder(); + /// set_request_timeout(&mut builder); + /// let config = builder.build(); + /// ``` + pub fn set_timeout_config(&mut self, timeout_config: ::std::option::Option<::aws_smithy_types::timeout::TimeoutConfig>) -> &mut Self { + // passing None has no impact. + let Some(mut timeout_config) = timeout_config else { + return self + }; + + if let Some(base) = self.config.load::<::aws_smithy_types::timeout::TimeoutConfig>() { + timeout_config.take_defaults_from(base); + } + self.config.store_put(timeout_config); + self + } + /// Set the partition for retry-related state. When clients share a retry partition, they will + /// also share things like token buckets and client rate limiters. By default, all clients + /// for the same service will share a partition. + pub fn retry_partition(mut self, retry_partition: ::aws_smithy_runtime::client::retries::RetryPartition) -> Self { + self.set_retry_partition(Some(retry_partition)); + self + } + /// Set the partition for retry-related state. When clients share a retry partition, they will + /// also share things like token buckets and client rate limiters. By default, all clients + /// for the same service will share a partition. + pub fn set_retry_partition(&mut self, retry_partition: ::std::option::Option<::aws_smithy_runtime::client::retries::RetryPartition>) -> &mut Self { + retry_partition.map(|r| self.config.store_put(r)); + self + } + /// Set the identity cache for auth. + /// + /// The identity cache defaults to a lazy caching implementation that will resolve + /// an identity when it is requested, and place it in the cache thereafter. Subsequent + /// requests will take the value from the cache while it is still valid. Once it expires, + /// the next request will result in refreshing the identity. + /// + /// This configuration allows you to disable or change the default caching mechanism. + /// To use a custom caching mechanism, implement the [`ResolveCachedIdentity`](crate::config::ResolveCachedIdentity) + /// trait and pass that implementation into this function. + /// + /// # Examples + /// + /// Disabling identity caching: + /// ```no_run + /// use kronos_sdk::config::IdentityCache; + /// + /// let config = kronos_sdk::Config::builder() + /// .identity_cache(IdentityCache::no_cache()) + /// // ... + /// .build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + /// + /// Customizing lazy caching: + /// ```no_run + /// use kronos_sdk::config::IdentityCache; + /// use std::time::Duration; + /// + /// let config = kronos_sdk::Config::builder() + /// .identity_cache( + /// IdentityCache::lazy() + /// // change the load timeout to 10 seconds + /// .load_timeout(Duration::from_secs(10)) + /// .build() + /// ) + /// // ... + /// .build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + + pub fn identity_cache(mut self, identity_cache: impl crate::config::ResolveCachedIdentity + 'static) -> Self { + self.set_identity_cache(identity_cache); + self + } + + + /// Set the identity cache for auth. + /// + /// The identity cache defaults to a lazy caching implementation that will resolve + /// an identity when it is requested, and place it in the cache thereafter. Subsequent + /// requests will take the value from the cache while it is still valid. Once it expires, + /// the next request will result in refreshing the identity. + /// + /// This configuration allows you to disable or change the default caching mechanism. + /// To use a custom caching mechanism, implement the [`ResolveCachedIdentity`](crate::config::ResolveCachedIdentity) + /// trait and pass that implementation into this function. + /// + /// # Examples + /// + /// Disabling identity caching: + /// ```no_run + /// use kronos_sdk::config::IdentityCache; + /// + /// let config = kronos_sdk::Config::builder() + /// .identity_cache(IdentityCache::no_cache()) + /// // ... + /// .build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + /// + /// Customizing lazy caching: + /// ```no_run + /// use kronos_sdk::config::IdentityCache; + /// use std::time::Duration; + /// + /// let config = kronos_sdk::Config::builder() + /// .identity_cache( + /// IdentityCache::lazy() + /// // change the load timeout to 10 seconds + /// .load_timeout(Duration::from_secs(10)) + /// .build() + /// ) + /// // ... + /// .build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + + pub fn set_identity_cache(&mut self, identity_cache: impl crate::config::ResolveCachedIdentity + 'static) -> &mut Self { + self.runtime_components.set_identity_cache(::std::option::Option::Some(identity_cache)); + self + } + /// Add an [interceptor](crate::config::Intercept) that runs at specific stages of the request execution pipeline. + /// + /// Interceptors targeted at a certain stage are executed according to the pre-defined priority. + /// The SDK provides a default set of interceptors. An interceptor configured by this method + /// will run after those default interceptors. + /// + /// # Examples + /// ```no_run + /// # #[cfg(test)] + /// # mod tests { + /// # #[test] + /// # fn example() { + /// use aws_smithy_runtime_api::client::interceptors::context::phase::BeforeTransmit; + /// use aws_smithy_runtime_api::client::interceptors::{Interceptor, InterceptorContext}; + /// use aws_smithy_types::config_bag::ConfigBag; + /// use kronos_sdk::config::Config; + /// + /// fn base_url() -> String { + /// // ... + /// # String::new() + /// } + /// + /// #[derive(Debug)] + /// pub struct UriModifierInterceptor; + /// impl Intercept for UriModifierInterceptor { + /// fn modify_before_signing( + /// &self, + /// context: &mut InterceptorContext, + /// _cfg: &mut ConfigBag, + /// ) -> Result<(), aws_smithy_runtime_api::client::interceptors::BoxError> { + /// let request = context.request_mut(); + /// let uri = format!("{}{}", base_url(), request.uri().path()); + /// *request.uri_mut() = uri.parse()?; + /// + /// Ok(()) + /// } + /// } + /// + /// let config = Config::builder() + /// .interceptor(UriModifierInterceptor) + /// .build(); + /// # } + /// # } + /// ``` + pub fn interceptor(mut self, interceptor: impl crate::config::Intercept + 'static) -> Self { + self.push_interceptor(crate::config::SharedInterceptor::new(interceptor)); + self + } + + /// Add a [`SharedInterceptor`](crate::config::SharedInterceptor) that runs at specific stages of the request execution pipeline. + /// + /// Interceptors targeted at a certain stage are executed according to the pre-defined priority. + /// The SDK provides a default set of interceptors. An interceptor configured by this method + /// will run after those default interceptors. + /// + /// # Examples + /// ```no_run + /// # #[cfg(test)] + /// # mod tests { + /// # #[test] + /// # fn example() { + /// use aws_smithy_runtime_api::client::interceptors::context::phase::BeforeTransmit; + /// use aws_smithy_runtime_api::client::interceptors::{Interceptor, InterceptorContext, SharedInterceptor}; + /// use aws_smithy_types::config_bag::ConfigBag; + /// use kronos_sdk::config::{Builder, Config}; + /// + /// fn base_url() -> String { + /// // ... + /// # String::new() + /// } + /// + /// fn modify_request_uri(builder: &mut Builder) { + /// #[derive(Debug)] + /// pub struct UriModifierInterceptor; + /// impl Intercept for UriModifierInterceptor { + /// fn modify_before_signing( + /// &self, + /// context: &mut InterceptorContext, + /// _cfg: &mut ConfigBag, + /// ) -> Result<(), aws_smithy_runtime_api::client::interceptors::BoxError> { + /// let request = context.request_mut(); + /// let uri = format!("{}{}", base_url(), request.uri().path()); + /// *request.uri_mut() = uri.parse()?; + /// + /// Ok(()) + /// } + /// } + /// builder.push_interceptor(SharedInterceptor::new(UriModifierInterceptor)); + /// } + /// + /// let mut builder = Config::builder(); + /// modify_request_uri(&mut builder); + /// let config = builder.build(); + /// # } + /// # } + /// ``` + pub fn push_interceptor(&mut self, interceptor: crate::config::SharedInterceptor) -> &mut Self { + self.runtime_components.push_interceptor(interceptor); + self + } + + /// Set [`SharedInterceptor`](crate::config::SharedInterceptor)s for the builder. + pub fn set_interceptors(&mut self, interceptors: impl IntoIterator) -> &mut Self { + self.runtime_components.set_interceptors(interceptors.into_iter()); + self + } + /// Sets the time source used for this service + pub fn time_source( + mut self, + time_source: impl ::aws_smithy_async::time::TimeSource + 'static, + ) -> Self { + self.set_time_source(::std::option::Option::Some(::aws_smithy_runtime_api::shared::IntoShared::into_shared(time_source))); + self + } + /// Sets the time source used for this service + pub fn set_time_source( + &mut self, + time_source: ::std::option::Option<::aws_smithy_async::time::SharedTimeSource>, + ) -> &mut Self { + self.runtime_components.set_time_source(time_source); + self + } + /// Add type implementing [`ClassifyRetry`](::aws_smithy_runtime_api::client::retries::classifiers::ClassifyRetry) that will be used by the + /// [`RetryStrategy`](::aws_smithy_runtime_api::client::retries::RetryStrategy) to determine what responses should be retried. + /// + /// A retry classifier configured by this method will run according to its [priority](::aws_smithy_runtime_api::client::retries::classifiers::RetryClassifierPriority). + /// + /// # Examples + /// ```no_run + /// # #[cfg(test)] + /// # mod tests { + /// # #[test] + /// # fn example() { + /// use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext; + /// use aws_smithy_runtime_api::client::orchestrator::OrchestratorError; + /// use aws_smithy_runtime_api::client::retries::classifiers::{ + /// ClassifyRetry, RetryAction, RetryClassifierPriority, + /// }; + /// use aws_smithy_types::error::metadata::ProvideErrorMetadata; + /// use aws_smithy_types::retry::ErrorKind; + /// use std::error::Error as StdError; + /// use std::marker::PhantomData; + /// use kronos_sdk::config::Config; + /// # struct SomeOperationError {} + /// + /// const RETRYABLE_ERROR_CODES: &[&str] = [ + /// // List error codes to be retried here... + /// ]; + /// + /// // When classifying at an operation's error type, classifiers require a generic parameter. + /// // When classifying the HTTP response alone, no generic is needed. + /// #[derive(Debug, Default)] + /// pub struct ErrorCodeClassifier { + /// _inner: PhantomData, + /// } + /// + /// impl ExampleErrorCodeClassifier { + /// pub fn new() -> Self { + /// Self { + /// _inner: PhantomData, + /// } + /// } + /// } + /// + /// impl ClassifyRetry for ExampleErrorCodeClassifier + /// where + /// // Adding a trait bound for ProvideErrorMetadata allows us to inspect the error code. + /// E: StdError + ProvideErrorMetadata + Send + Sync + 'static, + /// { + /// fn classify_retry(&self, ctx: &InterceptorContext) -> RetryAction { + /// // Check for a result + /// let output_or_error = ctx.output_or_error(); + /// // Check for an error + /// let error = match output_or_error { + /// Some(Ok(_)) | None => return RetryAction::NoActionIndicated, + /// Some(Err(err)) => err, + /// }; + /// + /// // Downcast the generic error and extract the code + /// let error_code = OrchestratorError::as_operation_error(error) + /// .and_then(|err| err.downcast_ref::()) + /// .and_then(|err| err.code()); + /// + /// // If this error's code is in our list, return an action that tells the RetryStrategy to retry this request. + /// if let Some(error_code) = error_code { + /// if RETRYABLE_ERROR_CODES.contains(&error_code) { + /// return RetryAction::transient_error(); + /// } + /// } + /// + /// // Otherwise, return that no action is indicated i.e. that this classifier doesn't require a retry. + /// // Another classifier may still classify this response as retryable. + /// RetryAction::NoActionIndicated + /// } + /// + /// fn name(&self) -> &'static str { "Example Error Code Classifier" } + /// } + /// + /// let config = Config::builder() + /// .retry_classifier(ExampleErrorCodeClassifier::::new()) + /// .build(); + /// # } + /// # } + /// ``` + pub fn retry_classifier(mut self, retry_classifier: impl ::aws_smithy_runtime_api::client::retries::classifiers::ClassifyRetry + 'static) -> Self { + self.push_retry_classifier(::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier::new(retry_classifier)); + self + } + + /// Add a [`SharedRetryClassifier`](::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier) that will be used by the + /// [`RetryStrategy`](::aws_smithy_runtime_api::client::retries::RetryStrategy) to determine what responses should be retried. + /// + /// A retry classifier configured by this method will run according to its priority. + /// + /// # Examples + /// ```no_run + /// # #[cfg(test)] + /// # mod tests { + /// # #[test] + /// # fn example() { + /// use aws_smithy_runtime_api::client::interceptors::context::InterceptorContext; + /// use aws_smithy_runtime_api::client::orchestrator::OrchestratorError; + /// use aws_smithy_runtime_api::client::retries::classifiers::{ + /// ClassifyRetry, RetryAction, RetryClassifierPriority, + /// }; + /// use aws_smithy_types::error::metadata::ProvideErrorMetadata; + /// use aws_smithy_types::retry::ErrorKind; + /// use std::error::Error as StdError; + /// use std::marker::PhantomData; + /// use kronos_sdk::config::{Builder, Config}; + /// # struct SomeOperationError {} + /// + /// const RETRYABLE_ERROR_CODES: &[&str] = [ + /// // List error codes to be retried here... + /// ]; + /// fn set_example_error_code_classifier(builder: &mut Builder) { + /// // When classifying at an operation's error type, classifiers require a generic parameter. + /// // When classifying the HTTP response alone, no generic is needed. + /// #[derive(Debug, Default)] + /// pub struct ExampleErrorCodeClassifier { + /// _inner: PhantomData, + /// } + /// + /// impl ExampleErrorCodeClassifier { + /// pub fn new() -> Self { + /// Self { + /// _inner: PhantomData, + /// } + /// } + /// } + /// + /// impl ClassifyRetry for ExampleErrorCodeClassifier + /// where + /// // Adding a trait bound for ProvideErrorMetadata allows us to inspect the error code. + /// E: StdError + ProvideErrorMetadata + Send + Sync + 'static, + /// { + /// fn classify_retry(&self, ctx: &InterceptorContext) -> RetryAction { + /// // Check for a result + /// let output_or_error = ctx.output_or_error(); + /// // Check for an error + /// let error = match output_or_error { + /// Some(Ok(_)) | None => return RetryAction::NoActionIndicated, + /// Some(Err(err)) => err, + /// }; + /// + /// // Downcast the generic error and extract the code + /// let error_code = OrchestratorError::as_operation_error(error) + /// .and_then(|err| err.downcast_ref::()) + /// .and_then(|err| err.code()); + /// + /// // If this error's code is in our list, return an action that tells the RetryStrategy to retry this request. + /// if let Some(error_code) = error_code { + /// if RETRYABLE_ERROR_CODES.contains(&error_code) { + /// return RetryAction::transient_error(); + /// } + /// } + /// + /// // Otherwise, return that no action is indicated i.e. that this classifier doesn't require a retry. + /// // Another classifier may still classify this response as retryable. + /// RetryAction::NoActionIndicated + /// } + /// + /// fn name(&self) -> &'static str { "Example Error Code Classifier" } + /// } + /// + /// builder.push_retry_classifier(ExampleErrorCodeClassifier::::new()) + /// } + /// + /// let mut builder = Config::builder(); + /// set_example_error_code_classifier(&mut builder); + /// let config = builder.build(); + /// # } + /// # } + /// ``` + pub fn push_retry_classifier(&mut self, retry_classifier: ::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier) -> &mut Self { + self.runtime_components.push_retry_classifier(retry_classifier); + self + } + + /// Set [`SharedRetryClassifier`](::aws_smithy_runtime_api::client::retries::classifiers::SharedRetryClassifier)s for the builder, replacing any that + /// were previously set. + pub fn set_retry_classifiers(&mut self, retry_classifiers: impl IntoIterator) -> &mut Self { + self.runtime_components.set_retry_classifiers(retry_classifiers.into_iter()); + self + } + /// Sets the [`behavior major version`](crate::config::BehaviorVersion). + /// + /// Over time, new best-practice behaviors are introduced. However, these behaviors might not be backwards + /// compatible. For example, a change which introduces new default timeouts or a new retry-mode for + /// all operations might be the ideal behavior but could break existing applications. + /// + /// # Examples + /// + /// Set the behavior major version to `latest`. This is equivalent to enabling the `behavior-version-latest` cargo feature. + /// ```no_run + /// use kronos_sdk::config::BehaviorVersion; + /// + /// let config = kronos_sdk::Config::builder() + /// .behavior_version(BehaviorVersion::latest()) + /// // ... + /// .build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + /// + /// Customizing behavior major version: + /// ```no_run + /// use kronos_sdk::config::BehaviorVersion; + /// + /// let config = kronos_sdk::Config::builder() + /// .behavior_version(BehaviorVersion::v2023_11_09()) + /// // ... + /// .build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + + pub fn behavior_version(mut self, behavior_version: crate::config::BehaviorVersion) -> Self { + self.set_behavior_version(Some(behavior_version)); + self + } + + + /// Sets the [`behavior major version`](crate::config::BehaviorVersion). + /// + /// Over time, new best-practice behaviors are introduced. However, these behaviors might not be backwards + /// compatible. For example, a change which introduces new default timeouts or a new retry-mode for + /// all operations might be the ideal behavior but could break existing applications. + /// + /// # Examples + /// + /// Set the behavior major version to `latest`. This is equivalent to enabling the `behavior-version-latest` cargo feature. + /// ```no_run + /// use kronos_sdk::config::BehaviorVersion; + /// + /// let config = kronos_sdk::Config::builder() + /// .behavior_version(BehaviorVersion::latest()) + /// // ... + /// .build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + /// + /// Customizing behavior major version: + /// ```no_run + /// use kronos_sdk::config::BehaviorVersion; + /// + /// let config = kronos_sdk::Config::builder() + /// .behavior_version(BehaviorVersion::v2023_11_09()) + /// // ... + /// .build(); + /// let client = kronos_sdk::Client::from_conf(config); + /// ``` + + pub fn set_behavior_version(&mut self, behavior_version: Option) -> &mut Self { + self.behavior_version = behavior_version; + self + } + + /// Convenience method to set the latest behavior major version + /// + /// This is equivalent to enabling the `behavior-version-latest` Cargo feature + pub fn behavior_version_latest(mut self) -> Self { + self.set_behavior_version(Some(crate::config::BehaviorVersion::latest())); + self + } + /// Adds a runtime plugin to the config. + pub fn runtime_plugin(mut self, plugin: impl crate::config::RuntimePlugin + 'static) -> Self { + self.push_runtime_plugin(crate::config::SharedRuntimePlugin::new(plugin)); + self + } + /// Adds a runtime plugin to the config. + pub fn push_runtime_plugin(&mut self, plugin: crate::config::SharedRuntimePlugin) -> &mut Self { + self.runtime_plugins.push(plugin); + self + } + #[cfg(any(feature = "test-util", test))] + #[allow(unused_mut)] + /// Apply test defaults to the builder + pub fn apply_test_defaults(&mut self) -> &mut Self { + self + .set_time_source(::std::option::Option::Some(::aws_smithy_async::time::SharedTimeSource::new( + ::aws_smithy_async::time::StaticTimeSource::new(::std::time::UNIX_EPOCH + ::std::time::Duration::from_secs(1234567890))) + )); + self.behavior_version = ::std::option::Option::Some(crate::config::BehaviorVersion::latest()); + self + } + #[cfg(any(feature = "test-util", test))] + #[allow(unused_mut)] + /// Apply test defaults to the builder + pub fn with_test_defaults(mut self) -> Self { + self.apply_test_defaults(); self + } + /// Builds a [`Config`]. + #[allow(unused_mut)] + pub fn build(mut self) -> Config { + let mut layer = self.config; + if self.runtime_components.time_source().is_none() { + self.runtime_components.set_time_source(::std::option::Option::Some(::std::default::Default::default())); + } + Config { + config: crate::config::Layer::from(layer.clone()).with_name("kronos_sdk::config::Config").freeze(), + cloneable: layer, + runtime_components: self.runtime_components, + runtime_plugins: self.runtime_plugins, + behavior_version: self.behavior_version, + } + } +} +#[derive(::std::fmt::Debug)] + pub(crate) struct ServiceRuntimePlugin { + config: ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer>, + runtime_components: ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder, + } + + impl ServiceRuntimePlugin { + pub fn new(_service_config: crate::config::Config) -> Self { + let config = { None }; + let mut runtime_components = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ServiceRuntimePlugin"); + runtime_components.push_auth_scheme(::aws_smithy_runtime_api::client::auth::SharedAuthScheme::new(::aws_smithy_runtime::client::auth::http::BearerAuthScheme::new())); +runtime_components.push_interceptor(::aws_smithy_runtime::client::http::connection_poisoning::ConnectionPoisoningInterceptor::new()); +runtime_components.push_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::HttpStatusCodeClassifier::default()); +runtime_components.push_interceptor(crate::sdk_feature_tracker::retry_mode::RetryModeFeatureTrackerInterceptor::new()); + Self { config, runtime_components } + } + } + + impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ServiceRuntimePlugin { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + self.config.clone() + } + + fn order(&self) -> ::aws_smithy_runtime_api::client::runtime_plugin::Order { + ::aws_smithy_runtime_api::client::runtime_plugin::Order::Defaults + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + ::std::borrow::Cow::Borrowed(&self.runtime_components) + } + } + + /// Cross-operation shared-state singletons + +/// A plugin that enables configuration for a single operation invocation + /// + /// The `config` method will return a `FrozenLayer` by storing values from `config_override`. + /// In the case of default values requested, they will be obtained from `client_config`. + #[derive(Debug)] + pub(crate) struct ConfigOverrideRuntimePlugin { + pub(crate) config: ::aws_smithy_types::config_bag::FrozenLayer, + pub(crate) components: ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder, + } + + impl ConfigOverrideRuntimePlugin { + #[allow(dead_code)] // unused when a service does not provide any operations + pub(crate) fn new( + config_override: Builder, + initial_config: ::aws_smithy_types::config_bag::FrozenLayer, + initial_components: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder + ) -> Self { + let mut layer = config_override.config; + let mut components = config_override.runtime_components; + #[allow(unused_mut)] + let mut resolver = ::aws_smithy_runtime::client::config_override::Resolver::overrid(initial_config, initial_components, &mut layer, &mut components); + + + + let _ = resolver; + Self { + config: ::aws_smithy_types::config_bag::Layer::from(layer) + .with_name("kronos_sdk::config::ConfigOverrideRuntimePlugin").freeze(), + components, + } + } + } + + impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ConfigOverrideRuntimePlugin { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + Some(self.config.clone()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + ::std::borrow::Cow::Borrowed(&self.components) + } + } + +pub use ::aws_smithy_types::config_bag::ConfigBag; + pub use ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; + pub use ::aws_smithy_runtime::client::identity::IdentityCache; + +pub use ::aws_smithy_async::rt::sleep::{Sleep}; + +pub(crate) fn base_client_runtime_plugins( + mut config: crate::Config, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut configured_plugins = ::std::vec::Vec::new(); + ::std::mem::swap(&mut config.runtime_plugins, &mut configured_plugins); + #[cfg(feature = "behavior-version-latest")] { + if config.behavior_version.is_none() { + config.behavior_version = Some(::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion::latest()); + } +} + + let default_retry_partition = "kronosservice"; + + + let scope = "kronos_sdk"; + + let mut plugins = ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins::new() + // defaults + .with_client_plugins(::aws_smithy_runtime::client::defaults::default_plugins( + ::aws_smithy_runtime::client::defaults::DefaultPluginParams::new() + .with_retry_partition_name(default_retry_partition) + .with_behavior_version(config.behavior_version.expect("Invalid client configuration: A behavior major version must be set when sending a request or constructing a client. You must set it during client construction or by enabling the `behavior-version-latest` cargo feature.")) + )) + // user config + .with_client_plugin( + ::aws_smithy_runtime_api::client::runtime_plugin::StaticRuntimePlugin::new() + .with_config(config.config.clone()) + .with_runtime_components(config.runtime_components.clone()) + ) + // codegen config + .with_client_plugin(crate::config::ServiceRuntimePlugin::new(config.clone())) + .with_client_plugin(::aws_smithy_runtime::client::auth::no_auth::NoAuthRuntimePlugin::new()) + .with_client_plugin( + ::aws_smithy_runtime::client::metrics::MetricsRuntimePlugin::builder() + .with_scope(scope) + .with_time_source(config.runtime_components.time_source().unwrap_or_default()) + .build() + .expect("All required fields have been set") + ); + + + + for plugin in configured_plugins { + plugins = plugins.with_client_plugin(plugin); + } + plugins + } + +pub use ::aws_smithy_types::config_bag::FrozenLayer; + +pub use ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder; + +pub use ::aws_smithy_runtime_api::client::runtime_plugin::SharedRuntimePlugin; + +pub use ::aws_smithy_runtime_api::client::behavior_version::BehaviorVersion; + +pub use ::aws_smithy_runtime_api::client::stalled_stream_protection::StalledStreamProtectionConfig; + +pub use ::aws_smithy_runtime_api::client::http::SharedHttpClient; + +pub use ::aws_smithy_async::rt::sleep::SharedAsyncSleep; + +pub use ::aws_smithy_runtime_api::client::identity::SharedIdentityCache; + +pub use ::aws_smithy_runtime_api::client::interceptors::SharedInterceptor; + +pub use ::aws_smithy_runtime_api::client::http::HttpClient; + +pub use ::aws_smithy_runtime_api::shared::IntoShared; + +pub use ::aws_smithy_runtime_api::client::identity::http::Token; + +pub use ::aws_smithy_runtime_api::client::identity::ResolveIdentity; + +pub use ::aws_smithy_async::rt::sleep::AsyncSleep; + +pub use ::aws_smithy_runtime_api::client::identity::ResolveCachedIdentity; + +pub use ::aws_smithy_runtime_api::client::interceptors::Intercept; + +pub use ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin; + +pub use ::aws_smithy_types::config_bag::Layer; + +/// Types needed to configure endpoint resolution. +pub mod endpoint; + +/// HTTP request and response types. +pub mod http; + +/// Types needed to implement [`Intercept`](crate::config::Intercept). +pub mod interceptors; + +/// Retry configuration. +pub mod retry; + +/// Timeout configuration. +pub mod timeout; + diff --git a/sdks/rust/src/config/endpoint.rs b/sdks/rust/src/config/endpoint.rs new file mode 100644 index 0000000..a0c40bf --- /dev/null +++ b/sdks/rust/src/config/endpoint.rs @@ -0,0 +1,89 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver; + pub use ::aws_smithy_runtime_api::client::endpoint::EndpointFuture; + pub use ::aws_smithy_types::endpoint::Endpoint; + +#[cfg(test)] +mod test { + + + +} + +/// Endpoint resolver trait specific to Kronos Task Executor API + pub trait ResolveEndpoint: ::std::marker::Send + ::std::marker::Sync + ::std::fmt::Debug { + /// Resolve an endpoint with the given parameters + fn resolve_endpoint<'a>(&'a self, params: &'a crate::config::endpoint::Params) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a>; + + /// Convert this service-specific resolver into a `SharedEndpointResolver` + /// + /// The resulting resolver will downcast `EndpointResolverParams` into `crate::config::endpoint::Params`. + fn into_shared_resolver(self) -> ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver + where + Self: Sized + 'static, + { + ::aws_smithy_runtime_api::client::endpoint::SharedEndpointResolver::new(DowncastParams(self)) + } + } + + #[derive(Debug)] + struct DowncastParams(T); + impl ::aws_smithy_runtime_api::client::endpoint::ResolveEndpoint for DowncastParams + where + T: ResolveEndpoint, + { + fn resolve_endpoint<'a>(&'a self, params: &'a ::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams) -> ::aws_smithy_runtime_api::client::endpoint::EndpointFuture<'a> { + let ep = match params.get::() { + Some(params) => self.0.resolve_endpoint(params), + None => ::aws_smithy_runtime_api::client::endpoint::EndpointFuture::ready(Err("params of expected type was not present".into())), + }; + ep + } + } + +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +/// Configuration parameters for resolving the correct endpoint +pub struct Params { +} +impl Params { + /// Create a builder for [`Params`] + pub fn builder() -> crate::config::endpoint::ParamsBuilder { + crate::config::endpoint::ParamsBuilder::default() + } +} + +/// Builder for [`Params`] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +pub struct ParamsBuilder { +} +impl ParamsBuilder { + /// Consume this builder, creating [`Params`]. + pub fn build(self) -> ::std::result::Result { + Ok(#[allow(clippy::unnecessary_lazy_evaluations)] + crate::config::endpoint::Params { + }) + } +} + +/// An error that occurred during endpoint resolution + #[derive(Debug)] + pub struct InvalidParams { + field: std::borrow::Cow<'static, str> + } + + impl InvalidParams { + #[allow(dead_code)] + fn missing(field: &'static str) -> Self { + Self { field: field.into() } + } + } + + impl std::fmt::Display for InvalidParams { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "a required field was missing: `{}`", self.field) + } + } + + impl std::error::Error for InvalidParams { } + diff --git a/sdks/rust/src/config/http.rs b/sdks/rust/src/config/http.rs new file mode 100644 index 0000000..b733714 --- /dev/null +++ b/sdks/rust/src/config/http.rs @@ -0,0 +1,4 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use ::aws_smithy_runtime_api::client::orchestrator::HttpRequest; + pub use ::aws_smithy_runtime_api::client::orchestrator::HttpResponse; + diff --git a/sdks/rust/src/config/interceptors.rs b/sdks/rust/src/config/interceptors.rs new file mode 100644 index 0000000..bc560a2 --- /dev/null +++ b/sdks/rust/src/config/interceptors.rs @@ -0,0 +1,12 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use ::aws_smithy_runtime_api::client::interceptors::context::AfterDeserializationInterceptorContextRef; + pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeDeserializationInterceptorContextMut; + pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeDeserializationInterceptorContextRef; + pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut; + pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef; + pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextMut; + pub use ::aws_smithy_runtime_api::client::interceptors::context::BeforeTransmitInterceptorContextRef; + pub use ::aws_smithy_runtime_api::client::interceptors::context::FinalizerInterceptorContextMut; + pub use ::aws_smithy_runtime_api::client::interceptors::context::FinalizerInterceptorContextRef; + pub use ::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext; + diff --git a/sdks/rust/src/config/retry.rs b/sdks/rust/src/config/retry.rs new file mode 100644 index 0000000..9c2f16b --- /dev/null +++ b/sdks/rust/src/config/retry.rs @@ -0,0 +1,8 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use ::aws_smithy_runtime_api::client::retries::classifiers::ClassifyRetry; + pub use ::aws_smithy_runtime_api::client::retries::classifiers::RetryAction; + pub use ::aws_smithy_runtime_api::client::retries::ShouldAttempt; + +pub use ::aws_smithy_types::retry::{RetryConfig, RetryConfigBuilder, RetryMode, ReconnectMode}; +pub use ::aws_smithy_runtime::client::retries::RetryPartition; + diff --git a/sdks/rust/src/config/timeout.rs b/sdks/rust/src/config/timeout.rs new file mode 100644 index 0000000..cfc93b8 --- /dev/null +++ b/sdks/rust/src/config/timeout.rs @@ -0,0 +1,3 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use ::aws_smithy_types::timeout::{TimeoutConfig, TimeoutConfigBuilder}; + diff --git a/sdks/rust/src/error.rs b/sdks/rust/src/error.rs new file mode 100644 index 0000000..7d34334 --- /dev/null +++ b/sdks/rust/src/error.rs @@ -0,0 +1,31 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use ::aws_smithy_runtime_api::box_error::BoxError; + +/// Error type returned by the client. + pub type SdkError = ::aws_smithy_runtime_api::client::result::SdkError; + pub use ::aws_smithy_types::error::operation::BuildError; + pub use ::aws_smithy_runtime_api::client::result::ConnectorError; + + pub use ::aws_smithy_types::error::display::DisplayErrorContext; + pub use ::aws_smithy_types::error::metadata::ProvideErrorMetadata; + pub use ::aws_smithy_types::error::metadata::ErrorMetadata; + +/// The given enum value failed to parse since it is not a known value. + #[derive(Debug)] + pub struct UnknownVariantError { + value: ::std::string::String, + } + impl UnknownVariantError { + pub(crate) fn new(value: impl ::std::convert::Into<::std::string::String>) -> Self { + Self { value: value.into() } + } + } + impl ::std::fmt::Display for UnknownVariantError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::result::Result<(), ::std::fmt::Error> { + write!(f, "unknown enum variant: '{}'", self.value) + } + } + impl ::std::error::Error for UnknownVariantError {} + +pub(crate) mod sealed_unhandled; + diff --git a/sdks/rust/src/error/sealed_unhandled.rs b/sdks/rust/src/error/sealed_unhandled.rs new file mode 100644 index 0000000..cd77070 --- /dev/null +++ b/sdks/rust/src/error/sealed_unhandled.rs @@ -0,0 +1,21 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// This struct is not intended to be used. + /// + /// This struct holds information about an unhandled error, + /// but that information should be obtained by using the + /// [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) trait + /// on the error type. + /// + /// This struct intentionally doesn't yield any useful information itself. + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ +variable wildcard pattern and check `.code()`: + \ +   `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ +See [`ProvideErrorMetadata`](::aws_smithy_types::error::metadata::ProvideErrorMetadata) for what information is available for the error.")] + #[derive(Debug)] + pub struct Unhandled { + pub(crate) source: ::aws_smithy_runtime_api::box_error::BoxError, + pub(crate) meta: ::aws_smithy_types::error::metadata::ErrorMetadata, + } + diff --git a/sdks/rust/src/error_meta.rs b/sdks/rust/src/error_meta.rs new file mode 100644 index 0000000..a61dcc4 --- /dev/null +++ b/sdks/rust/src/error_meta.rs @@ -0,0 +1,618 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// All possible error types for this service. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum Error { + #[allow(missing_docs)] // documentation missing in model + ConflictError(crate::types::error::ConflictError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + InvalidRequestError(crate::types::error::InvalidRequestError), + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + UnprocessableEntityError(crate::types::error::UnprocessableEntityError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-Error) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled) +} +impl ::std::fmt::Display for Error { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Error::ConflictError(inner) => inner.fmt(f), + Error::InternalError(inner) => inner.fmt(f), + Error::InvalidRequestError(inner) => inner.fmt(f), + Error::NotFoundError(inner) => inner.fmt(f), + Error::RateLimitedError(inner) => inner.fmt(f), + Error::UnauthorizedError(inner) => inner.fmt(f), + Error::UnprocessableEntityError(inner) => inner.fmt(f), + Error::Unhandled(_) => if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } +} +impl From<::aws_smithy_types::error::operation::BuildError> for Error { + fn from(value: ::aws_smithy_types::error::operation::BuildError) -> Self { + Error::Unhandled(crate::error::sealed_unhandled::Unhandled { source: value.into(), meta: ::std::default::Default::default() }) + } + } +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for Error { + fn meta(&self) -> &::aws_smithy_types::error::metadata::ErrorMetadata { + match self { + Self::ConflictError(inner) => inner.meta(), +Self::InternalError(inner) => inner.meta(), +Self::InvalidRequestError(inner) => inner.meta(), +Self::NotFoundError(inner) => inner.meta(), +Self::RateLimitedError(inner) => inner.meta(), +Self::UnauthorizedError(inner) => inner.meta(), +Self::UnprocessableEntityError(inner) => inner.meta(), + Self::Unhandled(inner) => &inner.meta, + } + } + } +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::cancel_execution::CancelExecutionError) -> Self { + match err { + crate::operation::cancel_execution::CancelExecutionError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::cancel_execution::CancelExecutionError::ConflictError(inner) => Error::ConflictError(inner), + crate::operation::cancel_execution::CancelExecutionError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::cancel_execution::CancelExecutionError::InternalError(inner) => Error::InternalError(inner), + crate::operation::cancel_execution::CancelExecutionError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::cancel_execution::CancelExecutionError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::cancel_job::CancelJobError) -> Self { + match err { + crate::operation::cancel_job::CancelJobError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::cancel_job::CancelJobError::ConflictError(inner) => Error::ConflictError(inner), + crate::operation::cancel_job::CancelJobError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::cancel_job::CancelJobError::InternalError(inner) => Error::InternalError(inner), + crate::operation::cancel_job::CancelJobError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::cancel_job::CancelJobError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::create_endpoint::CreateEndpointError) -> Self { + match err { + crate::operation::create_endpoint::CreateEndpointError::InvalidRequestError(inner) => Error::InvalidRequestError(inner), + crate::operation::create_endpoint::CreateEndpointError::ConflictError(inner) => Error::ConflictError(inner), + crate::operation::create_endpoint::CreateEndpointError::UnprocessableEntityError(inner) => Error::UnprocessableEntityError(inner), + crate::operation::create_endpoint::CreateEndpointError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::create_endpoint::CreateEndpointError::InternalError(inner) => Error::InternalError(inner), + crate::operation::create_endpoint::CreateEndpointError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::create_endpoint::CreateEndpointError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::create_job::CreateJobError) -> Self { + match err { + crate::operation::create_job::CreateJobError::InvalidRequestError(inner) => Error::InvalidRequestError(inner), + crate::operation::create_job::CreateJobError::ConflictError(inner) => Error::ConflictError(inner), + crate::operation::create_job::CreateJobError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::create_job::CreateJobError::UnprocessableEntityError(inner) => Error::UnprocessableEntityError(inner), + crate::operation::create_job::CreateJobError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::create_job::CreateJobError::InternalError(inner) => Error::InternalError(inner), + crate::operation::create_job::CreateJobError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::create_job::CreateJobError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::create_payload_spec::CreatePayloadSpecError) -> Self { + match err { + crate::operation::create_payload_spec::CreatePayloadSpecError::InvalidRequestError(inner) => Error::InvalidRequestError(inner), + crate::operation::create_payload_spec::CreatePayloadSpecError::ConflictError(inner) => Error::ConflictError(inner), + crate::operation::create_payload_spec::CreatePayloadSpecError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::create_payload_spec::CreatePayloadSpecError::InternalError(inner) => Error::InternalError(inner), + crate::operation::create_payload_spec::CreatePayloadSpecError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::create_payload_spec::CreatePayloadSpecError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::delete_endpoint::DeleteEndpointError) -> Self { + match err { + crate::operation::delete_endpoint::DeleteEndpointError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::delete_endpoint::DeleteEndpointError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::delete_endpoint::DeleteEndpointError::InternalError(inner) => Error::InternalError(inner), + crate::operation::delete_endpoint::DeleteEndpointError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::delete_endpoint::DeleteEndpointError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::delete_payload_spec::DeletePayloadSpecError) -> Self { + match err { + crate::operation::delete_payload_spec::DeletePayloadSpecError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::delete_payload_spec::DeletePayloadSpecError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::delete_payload_spec::DeletePayloadSpecError::InternalError(inner) => Error::InternalError(inner), + crate::operation::delete_payload_spec::DeletePayloadSpecError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::delete_payload_spec::DeletePayloadSpecError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::get_endpoint::GetEndpointError) -> Self { + match err { + crate::operation::get_endpoint::GetEndpointError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::get_endpoint::GetEndpointError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::get_endpoint::GetEndpointError::InternalError(inner) => Error::InternalError(inner), + crate::operation::get_endpoint::GetEndpointError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::get_endpoint::GetEndpointError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::get_execution::GetExecutionError) -> Self { + match err { + crate::operation::get_execution::GetExecutionError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::get_execution::GetExecutionError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::get_execution::GetExecutionError::InternalError(inner) => Error::InternalError(inner), + crate::operation::get_execution::GetExecutionError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::get_execution::GetExecutionError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::get_job::GetJobError) -> Self { + match err { + crate::operation::get_job::GetJobError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::get_job::GetJobError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::get_job::GetJobError::InternalError(inner) => Error::InternalError(inner), + crate::operation::get_job::GetJobError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::get_job::GetJobError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::get_job_status::GetJobStatusError) -> Self { + match err { + crate::operation::get_job_status::GetJobStatusError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::get_job_status::GetJobStatusError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::get_job_status::GetJobStatusError::InternalError(inner) => Error::InternalError(inner), + crate::operation::get_job_status::GetJobStatusError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::get_job_status::GetJobStatusError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::get_job_versions::GetJobVersionsError) -> Self { + match err { + crate::operation::get_job_versions::GetJobVersionsError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::get_job_versions::GetJobVersionsError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::get_job_versions::GetJobVersionsError::InternalError(inner) => Error::InternalError(inner), + crate::operation::get_job_versions::GetJobVersionsError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::get_job_versions::GetJobVersionsError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::get_payload_spec::GetPayloadSpecError) -> Self { + match err { + crate::operation::get_payload_spec::GetPayloadSpecError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::get_payload_spec::GetPayloadSpecError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::get_payload_spec::GetPayloadSpecError::InternalError(inner) => Error::InternalError(inner), + crate::operation::get_payload_spec::GetPayloadSpecError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::get_payload_spec::GetPayloadSpecError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::list_endpoints::ListEndpointsError) -> Self { + match err { + crate::operation::list_endpoints::ListEndpointsError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::list_endpoints::ListEndpointsError::InternalError(inner) => Error::InternalError(inner), + crate::operation::list_endpoints::ListEndpointsError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::list_endpoints::ListEndpointsError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::list_execution_attempts::ListExecutionAttemptsError) -> Self { + match err { + crate::operation::list_execution_attempts::ListExecutionAttemptsError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::list_execution_attempts::ListExecutionAttemptsError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::list_execution_attempts::ListExecutionAttemptsError::InternalError(inner) => Error::InternalError(inner), + crate::operation::list_execution_attempts::ListExecutionAttemptsError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::list_execution_attempts::ListExecutionAttemptsError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::list_execution_logs::ListExecutionLogsError) -> Self { + match err { + crate::operation::list_execution_logs::ListExecutionLogsError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::list_execution_logs::ListExecutionLogsError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::list_execution_logs::ListExecutionLogsError::InternalError(inner) => Error::InternalError(inner), + crate::operation::list_execution_logs::ListExecutionLogsError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::list_execution_logs::ListExecutionLogsError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::list_job_executions::ListJobExecutionsError) -> Self { + match err { + crate::operation::list_job_executions::ListJobExecutionsError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::list_job_executions::ListJobExecutionsError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::list_job_executions::ListJobExecutionsError::InternalError(inner) => Error::InternalError(inner), + crate::operation::list_job_executions::ListJobExecutionsError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::list_job_executions::ListJobExecutionsError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::list_jobs::ListJobsError) -> Self { + match err { + crate::operation::list_jobs::ListJobsError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::list_jobs::ListJobsError::InternalError(inner) => Error::InternalError(inner), + crate::operation::list_jobs::ListJobsError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::list_jobs::ListJobsError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::list_payload_specs::ListPayloadSpecsError) -> Self { + match err { + crate::operation::list_payload_specs::ListPayloadSpecsError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::list_payload_specs::ListPayloadSpecsError::InternalError(inner) => Error::InternalError(inner), + crate::operation::list_payload_specs::ListPayloadSpecsError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::list_payload_specs::ListPayloadSpecsError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::update_endpoint::UpdateEndpointError) -> Self { + match err { + crate::operation::update_endpoint::UpdateEndpointError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::update_endpoint::UpdateEndpointError::InvalidRequestError(inner) => Error::InvalidRequestError(inner), + crate::operation::update_endpoint::UpdateEndpointError::UnprocessableEntityError(inner) => Error::UnprocessableEntityError(inner), + crate::operation::update_endpoint::UpdateEndpointError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::update_endpoint::UpdateEndpointError::InternalError(inner) => Error::InternalError(inner), + crate::operation::update_endpoint::UpdateEndpointError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::update_endpoint::UpdateEndpointError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::update_job::UpdateJobError) -> Self { + match err { + crate::operation::update_job::UpdateJobError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::update_job::UpdateJobError::InvalidRequestError(inner) => Error::InvalidRequestError(inner), + crate::operation::update_job::UpdateJobError::UnprocessableEntityError(inner) => Error::UnprocessableEntityError(inner), + crate::operation::update_job::UpdateJobError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::update_job::UpdateJobError::InternalError(inner) => Error::InternalError(inner), + crate::operation::update_job::UpdateJobError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::update_job::UpdateJobError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl From<::aws_smithy_runtime_api::client::result::SdkError> for Error where R: Send + Sync + std::fmt::Debug + 'static { + fn from(err: ::aws_smithy_runtime_api::client::result::SdkError) -> Self { + match err { + ::aws_smithy_runtime_api::client::result::SdkError::ServiceError(context) => Self::from(context.into_err()), + _ => Error::Unhandled( + crate::error::sealed_unhandled::Unhandled { + meta: ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(&err).clone(), + source: err.into(), + } + ), + } + } +} +impl From for Error { + fn from(err: crate::operation::update_payload_spec::UpdatePayloadSpecError) -> Self { + match err { + crate::operation::update_payload_spec::UpdatePayloadSpecError::NotFoundError(inner) => Error::NotFoundError(inner), + crate::operation::update_payload_spec::UpdatePayloadSpecError::InvalidRequestError(inner) => Error::InvalidRequestError(inner), + crate::operation::update_payload_spec::UpdatePayloadSpecError::UnauthorizedError(inner) => Error::UnauthorizedError(inner), + crate::operation::update_payload_spec::UpdatePayloadSpecError::InternalError(inner) => Error::InternalError(inner), + crate::operation::update_payload_spec::UpdatePayloadSpecError::RateLimitedError(inner) => Error::RateLimitedError(inner), + crate::operation::update_payload_spec::UpdatePayloadSpecError::Unhandled(inner) => Error::Unhandled(inner), + } + } +} +impl ::std::error::Error for Error { + fn source(&self) -> std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Error::ConflictError(inner) => inner.source(), + Error::InternalError(inner) => inner.source(), + Error::InvalidRequestError(inner) => inner.source(), + Error::NotFoundError(inner) => inner.source(), + Error::RateLimitedError(inner) => inner.source(), + Error::UnauthorizedError(inner) => inner.source(), + Error::UnprocessableEntityError(inner) => inner.source(), + Error::Unhandled(inner) => ::std::option::Option::Some(&*inner.source) + } + } +} + diff --git a/sdks/rust/src/json_errors.rs b/sdks/rust/src/json_errors.rs new file mode 100644 index 0000000..6ddf43d --- /dev/null +++ b/sdks/rust/src/json_errors.rs @@ -0,0 +1,212 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +use aws_smithy_json::deserialize::token::skip_value; +use aws_smithy_json::deserialize::{error::DeserializeError, json_token_iter, Token}; +use aws_smithy_runtime_api::http::Headers; +use aws_smithy_types::error::metadata::{Builder as ErrorMetadataBuilder, ErrorMetadata}; +use std::borrow::Cow; + +// currently only used by AwsJson +#[allow(unused)] +pub fn is_error(response: &http::Response) -> bool { + !response.status().is_success() +} + +fn sanitize_error_code(error_code: &str) -> &str { + // Trim a trailing URL from the error code, which is done by removing the longest suffix + // beginning with a `:` + let error_code = match error_code.find(':') { + Some(idx) => &error_code[..idx], + None => error_code, + }; + + // Trim a prefixing namespace from the error code, beginning with a `#` + match error_code.find('#') { + Some(idx) => &error_code[idx + 1..], + None => error_code, + } +} + +struct ErrorBody<'a> { + code: Option>, + message: Option>, +} + +fn parse_error_body(bytes: &[u8]) -> Result { + let mut tokens = json_token_iter(bytes).peekable(); + let (mut typ, mut code, mut message) = (None, None, None); + if let Some(Token::StartObject { .. }) = tokens.next().transpose()? { + loop { + match tokens.next().transpose()? { + Some(Token::EndObject { .. }) => break, + Some(Token::ObjectKey { key, .. }) => { + if let Some(Ok(Token::ValueString { value, .. })) = tokens.peek() { + match key.as_escaped_str() { + "code" => code = Some(value.to_unescaped()?), + "__type" => typ = Some(value.to_unescaped()?), + "message" | "Message" | "errorMessage" => { + message = Some(value.to_unescaped()?) + } + _ => {} + } + } + skip_value(&mut tokens)?; + } + _ => { + return Err(DeserializeError::custom( + "expected object key or end object", + )) + } + } + } + if tokens.next().is_some() { + return Err(DeserializeError::custom( + "found more JSON tokens after completing parsing", + )); + } + } + Ok(ErrorBody { + code: code.or(typ), + message, + }) +} + +pub fn parse_error_metadata( + payload: &[u8], + headers: &Headers, +) -> Result { + let ErrorBody { code, message } = parse_error_body(payload)?; + + let mut err_builder = ErrorMetadata::builder(); + if let Some(code) = headers + .get("x-amzn-errortype") + .or(code.as_deref()) + .map(sanitize_error_code) + { + err_builder = err_builder.code(code); + } + if let Some(message) = message { + err_builder = err_builder.message(message); + } + Ok(err_builder) +} + +#[cfg(test)] +mod test { + use crate::json_errors::{parse_error_body, parse_error_metadata, sanitize_error_code}; + use aws_smithy_runtime_api::client::orchestrator::HttpResponse; + use aws_smithy_types::{body::SdkBody, error::ErrorMetadata}; + use std::borrow::Cow; + + #[test] + fn error_metadata() { + let response = HttpResponse::try_from( + http::Response::builder() + .body(SdkBody::from( + r#"{ "__type": "FooError", "message": "Go to foo" }"#, + )) + .unwrap(), + ) + .unwrap(); + assert_eq!( + parse_error_metadata(response.body().bytes().unwrap(), response.headers()) + .unwrap() + .build(), + ErrorMetadata::builder() + .code("FooError") + .message("Go to foo") + .build() + ) + } + + #[test] + fn error_type() { + assert_eq!( + Some(Cow::Borrowed("FooError")), + parse_error_body(br#"{ "__type": "FooError" }"#) + .unwrap() + .code + ); + } + + #[test] + fn code_takes_priority() { + assert_eq!( + Some(Cow::Borrowed("BarError")), + parse_error_body(br#"{ "code": "BarError", "__type": "FooError" }"#) + .unwrap() + .code + ); + } + + #[test] + fn ignore_unrecognized_fields() { + assert_eq!( + Some(Cow::Borrowed("FooError")), + parse_error_body(br#"{ "__type": "FooError", "asdf": 5, "fdsa": {}, "foo": "1" }"#) + .unwrap() + .code + ); + } + + #[test] + fn sanitize_namespace_and_url() { + assert_eq!( + sanitize_error_code("aws.protocoltests.restjson#FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/"), + "FooError"); + } + + #[test] + fn sanitize_noop() { + assert_eq!(sanitize_error_code("FooError"), "FooError"); + } + + #[test] + fn sanitize_url() { + assert_eq!( + sanitize_error_code( + "FooError:http://internal.amazon.com/coral/com.amazon.coral.validate/" + ), + "FooError" + ); + } + + #[test] + fn sanitize_namespace() { + assert_eq!( + sanitize_error_code("aws.protocoltests.restjson#FooError"), + "FooError" + ); + } + + // services like lambda use an alternate `Message` instead of `message` + #[test] + fn alternative_error_message_names() { + let response = HttpResponse::try_from( + http::Response::builder() + .header("x-amzn-errortype", "ResourceNotFoundException") + .body(SdkBody::from( + r#"{ + "Type": "User", + "Message": "Functions from 'us-west-2' are not reachable from us-east-1" + }"#, + )) + .unwrap(), + ) + .unwrap(); + assert_eq!( + parse_error_metadata(response.body().bytes().unwrap(), response.headers()) + .unwrap() + .build(), + ErrorMetadata::builder() + .code("ResourceNotFoundException") + .message("Functions from 'us-west-2' are not reachable from us-east-1") + .build() + ); + } +} + diff --git a/sdks/rust/src/lib.rs b/sdks/rust/src/lib.rs new file mode 100644 index 0000000..ca8d12f --- /dev/null +++ b/sdks/rust/src/lib.rs @@ -0,0 +1,136 @@ +#![allow(deprecated)] +#![allow(unknown_lints)] +#![allow(clippy::module_inception)] +#![allow(clippy::upper_case_acronyms)] +#![allow(clippy::large_enum_variant)] +#![allow(clippy::wrong_self_convention)] +#![allow(clippy::should_implement_trait)] +#![allow(clippy::disallowed_names)] +#![allow(clippy::vec_init_then_push)] +#![allow(clippy::type_complexity)] +#![allow(clippy::needless_return)] +#![allow(clippy::derive_partial_eq_without_eq)] +#![allow(clippy::result_large_err)] +#![allow(clippy::unnecessary_map_on_constructor)] +#![allow(rustdoc::bare_urls)] +#![allow(rustdoc::redundant_explicit_links)] + +#![forbid(unsafe_code)] +#![warn(missing_docs)] +#![cfg_attr(docsrs, feature(doc_auto_cfg))] +//! Kronos — Distributed Job Scheduling and Execution Engine. +//! Provides durable, retriable delivery of messages to HTTP endpoints, +//! Kafka topics, and Redis Streams. +//! +//! # Crate Organization +//! +//! The entry point for most customers will be [`Client`], which exposes one method for each API +//! offered by Kronos Task Executor API. The return value of each of these methods is a "fluent builder", +//! where the different inputs for that API are added by builder-style function call chaining, +//! followed by calling `send()` to get a [`Future`](std::future::Future) that will result in +//! either a successful output or a [`SdkError`](crate::error::SdkError). +//! +//! Some of these API inputs may be structs or enums to provide more complex structured information. +//! These structs and enums live in [`types`](crate::types). There are some simpler types for +//! representing data such as date times or binary blobs that live in [`primitives`](crate::primitives). +//! +//! All types required to configure a client via the [`Config`](crate::Config) struct live +//! in [`config`](crate::config). +//! +//! The [`operation`](crate::operation) module has a submodule for every API, and in each submodule +//! is the input, output, and error type for that API, as well as builders to construct each of those. +//! +//! There is a top-level [`Error`](crate::Error) type that encompasses all the errors that the +//! client can return. Any other error type can be converted to this `Error` type via the +//! [`From`](std::convert::From) trait. +//! +//! The other modules within this crate are not required for normal usage. + + +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use error_meta::Error; + +#[doc(inline)] +pub use config::Config; + +/// Client for calling Kronos Task Executor API. +/// +/// ## Constructing a `Client` +/// +/// A `Client` requires a config in order to be constructed. With the default set of Cargo features, +/// this config will only require an endpoint to produce a functioning client. However, some Smithy +/// features will require additional configuration. For example, `@auth` requires some kind of identity +/// or identity resolver to be configured. The config is used to customize various aspects of the client, +/// such as: +/// +/// - [The underlying HTTP client](crate::config::Builder::http_client) +/// - [Retries](crate::config::Builder::retry_config) +/// - [Timeouts](crate::config::Builder::timeout_config) +/// - [... and more](crate::config::Builder) +/// +/// Below is a minimal example of how to create a client: +/// +/// ```rust,no_run +/// let config = kronos_sdk::Config::builder() +/// .endpoint_url("http://localhost:1234") +/// .build(); +/// let client = kronos_sdk::Client::from_conf(config); +/// ``` +/// +/// _Note:_ Client construction is expensive due to connection thread pool initialization, and should be done +/// once at application start-up. Cloning a client is cheap (it's just an [`Arc`](std::sync::Arc) under the hood), +/// so creating it once at start-up and cloning it around the application as needed is recommended. +/// # Using the `Client` +/// +/// A client has a function for every operation that can be performed by the service. +/// For example, the [`CancelExecution`](crate::operation::cancel_execution) operation has +/// a [`Client::cancel_execution`], function which returns a builder for that operation. +/// The fluent builder ultimately has a `send()` function that returns an async future that +/// returns a result, as illustrated below: +/// +/// ```rust,ignore +/// let result = client.cancel_execution() +/// .org_id("example") +/// .send() +/// .await; +/// ``` +/// +/// The underlying HTTP requests that get made by this can be modified with the `customize_operation` +/// function on the fluent builder. See the [`customize`](crate::client::customize) module for more +/// information. +pub mod client; + +/// Configuration for Kronos Task Executor API. +pub mod config; + +/// Common errors and error handling utilities. +pub mod error; + +mod error_meta; + +/// Information about this crate. +pub mod meta; + +/// Primitives such as `Blob` or `DateTime` used by other types. +pub mod primitives; + +/// Data structures used by operation inputs/outputs. +pub mod types; + +mod auth_plugin; + +/// All operations that this crate can perform. +pub mod operation; + +pub(crate) mod protocol_serde; + +mod sdk_feature_tracker; + +mod serialization_settings; + +mod serde_util; + +mod json_errors; + +pub use client::Client; + diff --git a/sdks/rust/src/meta.rs b/sdks/rust/src/meta.rs new file mode 100644 index 0000000..3fda457 --- /dev/null +++ b/sdks/rust/src/meta.rs @@ -0,0 +1,5 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// Crate version number. + pub static PKG_VERSION: &str = env!("CARGO_PKG_VERSION"); + diff --git a/sdks/rust/src/operation.rs b/sdks/rust/src/operation.rs new file mode 100644 index 0000000..2256602 --- /dev/null +++ b/sdks/rust/src/operation.rs @@ -0,0 +1,68 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// Types for the `CancelExecution` operation. +pub mod cancel_execution; + +/// Types for the `CancelJob` operation. +pub mod cancel_job; + +/// Types for the `CreateEndpoint` operation. +pub mod create_endpoint; + +/// Types for the `CreateJob` operation. +pub mod create_job; + +/// Types for the `CreatePayloadSpec` operation. +pub mod create_payload_spec; + +/// Types for the `DeleteEndpoint` operation. +pub mod delete_endpoint; + +/// Types for the `DeletePayloadSpec` operation. +pub mod delete_payload_spec; + +/// Types for the `GetEndpoint` operation. +pub mod get_endpoint; + +/// Types for the `GetExecution` operation. +pub mod get_execution; + +/// Types for the `GetJob` operation. +pub mod get_job; + +/// Types for the `GetJobStatus` operation. +pub mod get_job_status; + +/// Types for the `GetJobVersions` operation. +pub mod get_job_versions; + +/// Types for the `GetPayloadSpec` operation. +pub mod get_payload_spec; + +/// Types for the `ListEndpoints` operation. +pub mod list_endpoints; + +/// Types for the `ListExecutionAttempts` operation. +pub mod list_execution_attempts; + +/// Types for the `ListExecutionLogs` operation. +pub mod list_execution_logs; + +/// Types for the `ListJobExecutions` operation. +pub mod list_job_executions; + +/// Types for the `ListJobs` operation. +pub mod list_jobs; + +/// Types for the `ListPayloadSpecs` operation. +pub mod list_payload_specs; + +/// Types for the `UpdateEndpoint` operation. +pub mod update_endpoint; + +/// Types for the `UpdateJob` operation. +pub mod update_job; + +/// Types for the `UpdatePayloadSpec` operation. +pub mod update_payload_spec; + diff --git a/sdks/rust/src/operation/cancel_execution.rs b/sdks/rust/src/operation/cancel_execution.rs new file mode 100644 index 0000000..181494d --- /dev/null +++ b/sdks/rust/src/operation/cancel_execution.rs @@ -0,0 +1,364 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `CancelExecution`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CancelExecution; +impl CancelExecution { + /// Creates a new `CancelExecution` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::cancel_execution::CancelExecutionInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::cancel_execution::CancelExecutionInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "CancelExecution", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.CancelExecution", + "rpc.service" = "KronosService", + "rpc.method" = "CancelExecution", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CancelExecution { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CancelExecution"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(CancelExecutionRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(CancelExecutionResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "CancelExecution", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CancelExecution") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(CancelExecutionEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct CancelExecutionResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CancelExecutionResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_cancel_execution::de_cancel_execution_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_cancel_execution::de_cancel_execution_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct CancelExecutionRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CancelExecutionRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::cancel_execution::CancelExecutionInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.execution_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "cannot be empty or unset"))?; + let execution_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if execution_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/executions/{execution_id}/cancel", execution_id = execution_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::cancel_execution::CancelExecutionInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_cancel_execution::ser_cancel_execution_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("POST").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct CancelExecutionEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CancelExecutionEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "CancelExecutionEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to CancelExecutionInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `CancelExecutionError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum CancelExecutionError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + ConflictError(crate::types::error::ConflictError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CancelExecutionError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl CancelExecutionError { + /// Creates the `CancelExecutionError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `CancelExecutionError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::ConflictError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `CancelExecutionError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `CancelExecutionError::ConflictError`. + pub fn is_conflict_error(&self) -> bool { + matches!(self, Self::ConflictError(_)) + } + /// Returns `true` if the error kind is `CancelExecutionError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `CancelExecutionError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `CancelExecutionError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for CancelExecutionError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::ConflictError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for CancelExecutionError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::ConflictError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for CancelExecutionError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CancelExecutionError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::ConflictError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CancelExecutionError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::cancel_execution::_cancel_execution_input::CancelExecutionInput; + +pub use crate::operation::cancel_execution::_cancel_execution_output::CancelExecutionOutput; + +mod _cancel_execution_input; + +mod _cancel_execution_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/cancel_execution/_cancel_execution_input.rs b/sdks/rust/src/operation/cancel_execution/_cancel_execution_input.rs new file mode 100644 index 0000000..2e1b57f --- /dev/null +++ b/sdks/rust/src/operation/cancel_execution/_cancel_execution_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CancelExecutionInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub execution_id: ::std::option::Option<::std::string::String>, +} +impl CancelExecutionInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(&self) -> ::std::option::Option<&str> { + self.execution_id.as_deref() + } +} +impl CancelExecutionInput { + /// Creates a new builder-style object to manufacture [`CancelExecutionInput`](crate::operation::cancel_execution::CancelExecutionInput). + pub fn builder() -> crate::operation::cancel_execution::builders::CancelExecutionInputBuilder { + crate::operation::cancel_execution::builders::CancelExecutionInputBuilder::default() + } +} + +/// A builder for [`CancelExecutionInput`](crate::operation::cancel_execution::CancelExecutionInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CancelExecutionInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) execution_id: ::std::option::Option<::std::string::String>, +} +impl CancelExecutionInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.execution_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.execution_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + &self.execution_id + } + /// Consumes the builder and constructs a [`CancelExecutionInput`](crate::operation::cancel_execution::CancelExecutionInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::cancel_execution::CancelExecutionInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + execution_id: self.execution_id + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/cancel_execution/_cancel_execution_output.rs b/sdks/rust/src/operation/cancel_execution/_cancel_execution_output.rs new file mode 100644 index 0000000..3a1e1fe --- /dev/null +++ b/sdks/rust/src/operation/cancel_execution/_cancel_execution_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CancelExecutionOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::ExecutionResource, +} +impl CancelExecutionOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::ExecutionResource { + &self.data + } +} +impl CancelExecutionOutput { + /// Creates a new builder-style object to manufacture [`CancelExecutionOutput`](crate::operation::cancel_execution::CancelExecutionOutput). + pub fn builder() -> crate::operation::cancel_execution::builders::CancelExecutionOutputBuilder { + crate::operation::cancel_execution::builders::CancelExecutionOutputBuilder::default() + } +} + +/// A builder for [`CancelExecutionOutput`](crate::operation::cancel_execution::CancelExecutionOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CancelExecutionOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl CancelExecutionOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::ExecutionResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`CancelExecutionOutput`](crate::operation::cancel_execution::CancelExecutionOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::cancel_execution::builders::CancelExecutionOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::cancel_execution::CancelExecutionOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building CancelExecutionOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/cancel_execution/builders.rs b/sdks/rust/src/operation/cancel_execution/builders.rs new file mode 100644 index 0000000..72a4711 --- /dev/null +++ b/sdks/rust/src/operation/cancel_execution/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::cancel_execution::_cancel_execution_input::CancelExecutionInputBuilder; + +pub use crate::operation::cancel_execution::_cancel_execution_output::CancelExecutionOutputBuilder; + +impl crate::operation::cancel_execution::builders::CancelExecutionInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::cancel_execution::CancelExecutionOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::cancel_execution::CancelExecutionError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.cancel_execution(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `CancelExecution`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct CancelExecutionFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::cancel_execution::builders::CancelExecutionInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::cancel_execution::CancelExecutionOutput, + crate::operation::cancel_execution::CancelExecutionError, + > for CancelExecutionFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::cancel_execution::CancelExecutionOutput, + crate::operation::cancel_execution::CancelExecutionError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl CancelExecutionFluentBuilder { + /// Creates a new `CancelExecutionFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the CancelExecution as a reference. + pub fn as_input(&self) -> &crate::operation::cancel_execution::builders::CancelExecutionInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::cancel_execution::CancelExecution::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::cancel_execution::CancelExecution::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.execution_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_execution_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_execution_id() + } +} + diff --git a/sdks/rust/src/operation/cancel_job.rs b/sdks/rust/src/operation/cancel_job.rs new file mode 100644 index 0000000..a56f15e --- /dev/null +++ b/sdks/rust/src/operation/cancel_job.rs @@ -0,0 +1,364 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `CancelJob`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CancelJob; +impl CancelJob { + /// Creates a new `CancelJob` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::cancel_job::CancelJobInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::cancel_job::CancelJobInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "CancelJob", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.CancelJob", + "rpc.service" = "KronosService", + "rpc.method" = "CancelJob", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CancelJob { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CancelJob"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(CancelJobRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(CancelJobResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "CancelJob", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CancelJob") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(CancelJobEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct CancelJobResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CancelJobResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_cancel_job::de_cancel_job_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_cancel_job::de_cancel_job_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct CancelJobRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CancelJobRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::cancel_job::CancelJobInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.job_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset"))?; + let job_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if job_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/jobs/{job_id}/cancel", job_id = job_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::cancel_job::CancelJobInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_cancel_job::ser_cancel_job_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("POST").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct CancelJobEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CancelJobEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "CancelJobEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to CancelJobInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `CancelJobError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum CancelJobError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + ConflictError(crate::types::error::ConflictError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CancelJobError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl CancelJobError { + /// Creates the `CancelJobError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `CancelJobError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::ConflictError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `CancelJobError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `CancelJobError::ConflictError`. + pub fn is_conflict_error(&self) -> bool { + matches!(self, Self::ConflictError(_)) + } + /// Returns `true` if the error kind is `CancelJobError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `CancelJobError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `CancelJobError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for CancelJobError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::ConflictError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for CancelJobError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::ConflictError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for CancelJobError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CancelJobError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::ConflictError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CancelJobError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::cancel_job::_cancel_job_input::CancelJobInput; + +pub use crate::operation::cancel_job::_cancel_job_output::CancelJobOutput; + +mod _cancel_job_input; + +mod _cancel_job_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/cancel_job/_cancel_job_input.rs b/sdks/rust/src/operation/cancel_job/_cancel_job_input.rs new file mode 100644 index 0000000..546dbd0 --- /dev/null +++ b/sdks/rust/src/operation/cancel_job/_cancel_job_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CancelJobInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::option::Option<::std::string::String>, +} +impl CancelJobInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> ::std::option::Option<&str> { + self.job_id.as_deref() + } +} +impl CancelJobInput { + /// Creates a new builder-style object to manufacture [`CancelJobInput`](crate::operation::cancel_job::CancelJobInput). + pub fn builder() -> crate::operation::cancel_job::builders::CancelJobInputBuilder { + crate::operation::cancel_job::builders::CancelJobInputBuilder::default() + } +} + +/// A builder for [`CancelJobInput`](crate::operation::cancel_job::CancelJobInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CancelJobInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) job_id: ::std::option::Option<::std::string::String>, +} +impl CancelJobInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + /// Consumes the builder and constructs a [`CancelJobInput`](crate::operation::cancel_job::CancelJobInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::cancel_job::CancelJobInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + job_id: self.job_id + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/cancel_job/_cancel_job_output.rs b/sdks/rust/src/operation/cancel_job/_cancel_job_output.rs new file mode 100644 index 0000000..f6d5a84 --- /dev/null +++ b/sdks/rust/src/operation/cancel_job/_cancel_job_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CancelJobOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::JobResource, +} +impl CancelJobOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::JobResource { + &self.data + } +} +impl CancelJobOutput { + /// Creates a new builder-style object to manufacture [`CancelJobOutput`](crate::operation::cancel_job::CancelJobOutput). + pub fn builder() -> crate::operation::cancel_job::builders::CancelJobOutputBuilder { + crate::operation::cancel_job::builders::CancelJobOutputBuilder::default() + } +} + +/// A builder for [`CancelJobOutput`](crate::operation::cancel_job::CancelJobOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CancelJobOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl CancelJobOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::JobResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`CancelJobOutput`](crate::operation::cancel_job::CancelJobOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::cancel_job::builders::CancelJobOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::cancel_job::CancelJobOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building CancelJobOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/cancel_job/builders.rs b/sdks/rust/src/operation/cancel_job/builders.rs new file mode 100644 index 0000000..648d841 --- /dev/null +++ b/sdks/rust/src/operation/cancel_job/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::cancel_job::_cancel_job_input::CancelJobInputBuilder; + +pub use crate::operation::cancel_job::_cancel_job_output::CancelJobOutputBuilder; + +impl crate::operation::cancel_job::builders::CancelJobInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::cancel_job::CancelJobOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::cancel_job::CancelJobError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.cancel_job(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `CancelJob`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct CancelJobFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::cancel_job::builders::CancelJobInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::cancel_job::CancelJobOutput, + crate::operation::cancel_job::CancelJobError, + > for CancelJobFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::cancel_job::CancelJobOutput, + crate::operation::cancel_job::CancelJobError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl CancelJobFluentBuilder { + /// Creates a new `CancelJobFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the CancelJob as a reference. + pub fn as_input(&self) -> &crate::operation::cancel_job::builders::CancelJobInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::cancel_job::CancelJob::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::cancel_job::CancelJob::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.job_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_job_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_job_id() + } +} + diff --git a/sdks/rust/src/operation/create_endpoint.rs b/sdks/rust/src/operation/create_endpoint.rs new file mode 100644 index 0000000..d3f29b9 --- /dev/null +++ b/sdks/rust/src/operation/create_endpoint.rs @@ -0,0 +1,378 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `CreateEndpoint`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateEndpoint; +impl CreateEndpoint { + /// Creates a new `CreateEndpoint` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::create_endpoint::CreateEndpointInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::create_endpoint::CreateEndpointInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "CreateEndpoint", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.CreateEndpoint", + "rpc.service" = "KronosService", + "rpc.method" = "CreateEndpoint", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateEndpoint { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateEndpoint"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(CreateEndpointRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(CreateEndpointResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "CreateEndpoint", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateEndpoint") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(CreateEndpointEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct CreateEndpointResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateEndpointResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 201 || force_error { + crate::protocol_serde::shape_create_endpoint::de_create_endpoint_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_create_endpoint::de_create_endpoint_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct CreateEndpointRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateEndpointRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::create_endpoint::CreateEndpointInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + ::std::write!(output, "/v1/endpoints").expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::create_endpoint::CreateEndpointInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_create_endpoint::ser_create_endpoint_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("POST").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json"); +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_endpoint::ser_create_endpoint_input(&input)?); + if let Some(content_length) = body.content_length() { + let content_length = content_length.to_string(); + request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length); + } + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct CreateEndpointEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateEndpointEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "CreateEndpointEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to CreateEndpointInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `CreateEndpointError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum CreateEndpointError { + #[allow(missing_docs)] // documentation missing in model + InvalidRequestError(crate::types::error::InvalidRequestError), + #[allow(missing_docs)] // documentation missing in model + ConflictError(crate::types::error::ConflictError), + #[allow(missing_docs)] // documentation missing in model + UnprocessableEntityError(crate::types::error::UnprocessableEntityError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateEndpointError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl CreateEndpointError { + /// Creates the `CreateEndpointError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `CreateEndpointError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::InvalidRequestError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::ConflictError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnprocessableEntityError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `CreateEndpointError::InvalidRequestError`. + pub fn is_invalid_request_error(&self) -> bool { + matches!(self, Self::InvalidRequestError(_)) + } + /// Returns `true` if the error kind is `CreateEndpointError::ConflictError`. + pub fn is_conflict_error(&self) -> bool { + matches!(self, Self::ConflictError(_)) + } + /// Returns `true` if the error kind is `CreateEndpointError::UnprocessableEntityError`. + pub fn is_unprocessable_entity_error(&self) -> bool { + matches!(self, Self::UnprocessableEntityError(_)) + } + /// Returns `true` if the error kind is `CreateEndpointError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `CreateEndpointError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `CreateEndpointError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for CreateEndpointError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::InvalidRequestError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::ConflictError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnprocessableEntityError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for CreateEndpointError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::InvalidRequestError(_inner) => + _inner.fmt(f) + , + Self::ConflictError(_inner) => + _inner.fmt(f) + , + Self::UnprocessableEntityError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for CreateEndpointError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateEndpointError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::InvalidRequestError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::ConflictError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnprocessableEntityError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateEndpointError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::create_endpoint::_create_endpoint_input::CreateEndpointInput; + +pub use crate::operation::create_endpoint::_create_endpoint_output::CreateEndpointOutput; + +mod _create_endpoint_input; + +mod _create_endpoint_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/create_endpoint/_create_endpoint_input.rs b/sdks/rust/src/operation/create_endpoint/_create_endpoint_input.rs new file mode 100644 index 0000000..5b46c64 --- /dev/null +++ b/sdks/rust/src/operation/create_endpoint/_create_endpoint_input.rs @@ -0,0 +1,211 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CreateEndpointInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub endpoint_type: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub payload_spec: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub config: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub spec: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub retry_policy: ::std::option::Option, +} +impl CreateEndpointInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> ::std::option::Option<&str> { + self.name.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint_type(&self) -> ::std::option::Option<&crate::types::EndpointTypeEnum> { + self.endpoint_type.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn payload_spec(&self) -> ::std::option::Option<&str> { + self.payload_spec.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn config(&self) -> ::std::option::Option<&str> { + self.config.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn spec(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.spec.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn retry_policy(&self) -> ::std::option::Option<&crate::types::RetryPolicy> { + self.retry_policy.as_ref() + } +} +impl CreateEndpointInput { + /// Creates a new builder-style object to manufacture [`CreateEndpointInput`](crate::operation::create_endpoint::CreateEndpointInput). + pub fn builder() -> crate::operation::create_endpoint::builders::CreateEndpointInputBuilder { + crate::operation::create_endpoint::builders::CreateEndpointInputBuilder::default() + } +} + +/// A builder for [`CreateEndpointInput`](crate::operation::create_endpoint::CreateEndpointInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateEndpointInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) name: ::std::option::Option<::std::string::String>, + pub(crate) endpoint_type: ::std::option::Option, + pub(crate) payload_spec: ::std::option::Option<::std::string::String>, + pub(crate) config: ::std::option::Option<::std::string::String>, + pub(crate) spec: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) retry_policy: ::std::option::Option, +} +impl CreateEndpointInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn endpoint_type(mut self, input: crate::types::EndpointTypeEnum) -> Self { + self.endpoint_type = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint_type(mut self, input: ::std::option::Option) -> Self { + self.endpoint_type = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint_type(&self) -> &::std::option::Option { + &self.endpoint_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn payload_spec(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.payload_spec = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_payload_spec(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.payload_spec = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_payload_spec(&self) -> &::std::option::Option<::std::string::String> { + &self.payload_spec + } + #[allow(missing_docs)] // documentation missing in model + pub fn config(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.config = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_config(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.config = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_config(&self) -> &::std::option::Option<::std::string::String> { + &self.config + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn spec(mut self, input: ::aws_smithy_types::Document) -> Self { + self.spec = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_spec(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.spec = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_spec(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.spec + } + #[allow(missing_docs)] // documentation missing in model + pub fn retry_policy(mut self, input: crate::types::RetryPolicy) -> Self { + self.retry_policy = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_retry_policy(mut self, input: ::std::option::Option) -> Self { + self.retry_policy = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_retry_policy(&self) -> &::std::option::Option { + &self.retry_policy + } + /// Consumes the builder and constructs a [`CreateEndpointInput`](crate::operation::create_endpoint::CreateEndpointInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::create_endpoint::CreateEndpointInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + name: self.name + , + endpoint_type: self.endpoint_type + , + payload_spec: self.payload_spec + , + config: self.config + , + spec: self.spec + , + retry_policy: self.retry_policy + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/create_endpoint/_create_endpoint_output.rs b/sdks/rust/src/operation/create_endpoint/_create_endpoint_output.rs new file mode 100644 index 0000000..a0e5da8 --- /dev/null +++ b/sdks/rust/src/operation/create_endpoint/_create_endpoint_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CreateEndpointOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::EndpointResource, +} +impl CreateEndpointOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::EndpointResource { + &self.data + } +} +impl CreateEndpointOutput { + /// Creates a new builder-style object to manufacture [`CreateEndpointOutput`](crate::operation::create_endpoint::CreateEndpointOutput). + pub fn builder() -> crate::operation::create_endpoint::builders::CreateEndpointOutputBuilder { + crate::operation::create_endpoint::builders::CreateEndpointOutputBuilder::default() + } +} + +/// A builder for [`CreateEndpointOutput`](crate::operation::create_endpoint::CreateEndpointOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateEndpointOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl CreateEndpointOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::EndpointResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`CreateEndpointOutput`](crate::operation::create_endpoint::CreateEndpointOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::create_endpoint::builders::CreateEndpointOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::create_endpoint::CreateEndpointOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building CreateEndpointOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/create_endpoint/builders.rs b/sdks/rust/src/operation/create_endpoint/builders.rs new file mode 100644 index 0000000..f183b23 --- /dev/null +++ b/sdks/rust/src/operation/create_endpoint/builders.rs @@ -0,0 +1,211 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::create_endpoint::_create_endpoint_input::CreateEndpointInputBuilder; + +pub use crate::operation::create_endpoint::_create_endpoint_output::CreateEndpointOutputBuilder; + +impl crate::operation::create_endpoint::builders::CreateEndpointInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::create_endpoint::CreateEndpointOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::create_endpoint::CreateEndpointError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.create_endpoint(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `CreateEndpoint`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct CreateEndpointFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::create_endpoint::builders::CreateEndpointInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::create_endpoint::CreateEndpointOutput, + crate::operation::create_endpoint::CreateEndpointError, + > for CreateEndpointFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::create_endpoint::CreateEndpointOutput, + crate::operation::create_endpoint::CreateEndpointError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl CreateEndpointFluentBuilder { + /// Creates a new `CreateEndpointFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the CreateEndpoint as a reference. + pub fn as_input(&self) -> &crate::operation::create_endpoint::builders::CreateEndpointInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::create_endpoint::CreateEndpoint::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::create_endpoint::CreateEndpoint::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.name(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_name(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_name() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint_type(mut self, input: crate::types::EndpointTypeEnum) -> Self { + self.inner = self.inner.endpoint_type(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint_type(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_endpoint_type(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint_type(&self) -> &::std::option::Option { + self.inner.get_endpoint_type() + } + #[allow(missing_docs)] // documentation missing in model + pub fn payload_spec(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.payload_spec(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_payload_spec(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_payload_spec(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_payload_spec(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_payload_spec() + } + #[allow(missing_docs)] // documentation missing in model + pub fn config(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.config(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_config(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_config(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_config(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_config() + } + #[allow(missing_docs)] // documentation missing in model + pub fn spec(mut self, input: ::aws_smithy_types::Document) -> Self { + self.inner = self.inner.spec(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_spec(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.inner = self.inner.set_spec(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_spec(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + self.inner.get_spec() + } + #[allow(missing_docs)] // documentation missing in model + pub fn retry_policy(mut self, input: crate::types::RetryPolicy) -> Self { + self.inner = self.inner.retry_policy(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_retry_policy(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_retry_policy(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_retry_policy(&self) -> &::std::option::Option { + self.inner.get_retry_policy() + } +} + diff --git a/sdks/rust/src/operation/create_job.rs b/sdks/rust/src/operation/create_job.rs new file mode 100644 index 0000000..91948af --- /dev/null +++ b/sdks/rust/src/operation/create_job.rs @@ -0,0 +1,394 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `CreateJob`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateJob; +impl CreateJob { + /// Creates a new `CreateJob` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::create_job::CreateJobInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::create_job::CreateJobInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "CreateJob", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.CreateJob", + "rpc.service" = "KronosService", + "rpc.method" = "CreateJob", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreateJob { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreateJob"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(CreateJobRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(CreateJobResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "CreateJob", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreateJob") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(CreateJobEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct CreateJobResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreateJobResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 201 || force_error { + crate::protocol_serde::shape_create_job::de_create_job_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_create_job::de_create_job_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct CreateJobRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreateJobRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::create_job::CreateJobInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + ::std::write!(output, "/v1/jobs").expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::create_job::CreateJobInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_create_job::ser_create_job_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("POST").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json"); +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_job::ser_create_job_input(&input)?); + if let Some(content_length) = body.content_length() { + let content_length = content_length.to_string(); + request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length); + } + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct CreateJobEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreateJobEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "CreateJobEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to CreateJobInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `CreateJobError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum CreateJobError { + #[allow(missing_docs)] // documentation missing in model + InvalidRequestError(crate::types::error::InvalidRequestError), + #[allow(missing_docs)] // documentation missing in model + ConflictError(crate::types::error::ConflictError), + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnprocessableEntityError(crate::types::error::UnprocessableEntityError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreateJobError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl CreateJobError { + /// Creates the `CreateJobError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `CreateJobError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::InvalidRequestError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::ConflictError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnprocessableEntityError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `CreateJobError::InvalidRequestError`. + pub fn is_invalid_request_error(&self) -> bool { + matches!(self, Self::InvalidRequestError(_)) + } + /// Returns `true` if the error kind is `CreateJobError::ConflictError`. + pub fn is_conflict_error(&self) -> bool { + matches!(self, Self::ConflictError(_)) + } + /// Returns `true` if the error kind is `CreateJobError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `CreateJobError::UnprocessableEntityError`. + pub fn is_unprocessable_entity_error(&self) -> bool { + matches!(self, Self::UnprocessableEntityError(_)) + } + /// Returns `true` if the error kind is `CreateJobError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `CreateJobError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `CreateJobError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for CreateJobError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::InvalidRequestError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::ConflictError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnprocessableEntityError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for CreateJobError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::InvalidRequestError(_inner) => + _inner.fmt(f) + , + Self::ConflictError(_inner) => + _inner.fmt(f) + , + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnprocessableEntityError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for CreateJobError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreateJobError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::InvalidRequestError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::ConflictError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnprocessableEntityError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreateJobError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::create_job::_create_job_input::CreateJobInput; + +pub use crate::operation::create_job::_create_job_output::CreateJobOutput; + +mod _create_job_input; + +mod _create_job_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/create_job/_create_job_input.rs b/sdks/rust/src/operation/create_job/_create_job_input.rs new file mode 100644 index 0000000..3a3905d --- /dev/null +++ b/sdks/rust/src/operation/create_job/_create_job_input.rs @@ -0,0 +1,276 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CreateJobInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub endpoint: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub trigger: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub idempotency_key: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub input: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub run_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub cron: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub timezone: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub starts_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub ends_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl CreateJobInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint(&self) -> ::std::option::Option<&str> { + self.endpoint.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn trigger(&self) -> ::std::option::Option<&crate::types::TriggerTypeEnum> { + self.trigger.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn idempotency_key(&self) -> ::std::option::Option<&str> { + self.idempotency_key.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.input.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn run_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.run_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron(&self) -> ::std::option::Option<&str> { + self.cron.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn timezone(&self) -> ::std::option::Option<&str> { + self.timezone.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn starts_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.starts_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn ends_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.ends_at.as_ref() + } +} +impl CreateJobInput { + /// Creates a new builder-style object to manufacture [`CreateJobInput`](crate::operation::create_job::CreateJobInput). + pub fn builder() -> crate::operation::create_job::builders::CreateJobInputBuilder { + crate::operation::create_job::builders::CreateJobInputBuilder::default() + } +} + +/// A builder for [`CreateJobInput`](crate::operation::create_job::CreateJobInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateJobInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) endpoint: ::std::option::Option<::std::string::String>, + pub(crate) trigger: ::std::option::Option, + pub(crate) idempotency_key: ::std::option::Option<::std::string::String>, + pub(crate) input: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) run_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) cron: ::std::option::Option<::std::string::String>, + pub(crate) timezone: ::std::option::Option<::std::string::String>, + pub(crate) starts_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) ends_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl CreateJobInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.endpoint = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.endpoint = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint(&self) -> &::std::option::Option<::std::string::String> { + &self.endpoint + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn trigger(mut self, input: crate::types::TriggerTypeEnum) -> Self { + self.trigger = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_trigger(mut self, input: ::std::option::Option) -> Self { + self.trigger = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_trigger(&self) -> &::std::option::Option { + &self.trigger + } + #[allow(missing_docs)] // documentation missing in model + pub fn idempotency_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.idempotency_key = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_idempotency_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.idempotency_key = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_idempotency_key(&self) -> &::std::option::Option<::std::string::String> { + &self.idempotency_key + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(mut self, input: ::aws_smithy_types::Document) -> Self { + self.input = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_input(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.input = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_input(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.input + } + #[allow(missing_docs)] // documentation missing in model + pub fn run_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.run_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_run_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.run_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_run_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.run_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cron = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cron = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron(&self) -> &::std::option::Option<::std::string::String> { + &self.cron + } + #[allow(missing_docs)] // documentation missing in model + pub fn timezone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.timezone = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_timezone(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.timezone = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_timezone(&self) -> &::std::option::Option<::std::string::String> { + &self.timezone + } + #[allow(missing_docs)] // documentation missing in model + pub fn starts_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.starts_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_starts_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.starts_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_starts_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.starts_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn ends_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.ends_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_ends_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.ends_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_ends_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.ends_at + } + /// Consumes the builder and constructs a [`CreateJobInput`](crate::operation::create_job::CreateJobInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::create_job::CreateJobInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + endpoint: self.endpoint + , + trigger: self.trigger + , + idempotency_key: self.idempotency_key + , + input: self.input + , + run_at: self.run_at + , + cron: self.cron + , + timezone: self.timezone + , + starts_at: self.starts_at + , + ends_at: self.ends_at + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/create_job/_create_job_output.rs b/sdks/rust/src/operation/create_job/_create_job_output.rs new file mode 100644 index 0000000..1f3c161 --- /dev/null +++ b/sdks/rust/src/operation/create_job/_create_job_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CreateJobOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::JobResource, +} +impl CreateJobOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::JobResource { + &self.data + } +} +impl CreateJobOutput { + /// Creates a new builder-style object to manufacture [`CreateJobOutput`](crate::operation::create_job::CreateJobOutput). + pub fn builder() -> crate::operation::create_job::builders::CreateJobOutputBuilder { + crate::operation::create_job::builders::CreateJobOutputBuilder::default() + } +} + +/// A builder for [`CreateJobOutput`](crate::operation::create_job::CreateJobOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreateJobOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl CreateJobOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::JobResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`CreateJobOutput`](crate::operation::create_job::CreateJobOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::create_job::builders::CreateJobOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::create_job::CreateJobOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building CreateJobOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/create_job/builders.rs b/sdks/rust/src/operation/create_job/builders.rs new file mode 100644 index 0000000..fc6d06c --- /dev/null +++ b/sdks/rust/src/operation/create_job/builders.rs @@ -0,0 +1,253 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::create_job::_create_job_input::CreateJobInputBuilder; + +pub use crate::operation::create_job::_create_job_output::CreateJobOutputBuilder; + +impl crate::operation::create_job::builders::CreateJobInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::create_job::CreateJobOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::create_job::CreateJobError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.create_job(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `CreateJob`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct CreateJobFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::create_job::builders::CreateJobInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::create_job::CreateJobOutput, + crate::operation::create_job::CreateJobError, + > for CreateJobFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::create_job::CreateJobOutput, + crate::operation::create_job::CreateJobError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl CreateJobFluentBuilder { + /// Creates a new `CreateJobFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the CreateJob as a reference. + pub fn as_input(&self) -> &crate::operation::create_job::builders::CreateJobInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::create_job::CreateJob::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::create_job::CreateJob::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.endpoint(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_endpoint(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_endpoint() + } + #[allow(missing_docs)] // documentation missing in model + pub fn trigger(mut self, input: crate::types::TriggerTypeEnum) -> Self { + self.inner = self.inner.trigger(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_trigger(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_trigger(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_trigger(&self) -> &::std::option::Option { + self.inner.get_trigger() + } + #[allow(missing_docs)] // documentation missing in model + pub fn idempotency_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.idempotency_key(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_idempotency_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_idempotency_key(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_idempotency_key(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_idempotency_key() + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(mut self, input: ::aws_smithy_types::Document) -> Self { + self.inner = self.inner.input(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_input(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.inner = self.inner.set_input(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_input(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + self.inner.get_input() + } + #[allow(missing_docs)] // documentation missing in model + pub fn run_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.inner = self.inner.run_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_run_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.inner = self.inner.set_run_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_run_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + self.inner.get_run_at() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.cron(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_cron(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_cron() + } + #[allow(missing_docs)] // documentation missing in model + pub fn timezone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.timezone(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_timezone(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_timezone(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_timezone(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_timezone() + } + #[allow(missing_docs)] // documentation missing in model + pub fn starts_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.inner = self.inner.starts_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_starts_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.inner = self.inner.set_starts_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_starts_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + self.inner.get_starts_at() + } + #[allow(missing_docs)] // documentation missing in model + pub fn ends_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.inner = self.inner.ends_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_ends_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.inner = self.inner.set_ends_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_ends_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + self.inner.get_ends_at() + } +} + diff --git a/sdks/rust/src/operation/create_payload_spec.rs b/sdks/rust/src/operation/create_payload_spec.rs new file mode 100644 index 0000000..1f376af --- /dev/null +++ b/sdks/rust/src/operation/create_payload_spec.rs @@ -0,0 +1,362 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `CreatePayloadSpec`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreatePayloadSpec; +impl CreatePayloadSpec { + /// Creates a new `CreatePayloadSpec` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::create_payload_spec::CreatePayloadSpecInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::create_payload_spec::CreatePayloadSpecInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "CreatePayloadSpec", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.CreatePayloadSpec", + "rpc.service" = "KronosService", + "rpc.method" = "CreatePayloadSpec", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for CreatePayloadSpec { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("CreatePayloadSpec"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(CreatePayloadSpecRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(CreatePayloadSpecResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "CreatePayloadSpec", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("CreatePayloadSpec") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(CreatePayloadSpecEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct CreatePayloadSpecResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for CreatePayloadSpecResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 201 || force_error { + crate::protocol_serde::shape_create_payload_spec::de_create_payload_spec_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_create_payload_spec::de_create_payload_spec_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct CreatePayloadSpecRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for CreatePayloadSpecRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::create_payload_spec::CreatePayloadSpecInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + ::std::write!(output, "/v1/payload-specs").expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::create_payload_spec::CreatePayloadSpecInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_create_payload_spec::ser_create_payload_spec_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("POST").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json"); +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_create_payload_spec::ser_create_payload_spec_input(&input)?); + if let Some(content_length) = body.content_length() { + let content_length = content_length.to_string(); + request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length); + } + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct CreatePayloadSpecEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for CreatePayloadSpecEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "CreatePayloadSpecEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to CreatePayloadSpecInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `CreatePayloadSpecError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum CreatePayloadSpecError { + #[allow(missing_docs)] // documentation missing in model + InvalidRequestError(crate::types::error::InvalidRequestError), + #[allow(missing_docs)] // documentation missing in model + ConflictError(crate::types::error::ConflictError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-CreatePayloadSpecError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl CreatePayloadSpecError { + /// Creates the `CreatePayloadSpecError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `CreatePayloadSpecError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::InvalidRequestError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::ConflictError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `CreatePayloadSpecError::InvalidRequestError`. + pub fn is_invalid_request_error(&self) -> bool { + matches!(self, Self::InvalidRequestError(_)) + } + /// Returns `true` if the error kind is `CreatePayloadSpecError::ConflictError`. + pub fn is_conflict_error(&self) -> bool { + matches!(self, Self::ConflictError(_)) + } + /// Returns `true` if the error kind is `CreatePayloadSpecError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `CreatePayloadSpecError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `CreatePayloadSpecError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for CreatePayloadSpecError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::InvalidRequestError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::ConflictError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for CreatePayloadSpecError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::InvalidRequestError(_inner) => + _inner.fmt(f) + , + Self::ConflictError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for CreatePayloadSpecError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for CreatePayloadSpecError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::InvalidRequestError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::ConflictError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for CreatePayloadSpecError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::create_payload_spec::_create_payload_spec_input::CreatePayloadSpecInput; + +pub use crate::operation::create_payload_spec::_create_payload_spec_output::CreatePayloadSpecOutput; + +mod _create_payload_spec_input; + +mod _create_payload_spec_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/create_payload_spec/_create_payload_spec_input.rs b/sdks/rust/src/operation/create_payload_spec/_create_payload_spec_input.rs new file mode 100644 index 0000000..82b7944 --- /dev/null +++ b/sdks/rust/src/operation/create_payload_spec/_create_payload_spec_input.rs @@ -0,0 +1,122 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CreatePayloadSpecInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub schema: ::std::option::Option<::aws_smithy_types::Document>, +} +impl CreatePayloadSpecInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> ::std::option::Option<&str> { + self.name.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn schema(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.schema.as_ref() + } +} +impl CreatePayloadSpecInput { + /// Creates a new builder-style object to manufacture [`CreatePayloadSpecInput`](crate::operation::create_payload_spec::CreatePayloadSpecInput). + pub fn builder() -> crate::operation::create_payload_spec::builders::CreatePayloadSpecInputBuilder { + crate::operation::create_payload_spec::builders::CreatePayloadSpecInputBuilder::default() + } +} + +/// A builder for [`CreatePayloadSpecInput`](crate::operation::create_payload_spec::CreatePayloadSpecInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreatePayloadSpecInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) name: ::std::option::Option<::std::string::String>, + pub(crate) schema: ::std::option::Option<::aws_smithy_types::Document>, +} +impl CreatePayloadSpecInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn schema(mut self, input: ::aws_smithy_types::Document) -> Self { + self.schema = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_schema(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.schema = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_schema(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.schema + } + /// Consumes the builder and constructs a [`CreatePayloadSpecInput`](crate::operation::create_payload_spec::CreatePayloadSpecInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::create_payload_spec::CreatePayloadSpecInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + name: self.name + , + schema: self.schema + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/create_payload_spec/_create_payload_spec_output.rs b/sdks/rust/src/operation/create_payload_spec/_create_payload_spec_output.rs new file mode 100644 index 0000000..ff518b4 --- /dev/null +++ b/sdks/rust/src/operation/create_payload_spec/_create_payload_spec_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct CreatePayloadSpecOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::PayloadSpecResource, +} +impl CreatePayloadSpecOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::PayloadSpecResource { + &self.data + } +} +impl CreatePayloadSpecOutput { + /// Creates a new builder-style object to manufacture [`CreatePayloadSpecOutput`](crate::operation::create_payload_spec::CreatePayloadSpecOutput). + pub fn builder() -> crate::operation::create_payload_spec::builders::CreatePayloadSpecOutputBuilder { + crate::operation::create_payload_spec::builders::CreatePayloadSpecOutputBuilder::default() + } +} + +/// A builder for [`CreatePayloadSpecOutput`](crate::operation::create_payload_spec::CreatePayloadSpecOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct CreatePayloadSpecOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl CreatePayloadSpecOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::PayloadSpecResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`CreatePayloadSpecOutput`](crate::operation::create_payload_spec::CreatePayloadSpecOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::create_payload_spec::builders::CreatePayloadSpecOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::create_payload_spec::CreatePayloadSpecOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building CreatePayloadSpecOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/create_payload_spec/builders.rs b/sdks/rust/src/operation/create_payload_spec/builders.rs new file mode 100644 index 0000000..59c33bc --- /dev/null +++ b/sdks/rust/src/operation/create_payload_spec/builders.rs @@ -0,0 +1,155 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::create_payload_spec::_create_payload_spec_input::CreatePayloadSpecInputBuilder; + +pub use crate::operation::create_payload_spec::_create_payload_spec_output::CreatePayloadSpecOutputBuilder; + +impl crate::operation::create_payload_spec::builders::CreatePayloadSpecInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::create_payload_spec::CreatePayloadSpecOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::create_payload_spec::CreatePayloadSpecError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.create_payload_spec(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `CreatePayloadSpec`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct CreatePayloadSpecFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::create_payload_spec::builders::CreatePayloadSpecInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::create_payload_spec::CreatePayloadSpecOutput, + crate::operation::create_payload_spec::CreatePayloadSpecError, + > for CreatePayloadSpecFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::create_payload_spec::CreatePayloadSpecOutput, + crate::operation::create_payload_spec::CreatePayloadSpecError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl CreatePayloadSpecFluentBuilder { + /// Creates a new `CreatePayloadSpecFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the CreatePayloadSpec as a reference. + pub fn as_input(&self) -> &crate::operation::create_payload_spec::builders::CreatePayloadSpecInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::create_payload_spec::CreatePayloadSpec::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::create_payload_spec::CreatePayloadSpec::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.name(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_name(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_name() + } + #[allow(missing_docs)] // documentation missing in model + pub fn schema(mut self, input: ::aws_smithy_types::Document) -> Self { + self.inner = self.inner.schema(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_schema(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.inner = self.inner.set_schema(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_schema(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + self.inner.get_schema() + } +} + diff --git a/sdks/rust/src/operation/delete_endpoint.rs b/sdks/rust/src/operation/delete_endpoint.rs new file mode 100644 index 0000000..82c25cf --- /dev/null +++ b/sdks/rust/src/operation/delete_endpoint.rs @@ -0,0 +1,348 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `DeleteEndpoint`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct DeleteEndpoint; +impl DeleteEndpoint { + /// Creates a new `DeleteEndpoint` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::delete_endpoint::DeleteEndpointInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::delete_endpoint::DeleteEndpointInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "DeleteEndpoint", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.DeleteEndpoint", + "rpc.service" = "KronosService", + "rpc.method" = "DeleteEndpoint", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for DeleteEndpoint { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("DeleteEndpoint"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(DeleteEndpointRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(DeleteEndpointResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "DeleteEndpoint", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("DeleteEndpoint") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(DeleteEndpointEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct DeleteEndpointResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DeleteEndpointResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 204 || force_error { + crate::protocol_serde::shape_delete_endpoint::de_delete_endpoint_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_delete_endpoint::de_delete_endpoint_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct DeleteEndpointRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DeleteEndpointRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::delete_endpoint::DeleteEndpointInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.name; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset"))?; + let name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if name.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/endpoints/{name}", name = name).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::delete_endpoint::DeleteEndpointInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_delete_endpoint::ser_delete_endpoint_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("DELETE").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct DeleteEndpointEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DeleteEndpointEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "DeleteEndpointEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to DeleteEndpointInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `DeleteEndpointError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum DeleteEndpointError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DeleteEndpointError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl DeleteEndpointError { + /// Creates the `DeleteEndpointError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `DeleteEndpointError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `DeleteEndpointError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `DeleteEndpointError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `DeleteEndpointError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `DeleteEndpointError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for DeleteEndpointError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for DeleteEndpointError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for DeleteEndpointError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DeleteEndpointError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DeleteEndpointError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::delete_endpoint::_delete_endpoint_input::DeleteEndpointInput; + +pub use crate::operation::delete_endpoint::_delete_endpoint_output::DeleteEndpointOutput; + +mod _delete_endpoint_input; + +mod _delete_endpoint_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/delete_endpoint/_delete_endpoint_input.rs b/sdks/rust/src/operation/delete_endpoint/_delete_endpoint_input.rs new file mode 100644 index 0000000..d460605 --- /dev/null +++ b/sdks/rust/src/operation/delete_endpoint/_delete_endpoint_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct DeleteEndpointInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::option::Option<::std::string::String>, +} +impl DeleteEndpointInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> ::std::option::Option<&str> { + self.name.as_deref() + } +} +impl DeleteEndpointInput { + /// Creates a new builder-style object to manufacture [`DeleteEndpointInput`](crate::operation::delete_endpoint::DeleteEndpointInput). + pub fn builder() -> crate::operation::delete_endpoint::builders::DeleteEndpointInputBuilder { + crate::operation::delete_endpoint::builders::DeleteEndpointInputBuilder::default() + } +} + +/// A builder for [`DeleteEndpointInput`](crate::operation::delete_endpoint::DeleteEndpointInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct DeleteEndpointInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) name: ::std::option::Option<::std::string::String>, +} +impl DeleteEndpointInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + /// Consumes the builder and constructs a [`DeleteEndpointInput`](crate::operation::delete_endpoint::DeleteEndpointInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::delete_endpoint::DeleteEndpointInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + name: self.name + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/delete_endpoint/_delete_endpoint_output.rs b/sdks/rust/src/operation/delete_endpoint/_delete_endpoint_output.rs new file mode 100644 index 0000000..47d7c4e --- /dev/null +++ b/sdks/rust/src/operation/delete_endpoint/_delete_endpoint_output.rs @@ -0,0 +1,26 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct DeleteEndpointOutput { +} +impl DeleteEndpointOutput { + /// Creates a new builder-style object to manufacture [`DeleteEndpointOutput`](crate::operation::delete_endpoint::DeleteEndpointOutput). + pub fn builder() -> crate::operation::delete_endpoint::builders::DeleteEndpointOutputBuilder { + crate::operation::delete_endpoint::builders::DeleteEndpointOutputBuilder::default() + } +} + +/// A builder for [`DeleteEndpointOutput`](crate::operation::delete_endpoint::DeleteEndpointOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct DeleteEndpointOutputBuilder { +} +impl DeleteEndpointOutputBuilder { + /// Consumes the builder and constructs a [`DeleteEndpointOutput`](crate::operation::delete_endpoint::DeleteEndpointOutput). + pub fn build(self) -> crate::operation::delete_endpoint::DeleteEndpointOutput { + crate::operation::delete_endpoint::DeleteEndpointOutput { + } + } +} + diff --git a/sdks/rust/src/operation/delete_endpoint/builders.rs b/sdks/rust/src/operation/delete_endpoint/builders.rs new file mode 100644 index 0000000..08d8b84 --- /dev/null +++ b/sdks/rust/src/operation/delete_endpoint/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::delete_endpoint::_delete_endpoint_input::DeleteEndpointInputBuilder; + +pub use crate::operation::delete_endpoint::_delete_endpoint_output::DeleteEndpointOutputBuilder; + +impl crate::operation::delete_endpoint::builders::DeleteEndpointInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::delete_endpoint::DeleteEndpointOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::delete_endpoint::DeleteEndpointError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.delete_endpoint(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `DeleteEndpoint`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct DeleteEndpointFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::delete_endpoint::builders::DeleteEndpointInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::delete_endpoint::DeleteEndpointOutput, + crate::operation::delete_endpoint::DeleteEndpointError, + > for DeleteEndpointFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::delete_endpoint::DeleteEndpointOutput, + crate::operation::delete_endpoint::DeleteEndpointError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl DeleteEndpointFluentBuilder { + /// Creates a new `DeleteEndpointFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the DeleteEndpoint as a reference. + pub fn as_input(&self) -> &crate::operation::delete_endpoint::builders::DeleteEndpointInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::delete_endpoint::DeleteEndpoint::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::delete_endpoint::DeleteEndpoint::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.name(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_name(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_name() + } +} + diff --git a/sdks/rust/src/operation/delete_payload_spec.rs b/sdks/rust/src/operation/delete_payload_spec.rs new file mode 100644 index 0000000..443b1dc --- /dev/null +++ b/sdks/rust/src/operation/delete_payload_spec.rs @@ -0,0 +1,348 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `DeletePayloadSpec`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct DeletePayloadSpec; +impl DeletePayloadSpec { + /// Creates a new `DeletePayloadSpec` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::delete_payload_spec::DeletePayloadSpecInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::delete_payload_spec::DeletePayloadSpecInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "DeletePayloadSpec", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.DeletePayloadSpec", + "rpc.service" = "KronosService", + "rpc.method" = "DeletePayloadSpec", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for DeletePayloadSpec { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("DeletePayloadSpec"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(DeletePayloadSpecRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(DeletePayloadSpecResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "DeletePayloadSpec", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("DeletePayloadSpec") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(DeletePayloadSpecEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct DeletePayloadSpecResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for DeletePayloadSpecResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 204 || force_error { + crate::protocol_serde::shape_delete_payload_spec::de_delete_payload_spec_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_delete_payload_spec::de_delete_payload_spec_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct DeletePayloadSpecRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for DeletePayloadSpecRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::delete_payload_spec::DeletePayloadSpecInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.name; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset"))?; + let name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if name.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/payload-specs/{name}", name = name).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::delete_payload_spec::DeletePayloadSpecInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_delete_payload_spec::ser_delete_payload_spec_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("DELETE").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct DeletePayloadSpecEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for DeletePayloadSpecEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "DeletePayloadSpecEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to DeletePayloadSpecInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `DeletePayloadSpecError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum DeletePayloadSpecError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-DeletePayloadSpecError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl DeletePayloadSpecError { + /// Creates the `DeletePayloadSpecError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `DeletePayloadSpecError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `DeletePayloadSpecError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `DeletePayloadSpecError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `DeletePayloadSpecError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `DeletePayloadSpecError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for DeletePayloadSpecError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for DeletePayloadSpecError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for DeletePayloadSpecError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for DeletePayloadSpecError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for DeletePayloadSpecError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::delete_payload_spec::_delete_payload_spec_input::DeletePayloadSpecInput; + +pub use crate::operation::delete_payload_spec::_delete_payload_spec_output::DeletePayloadSpecOutput; + +mod _delete_payload_spec_input; + +mod _delete_payload_spec_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_input.rs b/sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_input.rs new file mode 100644 index 0000000..7b29705 --- /dev/null +++ b/sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct DeletePayloadSpecInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::option::Option<::std::string::String>, +} +impl DeletePayloadSpecInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> ::std::option::Option<&str> { + self.name.as_deref() + } +} +impl DeletePayloadSpecInput { + /// Creates a new builder-style object to manufacture [`DeletePayloadSpecInput`](crate::operation::delete_payload_spec::DeletePayloadSpecInput). + pub fn builder() -> crate::operation::delete_payload_spec::builders::DeletePayloadSpecInputBuilder { + crate::operation::delete_payload_spec::builders::DeletePayloadSpecInputBuilder::default() + } +} + +/// A builder for [`DeletePayloadSpecInput`](crate::operation::delete_payload_spec::DeletePayloadSpecInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct DeletePayloadSpecInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) name: ::std::option::Option<::std::string::String>, +} +impl DeletePayloadSpecInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + /// Consumes the builder and constructs a [`DeletePayloadSpecInput`](crate::operation::delete_payload_spec::DeletePayloadSpecInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::delete_payload_spec::DeletePayloadSpecInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + name: self.name + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_output.rs b/sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_output.rs new file mode 100644 index 0000000..e8c3bc7 --- /dev/null +++ b/sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_output.rs @@ -0,0 +1,26 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct DeletePayloadSpecOutput { +} +impl DeletePayloadSpecOutput { + /// Creates a new builder-style object to manufacture [`DeletePayloadSpecOutput`](crate::operation::delete_payload_spec::DeletePayloadSpecOutput). + pub fn builder() -> crate::operation::delete_payload_spec::builders::DeletePayloadSpecOutputBuilder { + crate::operation::delete_payload_spec::builders::DeletePayloadSpecOutputBuilder::default() + } +} + +/// A builder for [`DeletePayloadSpecOutput`](crate::operation::delete_payload_spec::DeletePayloadSpecOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct DeletePayloadSpecOutputBuilder { +} +impl DeletePayloadSpecOutputBuilder { + /// Consumes the builder and constructs a [`DeletePayloadSpecOutput`](crate::operation::delete_payload_spec::DeletePayloadSpecOutput). + pub fn build(self) -> crate::operation::delete_payload_spec::DeletePayloadSpecOutput { + crate::operation::delete_payload_spec::DeletePayloadSpecOutput { + } + } +} + diff --git a/sdks/rust/src/operation/delete_payload_spec/builders.rs b/sdks/rust/src/operation/delete_payload_spec/builders.rs new file mode 100644 index 0000000..9d4f9d5 --- /dev/null +++ b/sdks/rust/src/operation/delete_payload_spec/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::delete_payload_spec::_delete_payload_spec_input::DeletePayloadSpecInputBuilder; + +pub use crate::operation::delete_payload_spec::_delete_payload_spec_output::DeletePayloadSpecOutputBuilder; + +impl crate::operation::delete_payload_spec::builders::DeletePayloadSpecInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::delete_payload_spec::DeletePayloadSpecOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::delete_payload_spec::DeletePayloadSpecError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.delete_payload_spec(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `DeletePayloadSpec`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct DeletePayloadSpecFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::delete_payload_spec::builders::DeletePayloadSpecInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::delete_payload_spec::DeletePayloadSpecOutput, + crate::operation::delete_payload_spec::DeletePayloadSpecError, + > for DeletePayloadSpecFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::delete_payload_spec::DeletePayloadSpecOutput, + crate::operation::delete_payload_spec::DeletePayloadSpecError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl DeletePayloadSpecFluentBuilder { + /// Creates a new `DeletePayloadSpecFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the DeletePayloadSpec as a reference. + pub fn as_input(&self) -> &crate::operation::delete_payload_spec::builders::DeletePayloadSpecInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::delete_payload_spec::DeletePayloadSpec::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::delete_payload_spec::DeletePayloadSpec::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.name(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_name(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_name() + } +} + diff --git a/sdks/rust/src/operation/get_endpoint.rs b/sdks/rust/src/operation/get_endpoint.rs new file mode 100644 index 0000000..d890b75 --- /dev/null +++ b/sdks/rust/src/operation/get_endpoint.rs @@ -0,0 +1,348 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `GetEndpoint`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetEndpoint; +impl GetEndpoint { + /// Creates a new `GetEndpoint` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_endpoint::GetEndpointInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_endpoint::GetEndpointInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "GetEndpoint", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.GetEndpoint", + "rpc.service" = "KronosService", + "rpc.method" = "GetEndpoint", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetEndpoint { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetEndpoint"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(GetEndpointRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(GetEndpointResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "GetEndpoint", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetEndpoint") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(GetEndpointEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct GetEndpointResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetEndpointResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_get_endpoint::de_get_endpoint_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_get_endpoint::de_get_endpoint_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct GetEndpointRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetEndpointRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::get_endpoint::GetEndpointInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.name; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset"))?; + let name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if name.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/endpoints/{name}", name = name).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::get_endpoint::GetEndpointInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_get_endpoint::ser_get_endpoint_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct GetEndpointEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetEndpointEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "GetEndpointEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to GetEndpointInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `GetEndpointError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum GetEndpointError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetEndpointError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl GetEndpointError { + /// Creates the `GetEndpointError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `GetEndpointError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `GetEndpointError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `GetEndpointError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `GetEndpointError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `GetEndpointError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for GetEndpointError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for GetEndpointError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for GetEndpointError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetEndpointError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetEndpointError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::get_endpoint::_get_endpoint_input::GetEndpointInput; + +pub use crate::operation::get_endpoint::_get_endpoint_output::GetEndpointOutput; + +mod _get_endpoint_input; + +mod _get_endpoint_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/get_endpoint/_get_endpoint_input.rs b/sdks/rust/src/operation/get_endpoint/_get_endpoint_input.rs new file mode 100644 index 0000000..e3e2ee4 --- /dev/null +++ b/sdks/rust/src/operation/get_endpoint/_get_endpoint_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEndpointInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::option::Option<::std::string::String>, +} +impl GetEndpointInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> ::std::option::Option<&str> { + self.name.as_deref() + } +} +impl GetEndpointInput { + /// Creates a new builder-style object to manufacture [`GetEndpointInput`](crate::operation::get_endpoint::GetEndpointInput). + pub fn builder() -> crate::operation::get_endpoint::builders::GetEndpointInputBuilder { + crate::operation::get_endpoint::builders::GetEndpointInputBuilder::default() + } +} + +/// A builder for [`GetEndpointInput`](crate::operation::get_endpoint::GetEndpointInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetEndpointInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) name: ::std::option::Option<::std::string::String>, +} +impl GetEndpointInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + /// Consumes the builder and constructs a [`GetEndpointInput`](crate::operation::get_endpoint::GetEndpointInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_endpoint::GetEndpointInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + name: self.name + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_endpoint/_get_endpoint_output.rs b/sdks/rust/src/operation/get_endpoint/_get_endpoint_output.rs new file mode 100644 index 0000000..010a494 --- /dev/null +++ b/sdks/rust/src/operation/get_endpoint/_get_endpoint_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetEndpointOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::EndpointResource, +} +impl GetEndpointOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::EndpointResource { + &self.data + } +} +impl GetEndpointOutput { + /// Creates a new builder-style object to manufacture [`GetEndpointOutput`](crate::operation::get_endpoint::GetEndpointOutput). + pub fn builder() -> crate::operation::get_endpoint::builders::GetEndpointOutputBuilder { + crate::operation::get_endpoint::builders::GetEndpointOutputBuilder::default() + } +} + +/// A builder for [`GetEndpointOutput`](crate::operation::get_endpoint::GetEndpointOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetEndpointOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl GetEndpointOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::EndpointResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`GetEndpointOutput`](crate::operation::get_endpoint::GetEndpointOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::get_endpoint::builders::GetEndpointOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_endpoint::GetEndpointOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building GetEndpointOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_endpoint/builders.rs b/sdks/rust/src/operation/get_endpoint/builders.rs new file mode 100644 index 0000000..da7bc51 --- /dev/null +++ b/sdks/rust/src/operation/get_endpoint/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::get_endpoint::_get_endpoint_input::GetEndpointInputBuilder; + +pub use crate::operation::get_endpoint::_get_endpoint_output::GetEndpointOutputBuilder; + +impl crate::operation::get_endpoint::builders::GetEndpointInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::get_endpoint::GetEndpointOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::get_endpoint::GetEndpointError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.get_endpoint(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `GetEndpoint`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetEndpointFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::get_endpoint::builders::GetEndpointInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::get_endpoint::GetEndpointOutput, + crate::operation::get_endpoint::GetEndpointError, + > for GetEndpointFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::get_endpoint::GetEndpointOutput, + crate::operation::get_endpoint::GetEndpointError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl GetEndpointFluentBuilder { + /// Creates a new `GetEndpointFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the GetEndpoint as a reference. + pub fn as_input(&self) -> &crate::operation::get_endpoint::builders::GetEndpointInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::get_endpoint::GetEndpoint::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::get_endpoint::GetEndpoint::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.name(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_name(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_name() + } +} + diff --git a/sdks/rust/src/operation/get_execution.rs b/sdks/rust/src/operation/get_execution.rs new file mode 100644 index 0000000..2cd383a --- /dev/null +++ b/sdks/rust/src/operation/get_execution.rs @@ -0,0 +1,348 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `GetExecution`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetExecution; +impl GetExecution { + /// Creates a new `GetExecution` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_execution::GetExecutionInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_execution::GetExecutionInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "GetExecution", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.GetExecution", + "rpc.service" = "KronosService", + "rpc.method" = "GetExecution", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetExecution { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetExecution"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(GetExecutionRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(GetExecutionResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "GetExecution", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetExecution") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(GetExecutionEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct GetExecutionResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetExecutionResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_get_execution::de_get_execution_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_get_execution::de_get_execution_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct GetExecutionRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetExecutionRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::get_execution::GetExecutionInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.execution_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "cannot be empty or unset"))?; + let execution_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if execution_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/executions/{execution_id}", execution_id = execution_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::get_execution::GetExecutionInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_get_execution::ser_get_execution_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct GetExecutionEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetExecutionEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "GetExecutionEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to GetExecutionInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `GetExecutionError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum GetExecutionError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetExecutionError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl GetExecutionError { + /// Creates the `GetExecutionError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `GetExecutionError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `GetExecutionError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `GetExecutionError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `GetExecutionError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `GetExecutionError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for GetExecutionError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for GetExecutionError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for GetExecutionError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetExecutionError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetExecutionError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::get_execution::_get_execution_input::GetExecutionInput; + +pub use crate::operation::get_execution::_get_execution_output::GetExecutionOutput; + +mod _get_execution_input; + +mod _get_execution_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/get_execution/_get_execution_input.rs b/sdks/rust/src/operation/get_execution/_get_execution_input.rs new file mode 100644 index 0000000..20c353e --- /dev/null +++ b/sdks/rust/src/operation/get_execution/_get_execution_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetExecutionInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub execution_id: ::std::option::Option<::std::string::String>, +} +impl GetExecutionInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(&self) -> ::std::option::Option<&str> { + self.execution_id.as_deref() + } +} +impl GetExecutionInput { + /// Creates a new builder-style object to manufacture [`GetExecutionInput`](crate::operation::get_execution::GetExecutionInput). + pub fn builder() -> crate::operation::get_execution::builders::GetExecutionInputBuilder { + crate::operation::get_execution::builders::GetExecutionInputBuilder::default() + } +} + +/// A builder for [`GetExecutionInput`](crate::operation::get_execution::GetExecutionInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetExecutionInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) execution_id: ::std::option::Option<::std::string::String>, +} +impl GetExecutionInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.execution_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.execution_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + &self.execution_id + } + /// Consumes the builder and constructs a [`GetExecutionInput`](crate::operation::get_execution::GetExecutionInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_execution::GetExecutionInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + execution_id: self.execution_id + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_execution/_get_execution_output.rs b/sdks/rust/src/operation/get_execution/_get_execution_output.rs new file mode 100644 index 0000000..00d12f0 --- /dev/null +++ b/sdks/rust/src/operation/get_execution/_get_execution_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetExecutionOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::ExecutionResource, +} +impl GetExecutionOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::ExecutionResource { + &self.data + } +} +impl GetExecutionOutput { + /// Creates a new builder-style object to manufacture [`GetExecutionOutput`](crate::operation::get_execution::GetExecutionOutput). + pub fn builder() -> crate::operation::get_execution::builders::GetExecutionOutputBuilder { + crate::operation::get_execution::builders::GetExecutionOutputBuilder::default() + } +} + +/// A builder for [`GetExecutionOutput`](crate::operation::get_execution::GetExecutionOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetExecutionOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl GetExecutionOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::ExecutionResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`GetExecutionOutput`](crate::operation::get_execution::GetExecutionOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::get_execution::builders::GetExecutionOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_execution::GetExecutionOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building GetExecutionOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_execution/builders.rs b/sdks/rust/src/operation/get_execution/builders.rs new file mode 100644 index 0000000..295e32f --- /dev/null +++ b/sdks/rust/src/operation/get_execution/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::get_execution::_get_execution_input::GetExecutionInputBuilder; + +pub use crate::operation::get_execution::_get_execution_output::GetExecutionOutputBuilder; + +impl crate::operation::get_execution::builders::GetExecutionInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::get_execution::GetExecutionOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::get_execution::GetExecutionError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.get_execution(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `GetExecution`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetExecutionFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::get_execution::builders::GetExecutionInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::get_execution::GetExecutionOutput, + crate::operation::get_execution::GetExecutionError, + > for GetExecutionFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::get_execution::GetExecutionOutput, + crate::operation::get_execution::GetExecutionError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl GetExecutionFluentBuilder { + /// Creates a new `GetExecutionFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the GetExecution as a reference. + pub fn as_input(&self) -> &crate::operation::get_execution::builders::GetExecutionInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::get_execution::GetExecution::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::get_execution::GetExecution::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.execution_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_execution_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_execution_id() + } +} + diff --git a/sdks/rust/src/operation/get_job.rs b/sdks/rust/src/operation/get_job.rs new file mode 100644 index 0000000..19ee984 --- /dev/null +++ b/sdks/rust/src/operation/get_job.rs @@ -0,0 +1,348 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `GetJob`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJob; +impl GetJob { + /// Creates a new `GetJob` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_job::GetJobInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_job::GetJobInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "GetJob", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.GetJob", + "rpc.service" = "KronosService", + "rpc.method" = "GetJob", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetJob { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetJob"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(GetJobRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(GetJobResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "GetJob", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetJob") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(GetJobEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct GetJobResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetJobResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_get_job::de_get_job_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_get_job::de_get_job_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct GetJobRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetJobRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::get_job::GetJobInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.job_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset"))?; + let job_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if job_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/jobs/{job_id}", job_id = job_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::get_job::GetJobInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_get_job::ser_get_job_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct GetJobEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetJobEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "GetJobEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to GetJobInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `GetJobError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum GetJobError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetJobError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl GetJobError { + /// Creates the `GetJobError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `GetJobError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `GetJobError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `GetJobError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `GetJobError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `GetJobError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for GetJobError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for GetJobError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for GetJobError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetJobError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetJobError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::get_job::_get_job_input::GetJobInput; + +pub use crate::operation::get_job::_get_job_output::GetJobOutput; + +mod _get_job_input; + +mod _get_job_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/get_job/_get_job_input.rs b/sdks/rust/src/operation/get_job/_get_job_input.rs new file mode 100644 index 0000000..3cfd206 --- /dev/null +++ b/sdks/rust/src/operation/get_job/_get_job_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetJobInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::option::Option<::std::string::String>, +} +impl GetJobInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> ::std::option::Option<&str> { + self.job_id.as_deref() + } +} +impl GetJobInput { + /// Creates a new builder-style object to manufacture [`GetJobInput`](crate::operation::get_job::GetJobInput). + pub fn builder() -> crate::operation::get_job::builders::GetJobInputBuilder { + crate::operation::get_job::builders::GetJobInputBuilder::default() + } +} + +/// A builder for [`GetJobInput`](crate::operation::get_job::GetJobInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJobInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) job_id: ::std::option::Option<::std::string::String>, +} +impl GetJobInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + /// Consumes the builder and constructs a [`GetJobInput`](crate::operation::get_job::GetJobInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_job::GetJobInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + job_id: self.job_id + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_job/_get_job_output.rs b/sdks/rust/src/operation/get_job/_get_job_output.rs new file mode 100644 index 0000000..b0e9ea1 --- /dev/null +++ b/sdks/rust/src/operation/get_job/_get_job_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetJobOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::JobResource, +} +impl GetJobOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::JobResource { + &self.data + } +} +impl GetJobOutput { + /// Creates a new builder-style object to manufacture [`GetJobOutput`](crate::operation::get_job::GetJobOutput). + pub fn builder() -> crate::operation::get_job::builders::GetJobOutputBuilder { + crate::operation::get_job::builders::GetJobOutputBuilder::default() + } +} + +/// A builder for [`GetJobOutput`](crate::operation::get_job::GetJobOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJobOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl GetJobOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::JobResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`GetJobOutput`](crate::operation::get_job::GetJobOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::get_job::builders::GetJobOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_job::GetJobOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building GetJobOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_job/builders.rs b/sdks/rust/src/operation/get_job/builders.rs new file mode 100644 index 0000000..2665cdf --- /dev/null +++ b/sdks/rust/src/operation/get_job/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::get_job::_get_job_input::GetJobInputBuilder; + +pub use crate::operation::get_job::_get_job_output::GetJobOutputBuilder; + +impl crate::operation::get_job::builders::GetJobInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::get_job::GetJobOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::get_job::GetJobError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.get_job(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `GetJob`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetJobFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::get_job::builders::GetJobInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::get_job::GetJobOutput, + crate::operation::get_job::GetJobError, + > for GetJobFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::get_job::GetJobOutput, + crate::operation::get_job::GetJobError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl GetJobFluentBuilder { + /// Creates a new `GetJobFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the GetJob as a reference. + pub fn as_input(&self) -> &crate::operation::get_job::builders::GetJobInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::get_job::GetJob::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::get_job::GetJob::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.job_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_job_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_job_id() + } +} + diff --git a/sdks/rust/src/operation/get_job_status.rs b/sdks/rust/src/operation/get_job_status.rs new file mode 100644 index 0000000..3eeeb19 --- /dev/null +++ b/sdks/rust/src/operation/get_job_status.rs @@ -0,0 +1,348 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `GetJobStatus`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJobStatus; +impl GetJobStatus { + /// Creates a new `GetJobStatus` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_job_status::GetJobStatusInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_job_status::GetJobStatusInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "GetJobStatus", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.GetJobStatus", + "rpc.service" = "KronosService", + "rpc.method" = "GetJobStatus", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetJobStatus { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetJobStatus"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(GetJobStatusRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(GetJobStatusResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "GetJobStatus", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetJobStatus") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(GetJobStatusEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct GetJobStatusResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetJobStatusResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_get_job_status::de_get_job_status_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_get_job_status::de_get_job_status_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct GetJobStatusRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetJobStatusRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::get_job_status::GetJobStatusInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.job_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset"))?; + let job_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if job_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/jobs/{job_id}/status", job_id = job_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::get_job_status::GetJobStatusInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_get_job_status::ser_get_job_status_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct GetJobStatusEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetJobStatusEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "GetJobStatusEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to GetJobStatusInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `GetJobStatusError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum GetJobStatusError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetJobStatusError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl GetJobStatusError { + /// Creates the `GetJobStatusError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `GetJobStatusError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `GetJobStatusError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `GetJobStatusError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `GetJobStatusError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `GetJobStatusError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for GetJobStatusError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for GetJobStatusError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for GetJobStatusError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetJobStatusError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetJobStatusError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::get_job_status::_get_job_status_input::GetJobStatusInput; + +pub use crate::operation::get_job_status::_get_job_status_output::GetJobStatusOutput; + +mod _get_job_status_input; + +mod _get_job_status_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/get_job_status/_get_job_status_input.rs b/sdks/rust/src/operation/get_job_status/_get_job_status_input.rs new file mode 100644 index 0000000..5b405b4 --- /dev/null +++ b/sdks/rust/src/operation/get_job_status/_get_job_status_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetJobStatusInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::option::Option<::std::string::String>, +} +impl GetJobStatusInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> ::std::option::Option<&str> { + self.job_id.as_deref() + } +} +impl GetJobStatusInput { + /// Creates a new builder-style object to manufacture [`GetJobStatusInput`](crate::operation::get_job_status::GetJobStatusInput). + pub fn builder() -> crate::operation::get_job_status::builders::GetJobStatusInputBuilder { + crate::operation::get_job_status::builders::GetJobStatusInputBuilder::default() + } +} + +/// A builder for [`GetJobStatusInput`](crate::operation::get_job_status::GetJobStatusInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJobStatusInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) job_id: ::std::option::Option<::std::string::String>, +} +impl GetJobStatusInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + /// Consumes the builder and constructs a [`GetJobStatusInput`](crate::operation::get_job_status::GetJobStatusInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_job_status::GetJobStatusInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + job_id: self.job_id + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_job_status/_get_job_status_output.rs b/sdks/rust/src/operation/get_job_status/_get_job_status_output.rs new file mode 100644 index 0000000..d7dadcd --- /dev/null +++ b/sdks/rust/src/operation/get_job_status/_get_job_status_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetJobStatusOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::JobStatusResponse, +} +impl GetJobStatusOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::JobStatusResponse { + &self.data + } +} +impl GetJobStatusOutput { + /// Creates a new builder-style object to manufacture [`GetJobStatusOutput`](crate::operation::get_job_status::GetJobStatusOutput). + pub fn builder() -> crate::operation::get_job_status::builders::GetJobStatusOutputBuilder { + crate::operation::get_job_status::builders::GetJobStatusOutputBuilder::default() + } +} + +/// A builder for [`GetJobStatusOutput`](crate::operation::get_job_status::GetJobStatusOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJobStatusOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl GetJobStatusOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::JobStatusResponse) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`GetJobStatusOutput`](crate::operation::get_job_status::GetJobStatusOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::get_job_status::builders::GetJobStatusOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_job_status::GetJobStatusOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building GetJobStatusOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_job_status/builders.rs b/sdks/rust/src/operation/get_job_status/builders.rs new file mode 100644 index 0000000..55e2b21 --- /dev/null +++ b/sdks/rust/src/operation/get_job_status/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::get_job_status::_get_job_status_input::GetJobStatusInputBuilder; + +pub use crate::operation::get_job_status::_get_job_status_output::GetJobStatusOutputBuilder; + +impl crate::operation::get_job_status::builders::GetJobStatusInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::get_job_status::GetJobStatusOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::get_job_status::GetJobStatusError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.get_job_status(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `GetJobStatus`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetJobStatusFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::get_job_status::builders::GetJobStatusInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::get_job_status::GetJobStatusOutput, + crate::operation::get_job_status::GetJobStatusError, + > for GetJobStatusFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::get_job_status::GetJobStatusOutput, + crate::operation::get_job_status::GetJobStatusError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl GetJobStatusFluentBuilder { + /// Creates a new `GetJobStatusFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the GetJobStatus as a reference. + pub fn as_input(&self) -> &crate::operation::get_job_status::builders::GetJobStatusInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::get_job_status::GetJobStatus::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::get_job_status::GetJobStatus::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.job_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_job_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_job_id() + } +} + diff --git a/sdks/rust/src/operation/get_job_versions.rs b/sdks/rust/src/operation/get_job_versions.rs new file mode 100644 index 0000000..dfe3976 --- /dev/null +++ b/sdks/rust/src/operation/get_job_versions.rs @@ -0,0 +1,348 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `GetJobVersions`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJobVersions; +impl GetJobVersions { + /// Creates a new `GetJobVersions` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_job_versions::GetJobVersionsInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_job_versions::GetJobVersionsInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "GetJobVersions", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.GetJobVersions", + "rpc.service" = "KronosService", + "rpc.method" = "GetJobVersions", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetJobVersions { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetJobVersions"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(GetJobVersionsRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(GetJobVersionsResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "GetJobVersions", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetJobVersions") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(GetJobVersionsEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct GetJobVersionsResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetJobVersionsResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_get_job_versions::de_get_job_versions_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_get_job_versions::de_get_job_versions_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct GetJobVersionsRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetJobVersionsRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::get_job_versions::GetJobVersionsInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.job_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset"))?; + let job_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if job_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/jobs/{job_id}/versions", job_id = job_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::get_job_versions::GetJobVersionsInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_get_job_versions::ser_get_job_versions_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct GetJobVersionsEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetJobVersionsEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "GetJobVersionsEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to GetJobVersionsInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `GetJobVersionsError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum GetJobVersionsError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetJobVersionsError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl GetJobVersionsError { + /// Creates the `GetJobVersionsError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `GetJobVersionsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `GetJobVersionsError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `GetJobVersionsError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `GetJobVersionsError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `GetJobVersionsError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for GetJobVersionsError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for GetJobVersionsError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for GetJobVersionsError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetJobVersionsError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetJobVersionsError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::get_job_versions::_get_job_versions_input::GetJobVersionsInput; + +pub use crate::operation::get_job_versions::_get_job_versions_output::GetJobVersionsOutput; + +mod _get_job_versions_input; + +mod _get_job_versions_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/get_job_versions/_get_job_versions_input.rs b/sdks/rust/src/operation/get_job_versions/_get_job_versions_input.rs new file mode 100644 index 0000000..057a65e --- /dev/null +++ b/sdks/rust/src/operation/get_job_versions/_get_job_versions_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetJobVersionsInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::option::Option<::std::string::String>, +} +impl GetJobVersionsInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> ::std::option::Option<&str> { + self.job_id.as_deref() + } +} +impl GetJobVersionsInput { + /// Creates a new builder-style object to manufacture [`GetJobVersionsInput`](crate::operation::get_job_versions::GetJobVersionsInput). + pub fn builder() -> crate::operation::get_job_versions::builders::GetJobVersionsInputBuilder { + crate::operation::get_job_versions::builders::GetJobVersionsInputBuilder::default() + } +} + +/// A builder for [`GetJobVersionsInput`](crate::operation::get_job_versions::GetJobVersionsInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJobVersionsInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) job_id: ::std::option::Option<::std::string::String>, +} +impl GetJobVersionsInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + /// Consumes the builder and constructs a [`GetJobVersionsInput`](crate::operation::get_job_versions::GetJobVersionsInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_job_versions::GetJobVersionsInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + job_id: self.job_id + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_job_versions/_get_job_versions_output.rs b/sdks/rust/src/operation/get_job_versions/_get_job_versions_output.rs new file mode 100644 index 0000000..8d5048e --- /dev/null +++ b/sdks/rust/src/operation/get_job_versions/_get_job_versions_output.rs @@ -0,0 +1,62 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetJobVersionsOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: ::std::vec::Vec::, +} +impl GetJobVersionsOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &[crate::types::JobResource] { + use std::ops::Deref; self.data.deref() + } +} +impl GetJobVersionsOutput { + /// Creates a new builder-style object to manufacture [`GetJobVersionsOutput`](crate::operation::get_job_versions::GetJobVersionsOutput). + pub fn builder() -> crate::operation::get_job_versions::builders::GetJobVersionsOutputBuilder { + crate::operation::get_job_versions::builders::GetJobVersionsOutputBuilder::default() + } +} + +/// A builder for [`GetJobVersionsOutput`](crate::operation::get_job_versions::GetJobVersionsOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetJobVersionsOutputBuilder { + pub(crate) data: ::std::option::Option<::std::vec::Vec::>, +} +impl GetJobVersionsOutputBuilder { + /// Appends an item to `data`. + /// + /// To override the contents of this collection use [`set_data`](Self::set_data). + /// + pub fn data(mut self, input: crate::types::JobResource) -> Self { + let mut v = self.data.unwrap_or_default(); + v.push(input); + self.data = ::std::option::Option::Some(v); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option<::std::vec::Vec::>) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option<::std::vec::Vec::> { + &self.data + } + /// Consumes the builder and constructs a [`GetJobVersionsOutput`](crate::operation::get_job_versions::GetJobVersionsOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::get_job_versions::builders::GetJobVersionsOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_job_versions::GetJobVersionsOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building GetJobVersionsOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_job_versions/builders.rs b/sdks/rust/src/operation/get_job_versions/builders.rs new file mode 100644 index 0000000..281d9bf --- /dev/null +++ b/sdks/rust/src/operation/get_job_versions/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::get_job_versions::_get_job_versions_input::GetJobVersionsInputBuilder; + +pub use crate::operation::get_job_versions::_get_job_versions_output::GetJobVersionsOutputBuilder; + +impl crate::operation::get_job_versions::builders::GetJobVersionsInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::get_job_versions::GetJobVersionsOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::get_job_versions::GetJobVersionsError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.get_job_versions(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `GetJobVersions`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetJobVersionsFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::get_job_versions::builders::GetJobVersionsInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::get_job_versions::GetJobVersionsOutput, + crate::operation::get_job_versions::GetJobVersionsError, + > for GetJobVersionsFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::get_job_versions::GetJobVersionsOutput, + crate::operation::get_job_versions::GetJobVersionsError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl GetJobVersionsFluentBuilder { + /// Creates a new `GetJobVersionsFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the GetJobVersions as a reference. + pub fn as_input(&self) -> &crate::operation::get_job_versions::builders::GetJobVersionsInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::get_job_versions::GetJobVersions::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::get_job_versions::GetJobVersions::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.job_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_job_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_job_id() + } +} + diff --git a/sdks/rust/src/operation/get_payload_spec.rs b/sdks/rust/src/operation/get_payload_spec.rs new file mode 100644 index 0000000..045351a --- /dev/null +++ b/sdks/rust/src/operation/get_payload_spec.rs @@ -0,0 +1,348 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `GetPayloadSpec`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetPayloadSpec; +impl GetPayloadSpec { + /// Creates a new `GetPayloadSpec` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_payload_spec::GetPayloadSpecInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::get_payload_spec::GetPayloadSpecInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "GetPayloadSpec", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.GetPayloadSpec", + "rpc.service" = "KronosService", + "rpc.method" = "GetPayloadSpec", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for GetPayloadSpec { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("GetPayloadSpec"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(GetPayloadSpecRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(GetPayloadSpecResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "GetPayloadSpec", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("GetPayloadSpec") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(GetPayloadSpecEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct GetPayloadSpecResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for GetPayloadSpecResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_get_payload_spec::de_get_payload_spec_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_get_payload_spec::de_get_payload_spec_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct GetPayloadSpecRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for GetPayloadSpecRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::get_payload_spec::GetPayloadSpecInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.name; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset"))?; + let name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if name.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/payload-specs/{name}", name = name).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::get_payload_spec::GetPayloadSpecInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_get_payload_spec::ser_get_payload_spec_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct GetPayloadSpecEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for GetPayloadSpecEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "GetPayloadSpecEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to GetPayloadSpecInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `GetPayloadSpecError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum GetPayloadSpecError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-GetPayloadSpecError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl GetPayloadSpecError { + /// Creates the `GetPayloadSpecError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `GetPayloadSpecError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `GetPayloadSpecError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `GetPayloadSpecError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `GetPayloadSpecError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `GetPayloadSpecError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for GetPayloadSpecError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for GetPayloadSpecError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for GetPayloadSpecError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for GetPayloadSpecError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for GetPayloadSpecError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::get_payload_spec::_get_payload_spec_input::GetPayloadSpecInput; + +pub use crate::operation::get_payload_spec::_get_payload_spec_output::GetPayloadSpecOutput; + +mod _get_payload_spec_input; + +mod _get_payload_spec_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/get_payload_spec/_get_payload_spec_input.rs b/sdks/rust/src/operation/get_payload_spec/_get_payload_spec_input.rs new file mode 100644 index 0000000..652319f --- /dev/null +++ b/sdks/rust/src/operation/get_payload_spec/_get_payload_spec_input.rs @@ -0,0 +1,99 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetPayloadSpecInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::option::Option<::std::string::String>, +} +impl GetPayloadSpecInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> ::std::option::Option<&str> { + self.name.as_deref() + } +} +impl GetPayloadSpecInput { + /// Creates a new builder-style object to manufacture [`GetPayloadSpecInput`](crate::operation::get_payload_spec::GetPayloadSpecInput). + pub fn builder() -> crate::operation::get_payload_spec::builders::GetPayloadSpecInputBuilder { + crate::operation::get_payload_spec::builders::GetPayloadSpecInputBuilder::default() + } +} + +/// A builder for [`GetPayloadSpecInput`](crate::operation::get_payload_spec::GetPayloadSpecInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetPayloadSpecInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) name: ::std::option::Option<::std::string::String>, +} +impl GetPayloadSpecInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + /// Consumes the builder and constructs a [`GetPayloadSpecInput`](crate::operation::get_payload_spec::GetPayloadSpecInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_payload_spec::GetPayloadSpecInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + name: self.name + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_payload_spec/_get_payload_spec_output.rs b/sdks/rust/src/operation/get_payload_spec/_get_payload_spec_output.rs new file mode 100644 index 0000000..91f2944 --- /dev/null +++ b/sdks/rust/src/operation/get_payload_spec/_get_payload_spec_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct GetPayloadSpecOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::PayloadSpecResource, +} +impl GetPayloadSpecOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::PayloadSpecResource { + &self.data + } +} +impl GetPayloadSpecOutput { + /// Creates a new builder-style object to manufacture [`GetPayloadSpecOutput`](crate::operation::get_payload_spec::GetPayloadSpecOutput). + pub fn builder() -> crate::operation::get_payload_spec::builders::GetPayloadSpecOutputBuilder { + crate::operation::get_payload_spec::builders::GetPayloadSpecOutputBuilder::default() + } +} + +/// A builder for [`GetPayloadSpecOutput`](crate::operation::get_payload_spec::GetPayloadSpecOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct GetPayloadSpecOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl GetPayloadSpecOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::PayloadSpecResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`GetPayloadSpecOutput`](crate::operation::get_payload_spec::GetPayloadSpecOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::get_payload_spec::builders::GetPayloadSpecOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::get_payload_spec::GetPayloadSpecOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building GetPayloadSpecOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/get_payload_spec/builders.rs b/sdks/rust/src/operation/get_payload_spec/builders.rs new file mode 100644 index 0000000..c78d6ee --- /dev/null +++ b/sdks/rust/src/operation/get_payload_spec/builders.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::get_payload_spec::_get_payload_spec_input::GetPayloadSpecInputBuilder; + +pub use crate::operation::get_payload_spec::_get_payload_spec_output::GetPayloadSpecOutputBuilder; + +impl crate::operation::get_payload_spec::builders::GetPayloadSpecInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::get_payload_spec::GetPayloadSpecOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::get_payload_spec::GetPayloadSpecError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.get_payload_spec(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `GetPayloadSpec`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct GetPayloadSpecFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::get_payload_spec::builders::GetPayloadSpecInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::get_payload_spec::GetPayloadSpecOutput, + crate::operation::get_payload_spec::GetPayloadSpecError, + > for GetPayloadSpecFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::get_payload_spec::GetPayloadSpecOutput, + crate::operation::get_payload_spec::GetPayloadSpecError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl GetPayloadSpecFluentBuilder { + /// Creates a new `GetPayloadSpecFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the GetPayloadSpec as a reference. + pub fn as_input(&self) -> &crate::operation::get_payload_spec::builders::GetPayloadSpecInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::get_payload_spec::GetPayloadSpec::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::get_payload_spec::GetPayloadSpec::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.name(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_name(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_name() + } +} + diff --git a/sdks/rust/src/operation/list_endpoints.rs b/sdks/rust/src/operation/list_endpoints.rs new file mode 100644 index 0000000..591cd96 --- /dev/null +++ b/sdks/rust/src/operation/list_endpoints.rs @@ -0,0 +1,341 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `ListEndpoints`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListEndpoints; +impl ListEndpoints { + /// Creates a new `ListEndpoints` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_endpoints::ListEndpointsInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_endpoints::ListEndpointsInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "ListEndpoints", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.ListEndpoints", + "rpc.service" = "KronosService", + "rpc.method" = "ListEndpoints", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListEndpoints { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListEndpoints"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(ListEndpointsRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(ListEndpointsResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "ListEndpoints", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListEndpoints") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(ListEndpointsEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct ListEndpointsResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListEndpointsResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_list_endpoints::de_list_endpoints_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_list_endpoints::de_list_endpoints_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct ListEndpointsRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListEndpointsRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::list_endpoints::ListEndpointsInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + ::std::write!(output, "/v1/endpoints").expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +fn uri_query(_input: &crate::operation::list_endpoints::ListEndpointsInput, mut output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + let mut query = ::aws_smithy_http::query::Writer::new(output); + if let ::std::option::Option::Some(inner_1) = &_input.cursor { + { + query.push_kv("cursor", &::aws_smithy_http::query::fmt_string(inner_1)); + } + } + if let ::std::option::Option::Some(inner_2) = &_input.limit { + { + query.push_kv("limit", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode()); + } + } + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::list_endpoints::ListEndpointsInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + uri_query(input, &mut uri)?; + let builder = crate::protocol_serde::shape_list_endpoints::ser_list_endpoints_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct ListEndpointsEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListEndpointsEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "ListEndpointsEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to ListEndpointsInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `ListEndpointsError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum ListEndpointsError { + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListEndpointsError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl ListEndpointsError { + /// Creates the `ListEndpointsError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `ListEndpointsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `ListEndpointsError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `ListEndpointsError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `ListEndpointsError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for ListEndpointsError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for ListEndpointsError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for ListEndpointsError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListEndpointsError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListEndpointsError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::list_endpoints::_list_endpoints_input::ListEndpointsInput; + +pub use crate::operation::list_endpoints::_list_endpoints_output::ListEndpointsOutput; + +mod _list_endpoints_input; + +mod _list_endpoints_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/list_endpoints/_list_endpoints_input.rs b/sdks/rust/src/operation/list_endpoints/_list_endpoints_input.rs new file mode 100644 index 0000000..669ffa9 --- /dev/null +++ b/sdks/rust/src/operation/list_endpoints/_list_endpoints_input.rs @@ -0,0 +1,120 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListEndpointsInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub limit: ::std::option::Option, +} +impl ListEndpointsInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(&self) -> ::std::option::Option { + self.limit + } +} +impl ListEndpointsInput { + /// Creates a new builder-style object to manufacture [`ListEndpointsInput`](crate::operation::list_endpoints::ListEndpointsInput). + pub fn builder() -> crate::operation::list_endpoints::builders::ListEndpointsInputBuilder { + crate::operation::list_endpoints::builders::ListEndpointsInputBuilder::default() + } +} + +/// A builder for [`ListEndpointsInput`](crate::operation::list_endpoints::ListEndpointsInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListEndpointsInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, + pub(crate) limit: ::std::option::Option, +} +impl ListEndpointsInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.limit = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.limit = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + &self.limit + } + /// Consumes the builder and constructs a [`ListEndpointsInput`](crate::operation::list_endpoints::ListEndpointsInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_endpoints::ListEndpointsInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + cursor: self.cursor + , + limit: self.limit + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_endpoints/_list_endpoints_output.rs b/sdks/rust/src/operation/list_endpoints/_list_endpoints_output.rs new file mode 100644 index 0000000..19f29e0 --- /dev/null +++ b/sdks/rust/src/operation/list_endpoints/_list_endpoints_output.rs @@ -0,0 +1,84 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListEndpointsOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: ::std::vec::Vec::, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ListEndpointsOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &[crate::types::EndpointResource] { + use std::ops::Deref; self.data.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } +} +impl ListEndpointsOutput { + /// Creates a new builder-style object to manufacture [`ListEndpointsOutput`](crate::operation::list_endpoints::ListEndpointsOutput). + pub fn builder() -> crate::operation::list_endpoints::builders::ListEndpointsOutputBuilder { + crate::operation::list_endpoints::builders::ListEndpointsOutputBuilder::default() + } +} + +/// A builder for [`ListEndpointsOutput`](crate::operation::list_endpoints::ListEndpointsOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListEndpointsOutputBuilder { + pub(crate) data: ::std::option::Option<::std::vec::Vec::>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, +} +impl ListEndpointsOutputBuilder { + /// Appends an item to `data`. + /// + /// To override the contents of this collection use [`set_data`](Self::set_data). + /// + pub fn data(mut self, input: crate::types::EndpointResource) -> Self { + let mut v = self.data.unwrap_or_default(); + v.push(input); + self.data = ::std::option::Option::Some(v); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option<::std::vec::Vec::>) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option<::std::vec::Vec::> { + &self.data + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + /// Consumes the builder and constructs a [`ListEndpointsOutput`](crate::operation::list_endpoints::ListEndpointsOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::list_endpoints::builders::ListEndpointsOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_endpoints::ListEndpointsOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building ListEndpointsOutput") + )? + , + cursor: self.cursor + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_endpoints/builders.rs b/sdks/rust/src/operation/list_endpoints/builders.rs new file mode 100644 index 0000000..02948ba --- /dev/null +++ b/sdks/rust/src/operation/list_endpoints/builders.rs @@ -0,0 +1,155 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::list_endpoints::_list_endpoints_input::ListEndpointsInputBuilder; + +pub use crate::operation::list_endpoints::_list_endpoints_output::ListEndpointsOutputBuilder; + +impl crate::operation::list_endpoints::builders::ListEndpointsInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::list_endpoints::ListEndpointsOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::list_endpoints::ListEndpointsError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.list_endpoints(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `ListEndpoints`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct ListEndpointsFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::list_endpoints::builders::ListEndpointsInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::list_endpoints::ListEndpointsOutput, + crate::operation::list_endpoints::ListEndpointsError, + > for ListEndpointsFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::list_endpoints::ListEndpointsOutput, + crate::operation::list_endpoints::ListEndpointsError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl ListEndpointsFluentBuilder { + /// Creates a new `ListEndpointsFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the ListEndpoints as a reference. + pub fn as_input(&self) -> &crate::operation::list_endpoints::builders::ListEndpointsInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::list_endpoints::ListEndpoints::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::list_endpoints::ListEndpoints::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.cursor(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_cursor(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_cursor() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.inner = self.inner.limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + self.inner.get_limit() + } +} + diff --git a/sdks/rust/src/operation/list_execution_attempts.rs b/sdks/rust/src/operation/list_execution_attempts.rs new file mode 100644 index 0000000..9851c37 --- /dev/null +++ b/sdks/rust/src/operation/list_execution_attempts.rs @@ -0,0 +1,363 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `ListExecutionAttempts`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListExecutionAttempts; +impl ListExecutionAttempts { + /// Creates a new `ListExecutionAttempts` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_execution_attempts::ListExecutionAttemptsInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_execution_attempts::ListExecutionAttemptsInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "ListExecutionAttempts", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.ListExecutionAttempts", + "rpc.service" = "KronosService", + "rpc.method" = "ListExecutionAttempts", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListExecutionAttempts { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListExecutionAttempts"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(ListExecutionAttemptsRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(ListExecutionAttemptsResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "ListExecutionAttempts", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListExecutionAttempts") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(ListExecutionAttemptsEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct ListExecutionAttemptsResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListExecutionAttemptsResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_list_execution_attempts::de_list_execution_attempts_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_list_execution_attempts::de_list_execution_attempts_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct ListExecutionAttemptsRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListExecutionAttemptsRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::list_execution_attempts::ListExecutionAttemptsInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.execution_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "cannot be empty or unset"))?; + let execution_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if execution_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/executions/{execution_id}/attempts", execution_id = execution_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +fn uri_query(_input: &crate::operation::list_execution_attempts::ListExecutionAttemptsInput, mut output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + let mut query = ::aws_smithy_http::query::Writer::new(output); + if let ::std::option::Option::Some(inner_2) = &_input.cursor { + { + query.push_kv("cursor", &::aws_smithy_http::query::fmt_string(inner_2)); + } + } + if let ::std::option::Option::Some(inner_3) = &_input.limit { + { + query.push_kv("limit", ::aws_smithy_types::primitive::Encoder::from(*inner_3).encode()); + } + } + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::list_execution_attempts::ListExecutionAttemptsInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + uri_query(input, &mut uri)?; + let builder = crate::protocol_serde::shape_list_execution_attempts::ser_list_execution_attempts_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct ListExecutionAttemptsEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListExecutionAttemptsEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "ListExecutionAttemptsEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to ListExecutionAttemptsInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `ListExecutionAttemptsError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum ListExecutionAttemptsError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListExecutionAttemptsError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl ListExecutionAttemptsError { + /// Creates the `ListExecutionAttemptsError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `ListExecutionAttemptsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `ListExecutionAttemptsError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `ListExecutionAttemptsError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `ListExecutionAttemptsError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `ListExecutionAttemptsError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for ListExecutionAttemptsError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for ListExecutionAttemptsError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for ListExecutionAttemptsError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListExecutionAttemptsError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListExecutionAttemptsError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::list_execution_attempts::_list_execution_attempts_input::ListExecutionAttemptsInput; + +pub use crate::operation::list_execution_attempts::_list_execution_attempts_output::ListExecutionAttemptsOutput; + +mod _list_execution_attempts_input; + +mod _list_execution_attempts_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_input.rs b/sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_input.rs new file mode 100644 index 0000000..3746342 --- /dev/null +++ b/sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_input.rs @@ -0,0 +1,143 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListExecutionAttemptsInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub limit: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub execution_id: ::std::option::Option<::std::string::String>, +} +impl ListExecutionAttemptsInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(&self) -> ::std::option::Option { + self.limit + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(&self) -> ::std::option::Option<&str> { + self.execution_id.as_deref() + } +} +impl ListExecutionAttemptsInput { + /// Creates a new builder-style object to manufacture [`ListExecutionAttemptsInput`](crate::operation::list_execution_attempts::ListExecutionAttemptsInput). + pub fn builder() -> crate::operation::list_execution_attempts::builders::ListExecutionAttemptsInputBuilder { + crate::operation::list_execution_attempts::builders::ListExecutionAttemptsInputBuilder::default() + } +} + +/// A builder for [`ListExecutionAttemptsInput`](crate::operation::list_execution_attempts::ListExecutionAttemptsInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListExecutionAttemptsInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, + pub(crate) limit: ::std::option::Option, + pub(crate) execution_id: ::std::option::Option<::std::string::String>, +} +impl ListExecutionAttemptsInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.limit = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.limit = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + &self.limit + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.execution_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.execution_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + &self.execution_id + } + /// Consumes the builder and constructs a [`ListExecutionAttemptsInput`](crate::operation::list_execution_attempts::ListExecutionAttemptsInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_execution_attempts::ListExecutionAttemptsInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + cursor: self.cursor + , + limit: self.limit + , + execution_id: self.execution_id + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_output.rs b/sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_output.rs new file mode 100644 index 0000000..51e988c --- /dev/null +++ b/sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_output.rs @@ -0,0 +1,84 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListExecutionAttemptsOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: ::std::vec::Vec::, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ListExecutionAttemptsOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &[crate::types::AttemptResource] { + use std::ops::Deref; self.data.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } +} +impl ListExecutionAttemptsOutput { + /// Creates a new builder-style object to manufacture [`ListExecutionAttemptsOutput`](crate::operation::list_execution_attempts::ListExecutionAttemptsOutput). + pub fn builder() -> crate::operation::list_execution_attempts::builders::ListExecutionAttemptsOutputBuilder { + crate::operation::list_execution_attempts::builders::ListExecutionAttemptsOutputBuilder::default() + } +} + +/// A builder for [`ListExecutionAttemptsOutput`](crate::operation::list_execution_attempts::ListExecutionAttemptsOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListExecutionAttemptsOutputBuilder { + pub(crate) data: ::std::option::Option<::std::vec::Vec::>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, +} +impl ListExecutionAttemptsOutputBuilder { + /// Appends an item to `data`. + /// + /// To override the contents of this collection use [`set_data`](Self::set_data). + /// + pub fn data(mut self, input: crate::types::AttemptResource) -> Self { + let mut v = self.data.unwrap_or_default(); + v.push(input); + self.data = ::std::option::Option::Some(v); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option<::std::vec::Vec::>) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option<::std::vec::Vec::> { + &self.data + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + /// Consumes the builder and constructs a [`ListExecutionAttemptsOutput`](crate::operation::list_execution_attempts::ListExecutionAttemptsOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::list_execution_attempts::builders::ListExecutionAttemptsOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_execution_attempts::ListExecutionAttemptsOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building ListExecutionAttemptsOutput") + )? + , + cursor: self.cursor + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_execution_attempts/builders.rs b/sdks/rust/src/operation/list_execution_attempts/builders.rs new file mode 100644 index 0000000..a8d0d75 --- /dev/null +++ b/sdks/rust/src/operation/list_execution_attempts/builders.rs @@ -0,0 +1,169 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::list_execution_attempts::_list_execution_attempts_input::ListExecutionAttemptsInputBuilder; + +pub use crate::operation::list_execution_attempts::_list_execution_attempts_output::ListExecutionAttemptsOutputBuilder; + +impl crate::operation::list_execution_attempts::builders::ListExecutionAttemptsInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::list_execution_attempts::ListExecutionAttemptsOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::list_execution_attempts::ListExecutionAttemptsError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.list_execution_attempts(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `ListExecutionAttempts`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct ListExecutionAttemptsFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::list_execution_attempts::builders::ListExecutionAttemptsInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::list_execution_attempts::ListExecutionAttemptsOutput, + crate::operation::list_execution_attempts::ListExecutionAttemptsError, + > for ListExecutionAttemptsFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::list_execution_attempts::ListExecutionAttemptsOutput, + crate::operation::list_execution_attempts::ListExecutionAttemptsError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl ListExecutionAttemptsFluentBuilder { + /// Creates a new `ListExecutionAttemptsFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the ListExecutionAttempts as a reference. + pub fn as_input(&self) -> &crate::operation::list_execution_attempts::builders::ListExecutionAttemptsInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::list_execution_attempts::ListExecutionAttempts::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::list_execution_attempts::ListExecutionAttempts::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.cursor(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_cursor(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_cursor() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.inner = self.inner.limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + self.inner.get_limit() + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.execution_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_execution_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_execution_id() + } +} + diff --git a/sdks/rust/src/operation/list_execution_logs.rs b/sdks/rust/src/operation/list_execution_logs.rs new file mode 100644 index 0000000..0b861c8 --- /dev/null +++ b/sdks/rust/src/operation/list_execution_logs.rs @@ -0,0 +1,363 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `ListExecutionLogs`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListExecutionLogs; +impl ListExecutionLogs { + /// Creates a new `ListExecutionLogs` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_execution_logs::ListExecutionLogsInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_execution_logs::ListExecutionLogsInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "ListExecutionLogs", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.ListExecutionLogs", + "rpc.service" = "KronosService", + "rpc.method" = "ListExecutionLogs", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListExecutionLogs { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListExecutionLogs"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(ListExecutionLogsRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(ListExecutionLogsResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "ListExecutionLogs", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListExecutionLogs") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(ListExecutionLogsEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct ListExecutionLogsResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListExecutionLogsResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_list_execution_logs::de_list_execution_logs_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_list_execution_logs::de_list_execution_logs_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct ListExecutionLogsRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListExecutionLogsRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::list_execution_logs::ListExecutionLogsInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.execution_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "cannot be empty or unset"))?; + let execution_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if execution_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/executions/{execution_id}/logs", execution_id = execution_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +fn uri_query(_input: &crate::operation::list_execution_logs::ListExecutionLogsInput, mut output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + let mut query = ::aws_smithy_http::query::Writer::new(output); + if let ::std::option::Option::Some(inner_2) = &_input.cursor { + { + query.push_kv("cursor", &::aws_smithy_http::query::fmt_string(inner_2)); + } + } + if let ::std::option::Option::Some(inner_3) = &_input.limit { + { + query.push_kv("limit", ::aws_smithy_types::primitive::Encoder::from(*inner_3).encode()); + } + } + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::list_execution_logs::ListExecutionLogsInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + uri_query(input, &mut uri)?; + let builder = crate::protocol_serde::shape_list_execution_logs::ser_list_execution_logs_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct ListExecutionLogsEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListExecutionLogsEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "ListExecutionLogsEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to ListExecutionLogsInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `ListExecutionLogsError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum ListExecutionLogsError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListExecutionLogsError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl ListExecutionLogsError { + /// Creates the `ListExecutionLogsError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `ListExecutionLogsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `ListExecutionLogsError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `ListExecutionLogsError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `ListExecutionLogsError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `ListExecutionLogsError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for ListExecutionLogsError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for ListExecutionLogsError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for ListExecutionLogsError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListExecutionLogsError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListExecutionLogsError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::list_execution_logs::_list_execution_logs_input::ListExecutionLogsInput; + +pub use crate::operation::list_execution_logs::_list_execution_logs_output::ListExecutionLogsOutput; + +mod _list_execution_logs_input; + +mod _list_execution_logs_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/list_execution_logs/_list_execution_logs_input.rs b/sdks/rust/src/operation/list_execution_logs/_list_execution_logs_input.rs new file mode 100644 index 0000000..754de39 --- /dev/null +++ b/sdks/rust/src/operation/list_execution_logs/_list_execution_logs_input.rs @@ -0,0 +1,143 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListExecutionLogsInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub limit: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub execution_id: ::std::option::Option<::std::string::String>, +} +impl ListExecutionLogsInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(&self) -> ::std::option::Option { + self.limit + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(&self) -> ::std::option::Option<&str> { + self.execution_id.as_deref() + } +} +impl ListExecutionLogsInput { + /// Creates a new builder-style object to manufacture [`ListExecutionLogsInput`](crate::operation::list_execution_logs::ListExecutionLogsInput). + pub fn builder() -> crate::operation::list_execution_logs::builders::ListExecutionLogsInputBuilder { + crate::operation::list_execution_logs::builders::ListExecutionLogsInputBuilder::default() + } +} + +/// A builder for [`ListExecutionLogsInput`](crate::operation::list_execution_logs::ListExecutionLogsInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListExecutionLogsInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, + pub(crate) limit: ::std::option::Option, + pub(crate) execution_id: ::std::option::Option<::std::string::String>, +} +impl ListExecutionLogsInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.limit = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.limit = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + &self.limit + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.execution_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.execution_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + &self.execution_id + } + /// Consumes the builder and constructs a [`ListExecutionLogsInput`](crate::operation::list_execution_logs::ListExecutionLogsInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_execution_logs::ListExecutionLogsInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + cursor: self.cursor + , + limit: self.limit + , + execution_id: self.execution_id + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_execution_logs/_list_execution_logs_output.rs b/sdks/rust/src/operation/list_execution_logs/_list_execution_logs_output.rs new file mode 100644 index 0000000..66bf647 --- /dev/null +++ b/sdks/rust/src/operation/list_execution_logs/_list_execution_logs_output.rs @@ -0,0 +1,84 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListExecutionLogsOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: ::std::vec::Vec::, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ListExecutionLogsOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &[crate::types::ExecutionLogResource] { + use std::ops::Deref; self.data.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } +} +impl ListExecutionLogsOutput { + /// Creates a new builder-style object to manufacture [`ListExecutionLogsOutput`](crate::operation::list_execution_logs::ListExecutionLogsOutput). + pub fn builder() -> crate::operation::list_execution_logs::builders::ListExecutionLogsOutputBuilder { + crate::operation::list_execution_logs::builders::ListExecutionLogsOutputBuilder::default() + } +} + +/// A builder for [`ListExecutionLogsOutput`](crate::operation::list_execution_logs::ListExecutionLogsOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListExecutionLogsOutputBuilder { + pub(crate) data: ::std::option::Option<::std::vec::Vec::>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, +} +impl ListExecutionLogsOutputBuilder { + /// Appends an item to `data`. + /// + /// To override the contents of this collection use [`set_data`](Self::set_data). + /// + pub fn data(mut self, input: crate::types::ExecutionLogResource) -> Self { + let mut v = self.data.unwrap_or_default(); + v.push(input); + self.data = ::std::option::Option::Some(v); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option<::std::vec::Vec::>) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option<::std::vec::Vec::> { + &self.data + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + /// Consumes the builder and constructs a [`ListExecutionLogsOutput`](crate::operation::list_execution_logs::ListExecutionLogsOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::list_execution_logs::builders::ListExecutionLogsOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_execution_logs::ListExecutionLogsOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building ListExecutionLogsOutput") + )? + , + cursor: self.cursor + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_execution_logs/builders.rs b/sdks/rust/src/operation/list_execution_logs/builders.rs new file mode 100644 index 0000000..d2a6f48 --- /dev/null +++ b/sdks/rust/src/operation/list_execution_logs/builders.rs @@ -0,0 +1,169 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::list_execution_logs::_list_execution_logs_input::ListExecutionLogsInputBuilder; + +pub use crate::operation::list_execution_logs::_list_execution_logs_output::ListExecutionLogsOutputBuilder; + +impl crate::operation::list_execution_logs::builders::ListExecutionLogsInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::list_execution_logs::ListExecutionLogsOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::list_execution_logs::ListExecutionLogsError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.list_execution_logs(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `ListExecutionLogs`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct ListExecutionLogsFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::list_execution_logs::builders::ListExecutionLogsInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::list_execution_logs::ListExecutionLogsOutput, + crate::operation::list_execution_logs::ListExecutionLogsError, + > for ListExecutionLogsFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::list_execution_logs::ListExecutionLogsOutput, + crate::operation::list_execution_logs::ListExecutionLogsError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl ListExecutionLogsFluentBuilder { + /// Creates a new `ListExecutionLogsFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the ListExecutionLogs as a reference. + pub fn as_input(&self) -> &crate::operation::list_execution_logs::builders::ListExecutionLogsInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::list_execution_logs::ListExecutionLogs::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::list_execution_logs::ListExecutionLogs::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.cursor(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_cursor(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_cursor() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.inner = self.inner.limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + self.inner.get_limit() + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.execution_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_execution_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_execution_id() + } +} + diff --git a/sdks/rust/src/operation/list_job_executions.rs b/sdks/rust/src/operation/list_job_executions.rs new file mode 100644 index 0000000..98ba366 --- /dev/null +++ b/sdks/rust/src/operation/list_job_executions.rs @@ -0,0 +1,368 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `ListJobExecutions`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListJobExecutions; +impl ListJobExecutions { + /// Creates a new `ListJobExecutions` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_job_executions::ListJobExecutionsInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_job_executions::ListJobExecutionsInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "ListJobExecutions", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.ListJobExecutions", + "rpc.service" = "KronosService", + "rpc.method" = "ListJobExecutions", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListJobExecutions { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListJobExecutions"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(ListJobExecutionsRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(ListJobExecutionsResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "ListJobExecutions", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListJobExecutions") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(ListJobExecutionsEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct ListJobExecutionsResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListJobExecutionsResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_list_job_executions::de_list_job_executions_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_list_job_executions::de_list_job_executions_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct ListJobExecutionsRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListJobExecutionsRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::list_job_executions::ListJobExecutionsInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.job_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset"))?; + let job_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if job_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/jobs/{job_id}/executions", job_id = job_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +fn uri_query(_input: &crate::operation::list_job_executions::ListJobExecutionsInput, mut output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + let mut query = ::aws_smithy_http::query::Writer::new(output); + if let ::std::option::Option::Some(inner_2) = &_input.cursor { + { + query.push_kv("cursor", &::aws_smithy_http::query::fmt_string(inner_2)); + } + } + if let ::std::option::Option::Some(inner_3) = &_input.limit { + { + query.push_kv("limit", ::aws_smithy_types::primitive::Encoder::from(*inner_3).encode()); + } + } + if let ::std::option::Option::Some(inner_4) = &_input.status { + { + query.push_kv("status", &::aws_smithy_http::query::fmt_string(inner_4)); + } + } + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::list_job_executions::ListJobExecutionsInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + uri_query(input, &mut uri)?; + let builder = crate::protocol_serde::shape_list_job_executions::ser_list_job_executions_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct ListJobExecutionsEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListJobExecutionsEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "ListJobExecutionsEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to ListJobExecutionsInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `ListJobExecutionsError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum ListJobExecutionsError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListJobExecutionsError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl ListJobExecutionsError { + /// Creates the `ListJobExecutionsError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `ListJobExecutionsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `ListJobExecutionsError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `ListJobExecutionsError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `ListJobExecutionsError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `ListJobExecutionsError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for ListJobExecutionsError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for ListJobExecutionsError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for ListJobExecutionsError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListJobExecutionsError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListJobExecutionsError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::list_job_executions::_list_job_executions_input::ListJobExecutionsInput; + +pub use crate::operation::list_job_executions::_list_job_executions_output::ListJobExecutionsOutput; + +mod _list_job_executions_input; + +mod _list_job_executions_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/list_job_executions/_list_job_executions_input.rs b/sdks/rust/src/operation/list_job_executions/_list_job_executions_input.rs new file mode 100644 index 0000000..64982e9 --- /dev/null +++ b/sdks/rust/src/operation/list_job_executions/_list_job_executions_input.rs @@ -0,0 +1,165 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListJobExecutionsInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub limit: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub status: ::std::option::Option, +} +impl ListJobExecutionsInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(&self) -> ::std::option::Option { + self.limit + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> ::std::option::Option<&str> { + self.job_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(&self) -> ::std::option::Option<&crate::types::ExecutionStatusEnum> { + self.status.as_ref() + } +} +impl ListJobExecutionsInput { + /// Creates a new builder-style object to manufacture [`ListJobExecutionsInput`](crate::operation::list_job_executions::ListJobExecutionsInput). + pub fn builder() -> crate::operation::list_job_executions::builders::ListJobExecutionsInputBuilder { + crate::operation::list_job_executions::builders::ListJobExecutionsInputBuilder::default() + } +} + +/// A builder for [`ListJobExecutionsInput`](crate::operation::list_job_executions::ListJobExecutionsInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListJobExecutionsInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, + pub(crate) limit: ::std::option::Option, + pub(crate) job_id: ::std::option::Option<::std::string::String>, + pub(crate) status: ::std::option::Option, +} +impl ListJobExecutionsInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.limit = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.limit = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + &self.limit + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(mut self, input: crate::types::ExecutionStatusEnum) -> Self { + self.status = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.status = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + &self.status + } + /// Consumes the builder and constructs a [`ListJobExecutionsInput`](crate::operation::list_job_executions::ListJobExecutionsInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_job_executions::ListJobExecutionsInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + cursor: self.cursor + , + limit: self.limit + , + job_id: self.job_id + , + status: self.status + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_job_executions/_list_job_executions_output.rs b/sdks/rust/src/operation/list_job_executions/_list_job_executions_output.rs new file mode 100644 index 0000000..75c56d2 --- /dev/null +++ b/sdks/rust/src/operation/list_job_executions/_list_job_executions_output.rs @@ -0,0 +1,84 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListJobExecutionsOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: ::std::vec::Vec::, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ListJobExecutionsOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &[crate::types::ExecutionResource] { + use std::ops::Deref; self.data.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } +} +impl ListJobExecutionsOutput { + /// Creates a new builder-style object to manufacture [`ListJobExecutionsOutput`](crate::operation::list_job_executions::ListJobExecutionsOutput). + pub fn builder() -> crate::operation::list_job_executions::builders::ListJobExecutionsOutputBuilder { + crate::operation::list_job_executions::builders::ListJobExecutionsOutputBuilder::default() + } +} + +/// A builder for [`ListJobExecutionsOutput`](crate::operation::list_job_executions::ListJobExecutionsOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListJobExecutionsOutputBuilder { + pub(crate) data: ::std::option::Option<::std::vec::Vec::>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, +} +impl ListJobExecutionsOutputBuilder { + /// Appends an item to `data`. + /// + /// To override the contents of this collection use [`set_data`](Self::set_data). + /// + pub fn data(mut self, input: crate::types::ExecutionResource) -> Self { + let mut v = self.data.unwrap_or_default(); + v.push(input); + self.data = ::std::option::Option::Some(v); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option<::std::vec::Vec::>) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option<::std::vec::Vec::> { + &self.data + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + /// Consumes the builder and constructs a [`ListJobExecutionsOutput`](crate::operation::list_job_executions::ListJobExecutionsOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::list_job_executions::builders::ListJobExecutionsOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_job_executions::ListJobExecutionsOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building ListJobExecutionsOutput") + )? + , + cursor: self.cursor + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_job_executions/builders.rs b/sdks/rust/src/operation/list_job_executions/builders.rs new file mode 100644 index 0000000..28131ca --- /dev/null +++ b/sdks/rust/src/operation/list_job_executions/builders.rs @@ -0,0 +1,183 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::list_job_executions::_list_job_executions_input::ListJobExecutionsInputBuilder; + +pub use crate::operation::list_job_executions::_list_job_executions_output::ListJobExecutionsOutputBuilder; + +impl crate::operation::list_job_executions::builders::ListJobExecutionsInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::list_job_executions::ListJobExecutionsOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::list_job_executions::ListJobExecutionsError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.list_job_executions(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `ListJobExecutions`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct ListJobExecutionsFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::list_job_executions::builders::ListJobExecutionsInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::list_job_executions::ListJobExecutionsOutput, + crate::operation::list_job_executions::ListJobExecutionsError, + > for ListJobExecutionsFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::list_job_executions::ListJobExecutionsOutput, + crate::operation::list_job_executions::ListJobExecutionsError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl ListJobExecutionsFluentBuilder { + /// Creates a new `ListJobExecutionsFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the ListJobExecutions as a reference. + pub fn as_input(&self) -> &crate::operation::list_job_executions::builders::ListJobExecutionsInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::list_job_executions::ListJobExecutions::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::list_job_executions::ListJobExecutions::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.cursor(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_cursor(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_cursor() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.inner = self.inner.limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + self.inner.get_limit() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.job_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_job_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_job_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(mut self, input: crate::types::ExecutionStatusEnum) -> Self { + self.inner = self.inner.status(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_status(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + self.inner.get_status() + } +} + diff --git a/sdks/rust/src/operation/list_jobs.rs b/sdks/rust/src/operation/list_jobs.rs new file mode 100644 index 0000000..347627a --- /dev/null +++ b/sdks/rust/src/operation/list_jobs.rs @@ -0,0 +1,356 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `ListJobs`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListJobs; +impl ListJobs { + /// Creates a new `ListJobs` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_jobs::ListJobsInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_jobs::ListJobsInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "ListJobs", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.ListJobs", + "rpc.service" = "KronosService", + "rpc.method" = "ListJobs", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListJobs { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListJobs"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(ListJobsRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(ListJobsResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "ListJobs", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListJobs") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(ListJobsEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct ListJobsResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListJobsResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_list_jobs::de_list_jobs_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_list_jobs::de_list_jobs_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct ListJobsRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListJobsRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::list_jobs::ListJobsInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + ::std::write!(output, "/v1/jobs").expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +fn uri_query(_input: &crate::operation::list_jobs::ListJobsInput, mut output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + let mut query = ::aws_smithy_http::query::Writer::new(output); + if let ::std::option::Option::Some(inner_1) = &_input.cursor { + { + query.push_kv("cursor", &::aws_smithy_http::query::fmt_string(inner_1)); + } + } + if let ::std::option::Option::Some(inner_2) = &_input.limit { + { + query.push_kv("limit", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode()); + } + } + if let ::std::option::Option::Some(inner_3) = &_input.endpoint { + { + query.push_kv("endpoint", &::aws_smithy_http::query::fmt_string(inner_3)); + } + } + if let ::std::option::Option::Some(inner_4) = &_input.trigger_type { + { + query.push_kv("trigger_type", &::aws_smithy_http::query::fmt_string(inner_4)); + } + } + if let ::std::option::Option::Some(inner_5) = &_input.status { + { + query.push_kv("status", &::aws_smithy_http::query::fmt_string(inner_5)); + } + } + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::list_jobs::ListJobsInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + uri_query(input, &mut uri)?; + let builder = crate::protocol_serde::shape_list_jobs::ser_list_jobs_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct ListJobsEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListJobsEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "ListJobsEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to ListJobsInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `ListJobsError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum ListJobsError { + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListJobsError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl ListJobsError { + /// Creates the `ListJobsError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `ListJobsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `ListJobsError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `ListJobsError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `ListJobsError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for ListJobsError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for ListJobsError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for ListJobsError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListJobsError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListJobsError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::list_jobs::_list_jobs_input::ListJobsInput; + +pub use crate::operation::list_jobs::_list_jobs_output::ListJobsOutput; + +mod _list_jobs_input; + +mod _list_jobs_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/list_jobs/_list_jobs_input.rs b/sdks/rust/src/operation/list_jobs/_list_jobs_input.rs new file mode 100644 index 0000000..be6cb93 --- /dev/null +++ b/sdks/rust/src/operation/list_jobs/_list_jobs_input.rs @@ -0,0 +1,186 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListJobsInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub limit: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub endpoint: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub trigger_type: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub status: ::std::option::Option, +} +impl ListJobsInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(&self) -> ::std::option::Option { + self.limit + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint(&self) -> ::std::option::Option<&str> { + self.endpoint.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn trigger_type(&self) -> ::std::option::Option<&crate::types::TriggerTypeEnum> { + self.trigger_type.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(&self) -> ::std::option::Option<&crate::types::JobStatusEnum> { + self.status.as_ref() + } +} +impl ListJobsInput { + /// Creates a new builder-style object to manufacture [`ListJobsInput`](crate::operation::list_jobs::ListJobsInput). + pub fn builder() -> crate::operation::list_jobs::builders::ListJobsInputBuilder { + crate::operation::list_jobs::builders::ListJobsInputBuilder::default() + } +} + +/// A builder for [`ListJobsInput`](crate::operation::list_jobs::ListJobsInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListJobsInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, + pub(crate) limit: ::std::option::Option, + pub(crate) endpoint: ::std::option::Option<::std::string::String>, + pub(crate) trigger_type: ::std::option::Option, + pub(crate) status: ::std::option::Option, +} +impl ListJobsInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.limit = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.limit = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + &self.limit + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.endpoint = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.endpoint = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint(&self) -> &::std::option::Option<::std::string::String> { + &self.endpoint + } + #[allow(missing_docs)] // documentation missing in model + pub fn trigger_type(mut self, input: crate::types::TriggerTypeEnum) -> Self { + self.trigger_type = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_trigger_type(mut self, input: ::std::option::Option) -> Self { + self.trigger_type = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_trigger_type(&self) -> &::std::option::Option { + &self.trigger_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(mut self, input: crate::types::JobStatusEnum) -> Self { + self.status = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.status = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + &self.status + } + /// Consumes the builder and constructs a [`ListJobsInput`](crate::operation::list_jobs::ListJobsInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_jobs::ListJobsInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + cursor: self.cursor + , + limit: self.limit + , + endpoint: self.endpoint + , + trigger_type: self.trigger_type + , + status: self.status + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_jobs/_list_jobs_output.rs b/sdks/rust/src/operation/list_jobs/_list_jobs_output.rs new file mode 100644 index 0000000..750e4be --- /dev/null +++ b/sdks/rust/src/operation/list_jobs/_list_jobs_output.rs @@ -0,0 +1,84 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListJobsOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: ::std::vec::Vec::, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ListJobsOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &[crate::types::JobSummary] { + use std::ops::Deref; self.data.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } +} +impl ListJobsOutput { + /// Creates a new builder-style object to manufacture [`ListJobsOutput`](crate::operation::list_jobs::ListJobsOutput). + pub fn builder() -> crate::operation::list_jobs::builders::ListJobsOutputBuilder { + crate::operation::list_jobs::builders::ListJobsOutputBuilder::default() + } +} + +/// A builder for [`ListJobsOutput`](crate::operation::list_jobs::ListJobsOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListJobsOutputBuilder { + pub(crate) data: ::std::option::Option<::std::vec::Vec::>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, +} +impl ListJobsOutputBuilder { + /// Appends an item to `data`. + /// + /// To override the contents of this collection use [`set_data`](Self::set_data). + /// + pub fn data(mut self, input: crate::types::JobSummary) -> Self { + let mut v = self.data.unwrap_or_default(); + v.push(input); + self.data = ::std::option::Option::Some(v); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option<::std::vec::Vec::>) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option<::std::vec::Vec::> { + &self.data + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + /// Consumes the builder and constructs a [`ListJobsOutput`](crate::operation::list_jobs::ListJobsOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::list_jobs::builders::ListJobsOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_jobs::ListJobsOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building ListJobsOutput") + )? + , + cursor: self.cursor + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_jobs/builders.rs b/sdks/rust/src/operation/list_jobs/builders.rs new file mode 100644 index 0000000..cf08130 --- /dev/null +++ b/sdks/rust/src/operation/list_jobs/builders.rs @@ -0,0 +1,197 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::list_jobs::_list_jobs_input::ListJobsInputBuilder; + +pub use crate::operation::list_jobs::_list_jobs_output::ListJobsOutputBuilder; + +impl crate::operation::list_jobs::builders::ListJobsInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::list_jobs::ListJobsOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::list_jobs::ListJobsError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.list_jobs(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `ListJobs`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct ListJobsFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::list_jobs::builders::ListJobsInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::list_jobs::ListJobsOutput, + crate::operation::list_jobs::ListJobsError, + > for ListJobsFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::list_jobs::ListJobsOutput, + crate::operation::list_jobs::ListJobsError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl ListJobsFluentBuilder { + /// Creates a new `ListJobsFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the ListJobs as a reference. + pub fn as_input(&self) -> &crate::operation::list_jobs::builders::ListJobsInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::list_jobs::ListJobs::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::list_jobs::ListJobs::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.cursor(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_cursor(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_cursor() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.inner = self.inner.limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + self.inner.get_limit() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.endpoint(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_endpoint(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_endpoint() + } + #[allow(missing_docs)] // documentation missing in model + pub fn trigger_type(mut self, input: crate::types::TriggerTypeEnum) -> Self { + self.inner = self.inner.trigger_type(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_trigger_type(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_trigger_type(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_trigger_type(&self) -> &::std::option::Option { + self.inner.get_trigger_type() + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(mut self, input: crate::types::JobStatusEnum) -> Self { + self.inner = self.inner.status(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_status(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + self.inner.get_status() + } +} + diff --git a/sdks/rust/src/operation/list_payload_specs.rs b/sdks/rust/src/operation/list_payload_specs.rs new file mode 100644 index 0000000..044a534 --- /dev/null +++ b/sdks/rust/src/operation/list_payload_specs.rs @@ -0,0 +1,341 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `ListPayloadSpecs`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListPayloadSpecs; +impl ListPayloadSpecs { + /// Creates a new `ListPayloadSpecs` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_payload_specs::ListPayloadSpecsInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::list_payload_specs::ListPayloadSpecsInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "ListPayloadSpecs", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.ListPayloadSpecs", + "rpc.service" = "KronosService", + "rpc.method" = "ListPayloadSpecs", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for ListPayloadSpecs { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("ListPayloadSpecs"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(ListPayloadSpecsRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(ListPayloadSpecsResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "ListPayloadSpecs", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("ListPayloadSpecs") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(ListPayloadSpecsEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct ListPayloadSpecsResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for ListPayloadSpecsResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_list_payload_specs::de_list_payload_specs_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_list_payload_specs::de_list_payload_specs_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct ListPayloadSpecsRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for ListPayloadSpecsRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::list_payload_specs::ListPayloadSpecsInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + ::std::write!(output, "/v1/payload-specs").expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +fn uri_query(_input: &crate::operation::list_payload_specs::ListPayloadSpecsInput, mut output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + let mut query = ::aws_smithy_http::query::Writer::new(output); + if let ::std::option::Option::Some(inner_1) = &_input.cursor { + { + query.push_kv("cursor", &::aws_smithy_http::query::fmt_string(inner_1)); + } + } + if let ::std::option::Option::Some(inner_2) = &_input.limit { + { + query.push_kv("limit", ::aws_smithy_types::primitive::Encoder::from(*inner_2).encode()); + } + } + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::list_payload_specs::ListPayloadSpecsInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + uri_query(input, &mut uri)?; + let builder = crate::protocol_serde::shape_list_payload_specs::ser_list_payload_specs_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("GET").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(""); + + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct ListPayloadSpecsEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for ListPayloadSpecsEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "ListPayloadSpecsEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to ListPayloadSpecsInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `ListPayloadSpecsError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum ListPayloadSpecsError { + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-ListPayloadSpecsError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl ListPayloadSpecsError { + /// Creates the `ListPayloadSpecsError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `ListPayloadSpecsError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `ListPayloadSpecsError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `ListPayloadSpecsError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `ListPayloadSpecsError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for ListPayloadSpecsError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for ListPayloadSpecsError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for ListPayloadSpecsError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ListPayloadSpecsError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for ListPayloadSpecsError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::list_payload_specs::_list_payload_specs_input::ListPayloadSpecsInput; + +pub use crate::operation::list_payload_specs::_list_payload_specs_output::ListPayloadSpecsOutput; + +mod _list_payload_specs_input; + +mod _list_payload_specs_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/list_payload_specs/_list_payload_specs_input.rs b/sdks/rust/src/operation/list_payload_specs/_list_payload_specs_input.rs new file mode 100644 index 0000000..9a50f08 --- /dev/null +++ b/sdks/rust/src/operation/list_payload_specs/_list_payload_specs_input.rs @@ -0,0 +1,120 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListPayloadSpecsInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub limit: ::std::option::Option, +} +impl ListPayloadSpecsInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(&self) -> ::std::option::Option { + self.limit + } +} +impl ListPayloadSpecsInput { + /// Creates a new builder-style object to manufacture [`ListPayloadSpecsInput`](crate::operation::list_payload_specs::ListPayloadSpecsInput). + pub fn builder() -> crate::operation::list_payload_specs::builders::ListPayloadSpecsInputBuilder { + crate::operation::list_payload_specs::builders::ListPayloadSpecsInputBuilder::default() + } +} + +/// A builder for [`ListPayloadSpecsInput`](crate::operation::list_payload_specs::ListPayloadSpecsInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListPayloadSpecsInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, + pub(crate) limit: ::std::option::Option, +} +impl ListPayloadSpecsInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.limit = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.limit = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + &self.limit + } + /// Consumes the builder and constructs a [`ListPayloadSpecsInput`](crate::operation::list_payload_specs::ListPayloadSpecsInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_payload_specs::ListPayloadSpecsInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + cursor: self.cursor + , + limit: self.limit + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_payload_specs/_list_payload_specs_output.rs b/sdks/rust/src/operation/list_payload_specs/_list_payload_specs_output.rs new file mode 100644 index 0000000..1787df7 --- /dev/null +++ b/sdks/rust/src/operation/list_payload_specs/_list_payload_specs_output.rs @@ -0,0 +1,84 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ListPayloadSpecsOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: ::std::vec::Vec::, + #[allow(missing_docs)] // documentation missing in model + pub cursor: ::std::option::Option<::std::string::String>, +} +impl ListPayloadSpecsOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &[crate::types::PayloadSpecResource] { + use std::ops::Deref; self.data.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(&self) -> ::std::option::Option<&str> { + self.cursor.as_deref() + } +} +impl ListPayloadSpecsOutput { + /// Creates a new builder-style object to manufacture [`ListPayloadSpecsOutput`](crate::operation::list_payload_specs::ListPayloadSpecsOutput). + pub fn builder() -> crate::operation::list_payload_specs::builders::ListPayloadSpecsOutputBuilder { + crate::operation::list_payload_specs::builders::ListPayloadSpecsOutputBuilder::default() + } +} + +/// A builder for [`ListPayloadSpecsOutput`](crate::operation::list_payload_specs::ListPayloadSpecsOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ListPayloadSpecsOutputBuilder { + pub(crate) data: ::std::option::Option<::std::vec::Vec::>, + pub(crate) cursor: ::std::option::Option<::std::string::String>, +} +impl ListPayloadSpecsOutputBuilder { + /// Appends an item to `data`. + /// + /// To override the contents of this collection use [`set_data`](Self::set_data). + /// + pub fn data(mut self, input: crate::types::PayloadSpecResource) -> Self { + let mut v = self.data.unwrap_or_default(); + v.push(input); + self.data = ::std::option::Option::Some(v); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option<::std::vec::Vec::>) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option<::std::vec::Vec::> { + &self.data + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cursor = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cursor = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + &self.cursor + } + /// Consumes the builder and constructs a [`ListPayloadSpecsOutput`](crate::operation::list_payload_specs::ListPayloadSpecsOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::list_payload_specs::builders::ListPayloadSpecsOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::list_payload_specs::ListPayloadSpecsOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building ListPayloadSpecsOutput") + )? + , + cursor: self.cursor + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/list_payload_specs/builders.rs b/sdks/rust/src/operation/list_payload_specs/builders.rs new file mode 100644 index 0000000..e6f1514 --- /dev/null +++ b/sdks/rust/src/operation/list_payload_specs/builders.rs @@ -0,0 +1,155 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::list_payload_specs::_list_payload_specs_input::ListPayloadSpecsInputBuilder; + +pub use crate::operation::list_payload_specs::_list_payload_specs_output::ListPayloadSpecsOutputBuilder; + +impl crate::operation::list_payload_specs::builders::ListPayloadSpecsInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::list_payload_specs::ListPayloadSpecsOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::list_payload_specs::ListPayloadSpecsError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.list_payload_specs(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `ListPayloadSpecs`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct ListPayloadSpecsFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::list_payload_specs::builders::ListPayloadSpecsInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::list_payload_specs::ListPayloadSpecsOutput, + crate::operation::list_payload_specs::ListPayloadSpecsError, + > for ListPayloadSpecsFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::list_payload_specs::ListPayloadSpecsOutput, + crate::operation::list_payload_specs::ListPayloadSpecsError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl ListPayloadSpecsFluentBuilder { + /// Creates a new `ListPayloadSpecsFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the ListPayloadSpecs as a reference. + pub fn as_input(&self) -> &crate::operation::list_payload_specs::builders::ListPayloadSpecsInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::list_payload_specs::ListPayloadSpecs::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::list_payload_specs::ListPayloadSpecs::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cursor(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.cursor(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cursor(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_cursor(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cursor(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_cursor() + } + #[allow(missing_docs)] // documentation missing in model + pub fn limit(mut self, input: i32) -> Self { + self.inner = self.inner.limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_limit(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_limit(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_limit(&self) -> &::std::option::Option { + self.inner.get_limit() + } +} + diff --git a/sdks/rust/src/operation/update_endpoint.rs b/sdks/rust/src/operation/update_endpoint.rs new file mode 100644 index 0000000..cbd83c4 --- /dev/null +++ b/sdks/rust/src/operation/update_endpoint.rs @@ -0,0 +1,384 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `UpdateEndpoint`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdateEndpoint; +impl UpdateEndpoint { + /// Creates a new `UpdateEndpoint` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::update_endpoint::UpdateEndpointInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::update_endpoint::UpdateEndpointInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "UpdateEndpoint", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.UpdateEndpoint", + "rpc.service" = "KronosService", + "rpc.method" = "UpdateEndpoint", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for UpdateEndpoint { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("UpdateEndpoint"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(UpdateEndpointRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(UpdateEndpointResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "UpdateEndpoint", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("UpdateEndpoint") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(UpdateEndpointEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct UpdateEndpointResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for UpdateEndpointResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_update_endpoint::de_update_endpoint_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_update_endpoint::de_update_endpoint_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct UpdateEndpointRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for UpdateEndpointRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::update_endpoint::UpdateEndpointInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.name; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset"))?; + let name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if name.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/endpoints/{name}", name = name).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::update_endpoint::UpdateEndpointInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_update_endpoint::ser_update_endpoint_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("PUT").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json"); +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_update_endpoint::ser_update_endpoint_input(&input)?); + if let Some(content_length) = body.content_length() { + let content_length = content_length.to_string(); + request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length); + } + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct UpdateEndpointEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdateEndpointEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "UpdateEndpointEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to UpdateEndpointInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `UpdateEndpointError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum UpdateEndpointError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + InvalidRequestError(crate::types::error::InvalidRequestError), + #[allow(missing_docs)] // documentation missing in model + UnprocessableEntityError(crate::types::error::UnprocessableEntityError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-UpdateEndpointError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl UpdateEndpointError { + /// Creates the `UpdateEndpointError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `UpdateEndpointError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InvalidRequestError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnprocessableEntityError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `UpdateEndpointError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `UpdateEndpointError::InvalidRequestError`. + pub fn is_invalid_request_error(&self) -> bool { + matches!(self, Self::InvalidRequestError(_)) + } + /// Returns `true` if the error kind is `UpdateEndpointError::UnprocessableEntityError`. + pub fn is_unprocessable_entity_error(&self) -> bool { + matches!(self, Self::UnprocessableEntityError(_)) + } + /// Returns `true` if the error kind is `UpdateEndpointError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `UpdateEndpointError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `UpdateEndpointError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for UpdateEndpointError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InvalidRequestError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnprocessableEntityError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for UpdateEndpointError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::InvalidRequestError(_inner) => + _inner.fmt(f) + , + Self::UnprocessableEntityError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for UpdateEndpointError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UpdateEndpointError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InvalidRequestError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnprocessableEntityError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for UpdateEndpointError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::update_endpoint::_update_endpoint_input::UpdateEndpointInput; + +pub use crate::operation::update_endpoint::_update_endpoint_output::UpdateEndpointOutput; + +mod _update_endpoint_input; + +mod _update_endpoint_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/update_endpoint/_update_endpoint_input.rs b/sdks/rust/src/operation/update_endpoint/_update_endpoint_input.rs new file mode 100644 index 0000000..21699ba --- /dev/null +++ b/sdks/rust/src/operation/update_endpoint/_update_endpoint_input.rs @@ -0,0 +1,187 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct UpdateEndpointInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub spec: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub config: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub payload_spec: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub retry_policy: ::std::option::Option, +} +impl UpdateEndpointInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> ::std::option::Option<&str> { + self.name.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn spec(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.spec.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn config(&self) -> ::std::option::Option<&str> { + self.config.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn payload_spec(&self) -> ::std::option::Option<&str> { + self.payload_spec.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn retry_policy(&self) -> ::std::option::Option<&crate::types::RetryPolicy> { + self.retry_policy.as_ref() + } +} +impl UpdateEndpointInput { + /// Creates a new builder-style object to manufacture [`UpdateEndpointInput`](crate::operation::update_endpoint::UpdateEndpointInput). + pub fn builder() -> crate::operation::update_endpoint::builders::UpdateEndpointInputBuilder { + crate::operation::update_endpoint::builders::UpdateEndpointInputBuilder::default() + } +} + +/// A builder for [`UpdateEndpointInput`](crate::operation::update_endpoint::UpdateEndpointInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdateEndpointInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) name: ::std::option::Option<::std::string::String>, + pub(crate) spec: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) config: ::std::option::Option<::std::string::String>, + pub(crate) payload_spec: ::std::option::Option<::std::string::String>, + pub(crate) retry_policy: ::std::option::Option, +} +impl UpdateEndpointInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + #[allow(missing_docs)] // documentation missing in model + pub fn spec(mut self, input: ::aws_smithy_types::Document) -> Self { + self.spec = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_spec(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.spec = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_spec(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.spec + } + #[allow(missing_docs)] // documentation missing in model + pub fn config(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.config = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_config(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.config = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_config(&self) -> &::std::option::Option<::std::string::String> { + &self.config + } + #[allow(missing_docs)] // documentation missing in model + pub fn payload_spec(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.payload_spec = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_payload_spec(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.payload_spec = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_payload_spec(&self) -> &::std::option::Option<::std::string::String> { + &self.payload_spec + } + #[allow(missing_docs)] // documentation missing in model + pub fn retry_policy(mut self, input: crate::types::RetryPolicy) -> Self { + self.retry_policy = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_retry_policy(mut self, input: ::std::option::Option) -> Self { + self.retry_policy = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_retry_policy(&self) -> &::std::option::Option { + &self.retry_policy + } + /// Consumes the builder and constructs a [`UpdateEndpointInput`](crate::operation::update_endpoint::UpdateEndpointInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::update_endpoint::UpdateEndpointInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + name: self.name + , + spec: self.spec + , + config: self.config + , + payload_spec: self.payload_spec + , + retry_policy: self.retry_policy + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/update_endpoint/_update_endpoint_output.rs b/sdks/rust/src/operation/update_endpoint/_update_endpoint_output.rs new file mode 100644 index 0000000..45747c6 --- /dev/null +++ b/sdks/rust/src/operation/update_endpoint/_update_endpoint_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct UpdateEndpointOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::EndpointResource, +} +impl UpdateEndpointOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::EndpointResource { + &self.data + } +} +impl UpdateEndpointOutput { + /// Creates a new builder-style object to manufacture [`UpdateEndpointOutput`](crate::operation::update_endpoint::UpdateEndpointOutput). + pub fn builder() -> crate::operation::update_endpoint::builders::UpdateEndpointOutputBuilder { + crate::operation::update_endpoint::builders::UpdateEndpointOutputBuilder::default() + } +} + +/// A builder for [`UpdateEndpointOutput`](crate::operation::update_endpoint::UpdateEndpointOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdateEndpointOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl UpdateEndpointOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::EndpointResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`UpdateEndpointOutput`](crate::operation::update_endpoint::UpdateEndpointOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::update_endpoint::builders::UpdateEndpointOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::update_endpoint::UpdateEndpointOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building UpdateEndpointOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/update_endpoint/builders.rs b/sdks/rust/src/operation/update_endpoint/builders.rs new file mode 100644 index 0000000..50ffeed --- /dev/null +++ b/sdks/rust/src/operation/update_endpoint/builders.rs @@ -0,0 +1,197 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::update_endpoint::_update_endpoint_input::UpdateEndpointInputBuilder; + +pub use crate::operation::update_endpoint::_update_endpoint_output::UpdateEndpointOutputBuilder; + +impl crate::operation::update_endpoint::builders::UpdateEndpointInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::update_endpoint::UpdateEndpointOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::update_endpoint::UpdateEndpointError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.update_endpoint(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `UpdateEndpoint`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct UpdateEndpointFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::update_endpoint::builders::UpdateEndpointInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::update_endpoint::UpdateEndpointOutput, + crate::operation::update_endpoint::UpdateEndpointError, + > for UpdateEndpointFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::update_endpoint::UpdateEndpointOutput, + crate::operation::update_endpoint::UpdateEndpointError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl UpdateEndpointFluentBuilder { + /// Creates a new `UpdateEndpointFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the UpdateEndpoint as a reference. + pub fn as_input(&self) -> &crate::operation::update_endpoint::builders::UpdateEndpointInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::update_endpoint::UpdateEndpoint::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::update_endpoint::UpdateEndpoint::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.name(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_name(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_name() + } + #[allow(missing_docs)] // documentation missing in model + pub fn spec(mut self, input: ::aws_smithy_types::Document) -> Self { + self.inner = self.inner.spec(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_spec(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.inner = self.inner.set_spec(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_spec(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + self.inner.get_spec() + } + #[allow(missing_docs)] // documentation missing in model + pub fn config(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.config(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_config(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_config(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_config(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_config() + } + #[allow(missing_docs)] // documentation missing in model + pub fn payload_spec(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.payload_spec(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_payload_spec(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_payload_spec(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_payload_spec(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_payload_spec() + } + #[allow(missing_docs)] // documentation missing in model + pub fn retry_policy(mut self, input: crate::types::RetryPolicy) -> Self { + self.inner = self.inner.retry_policy(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_retry_policy(mut self, input: ::std::option::Option) -> Self { + self.inner = self.inner.set_retry_policy(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_retry_policy(&self) -> &::std::option::Option { + self.inner.get_retry_policy() + } +} + diff --git a/sdks/rust/src/operation/update_job.rs b/sdks/rust/src/operation/update_job.rs new file mode 100644 index 0000000..0c0e401 --- /dev/null +++ b/sdks/rust/src/operation/update_job.rs @@ -0,0 +1,384 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `UpdateJob`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdateJob; +impl UpdateJob { + /// Creates a new `UpdateJob` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::update_job::UpdateJobInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::update_job::UpdateJobInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "UpdateJob", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.UpdateJob", + "rpc.service" = "KronosService", + "rpc.method" = "UpdateJob", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for UpdateJob { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("UpdateJob"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(UpdateJobRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(UpdateJobResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "UpdateJob", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("UpdateJob") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(UpdateJobEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct UpdateJobResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for UpdateJobResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_update_job::de_update_job_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_update_job::de_update_job_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct UpdateJobRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for UpdateJobRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::update_job::UpdateJobInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.job_id; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset"))?; + let job_id = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if job_id.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/jobs/{job_id}", job_id = job_id).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::update_job::UpdateJobInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_update_job::ser_update_job_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("PUT").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json"); +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_update_job::ser_update_job_input(&input)?); + if let Some(content_length) = body.content_length() { + let content_length = content_length.to_string(); + request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length); + } + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct UpdateJobEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdateJobEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "UpdateJobEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to UpdateJobInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `UpdateJobError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum UpdateJobError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + InvalidRequestError(crate::types::error::InvalidRequestError), + #[allow(missing_docs)] // documentation missing in model + UnprocessableEntityError(crate::types::error::UnprocessableEntityError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-UpdateJobError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl UpdateJobError { + /// Creates the `UpdateJobError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `UpdateJobError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InvalidRequestError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnprocessableEntityError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `UpdateJobError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `UpdateJobError::InvalidRequestError`. + pub fn is_invalid_request_error(&self) -> bool { + matches!(self, Self::InvalidRequestError(_)) + } + /// Returns `true` if the error kind is `UpdateJobError::UnprocessableEntityError`. + pub fn is_unprocessable_entity_error(&self) -> bool { + matches!(self, Self::UnprocessableEntityError(_)) + } + /// Returns `true` if the error kind is `UpdateJobError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `UpdateJobError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `UpdateJobError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for UpdateJobError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InvalidRequestError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnprocessableEntityError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for UpdateJobError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::InvalidRequestError(_inner) => + _inner.fmt(f) + , + Self::UnprocessableEntityError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for UpdateJobError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UpdateJobError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InvalidRequestError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnprocessableEntityError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for UpdateJobError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::update_job::_update_job_input::UpdateJobInput; + +pub use crate::operation::update_job::_update_job_output::UpdateJobOutput; + +mod _update_job_input; + +mod _update_job_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/update_job/_update_job_input.rs b/sdks/rust/src/operation/update_job/_update_job_input.rs new file mode 100644 index 0000000..32d9606 --- /dev/null +++ b/sdks/rust/src/operation/update_job/_update_job_input.rs @@ -0,0 +1,209 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct UpdateJobInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cron: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub timezone: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub input: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub starts_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub ends_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl UpdateJobInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> ::std::option::Option<&str> { + self.job_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron(&self) -> ::std::option::Option<&str> { + self.cron.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn timezone(&self) -> ::std::option::Option<&str> { + self.timezone.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.input.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn starts_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.starts_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn ends_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.ends_at.as_ref() + } +} +impl UpdateJobInput { + /// Creates a new builder-style object to manufacture [`UpdateJobInput`](crate::operation::update_job::UpdateJobInput). + pub fn builder() -> crate::operation::update_job::builders::UpdateJobInputBuilder { + crate::operation::update_job::builders::UpdateJobInputBuilder::default() + } +} + +/// A builder for [`UpdateJobInput`](crate::operation::update_job::UpdateJobInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdateJobInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) job_id: ::std::option::Option<::std::string::String>, + pub(crate) cron: ::std::option::Option<::std::string::String>, + pub(crate) timezone: ::std::option::Option<::std::string::String>, + pub(crate) input: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) starts_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) ends_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl UpdateJobInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cron = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cron = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron(&self) -> &::std::option::Option<::std::string::String> { + &self.cron + } + #[allow(missing_docs)] // documentation missing in model + pub fn timezone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.timezone = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_timezone(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.timezone = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_timezone(&self) -> &::std::option::Option<::std::string::String> { + &self.timezone + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(mut self, input: ::aws_smithy_types::Document) -> Self { + self.input = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_input(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.input = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_input(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.input + } + #[allow(missing_docs)] // documentation missing in model + pub fn starts_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.starts_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_starts_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.starts_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_starts_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.starts_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn ends_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.ends_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_ends_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.ends_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_ends_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.ends_at + } + /// Consumes the builder and constructs a [`UpdateJobInput`](crate::operation::update_job::UpdateJobInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::update_job::UpdateJobInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + job_id: self.job_id + , + cron: self.cron + , + timezone: self.timezone + , + input: self.input + , + starts_at: self.starts_at + , + ends_at: self.ends_at + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/update_job/_update_job_output.rs b/sdks/rust/src/operation/update_job/_update_job_output.rs new file mode 100644 index 0000000..8a2603e --- /dev/null +++ b/sdks/rust/src/operation/update_job/_update_job_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct UpdateJobOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::JobResource, +} +impl UpdateJobOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::JobResource { + &self.data + } +} +impl UpdateJobOutput { + /// Creates a new builder-style object to manufacture [`UpdateJobOutput`](crate::operation::update_job::UpdateJobOutput). + pub fn builder() -> crate::operation::update_job::builders::UpdateJobOutputBuilder { + crate::operation::update_job::builders::UpdateJobOutputBuilder::default() + } +} + +/// A builder for [`UpdateJobOutput`](crate::operation::update_job::UpdateJobOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdateJobOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl UpdateJobOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::JobResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`UpdateJobOutput`](crate::operation::update_job::UpdateJobOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::update_job::builders::UpdateJobOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::update_job::UpdateJobOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building UpdateJobOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/update_job/builders.rs b/sdks/rust/src/operation/update_job/builders.rs new file mode 100644 index 0000000..d604156 --- /dev/null +++ b/sdks/rust/src/operation/update_job/builders.rs @@ -0,0 +1,211 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::update_job::_update_job_input::UpdateJobInputBuilder; + +pub use crate::operation::update_job::_update_job_output::UpdateJobOutputBuilder; + +impl crate::operation::update_job::builders::UpdateJobInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::update_job::UpdateJobOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::update_job::UpdateJobError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.update_job(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `UpdateJob`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct UpdateJobFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::update_job::builders::UpdateJobInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::update_job::UpdateJobOutput, + crate::operation::update_job::UpdateJobError, + > for UpdateJobFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::update_job::UpdateJobOutput, + crate::operation::update_job::UpdateJobError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl UpdateJobFluentBuilder { + /// Creates a new `UpdateJobFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the UpdateJob as a reference. + pub fn as_input(&self) -> &crate::operation::update_job::builders::UpdateJobInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::update_job::UpdateJob::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::update_job::UpdateJob::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.job_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_job_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_job_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.cron(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_cron(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_cron() + } + #[allow(missing_docs)] // documentation missing in model + pub fn timezone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.timezone(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_timezone(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_timezone(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_timezone(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_timezone() + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(mut self, input: ::aws_smithy_types::Document) -> Self { + self.inner = self.inner.input(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_input(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.inner = self.inner.set_input(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_input(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + self.inner.get_input() + } + #[allow(missing_docs)] // documentation missing in model + pub fn starts_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.inner = self.inner.starts_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_starts_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.inner = self.inner.set_starts_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_starts_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + self.inner.get_starts_at() + } + #[allow(missing_docs)] // documentation missing in model + pub fn ends_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.inner = self.inner.ends_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_ends_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.inner = self.inner.set_ends_at(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_ends_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + self.inner.get_ends_at() + } +} + diff --git a/sdks/rust/src/operation/update_payload_spec.rs b/sdks/rust/src/operation/update_payload_spec.rs new file mode 100644 index 0000000..afe6bec --- /dev/null +++ b/sdks/rust/src/operation/update_payload_spec.rs @@ -0,0 +1,368 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/// Orchestration and serialization glue logic for `UpdatePayloadSpec`. +#[derive(::std::clone::Clone, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdatePayloadSpec; +impl UpdatePayloadSpec { + /// Creates a new `UpdatePayloadSpec` + pub fn new() -> Self { + Self + } + pub(crate) async fn orchestrate( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::update_payload_spec::UpdatePayloadSpecInput, + ) -> ::std::result::Result> { + let map_err = |err: ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>| { + err.map_service_error(|err| { + err.downcast::().expect("correct error type") + }) + }; + let context = Self::orchestrate_with_stop_point(runtime_plugins, input, ::aws_smithy_runtime::client::orchestrator::StopPoint::None) + .await + .map_err(map_err)?; + let output = context.finalize().map_err(map_err)?; + ::std::result::Result::Ok(output.downcast::().expect("correct output type")) + } + + pub(crate) async fn orchestrate_with_stop_point( + runtime_plugins: &::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + input: crate::operation::update_payload_spec::UpdatePayloadSpecInput, + stop_point: ::aws_smithy_runtime::client::orchestrator::StopPoint, + ) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::InterceptorContext, ::aws_smithy_runtime_api::client::result::SdkError<::aws_smithy_runtime_api::client::interceptors::context::Error, ::aws_smithy_runtime_api::client::orchestrator::HttpResponse>> { + let input = ::aws_smithy_runtime_api::client::interceptors::context::Input::erase(input); + use ::tracing::Instrument; + ::aws_smithy_runtime::client::orchestrator::invoke_with_stop_point( + "KronosService", + "UpdatePayloadSpec", + input, + runtime_plugins, + stop_point + ) + // Create a parent span for the entire operation. Includes a random, internal-only, + // seven-digit ID for the operation orchestration so that it can be correlated in the logs. + .instrument(::tracing::debug_span!( + "KronosService.UpdatePayloadSpec", + "rpc.service" = "KronosService", + "rpc.method" = "UpdatePayloadSpec", + "sdk_invocation_id" = ::fastrand::u32(1_000_000..10_000_000), + + )) + .await + } + + pub(crate) fn operation_runtime_plugins( + client_runtime_plugins: ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins, + client_config: &crate::config::Config, + config_override: ::std::option::Option, + ) -> ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugins { + let mut runtime_plugins = client_runtime_plugins.with_operation_plugin(Self::new()); + runtime_plugins = runtime_plugins + .with_client_plugin(crate::auth_plugin::DefaultAuthOptionsPlugin::new(vec![::aws_smithy_runtime_api::client::auth::http::HTTP_BEARER_AUTH_SCHEME_ID])); + if let ::std::option::Option::Some(config_override) = config_override { + for plugin in config_override.runtime_plugins.iter().cloned() { + runtime_plugins = runtime_plugins.with_operation_plugin(plugin); + } + runtime_plugins = runtime_plugins.with_operation_plugin( + crate::config::ConfigOverrideRuntimePlugin::new(config_override, client_config.config.clone(), &client_config.runtime_components) + ); + } + runtime_plugins + } +} +impl ::aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin for UpdatePayloadSpec { + fn config(&self) -> ::std::option::Option<::aws_smithy_types::config_bag::FrozenLayer> { + let mut cfg = ::aws_smithy_types::config_bag::Layer::new("UpdatePayloadSpec"); + + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedRequestSerializer::new(UpdatePayloadSpecRequestSerializer)); + cfg.store_put(::aws_smithy_runtime_api::client::ser_de::SharedResponseDeserializer::new(UpdatePayloadSpecResponseDeserializer)); + + + cfg.store_put(::aws_smithy_runtime_api::client::auth::AuthSchemeOptionResolverParams::new(::aws_smithy_runtime_api::client::auth::static_resolver::StaticAuthSchemeOptionResolverParams::new())); + + cfg.store_put(::aws_smithy_runtime_api::client::orchestrator::Metadata::new( + "UpdatePayloadSpec", + "KronosService", + )); + + ::std::option::Option::Some(cfg.freeze()) + } + + fn runtime_components(&self, _: &::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder) -> ::std::borrow::Cow<'_, ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder> { + #[allow(unused_mut)] + let mut rcb = ::aws_smithy_runtime_api::client::runtime_components::RuntimeComponentsBuilder::new("UpdatePayloadSpec") + .with_interceptor(::aws_smithy_runtime::client::stalled_stream_protection::StalledStreamProtectionInterceptor::default()) +.with_interceptor(UpdatePayloadSpecEndpointParamsInterceptor) + .with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::TransientErrorClassifier::::new()) +.with_retry_classifier(::aws_smithy_runtime::client::retries::classifiers::ModeledAsRetryableClassifier::::new()); + + ::std::borrow::Cow::Owned(rcb) + } + } + + +#[derive(Debug)] + struct UpdatePayloadSpecResponseDeserializer; + impl ::aws_smithy_runtime_api::client::ser_de::DeserializeResponse for UpdatePayloadSpecResponseDeserializer { + + + fn deserialize_nonstreaming(&self, response: &::aws_smithy_runtime_api::client::orchestrator::HttpResponse) -> ::aws_smithy_runtime_api::client::interceptors::context::OutputOrError { + let (success, status) = (response.status().is_success(), response.status().as_u16()); + let headers = response.headers(); + let body = response.body().bytes().expect("body loaded"); + #[allow(unused_mut)] + let mut force_error = false; + + let parse_result = if !success && status != 200 || force_error { + crate::protocol_serde::shape_update_payload_spec::de_update_payload_spec_http_error(status, headers, body) + } else { + crate::protocol_serde::shape_update_payload_spec::de_update_payload_spec_http_response(status, headers, body) + }; + crate::protocol_serde::type_erase_result(parse_result) + } + } +#[derive(Debug)] + struct UpdatePayloadSpecRequestSerializer; + impl ::aws_smithy_runtime_api::client::ser_de::SerializeRequest for UpdatePayloadSpecRequestSerializer { + #[allow(unused_mut, clippy::let_and_return, clippy::needless_borrow, clippy::useless_conversion)] + fn serialize_input(&self, input: ::aws_smithy_runtime_api::client::interceptors::context::Input, _cfg: &mut ::aws_smithy_types::config_bag::ConfigBag) -> ::std::result::Result<::aws_smithy_runtime_api::client::orchestrator::HttpRequest, ::aws_smithy_runtime_api::box_error::BoxError> { + let input = input.downcast::().expect("correct type"); + let _header_serialization_settings = _cfg.load::().cloned().unwrap_or_default(); + let mut request_builder = { + fn uri_base(_input: &crate::operation::update_payload_spec::UpdatePayloadSpecInput, output: &mut ::std::string::String) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::BuildError> { + use ::std::fmt::Write as _; + let input_1 = &_input.name; + let input_1 = input_1.as_ref().ok_or_else(|| ::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset"))?; + let name = ::aws_smithy_http::label::fmt_string(input_1, ::aws_smithy_http::label::EncodingStrategy::Default); + if name.is_empty() { + return ::std::result::Result::Err(::aws_smithy_types::error::operation::BuildError::missing_field("name", "cannot be empty or unset")) + } + ::std::write!(output, "/v1/payload-specs/{name}", name = name).expect("formatting should succeed"); + ::std::result::Result::Ok(()) +} +#[allow(clippy::unnecessary_wraps)] +fn update_http_builder( + input: &crate::operation::update_payload_spec::UpdatePayloadSpecInput, + builder: ::http::request::Builder + ) -> ::std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + let mut uri = ::std::string::String::new(); + uri_base(input, &mut uri)?; + let builder = crate::protocol_serde::shape_update_payload_spec::ser_update_payload_spec_headers(input, builder)?; + ::std::result::Result::Ok(builder.method("PUT").uri(uri)) +} +let mut builder = update_http_builder(&input, ::http::request::Builder::new())?; +builder = _header_serialization_settings.set_default_header(builder, ::http::header::CONTENT_TYPE, "application/json"); +builder + }; + let body = ::aws_smithy_types::body::SdkBody::from(crate::protocol_serde::shape_update_payload_spec::ser_update_payload_spec_input(&input)?); + if let Some(content_length) = body.content_length() { + let content_length = content_length.to_string(); + request_builder = _header_serialization_settings.set_default_header(request_builder, ::http::header::CONTENT_LENGTH, &content_length); + } + ::std::result::Result::Ok(request_builder.body(body).expect("valid request").try_into().unwrap()) + } + } +#[derive(Debug)] + struct UpdatePayloadSpecEndpointParamsInterceptor; + + impl ::aws_smithy_runtime_api::client::interceptors::Intercept for UpdatePayloadSpecEndpointParamsInterceptor { + fn name(&self) -> &'static str { + "UpdatePayloadSpecEndpointParamsInterceptor" + } + + fn read_before_execution( + &self, + context: &::aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef<'_, ::aws_smithy_runtime_api::client::interceptors::context::Input, ::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::interceptors::context::Error>, + cfg: &mut ::aws_smithy_types::config_bag::ConfigBag, + ) -> ::std::result::Result<(), ::aws_smithy_runtime_api::box_error::BoxError> { + let _input = context.input() + .downcast_ref::() + .ok_or("failed to downcast to UpdatePayloadSpecInput")?; + + + + let params = crate::config::endpoint::Params::builder() + + .build() + .map_err(|err| ::aws_smithy_runtime_api::client::interceptors::error::ContextAttachedError::new("endpoint params could not be built", err))?; + cfg.interceptor_state().store_put(::aws_smithy_runtime_api::client::endpoint::EndpointResolverParams::new(params)); + ::std::result::Result::Ok(()) + } + } + + // The get_* functions below are generated from JMESPath expressions in the + // operationContextParams trait. They target the operation's input shape. + + + +/// Error type for the `UpdatePayloadSpecError` operation. +#[non_exhaustive] +#[derive(::std::fmt::Debug)] +pub enum UpdatePayloadSpecError { + #[allow(missing_docs)] // documentation missing in model + NotFoundError(crate::types::error::NotFoundError), + #[allow(missing_docs)] // documentation missing in model + InvalidRequestError(crate::types::error::InvalidRequestError), + #[allow(missing_docs)] // documentation missing in model + UnauthorizedError(crate::types::error::UnauthorizedError), + #[allow(missing_docs)] // documentation missing in model + InternalError(crate::types::error::InternalError), + #[allow(missing_docs)] // documentation missing in model + RateLimitedError(crate::types::error::RateLimitedError), + /// An unexpected error occurred (e.g., invalid JSON returned by the service or an unknown error code). + #[deprecated(note = "Matching `Unhandled` directly is not forwards compatible. Instead, match using a \ + variable wildcard pattern and check `.code()`: + \ +    `err if err.code() == Some(\"SpecificExceptionCode\") => { /* handle the error */ }` + \ + See [`ProvideErrorMetadata`](#impl-ProvideErrorMetadata-for-UpdatePayloadSpecError) for what information is available for the error.")] + Unhandled(crate::error::sealed_unhandled::Unhandled), +} +impl UpdatePayloadSpecError { + /// Creates the `UpdatePayloadSpecError::Unhandled` variant from any error type. + pub fn unhandled(err: impl ::std::convert::Into<::std::boxed::Box>) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.into(), meta: ::std::default::Default::default() }) + } + + /// Creates the `UpdatePayloadSpecError::Unhandled` variant from an [`ErrorMetadata`](::aws_smithy_types::error::ErrorMetadata). + pub fn generic(err: ::aws_smithy_types::error::ErrorMetadata) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source: err.clone().into(), meta: err }) + } + /// + /// Returns error metadata, which includes the error code, message, + /// request ID, and potentially additional information. + /// + pub fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InvalidRequestError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::UnauthorizedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::InternalError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::RateLimitedError(e) => ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(e), + Self::Unhandled(e) => &e.meta, + } + } + /// Returns `true` if the error kind is `UpdatePayloadSpecError::NotFoundError`. + pub fn is_not_found_error(&self) -> bool { + matches!(self, Self::NotFoundError(_)) + } + /// Returns `true` if the error kind is `UpdatePayloadSpecError::InvalidRequestError`. + pub fn is_invalid_request_error(&self) -> bool { + matches!(self, Self::InvalidRequestError(_)) + } + /// Returns `true` if the error kind is `UpdatePayloadSpecError::UnauthorizedError`. + pub fn is_unauthorized_error(&self) -> bool { + matches!(self, Self::UnauthorizedError(_)) + } + /// Returns `true` if the error kind is `UpdatePayloadSpecError::InternalError`. + pub fn is_internal_error(&self) -> bool { + matches!(self, Self::InternalError(_)) + } + /// Returns `true` if the error kind is `UpdatePayloadSpecError::RateLimitedError`. + pub fn is_rate_limited_error(&self) -> bool { + matches!(self, Self::RateLimitedError(_)) + } +} +impl ::std::error::Error for UpdatePayloadSpecError { + fn source(&self) -> ::std::option::Option<&(dyn ::std::error::Error + 'static)> { + match self { + Self::NotFoundError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InvalidRequestError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::UnauthorizedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::InternalError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::RateLimitedError(_inner) => + ::std::option::Option::Some(_inner) + , + Self::Unhandled(_inner) => { + ::std::option::Option::Some(&*_inner.source) + } + } + } +} +impl ::std::fmt::Display for UpdatePayloadSpecError { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + match self { + Self::NotFoundError(_inner) => + _inner.fmt(f) + , + Self::InvalidRequestError(_inner) => + _inner.fmt(f) + , + Self::UnauthorizedError(_inner) => + _inner.fmt(f) + , + Self::InternalError(_inner) => + _inner.fmt(f) + , + Self::RateLimitedError(_inner) => + _inner.fmt(f) + , + Self::Unhandled(_inner) => { + if let ::std::option::Option::Some(code) = ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) { + write!(f, "unhandled error ({code})") + } else { + f.write_str("unhandled error") + } + } + } + } +} +impl ::aws_smithy_types::retry::ProvideErrorKind for UpdatePayloadSpecError { + fn code(&self) -> ::std::option::Option<&str> { + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::code(self) + } + fn retryable_error_kind(&self) -> ::std::option::Option<::aws_smithy_types::retry::ErrorKind> { + ::std::option::Option::None + } +} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UpdatePayloadSpecError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { + match self { + Self::NotFoundError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InvalidRequestError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::UnauthorizedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::InternalError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::RateLimitedError(_inner) => + ::aws_smithy_types::error::metadata::ProvideErrorMetadata::meta(_inner) + , + Self::Unhandled(_inner) => { + &_inner.meta + } + } + } +} +impl ::aws_smithy_runtime_api::client::result::CreateUnhandledError for UpdatePayloadSpecError { + fn create_unhandled_error( + source: ::std::boxed::Box, + meta: ::std::option::Option<::aws_smithy_types::error::ErrorMetadata> + ) -> Self { + Self::Unhandled(crate::error::sealed_unhandled::Unhandled { source, meta: meta.unwrap_or_default() }) + } +} + +pub use crate::operation::update_payload_spec::_update_payload_spec_input::UpdatePayloadSpecInput; + +pub use crate::operation::update_payload_spec::_update_payload_spec_output::UpdatePayloadSpecOutput; + +mod _update_payload_spec_input; + +mod _update_payload_spec_output; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/operation/update_payload_spec/_update_payload_spec_input.rs b/sdks/rust/src/operation/update_payload_spec/_update_payload_spec_input.rs new file mode 100644 index 0000000..a96c86f --- /dev/null +++ b/sdks/rust/src/operation/update_payload_spec/_update_payload_spec_input.rs @@ -0,0 +1,122 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct UpdatePayloadSpecInput { + #[allow(missing_docs)] // documentation missing in model + pub org_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub workspace_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub schema: ::std::option::Option<::aws_smithy_types::Document>, +} +impl UpdatePayloadSpecInput { + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(&self) -> ::std::option::Option<&str> { + self.org_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(&self) -> ::std::option::Option<&str> { + self.workspace_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> ::std::option::Option<&str> { + self.name.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn schema(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.schema.as_ref() + } +} +impl UpdatePayloadSpecInput { + /// Creates a new builder-style object to manufacture [`UpdatePayloadSpecInput`](crate::operation::update_payload_spec::UpdatePayloadSpecInput). + pub fn builder() -> crate::operation::update_payload_spec::builders::UpdatePayloadSpecInputBuilder { + crate::operation::update_payload_spec::builders::UpdatePayloadSpecInputBuilder::default() + } +} + +/// A builder for [`UpdatePayloadSpecInput`](crate::operation::update_payload_spec::UpdatePayloadSpecInput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdatePayloadSpecInputBuilder { + pub(crate) org_id: ::std::option::Option<::std::string::String>, + pub(crate) workspace_id: ::std::option::Option<::std::string::String>, + pub(crate) name: ::std::option::Option<::std::string::String>, + pub(crate) schema: ::std::option::Option<::aws_smithy_types::Document>, +} +impl UpdatePayloadSpecInputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.org_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.org_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + &self.org_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.workspace_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.workspace_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + &self.workspace_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn schema(mut self, input: ::aws_smithy_types::Document) -> Self { + self.schema = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_schema(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.schema = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_schema(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.schema + } + /// Consumes the builder and constructs a [`UpdatePayloadSpecInput`](crate::operation::update_payload_spec::UpdatePayloadSpecInput). + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::update_payload_spec::UpdatePayloadSpecInput { + org_id: self.org_id + , + workspace_id: self.workspace_id + , + name: self.name + , + schema: self.schema + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/update_payload_spec/_update_payload_spec_output.rs b/sdks/rust/src/operation/update_payload_spec/_update_payload_spec_output.rs new file mode 100644 index 0000000..db6dbf8 --- /dev/null +++ b/sdks/rust/src/operation/update_payload_spec/_update_payload_spec_output.rs @@ -0,0 +1,58 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct UpdatePayloadSpecOutput { + #[allow(missing_docs)] // documentation missing in model + pub data: crate::types::PayloadSpecResource, +} +impl UpdatePayloadSpecOutput { + #[allow(missing_docs)] // documentation missing in model + pub fn data(&self) -> &crate::types::PayloadSpecResource { + &self.data + } +} +impl UpdatePayloadSpecOutput { + /// Creates a new builder-style object to manufacture [`UpdatePayloadSpecOutput`](crate::operation::update_payload_spec::UpdatePayloadSpecOutput). + pub fn builder() -> crate::operation::update_payload_spec::builders::UpdatePayloadSpecOutputBuilder { + crate::operation::update_payload_spec::builders::UpdatePayloadSpecOutputBuilder::default() + } +} + +/// A builder for [`UpdatePayloadSpecOutput`](crate::operation::update_payload_spec::UpdatePayloadSpecOutput). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UpdatePayloadSpecOutputBuilder { + pub(crate) data: ::std::option::Option, +} +impl UpdatePayloadSpecOutputBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn data(mut self, input: crate::types::PayloadSpecResource) -> Self { + self.data = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_data(mut self, input: ::std::option::Option) -> Self { + self.data = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_data(&self) -> &::std::option::Option { + &self.data + } + /// Consumes the builder and constructs a [`UpdatePayloadSpecOutput`](crate::operation::update_payload_spec::UpdatePayloadSpecOutput). + /// This method will fail if any of the following fields are not set: + /// - [`data`](crate::operation::update_payload_spec::builders::UpdatePayloadSpecOutputBuilder::data) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::operation::update_payload_spec::UpdatePayloadSpecOutput { + data: self.data + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("data", "data was not specified but it is required when building UpdatePayloadSpecOutput") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/operation/update_payload_spec/builders.rs b/sdks/rust/src/operation/update_payload_spec/builders.rs new file mode 100644 index 0000000..10370e7 --- /dev/null +++ b/sdks/rust/src/operation/update_payload_spec/builders.rs @@ -0,0 +1,155 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::operation::update_payload_spec::_update_payload_spec_input::UpdatePayloadSpecInputBuilder; + +pub use crate::operation::update_payload_spec::_update_payload_spec_output::UpdatePayloadSpecOutputBuilder; + +impl crate::operation::update_payload_spec::builders::UpdatePayloadSpecInputBuilder { + /// Sends a request with this input using the given client. + pub async fn send_with(self, client: &crate::Client) -> ::std::result::Result< + crate::operation::update_payload_spec::UpdatePayloadSpecOutput, + ::aws_smithy_runtime_api::client::result::SdkError< + crate::operation::update_payload_spec::UpdatePayloadSpecError, + ::aws_smithy_runtime_api::client::orchestrator::HttpResponse + > + > { + let mut fluent_builder = client.update_payload_spec(); + fluent_builder.inner = self; + fluent_builder.send().await + } + } +/// Fluent builder constructing a request to `UpdatePayloadSpec`. +/// +#[derive(::std::clone::Clone, ::std::fmt::Debug)] +pub struct UpdatePayloadSpecFluentBuilder { + handle: ::std::sync::Arc, + inner: crate::operation::update_payload_spec::builders::UpdatePayloadSpecInputBuilder, +config_override: ::std::option::Option, + } +impl + crate::client::customize::internal::CustomizableSend< + crate::operation::update_payload_spec::UpdatePayloadSpecOutput, + crate::operation::update_payload_spec::UpdatePayloadSpecError, + > for UpdatePayloadSpecFluentBuilder + { + fn send( + self, + config_override: crate::config::Builder, + ) -> crate::client::customize::internal::BoxFuture< + crate::client::customize::internal::SendResult< + crate::operation::update_payload_spec::UpdatePayloadSpecOutput, + crate::operation::update_payload_spec::UpdatePayloadSpecError, + >, + > { + ::std::boxed::Box::pin(async move { self.config_override(config_override).send().await }) + } + } +impl UpdatePayloadSpecFluentBuilder { + /// Creates a new `UpdatePayloadSpecFluentBuilder`. + pub(crate) fn new(handle: ::std::sync::Arc) -> Self { + Self { + handle, + inner: ::std::default::Default::default(), + config_override: ::std::option::Option::None, + } + } + /// Access the UpdatePayloadSpec as a reference. + pub fn as_input(&self) -> &crate::operation::update_payload_spec::builders::UpdatePayloadSpecInputBuilder { + &self.inner + } + /// Sends the request and returns the response. + /// + /// If an error occurs, an `SdkError` will be returned with additional details that + /// can be matched against. + /// + /// By default, any retryable failures will be retried twice. Retry behavior + /// is configurable with the [RetryConfig](aws_smithy_types::retry::RetryConfig), which can be + /// set when configuring the client. + pub async fn send(self) -> ::std::result::Result> { + let input = self.inner.build().map_err(::aws_smithy_runtime_api::client::result::SdkError::construction_failure)?; + let runtime_plugins = crate::operation::update_payload_spec::UpdatePayloadSpec::operation_runtime_plugins( + self.handle.runtime_plugins.clone(), + &self.handle.conf, + self.config_override, + ); + crate::operation::update_payload_spec::UpdatePayloadSpec::orchestrate(&runtime_plugins, input).await + } + + /// Consumes this builder, creating a customizable operation that can be modified before being sent. + pub fn customize( + self, + ) -> crate::client::customize::CustomizableOperation { + crate::client::customize::CustomizableOperation::new(self) + } + pub(crate) fn config_override( + mut self, + config_override: impl ::std::convert::Into, + ) -> Self { + self.set_config_override(::std::option::Option::Some(config_override.into())); + self + } + + pub(crate) fn set_config_override( + &mut self, + config_override: ::std::option::Option, + ) -> &mut Self { + self.config_override = config_override; + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn org_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.org_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_org_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_org_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_org_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_org_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn workspace_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.workspace_id(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_workspace_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_workspace_id(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_workspace_id(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_workspace_id() + } + #[allow(missing_docs)] // documentation missing in model + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.inner = self.inner.name(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.inner = self.inner.set_name(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + self.inner.get_name() + } + #[allow(missing_docs)] // documentation missing in model + pub fn schema(mut self, input: ::aws_smithy_types::Document) -> Self { + self.inner = self.inner.schema(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_schema(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.inner = self.inner.set_schema(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_schema(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + self.inner.get_schema() + } +} + diff --git a/sdks/rust/src/primitives.rs b/sdks/rust/src/primitives.rs new file mode 100644 index 0000000..56d3924 --- /dev/null +++ b/sdks/rust/src/primitives.rs @@ -0,0 +1,9 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use ::aws_smithy_types::DateTime; + pub use ::aws_smithy_types::date_time::Format as DateTimeFormat; + +/// Event stream related primitives such as `Message` or `Header`. +pub mod event_stream; + +pub(crate) mod sealed_enum_unknown; + diff --git a/sdks/rust/src/primitives/event_stream.rs b/sdks/rust/src/primitives/event_stream.rs new file mode 100644 index 0000000..1d46f86 --- /dev/null +++ b/sdks/rust/src/primitives/event_stream.rs @@ -0,0 +1,3 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + + diff --git a/sdks/rust/src/primitives/sealed_enum_unknown.rs b/sdks/rust/src/primitives/sealed_enum_unknown.rs new file mode 100644 index 0000000..4ea3a80 --- /dev/null +++ b/sdks/rust/src/primitives/sealed_enum_unknown.rs @@ -0,0 +1,20 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// Opaque struct used as inner data for the `Unknown` variant defined in enums in +/// the crate. +/// +/// This is not intended to be used directly. +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash)] +pub struct UnknownVariantValue(pub(crate) ::std::string::String); +impl UnknownVariantValue { + pub(crate) fn as_str(&self) -> &str { + &self.0 + } +} +impl ::std::fmt::Display for UnknownVariantValue { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + write!(f, "{}", self.0) + } + } + diff --git a/sdks/rust/src/protocol_serde.rs b/sdks/rust/src/protocol_serde.rs new file mode 100644 index 0000000..6ea4c5a --- /dev/null +++ b/sdks/rust/src/protocol_serde.rs @@ -0,0 +1,129 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn type_erase_result(result: ::std::result::Result) -> ::std::result::Result<::aws_smithy_runtime_api::client::interceptors::context::Output, ::aws_smithy_runtime_api::client::orchestrator::OrchestratorError<::aws_smithy_runtime_api::client::interceptors::context::Error>> + where + O: ::std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static, + E: ::std::error::Error + std::fmt::Debug + ::std::marker::Send + ::std::marker::Sync + 'static, + { + result.map(|output| ::aws_smithy_runtime_api::client::interceptors::context::Output::erase(output)) + .map_err(|error| ::aws_smithy_runtime_api::client::interceptors::context::Error::erase(error)) + .map_err(::std::convert::Into::into) + } + +pub fn parse_http_error_metadata(_response_status: u16, response_headers: &::aws_smithy_runtime_api::http::Headers, response_body: &[u8]) -> ::std::result::Result<::aws_smithy_types::error::metadata::Builder, ::aws_smithy_json::deserialize::error::DeserializeError> { + crate::json_errors::parse_error_metadata(response_body, response_headers) + } + +pub(crate) mod shape_cancel_execution; + +pub(crate) mod shape_cancel_job; + +pub(crate) mod shape_create_endpoint; + +pub(crate) mod shape_create_job; + +pub(crate) mod shape_create_payload_spec; + +pub(crate) mod shape_delete_endpoint; + +pub(crate) mod shape_delete_payload_spec; + +pub(crate) mod shape_get_endpoint; + +pub(crate) mod shape_get_execution; + +pub(crate) mod shape_get_job; + +pub(crate) mod shape_get_job_status; + +pub(crate) mod shape_get_job_versions; + +pub(crate) mod shape_get_payload_spec; + +pub(crate) mod shape_list_endpoints; + +pub(crate) mod shape_list_execution_attempts; + +pub(crate) mod shape_list_execution_logs; + +pub(crate) mod shape_list_job_executions; + +pub(crate) mod shape_list_jobs; + +pub(crate) mod shape_list_payload_specs; + +pub(crate) mod shape_update_endpoint; + +pub(crate) mod shape_update_job; + +pub(crate) mod shape_update_payload_spec; + +pub(crate) fn or_empty_doc(data: &[u8]) -> &[u8] { + if data.is_empty() { + b"{}" + } else { + data + } + } + +pub(crate) mod shape_conflict_error; + +pub(crate) mod shape_create_endpoint_input; + +pub(crate) mod shape_create_job_input; + +pub(crate) mod shape_create_payload_spec_input; + +pub(crate) mod shape_internal_error; + +pub(crate) mod shape_invalid_request_error; + +pub(crate) mod shape_not_found_error; + +pub(crate) mod shape_rate_limited_error; + +pub(crate) mod shape_unauthorized_error; + +pub(crate) mod shape_unprocessable_entity_error; + +pub(crate) mod shape_update_endpoint_input; + +pub(crate) mod shape_update_job_input; + +pub(crate) mod shape_update_payload_spec_input; + +pub(crate) mod shape_attempt_resource_list; + +pub(crate) mod shape_endpoint_list; + +pub(crate) mod shape_endpoint_resource; + +pub(crate) mod shape_error_detail; + +pub(crate) mod shape_execution_log_list; + +pub(crate) mod shape_execution_resource; + +pub(crate) mod shape_execution_resource_list; + +pub(crate) mod shape_job_resource; + +pub(crate) mod shape_job_status_response; + +pub(crate) mod shape_job_summary_list; + +pub(crate) mod shape_job_version_list; + +pub(crate) mod shape_payload_spec_list; + +pub(crate) mod shape_payload_spec_resource; + +pub(crate) mod shape_retry_policy; + +pub(crate) mod shape_attempt_resource; + +pub(crate) mod shape_execution_log_resource; + +pub(crate) mod shape_execution_summary; + +pub(crate) mod shape_job_summary; + diff --git a/sdks/rust/src/protocol_serde/shape_attempt_resource.rs b/sdks/rust/src/protocol_serde/shape_attempt_resource.rs new file mode 100644 index 0000000..76cdc2c --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_attempt_resource.rs @@ -0,0 +1,93 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_attempt_resource<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::AttemptResourceBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "attempt_id" => { + builder = builder.set_attempt_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "execution_id" => { + builder = builder.set_execution_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "attempt_number" => { + builder = builder.set_attempt_number( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "status" => { + builder = builder.set_status( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::AttemptStatusEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "started_at" => { + builder = builder.set_started_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "completed_at" => { + builder = builder.set_completed_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "duration_ms" => { + builder = builder.set_duration_ms( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "output" => { + builder = builder.set_output( + Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?) + ); + } + "error" => { + builder = builder.set_error( + Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?) + ); + } + "created_at" => { + builder = builder.set_created_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::attempt_resource_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_attempt_resource_list.rs b/sdks/rust/src/protocol_serde/shape_attempt_resource_list.rs new file mode 100644 index 0000000..7f42f6b --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_attempt_resource_list.rs @@ -0,0 +1,30 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_attempt_resource_list<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result>, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => { + let mut items = Vec::new(); + loop { + match tokens.peek() { + Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => { + tokens.next().transpose().unwrap(); break; + } + _ => { + let value = + crate::protocol_serde::shape_attempt_resource::de_attempt_resource(tokens)? + ; + if let Some(value) = value { + items.push(value); + } + } + } + } + Ok(Some(items)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start array or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_cancel_execution.rs b/sdks/rust/src/protocol_serde/shape_cancel_execution.rs new file mode 100644 index 0000000..a4bfd19 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_cancel_execution.rs @@ -0,0 +1,164 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_cancel_execution_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::cancel_execution::CancelExecutionError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::cancel_execution::CancelExecutionError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "ConflictError" => crate::operation::cancel_execution::CancelExecutionError::ConflictError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::ConflictErrorBuilder::default(); + output = crate::protocol_serde::shape_conflict_error::de_conflict_error_json_err(_response_body, output).map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::conflict_error_correct_errors(output).build().map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::cancel_execution::CancelExecutionError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::cancel_execution::CancelExecutionError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::cancel_execution::CancelExecutionError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::cancel_execution::CancelExecutionError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_cancel_execution_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::cancel_execution::builders::CancelExecutionOutputBuilder::default(); + output = crate::protocol_serde::shape_cancel_execution::de_cancel_execution(_response_body, output).map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)?; + crate::serde_util::cancel_execution_output_output_correct_errors(output).build().map_err(crate::operation::cancel_execution::CancelExecutionError::unhandled)? + }) +} + +pub fn ser_cancel_execution_headers( + input: &crate::operation::cancel_execution::CancelExecutionInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_cancel_execution(value: &[u8], mut builder: crate::operation::cancel_execution::builders::CancelExecutionOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_execution_resource::de_execution_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_cancel_job.rs b/sdks/rust/src/protocol_serde/shape_cancel_job.rs new file mode 100644 index 0000000..aac3c0f --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_cancel_job.rs @@ -0,0 +1,164 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_cancel_job_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::cancel_job::CancelJobError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::cancel_job::CancelJobError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::cancel_job::CancelJobError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::cancel_job::CancelJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::cancel_job::CancelJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "ConflictError" => crate::operation::cancel_job::CancelJobError::ConflictError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::ConflictErrorBuilder::default(); + output = crate::protocol_serde::shape_conflict_error::de_conflict_error_json_err(_response_body, output).map_err(crate::operation::cancel_job::CancelJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::conflict_error_correct_errors(output).build().map_err(crate::operation::cancel_job::CancelJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::cancel_job::CancelJobError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::cancel_job::CancelJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::cancel_job::CancelJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::cancel_job::CancelJobError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::cancel_job::CancelJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::cancel_job::CancelJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::cancel_job::CancelJobError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::cancel_job::CancelJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::cancel_job::CancelJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::cancel_job::CancelJobError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_cancel_job_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::cancel_job::builders::CancelJobOutputBuilder::default(); + output = crate::protocol_serde::shape_cancel_job::de_cancel_job(_response_body, output).map_err(crate::operation::cancel_job::CancelJobError::unhandled)?; + crate::serde_util::cancel_job_output_output_correct_errors(output).build().map_err(crate::operation::cancel_job::CancelJobError::unhandled)? + }) +} + +pub fn ser_cancel_job_headers( + input: &crate::operation::cancel_job::CancelJobInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_cancel_job(value: &[u8], mut builder: crate::operation::cancel_job::builders::CancelJobOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_job_resource::de_job_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_conflict_error.rs b/sdks/rust/src/protocol_serde/shape_conflict_error.rs new file mode 100644 index 0000000..bd6c339 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_conflict_error.rs @@ -0,0 +1,36 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_conflict_error_json_err(value: &[u8], mut builder: crate::types::error::builders::ConflictErrorBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "error" => { + builder = builder.set_error( + crate::protocol_serde::shape_error_detail::de_error_detail(tokens)? + ); + } + "Message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_create_endpoint.rs b/sdks/rust/src/protocol_serde/shape_create_endpoint.rs new file mode 100644 index 0000000..1ddc203 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_create_endpoint.rs @@ -0,0 +1,188 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_create_endpoint_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::create_endpoint::CreateEndpointError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "InvalidRequestError" => crate::operation::create_endpoint::CreateEndpointError::InvalidRequestError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InvalidRequestErrorBuilder::default(); + output = crate::protocol_serde::shape_invalid_request_error::de_invalid_request_error_json_err(_response_body, output).map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::invalid_request_error_correct_errors(output).build().map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "ConflictError" => crate::operation::create_endpoint::CreateEndpointError::ConflictError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::ConflictErrorBuilder::default(); + output = crate::protocol_serde::shape_conflict_error::de_conflict_error_json_err(_response_body, output).map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::conflict_error_correct_errors(output).build().map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnprocessableEntityError" => crate::operation::create_endpoint::CreateEndpointError::UnprocessableEntityError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnprocessableEntityErrorBuilder::default(); + output = crate::protocol_serde::shape_unprocessable_entity_error::de_unprocessable_entity_error_json_err(_response_body, output).map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unprocessable_entity_error_correct_errors(output).build().map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::create_endpoint::CreateEndpointError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::create_endpoint::CreateEndpointError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::create_endpoint::CreateEndpointError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::create_endpoint::CreateEndpointError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_create_endpoint_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::create_endpoint::builders::CreateEndpointOutputBuilder::default(); + output = crate::protocol_serde::shape_create_endpoint::de_create_endpoint(_response_body, output).map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)?; + crate::serde_util::create_endpoint_output_output_correct_errors(output).build().map_err(crate::operation::create_endpoint::CreateEndpointError::unhandled)? + }) +} + +pub fn ser_create_endpoint_headers( + input: &crate::operation::create_endpoint::CreateEndpointInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub fn ser_create_endpoint_input(input: &crate::operation::create_endpoint::CreateEndpointInput) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> { + let mut out = String::new(); + let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out); + crate::protocol_serde::shape_create_endpoint_input::ser_create_endpoint_input_input(&mut object, input)?; + object.finish(); + Ok(::aws_smithy_types::body::SdkBody::from(out)) +} + +pub(crate) fn de_create_endpoint(value: &[u8], mut builder: crate::operation::create_endpoint::builders::CreateEndpointOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_endpoint_resource::de_endpoint_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_create_endpoint_input.rs b/sdks/rust/src/protocol_serde/shape_create_endpoint_input.rs new file mode 100644 index 0000000..16e9d89 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_create_endpoint_input.rs @@ -0,0 +1,29 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub fn ser_create_endpoint_input_input( + object: &mut ::aws_smithy_json::serialize::JsonObjectWriter, + input: &crate::operation::create_endpoint::CreateEndpointInput, + ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> { + if let Some(var_1) = &input.config { + object.key("config").string(var_1.as_str()); + } + if let Some(var_2) = &input.endpoint_type { + object.key("type").string(var_2.as_str()); + } + if let Some(var_3) = &input.name { + object.key("name").string(var_3.as_str()); + } + if let Some(var_4) = &input.payload_spec { + object.key("payload_spec").string(var_4.as_str()); + } + if let Some(var_5) = &input.retry_policy { + #[allow(unused_mut)] + let mut object_6 = object.key("retry_policy").start_object(); + crate::protocol_serde::shape_retry_policy::ser_retry_policy(&mut object_6, var_5)?; + object_6.finish(); + } + if let Some(var_7) = &input.spec { + object.key("spec").document(var_7); + } + Ok(()) +} + diff --git a/sdks/rust/src/protocol_serde/shape_create_job.rs b/sdks/rust/src/protocol_serde/shape_create_job.rs new file mode 100644 index 0000000..cb51cd2 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_create_job.rs @@ -0,0 +1,204 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_create_job_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::create_job::CreateJobError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "InvalidRequestError" => crate::operation::create_job::CreateJobError::InvalidRequestError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InvalidRequestErrorBuilder::default(); + output = crate::protocol_serde::shape_invalid_request_error::de_invalid_request_error_json_err(_response_body, output).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::invalid_request_error_correct_errors(output).build().map_err(crate::operation::create_job::CreateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "ConflictError" => crate::operation::create_job::CreateJobError::ConflictError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::ConflictErrorBuilder::default(); + output = crate::protocol_serde::shape_conflict_error::de_conflict_error_json_err(_response_body, output).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::conflict_error_correct_errors(output).build().map_err(crate::operation::create_job::CreateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "NotFoundError" => crate::operation::create_job::CreateJobError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::create_job::CreateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnprocessableEntityError" => crate::operation::create_job::CreateJobError::UnprocessableEntityError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnprocessableEntityErrorBuilder::default(); + output = crate::protocol_serde::shape_unprocessable_entity_error::de_unprocessable_entity_error_json_err(_response_body, output).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unprocessable_entity_error_correct_errors(output).build().map_err(crate::operation::create_job::CreateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::create_job::CreateJobError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::create_job::CreateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::create_job::CreateJobError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::create_job::CreateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::create_job::CreateJobError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::create_job::CreateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::create_job::CreateJobError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_create_job_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::create_job::builders::CreateJobOutputBuilder::default(); + output = crate::protocol_serde::shape_create_job::de_create_job(_response_body, output).map_err(crate::operation::create_job::CreateJobError::unhandled)?; + crate::serde_util::create_job_output_output_correct_errors(output).build().map_err(crate::operation::create_job::CreateJobError::unhandled)? + }) +} + +pub fn ser_create_job_headers( + input: &crate::operation::create_job::CreateJobInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub fn ser_create_job_input(input: &crate::operation::create_job::CreateJobInput) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> { + let mut out = String::new(); + let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out); + crate::protocol_serde::shape_create_job_input::ser_create_job_input_input(&mut object, input)?; + object.finish(); + Ok(::aws_smithy_types::body::SdkBody::from(out)) +} + +pub(crate) fn de_create_job(value: &[u8], mut builder: crate::operation::create_job::builders::CreateJobOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_job_resource::de_job_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_create_job_input.rs b/sdks/rust/src/protocol_serde/shape_create_job_input.rs new file mode 100644 index 0000000..a75d415 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_create_job_input.rs @@ -0,0 +1,35 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub fn ser_create_job_input_input( + object: &mut ::aws_smithy_json::serialize::JsonObjectWriter, + input: &crate::operation::create_job::CreateJobInput, + ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> { + if let Some(var_1) = &input.cron { + object.key("cron").string(var_1.as_str()); + } + if let Some(var_2) = &input.endpoint { + object.key("endpoint").string(var_2.as_str()); + } + if let Some(var_3) = &input.ends_at { + object.key("ends_at").date_time(var_3, ::aws_smithy_types::date_time::Format::DateTime)?; + } + if let Some(var_4) = &input.idempotency_key { + object.key("idempotency_key").string(var_4.as_str()); + } + if let Some(var_5) = &input.input { + object.key("input").document(var_5); + } + if let Some(var_6) = &input.run_at { + object.key("run_at").date_time(var_6, ::aws_smithy_types::date_time::Format::DateTime)?; + } + if let Some(var_7) = &input.starts_at { + object.key("starts_at").date_time(var_7, ::aws_smithy_types::date_time::Format::DateTime)?; + } + if let Some(var_8) = &input.timezone { + object.key("timezone").string(var_8.as_str()); + } + if let Some(var_9) = &input.trigger { + object.key("trigger").string(var_9.as_str()); + } + Ok(()) +} + diff --git a/sdks/rust/src/protocol_serde/shape_create_payload_spec.rs b/sdks/rust/src/protocol_serde/shape_create_payload_spec.rs new file mode 100644 index 0000000..56e0b71 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_create_payload_spec.rs @@ -0,0 +1,172 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_create_payload_spec_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "InvalidRequestError" => crate::operation::create_payload_spec::CreatePayloadSpecError::InvalidRequestError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InvalidRequestErrorBuilder::default(); + output = crate::protocol_serde::shape_invalid_request_error::de_invalid_request_error_json_err(_response_body, output).map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::invalid_request_error_correct_errors(output).build().map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "ConflictError" => crate::operation::create_payload_spec::CreatePayloadSpecError::ConflictError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::ConflictErrorBuilder::default(); + output = crate::protocol_serde::shape_conflict_error::de_conflict_error_json_err(_response_body, output).map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::conflict_error_correct_errors(output).build().map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::create_payload_spec::CreatePayloadSpecError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::create_payload_spec::CreatePayloadSpecError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::create_payload_spec::CreatePayloadSpecError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::create_payload_spec::CreatePayloadSpecError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_create_payload_spec_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::create_payload_spec::builders::CreatePayloadSpecOutputBuilder::default(); + output = crate::protocol_serde::shape_create_payload_spec::de_create_payload_spec(_response_body, output).map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)?; + crate::serde_util::create_payload_spec_output_output_correct_errors(output).build().map_err(crate::operation::create_payload_spec::CreatePayloadSpecError::unhandled)? + }) +} + +pub fn ser_create_payload_spec_headers( + input: &crate::operation::create_payload_spec::CreatePayloadSpecInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub fn ser_create_payload_spec_input(input: &crate::operation::create_payload_spec::CreatePayloadSpecInput) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> { + let mut out = String::new(); + let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out); + crate::protocol_serde::shape_create_payload_spec_input::ser_create_payload_spec_input_input(&mut object, input)?; + object.finish(); + Ok(::aws_smithy_types::body::SdkBody::from(out)) +} + +pub(crate) fn de_create_payload_spec(value: &[u8], mut builder: crate::operation::create_payload_spec::builders::CreatePayloadSpecOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_payload_spec_resource::de_payload_spec_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_create_payload_spec_input.rs b/sdks/rust/src/protocol_serde/shape_create_payload_spec_input.rs new file mode 100644 index 0000000..c9bcc8b --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_create_payload_spec_input.rs @@ -0,0 +1,14 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub fn ser_create_payload_spec_input_input( + object: &mut ::aws_smithy_json::serialize::JsonObjectWriter, + input: &crate::operation::create_payload_spec::CreatePayloadSpecInput, + ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> { + if let Some(var_1) = &input.name { + object.key("name").string(var_1.as_str()); + } + if let Some(var_2) = &input.schema { + object.key("schema").document(var_2); + } + Ok(()) +} + diff --git a/sdks/rust/src/protocol_serde/shape_delete_endpoint.rs b/sdks/rust/src/protocol_serde/shape_delete_endpoint.rs new file mode 100644 index 0000000..ac14467 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_delete_endpoint.rs @@ -0,0 +1,121 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_delete_endpoint_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::delete_endpoint::DeleteEndpointError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::delete_endpoint::DeleteEndpointError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::delete_endpoint::DeleteEndpointError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::delete_endpoint::DeleteEndpointError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::delete_endpoint::DeleteEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::delete_endpoint::DeleteEndpointError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_delete_endpoint_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::delete_endpoint::builders::DeleteEndpointOutputBuilder::default(); + output.build() + }) +} + +pub fn ser_delete_endpoint_headers( + input: &crate::operation::delete_endpoint::DeleteEndpointInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_delete_payload_spec.rs b/sdks/rust/src/protocol_serde/shape_delete_payload_spec.rs new file mode 100644 index 0000000..1896a2c --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_delete_payload_spec.rs @@ -0,0 +1,121 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_delete_payload_spec_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::delete_payload_spec::DeletePayloadSpecError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::delete_payload_spec::DeletePayloadSpecError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::delete_payload_spec::DeletePayloadSpecError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::delete_payload_spec::DeletePayloadSpecError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::delete_payload_spec::DeletePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::delete_payload_spec::DeletePayloadSpecError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_delete_payload_spec_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::delete_payload_spec::builders::DeletePayloadSpecOutputBuilder::default(); + output.build() + }) +} + +pub fn ser_delete_payload_spec_headers( + input: &crate::operation::delete_payload_spec::DeletePayloadSpecInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_endpoint_list.rs b/sdks/rust/src/protocol_serde/shape_endpoint_list.rs new file mode 100644 index 0000000..d2482b0 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_endpoint_list.rs @@ -0,0 +1,30 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_endpoint_list<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result>, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => { + let mut items = Vec::new(); + loop { + match tokens.peek() { + Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => { + tokens.next().transpose().unwrap(); break; + } + _ => { + let value = + crate::protocol_serde::shape_endpoint_resource::de_endpoint_resource(tokens)? + ; + if let Some(value) = value { + items.push(value); + } + } + } + } + Ok(Some(items)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start array or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_endpoint_resource.rs b/sdks/rust/src/protocol_serde/shape_endpoint_resource.rs new file mode 100644 index 0000000..8c3b5f0 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_endpoint_resource.rs @@ -0,0 +1,83 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_endpoint_resource<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::EndpointResourceBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "name" => { + builder = builder.set_name( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "type" => { + builder = builder.set_endpoint_type( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::EndpointTypeEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "payload_spec" => { + builder = builder.set_payload_spec( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "config" => { + builder = builder.set_config( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "spec" => { + builder = builder.set_spec( + Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?) + ); + } + "retry_policy" => { + builder = builder.set_retry_policy( + crate::protocol_serde::shape_retry_policy::de_retry_policy(tokens)? + ); + } + "created_at" => { + builder = builder.set_created_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "updated_at" => { + builder = builder.set_updated_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::endpoint_resource_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_error_detail.rs b/sdks/rust/src/protocol_serde/shape_error_detail.rs new file mode 100644 index 0000000..a06b3e3 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_error_detail.rs @@ -0,0 +1,54 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_error_detail<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::ErrorDetailBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "code" => { + builder = builder.set_code( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "request_id" => { + builder = builder.set_request_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::error_detail_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_execution_log_list.rs b/sdks/rust/src/protocol_serde/shape_execution_log_list.rs new file mode 100644 index 0000000..6dbe521 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_execution_log_list.rs @@ -0,0 +1,30 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_execution_log_list<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result>, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => { + let mut items = Vec::new(); + loop { + match tokens.peek() { + Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => { + tokens.next().transpose().unwrap(); break; + } + _ => { + let value = + crate::protocol_serde::shape_execution_log_resource::de_execution_log_resource(tokens)? + ; + if let Some(value) = value { + items.push(value); + } + } + } + } + Ok(Some(items)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start array or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_execution_log_resource.rs b/sdks/rust/src/protocol_serde/shape_execution_log_resource.rs new file mode 100644 index 0000000..3555adf --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_execution_log_resource.rs @@ -0,0 +1,75 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_execution_log_resource<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::ExecutionLogResourceBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "log_id" => { + builder = builder.set_log_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "execution_id" => { + builder = builder.set_execution_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "attempt_number" => { + builder = builder.set_attempt_number( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "level" => { + builder = builder.set_level( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::LogLevelEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "logged_at" => { + builder = builder.set_logged_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::execution_log_resource_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_execution_resource.rs b/sdks/rust/src/protocol_serde/shape_execution_resource.rs new file mode 100644 index 0000000..a0a693e --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_execution_resource.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_execution_resource<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::ExecutionResourceBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "execution_id" => { + builder = builder.set_execution_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "job_id" => { + builder = builder.set_job_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "endpoint" => { + builder = builder.set_endpoint( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "endpoint_type" => { + builder = builder.set_endpoint_type( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::EndpointTypeEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "idempotency_key" => { + builder = builder.set_idempotency_key( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "status" => { + builder = builder.set_status( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::ExecutionStatusEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "input" => { + builder = builder.set_input( + Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?) + ); + } + "output" => { + builder = builder.set_output( + Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?) + ); + } + "attempt_count" => { + builder = builder.set_attempt_count( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "max_attempts" => { + builder = builder.set_max_attempts( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "worker_id" => { + builder = builder.set_worker_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "run_at" => { + builder = builder.set_run_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "started_at" => { + builder = builder.set_started_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "completed_at" => { + builder = builder.set_completed_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "duration_ms" => { + builder = builder.set_duration_ms( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "created_at" => { + builder = builder.set_created_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::execution_resource_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_execution_resource_list.rs b/sdks/rust/src/protocol_serde/shape_execution_resource_list.rs new file mode 100644 index 0000000..9e6b4f9 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_execution_resource_list.rs @@ -0,0 +1,30 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_execution_resource_list<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result>, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => { + let mut items = Vec::new(); + loop { + match tokens.peek() { + Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => { + tokens.next().transpose().unwrap(); break; + } + _ => { + let value = + crate::protocol_serde::shape_execution_resource::de_execution_resource(tokens)? + ; + if let Some(value) = value { + items.push(value); + } + } + } + } + Ok(Some(items)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start array or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_execution_summary.rs b/sdks/rust/src/protocol_serde/shape_execution_summary.rs new file mode 100644 index 0000000..df89291 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_execution_summary.rs @@ -0,0 +1,69 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_execution_summary<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::ExecutionSummaryBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "execution_id" => { + builder = builder.set_execution_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "status" => { + builder = builder.set_status( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::ExecutionStatusEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "attempt_count" => { + builder = builder.set_attempt_count( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "max_attempts" => { + builder = builder.set_max_attempts( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "started_at" => { + builder = builder.set_started_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "completed_at" => { + builder = builder.set_completed_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::execution_summary_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_get_endpoint.rs b/sdks/rust/src/protocol_serde/shape_get_endpoint.rs new file mode 100644 index 0000000..b29dd70 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_get_endpoint.rs @@ -0,0 +1,148 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_endpoint_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::get_endpoint::GetEndpointError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::get_endpoint::GetEndpointError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::get_endpoint::GetEndpointError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::get_endpoint::GetEndpointError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::get_endpoint::GetEndpointError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::get_endpoint::GetEndpointError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_endpoint_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::get_endpoint::builders::GetEndpointOutputBuilder::default(); + output = crate::protocol_serde::shape_get_endpoint::de_get_endpoint(_response_body, output).map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)?; + crate::serde_util::get_endpoint_output_output_correct_errors(output).build().map_err(crate::operation::get_endpoint::GetEndpointError::unhandled)? + }) +} + +pub fn ser_get_endpoint_headers( + input: &crate::operation::get_endpoint::GetEndpointInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_get_endpoint(value: &[u8], mut builder: crate::operation::get_endpoint::builders::GetEndpointOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_endpoint_resource::de_endpoint_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_get_execution.rs b/sdks/rust/src/protocol_serde/shape_get_execution.rs new file mode 100644 index 0000000..be924b2 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_get_execution.rs @@ -0,0 +1,148 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_execution_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::get_execution::GetExecutionError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::get_execution::GetExecutionError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::get_execution::GetExecutionError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::get_execution::GetExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::get_execution::GetExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::get_execution::GetExecutionError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::get_execution::GetExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::get_execution::GetExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::get_execution::GetExecutionError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::get_execution::GetExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::get_execution::GetExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::get_execution::GetExecutionError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::get_execution::GetExecutionError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::get_execution::GetExecutionError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::get_execution::GetExecutionError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_execution_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::get_execution::builders::GetExecutionOutputBuilder::default(); + output = crate::protocol_serde::shape_get_execution::de_get_execution(_response_body, output).map_err(crate::operation::get_execution::GetExecutionError::unhandled)?; + crate::serde_util::get_execution_output_output_correct_errors(output).build().map_err(crate::operation::get_execution::GetExecutionError::unhandled)? + }) +} + +pub fn ser_get_execution_headers( + input: &crate::operation::get_execution::GetExecutionInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_get_execution(value: &[u8], mut builder: crate::operation::get_execution::builders::GetExecutionOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_execution_resource::de_execution_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_get_job.rs b/sdks/rust/src/protocol_serde/shape_get_job.rs new file mode 100644 index 0000000..2fa4562 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_get_job.rs @@ -0,0 +1,148 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_job_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::get_job::GetJobError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::get_job::GetJobError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::get_job::GetJobError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::get_job::GetJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::get_job::GetJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::get_job::GetJobError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::get_job::GetJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::get_job::GetJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::get_job::GetJobError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::get_job::GetJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::get_job::GetJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::get_job::GetJobError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::get_job::GetJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::get_job::GetJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::get_job::GetJobError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_job_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::get_job::builders::GetJobOutputBuilder::default(); + output = crate::protocol_serde::shape_get_job::de_get_job(_response_body, output).map_err(crate::operation::get_job::GetJobError::unhandled)?; + crate::serde_util::get_job_output_output_correct_errors(output).build().map_err(crate::operation::get_job::GetJobError::unhandled)? + }) +} + +pub fn ser_get_job_headers( + input: &crate::operation::get_job::GetJobInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_get_job(value: &[u8], mut builder: crate::operation::get_job::builders::GetJobOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_job_resource::de_job_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_get_job_status.rs b/sdks/rust/src/protocol_serde/shape_get_job_status.rs new file mode 100644 index 0000000..759afe1 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_get_job_status.rs @@ -0,0 +1,148 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_job_status_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::get_job_status::GetJobStatusError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::get_job_status::GetJobStatusError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::get_job_status::GetJobStatusError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::get_job_status::GetJobStatusError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::get_job_status::GetJobStatusError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::get_job_status::GetJobStatusError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_job_status_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::get_job_status::builders::GetJobStatusOutputBuilder::default(); + output = crate::protocol_serde::shape_get_job_status::de_get_job_status(_response_body, output).map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)?; + crate::serde_util::get_job_status_output_output_correct_errors(output).build().map_err(crate::operation::get_job_status::GetJobStatusError::unhandled)? + }) +} + +pub fn ser_get_job_status_headers( + input: &crate::operation::get_job_status::GetJobStatusInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_get_job_status(value: &[u8], mut builder: crate::operation::get_job_status::builders::GetJobStatusOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_job_status_response::de_job_status_response(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_get_job_versions.rs b/sdks/rust/src/protocol_serde/shape_get_job_versions.rs new file mode 100644 index 0000000..2247f12 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_get_job_versions.rs @@ -0,0 +1,148 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_job_versions_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::get_job_versions::GetJobVersionsError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::get_job_versions::GetJobVersionsError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::get_job_versions::GetJobVersionsError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::get_job_versions::GetJobVersionsError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::get_job_versions::GetJobVersionsError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::get_job_versions::GetJobVersionsError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_job_versions_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::get_job_versions::builders::GetJobVersionsOutputBuilder::default(); + output = crate::protocol_serde::shape_get_job_versions::de_get_job_versions(_response_body, output).map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)?; + crate::serde_util::get_job_versions_output_output_correct_errors(output).build().map_err(crate::operation::get_job_versions::GetJobVersionsError::unhandled)? + }) +} + +pub fn ser_get_job_versions_headers( + input: &crate::operation::get_job_versions::GetJobVersionsInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_get_job_versions(value: &[u8], mut builder: crate::operation::get_job_versions::builders::GetJobVersionsOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_job_version_list::de_job_version_list(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_get_payload_spec.rs b/sdks/rust/src/protocol_serde/shape_get_payload_spec.rs new file mode 100644 index 0000000..00b56ed --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_get_payload_spec.rs @@ -0,0 +1,148 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_payload_spec_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::get_payload_spec::GetPayloadSpecError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::get_payload_spec::GetPayloadSpecError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::get_payload_spec::GetPayloadSpecError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::get_payload_spec::GetPayloadSpecError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::get_payload_spec::GetPayloadSpecError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_get_payload_spec_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::get_payload_spec::builders::GetPayloadSpecOutputBuilder::default(); + output = crate::protocol_serde::shape_get_payload_spec::de_get_payload_spec(_response_body, output).map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)?; + crate::serde_util::get_payload_spec_output_output_correct_errors(output).build().map_err(crate::operation::get_payload_spec::GetPayloadSpecError::unhandled)? + }) +} + +pub fn ser_get_payload_spec_headers( + input: &crate::operation::get_payload_spec::GetPayloadSpecInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_get_payload_spec(value: &[u8], mut builder: crate::operation::get_payload_spec::builders::GetPayloadSpecOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_payload_spec_resource::de_payload_spec_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_internal_error.rs b/sdks/rust/src/protocol_serde/shape_internal_error.rs new file mode 100644 index 0000000..ddac6ba --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_internal_error.rs @@ -0,0 +1,36 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_internal_error_json_err(value: &[u8], mut builder: crate::types::error::builders::InternalErrorBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "error" => { + builder = builder.set_error( + crate::protocol_serde::shape_error_detail::de_error_detail(tokens)? + ); + } + "Message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_invalid_request_error.rs b/sdks/rust/src/protocol_serde/shape_invalid_request_error.rs new file mode 100644 index 0000000..bf6b42d --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_invalid_request_error.rs @@ -0,0 +1,36 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_invalid_request_error_json_err(value: &[u8], mut builder: crate::types::error::builders::InvalidRequestErrorBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "error" => { + builder = builder.set_error( + crate::protocol_serde::shape_error_detail::de_error_detail(tokens)? + ); + } + "Message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_job_resource.rs b/sdks/rust/src/protocol_serde/shape_job_resource.rs new file mode 100644 index 0000000..d633291 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_job_resource.rs @@ -0,0 +1,164 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_job_resource<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::JobResourceBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "job_id" => { + builder = builder.set_job_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "endpoint" => { + builder = builder.set_endpoint( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "endpoint_type" => { + builder = builder.set_endpoint_type( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::EndpointTypeEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "trigger_type" => { + builder = builder.set_trigger_type( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::TriggerTypeEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "status" => { + builder = builder.set_status( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::JobStatusEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "version" => { + builder = builder.set_version( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "previous_version_id" => { + builder = builder.set_previous_version_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "replaced_by_id" => { + builder = builder.set_replaced_by_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "idempotency_key" => { + builder = builder.set_idempotency_key( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "input" => { + builder = builder.set_input( + Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?) + ); + } + "run_at" => { + builder = builder.set_run_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "cron_expression" => { + builder = builder.set_cron_expression( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "cron_timezone" => { + builder = builder.set_cron_timezone( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "cron_starts_at" => { + builder = builder.set_cron_starts_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "cron_ends_at" => { + builder = builder.set_cron_ends_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "cron_next_run_at" => { + builder = builder.set_cron_next_run_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "cron_last_tick_at" => { + builder = builder.set_cron_last_tick_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "created_at" => { + builder = builder.set_created_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "retired_at" => { + builder = builder.set_retired_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::job_resource_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_job_status_response.rs b/sdks/rust/src/protocol_serde/shape_job_status_response.rs new file mode 100644 index 0000000..a4b4176 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_job_status_response.rs @@ -0,0 +1,50 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_job_status_response<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::JobStatusResponseBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "job_id" => { + builder = builder.set_job_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "job_status" => { + builder = builder.set_job_status( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::JobStatusEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "latest_execution" => { + builder = builder.set_latest_execution( + crate::protocol_serde::shape_execution_summary::de_execution_summary(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::job_status_response_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_job_summary.rs b/sdks/rust/src/protocol_serde/shape_job_summary.rs new file mode 100644 index 0000000..b47d421 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_job_summary.rs @@ -0,0 +1,75 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_job_summary<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::JobSummaryBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "job_id" => { + builder = builder.set_job_id( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "endpoint" => { + builder = builder.set_endpoint( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "trigger_type" => { + builder = builder.set_trigger_type( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::TriggerTypeEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "status" => { + builder = builder.set_status( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::JobStatusEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "version" => { + builder = builder.set_version( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "created_at" => { + builder = builder.set_created_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::job_summary_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_job_summary_list.rs b/sdks/rust/src/protocol_serde/shape_job_summary_list.rs new file mode 100644 index 0000000..dd2ecec --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_job_summary_list.rs @@ -0,0 +1,30 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_job_summary_list<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result>, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => { + let mut items = Vec::new(); + loop { + match tokens.peek() { + Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => { + tokens.next().transpose().unwrap(); break; + } + _ => { + let value = + crate::protocol_serde::shape_job_summary::de_job_summary(tokens)? + ; + if let Some(value) = value { + items.push(value); + } + } + } + } + Ok(Some(items)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start array or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_job_version_list.rs b/sdks/rust/src/protocol_serde/shape_job_version_list.rs new file mode 100644 index 0000000..fe4e617 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_job_version_list.rs @@ -0,0 +1,30 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_job_version_list<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result>, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => { + let mut items = Vec::new(); + loop { + match tokens.peek() { + Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => { + tokens.next().transpose().unwrap(); break; + } + _ => { + let value = + crate::protocol_serde::shape_job_resource::de_job_resource(tokens)? + ; + if let Some(value) = value { + items.push(value); + } + } + } + } + Ok(Some(items)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start array or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_list_endpoints.rs b/sdks/rust/src/protocol_serde/shape_list_endpoints.rs new file mode 100644 index 0000000..3bc2874 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_list_endpoints.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_endpoints_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::list_endpoints::ListEndpointsError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "UnauthorizedError" => crate::operation::list_endpoints::ListEndpointsError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::list_endpoints::ListEndpointsError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::list_endpoints::ListEndpointsError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::list_endpoints::ListEndpointsError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_endpoints_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::list_endpoints::builders::ListEndpointsOutputBuilder::default(); + output = crate::protocol_serde::shape_list_endpoints::de_list_endpoints(_response_body, output).map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)?; + crate::serde_util::list_endpoints_output_output_correct_errors(output).build().map_err(crate::operation::list_endpoints::ListEndpointsError::unhandled)? + }) +} + +pub fn ser_list_endpoints_headers( + input: &crate::operation::list_endpoints::ListEndpointsInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_list_endpoints(value: &[u8], mut builder: crate::operation::list_endpoints::builders::ListEndpointsOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "cursor" => { + builder = builder.set_cursor( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_endpoint_list::de_endpoint_list(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_list_execution_attempts.rs b/sdks/rust/src/protocol_serde/shape_list_execution_attempts.rs new file mode 100644 index 0000000..11e67dc --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_list_execution_attempts.rs @@ -0,0 +1,157 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_execution_attempts_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::list_execution_attempts::ListExecutionAttemptsError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::list_execution_attempts::ListExecutionAttemptsError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::list_execution_attempts::ListExecutionAttemptsError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::list_execution_attempts::ListExecutionAttemptsError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::list_execution_attempts::ListExecutionAttemptsError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_execution_attempts_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::list_execution_attempts::builders::ListExecutionAttemptsOutputBuilder::default(); + output = crate::protocol_serde::shape_list_execution_attempts::de_list_execution_attempts(_response_body, output).map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)?; + crate::serde_util::list_execution_attempts_output_output_correct_errors(output).build().map_err(crate::operation::list_execution_attempts::ListExecutionAttemptsError::unhandled)? + }) +} + +pub fn ser_list_execution_attempts_headers( + input: &crate::operation::list_execution_attempts::ListExecutionAttemptsInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_list_execution_attempts(value: &[u8], mut builder: crate::operation::list_execution_attempts::builders::ListExecutionAttemptsOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "cursor" => { + builder = builder.set_cursor( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_attempt_resource_list::de_attempt_resource_list(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_list_execution_logs.rs b/sdks/rust/src/protocol_serde/shape_list_execution_logs.rs new file mode 100644 index 0000000..3cfb2c2 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_list_execution_logs.rs @@ -0,0 +1,157 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_execution_logs_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::list_execution_logs::ListExecutionLogsError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::list_execution_logs::ListExecutionLogsError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::list_execution_logs::ListExecutionLogsError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::list_execution_logs::ListExecutionLogsError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::list_execution_logs::ListExecutionLogsError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_execution_logs_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::list_execution_logs::builders::ListExecutionLogsOutputBuilder::default(); + output = crate::protocol_serde::shape_list_execution_logs::de_list_execution_logs(_response_body, output).map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)?; + crate::serde_util::list_execution_logs_output_output_correct_errors(output).build().map_err(crate::operation::list_execution_logs::ListExecutionLogsError::unhandled)? + }) +} + +pub fn ser_list_execution_logs_headers( + input: &crate::operation::list_execution_logs::ListExecutionLogsInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_list_execution_logs(value: &[u8], mut builder: crate::operation::list_execution_logs::builders::ListExecutionLogsOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "cursor" => { + builder = builder.set_cursor( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_execution_log_list::de_execution_log_list(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_list_job_executions.rs b/sdks/rust/src/protocol_serde/shape_list_job_executions.rs new file mode 100644 index 0000000..70bf534 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_list_job_executions.rs @@ -0,0 +1,157 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_job_executions_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::list_job_executions::ListJobExecutionsError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::list_job_executions::ListJobExecutionsError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::list_job_executions::ListJobExecutionsError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::list_job_executions::ListJobExecutionsError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::list_job_executions::ListJobExecutionsError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_job_executions_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::list_job_executions::builders::ListJobExecutionsOutputBuilder::default(); + output = crate::protocol_serde::shape_list_job_executions::de_list_job_executions(_response_body, output).map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)?; + crate::serde_util::list_job_executions_output_output_correct_errors(output).build().map_err(crate::operation::list_job_executions::ListJobExecutionsError::unhandled)? + }) +} + +pub fn ser_list_job_executions_headers( + input: &crate::operation::list_job_executions::ListJobExecutionsInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_list_job_executions(value: &[u8], mut builder: crate::operation::list_job_executions::builders::ListJobExecutionsOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "cursor" => { + builder = builder.set_cursor( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_execution_resource_list::de_execution_resource_list(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_list_jobs.rs b/sdks/rust/src/protocol_serde/shape_list_jobs.rs new file mode 100644 index 0000000..88a897e --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_list_jobs.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_jobs_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::list_jobs::ListJobsError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::list_jobs::ListJobsError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "UnauthorizedError" => crate::operation::list_jobs::ListJobsError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::list_jobs::ListJobsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::list_jobs::ListJobsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::list_jobs::ListJobsError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::list_jobs::ListJobsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::list_jobs::ListJobsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::list_jobs::ListJobsError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::list_jobs::ListJobsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::list_jobs::ListJobsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::list_jobs::ListJobsError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_jobs_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::list_jobs::builders::ListJobsOutputBuilder::default(); + output = crate::protocol_serde::shape_list_jobs::de_list_jobs(_response_body, output).map_err(crate::operation::list_jobs::ListJobsError::unhandled)?; + crate::serde_util::list_jobs_output_output_correct_errors(output).build().map_err(crate::operation::list_jobs::ListJobsError::unhandled)? + }) +} + +pub fn ser_list_jobs_headers( + input: &crate::operation::list_jobs::ListJobsInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_list_jobs(value: &[u8], mut builder: crate::operation::list_jobs::builders::ListJobsOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "cursor" => { + builder = builder.set_cursor( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_job_summary_list::de_job_summary_list(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_list_payload_specs.rs b/sdks/rust/src/protocol_serde/shape_list_payload_specs.rs new file mode 100644 index 0000000..1f1d2b5 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_list_payload_specs.rs @@ -0,0 +1,141 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_payload_specs_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "UnauthorizedError" => crate::operation::list_payload_specs::ListPayloadSpecsError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::list_payload_specs::ListPayloadSpecsError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::list_payload_specs::ListPayloadSpecsError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::list_payload_specs::ListPayloadSpecsError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_list_payload_specs_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::list_payload_specs::builders::ListPayloadSpecsOutputBuilder::default(); + output = crate::protocol_serde::shape_list_payload_specs::de_list_payload_specs(_response_body, output).map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)?; + crate::serde_util::list_payload_specs_output_output_correct_errors(output).build().map_err(crate::operation::list_payload_specs::ListPayloadSpecsError::unhandled)? + }) +} + +pub fn ser_list_payload_specs_headers( + input: &crate::operation::list_payload_specs::ListPayloadSpecsInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub(crate) fn de_list_payload_specs(value: &[u8], mut builder: crate::operation::list_payload_specs::builders::ListPayloadSpecsOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "cursor" => { + builder = builder.set_cursor( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_payload_spec_list::de_payload_spec_list(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_not_found_error.rs b/sdks/rust/src/protocol_serde/shape_not_found_error.rs new file mode 100644 index 0000000..bb33142 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_not_found_error.rs @@ -0,0 +1,36 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_not_found_error_json_err(value: &[u8], mut builder: crate::types::error::builders::NotFoundErrorBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "error" => { + builder = builder.set_error( + crate::protocol_serde::shape_error_detail::de_error_detail(tokens)? + ); + } + "Message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_payload_spec_list.rs b/sdks/rust/src/protocol_serde/shape_payload_spec_list.rs new file mode 100644 index 0000000..a2d77f4 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_payload_spec_list.rs @@ -0,0 +1,30 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_payload_spec_list<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result>, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartArray { .. }) => { + let mut items = Vec::new(); + loop { + match tokens.peek() { + Some(Ok(::aws_smithy_json::deserialize::Token::EndArray { .. })) => { + tokens.next().transpose().unwrap(); break; + } + _ => { + let value = + crate::protocol_serde::shape_payload_spec_resource::de_payload_spec_resource(tokens)? + ; + if let Some(value) = value { + items.push(value); + } + } + } + } + Ok(Some(items)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start array or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_payload_spec_resource.rs b/sdks/rust/src/protocol_serde/shape_payload_spec_resource.rs new file mode 100644 index 0000000..08b89df --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_payload_spec_resource.rs @@ -0,0 +1,51 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_payload_spec_resource<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::PayloadSpecResourceBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "name" => { + builder = builder.set_name( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + "schema" => { + builder = builder.set_schema( + Some(::aws_smithy_json::deserialize::token::expect_document(tokens)?) + ); + } + "created_at" => { + builder = builder.set_created_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + "updated_at" => { + builder = builder.set_updated_at( + ::aws_smithy_json::deserialize::token::expect_timestamp_or_null(tokens.next(), ::aws_smithy_types::date_time::Format::DateTimeWithOffset)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(crate::serde_util::payload_spec_resource_correct_errors(builder).build().map_err(|err|::aws_smithy_json::deserialize::error::DeserializeError::custom_source("Response was invalid", err))?)) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_rate_limited_error.rs b/sdks/rust/src/protocol_serde/shape_rate_limited_error.rs new file mode 100644 index 0000000..dc5210f --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_rate_limited_error.rs @@ -0,0 +1,36 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_rate_limited_error_json_err(value: &[u8], mut builder: crate::types::error::builders::RateLimitedErrorBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "error" => { + builder = builder.set_error( + crate::protocol_serde::shape_error_detail::de_error_detail(tokens)? + ); + } + "Message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_retry_policy.rs b/sdks/rust/src/protocol_serde/shape_retry_policy.rs new file mode 100644 index 0000000..6a3076b --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_retry_policy.rs @@ -0,0 +1,76 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub fn ser_retry_policy( + object: &mut ::aws_smithy_json::serialize::JsonObjectWriter, + input: &crate::types::RetryPolicy, + ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> { + if let Some(var_1) = &input.max_attempts { + object.key("max_attempts").number(#[allow(clippy::useless_conversion)]::aws_smithy_types::Number::NegInt((*var_1).into())); + } + if let Some(var_2) = &input.backoff { + object.key("backoff").string(var_2.as_str()); + } + if let Some(var_3) = &input.initial_delay_ms { + object.key("initial_delay_ms").number(#[allow(clippy::useless_conversion)]::aws_smithy_types::Number::NegInt((*var_3).into())); + } + if let Some(var_4) = &input.max_delay_ms { + object.key("max_delay_ms").number(#[allow(clippy::useless_conversion)]::aws_smithy_types::Number::NegInt((*var_4).into())); + } + Ok(()) +} + +pub(crate) fn de_retry_policy<'a, I>(tokens: &mut ::std::iter::Peekable) -> ::std::result::Result, ::aws_smithy_json::deserialize::error::DeserializeError> + where I: Iterator, ::aws_smithy_json::deserialize::error::DeserializeError>> { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::ValueNull { .. }) => Ok(None), + Some(::aws_smithy_json::deserialize::Token::StartObject { .. }) => { + #[allow(unused_mut)] + let mut builder = crate::types::builders::RetryPolicyBuilder::default(); + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "max_attempts" => { + builder = builder.set_max_attempts( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i32::try_from) + .transpose()? + ); + } + "backoff" => { + builder = builder.set_backoff( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + crate::types::BackoffTypeEnum::from(u.as_ref()) + ) + ).transpose()? + ); + } + "initial_delay_ms" => { + builder = builder.set_initial_delay_ms( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i64::try_from) + .transpose()? + ); + } + "max_delay_ms" => { + builder = builder.set_max_delay_ms( + ::aws_smithy_json::deserialize::token::expect_number_or_null(tokens.next())? + .map(i64::try_from) + .transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + Ok(Some(builder.build())) + } + _ => { + Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("expected start object or null")) + } + } +} + diff --git a/sdks/rust/src/protocol_serde/shape_unauthorized_error.rs b/sdks/rust/src/protocol_serde/shape_unauthorized_error.rs new file mode 100644 index 0000000..f207d3f --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_unauthorized_error.rs @@ -0,0 +1,36 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_unauthorized_error_json_err(value: &[u8], mut builder: crate::types::error::builders::UnauthorizedErrorBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "error" => { + builder = builder.set_error( + crate::protocol_serde::shape_error_detail::de_error_detail(tokens)? + ); + } + "Message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_unprocessable_entity_error.rs b/sdks/rust/src/protocol_serde/shape_unprocessable_entity_error.rs new file mode 100644 index 0000000..3b63c89 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_unprocessable_entity_error.rs @@ -0,0 +1,36 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn de_unprocessable_entity_error_json_err(value: &[u8], mut builder: crate::types::error::builders::UnprocessableEntityErrorBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "error" => { + builder = builder.set_error( + crate::protocol_serde::shape_error_detail::de_error_detail(tokens)? + ); + } + "Message" => { + builder = builder.set_message( + ::aws_smithy_json::deserialize::token::expect_string_or_null(tokens.next())?.map(|s| + s.to_unescaped().map(|u| + u.into_owned() + ) + ).transpose()? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_update_endpoint.rs b/sdks/rust/src/protocol_serde/shape_update_endpoint.rs new file mode 100644 index 0000000..fb0dcf3 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_update_endpoint.rs @@ -0,0 +1,188 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_update_endpoint_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::update_endpoint::UpdateEndpointError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::update_endpoint::UpdateEndpointError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InvalidRequestError" => crate::operation::update_endpoint::UpdateEndpointError::InvalidRequestError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InvalidRequestErrorBuilder::default(); + output = crate::protocol_serde::shape_invalid_request_error::de_invalid_request_error_json_err(_response_body, output).map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::invalid_request_error_correct_errors(output).build().map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnprocessableEntityError" => crate::operation::update_endpoint::UpdateEndpointError::UnprocessableEntityError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnprocessableEntityErrorBuilder::default(); + output = crate::protocol_serde::shape_unprocessable_entity_error::de_unprocessable_entity_error_json_err(_response_body, output).map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unprocessable_entity_error_correct_errors(output).build().map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::update_endpoint::UpdateEndpointError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::update_endpoint::UpdateEndpointError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::update_endpoint::UpdateEndpointError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::update_endpoint::UpdateEndpointError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_update_endpoint_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::update_endpoint::builders::UpdateEndpointOutputBuilder::default(); + output = crate::protocol_serde::shape_update_endpoint::de_update_endpoint(_response_body, output).map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)?; + crate::serde_util::update_endpoint_output_output_correct_errors(output).build().map_err(crate::operation::update_endpoint::UpdateEndpointError::unhandled)? + }) +} + +pub fn ser_update_endpoint_headers( + input: &crate::operation::update_endpoint::UpdateEndpointInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub fn ser_update_endpoint_input(input: &crate::operation::update_endpoint::UpdateEndpointInput) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> { + let mut out = String::new(); + let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out); + crate::protocol_serde::shape_update_endpoint_input::ser_update_endpoint_input_input(&mut object, input)?; + object.finish(); + Ok(::aws_smithy_types::body::SdkBody::from(out)) +} + +pub(crate) fn de_update_endpoint(value: &[u8], mut builder: crate::operation::update_endpoint::builders::UpdateEndpointOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_endpoint_resource::de_endpoint_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_update_endpoint_input.rs b/sdks/rust/src/protocol_serde/shape_update_endpoint_input.rs new file mode 100644 index 0000000..d296fe3 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_update_endpoint_input.rs @@ -0,0 +1,23 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub fn ser_update_endpoint_input_input( + object: &mut ::aws_smithy_json::serialize::JsonObjectWriter, + input: &crate::operation::update_endpoint::UpdateEndpointInput, + ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> { + if let Some(var_1) = &input.config { + object.key("config").string(var_1.as_str()); + } + if let Some(var_2) = &input.payload_spec { + object.key("payload_spec").string(var_2.as_str()); + } + if let Some(var_3) = &input.retry_policy { + #[allow(unused_mut)] + let mut object_4 = object.key("retry_policy").start_object(); + crate::protocol_serde::shape_retry_policy::ser_retry_policy(&mut object_4, var_3)?; + object_4.finish(); + } + if let Some(var_5) = &input.spec { + object.key("spec").document(var_5); + } + Ok(()) +} + diff --git a/sdks/rust/src/protocol_serde/shape_update_job.rs b/sdks/rust/src/protocol_serde/shape_update_job.rs new file mode 100644 index 0000000..09027f5 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_update_job.rs @@ -0,0 +1,188 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_update_job_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::update_job::UpdateJobError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::update_job::UpdateJobError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::update_job::UpdateJobError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::update_job::UpdateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::update_job::UpdateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InvalidRequestError" => crate::operation::update_job::UpdateJobError::InvalidRequestError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InvalidRequestErrorBuilder::default(); + output = crate::protocol_serde::shape_invalid_request_error::de_invalid_request_error_json_err(_response_body, output).map_err(crate::operation::update_job::UpdateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::invalid_request_error_correct_errors(output).build().map_err(crate::operation::update_job::UpdateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnprocessableEntityError" => crate::operation::update_job::UpdateJobError::UnprocessableEntityError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnprocessableEntityErrorBuilder::default(); + output = crate::protocol_serde::shape_unprocessable_entity_error::de_unprocessable_entity_error_json_err(_response_body, output).map_err(crate::operation::update_job::UpdateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unprocessable_entity_error_correct_errors(output).build().map_err(crate::operation::update_job::UpdateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::update_job::UpdateJobError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::update_job::UpdateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::update_job::UpdateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::update_job::UpdateJobError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::update_job::UpdateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::update_job::UpdateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::update_job::UpdateJobError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::update_job::UpdateJobError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::update_job::UpdateJobError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::update_job::UpdateJobError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_update_job_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::update_job::builders::UpdateJobOutputBuilder::default(); + output = crate::protocol_serde::shape_update_job::de_update_job(_response_body, output).map_err(crate::operation::update_job::UpdateJobError::unhandled)?; + crate::serde_util::update_job_output_output_correct_errors(output).build().map_err(crate::operation::update_job::UpdateJobError::unhandled)? + }) +} + +pub fn ser_update_job_headers( + input: &crate::operation::update_job::UpdateJobInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub fn ser_update_job_input(input: &crate::operation::update_job::UpdateJobInput) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> { + let mut out = String::new(); + let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out); + crate::protocol_serde::shape_update_job_input::ser_update_job_input_input(&mut object, input)?; + object.finish(); + Ok(::aws_smithy_types::body::SdkBody::from(out)) +} + +pub(crate) fn de_update_job(value: &[u8], mut builder: crate::operation::update_job::builders::UpdateJobOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_job_resource::de_job_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_update_job_input.rs b/sdks/rust/src/protocol_serde/shape_update_job_input.rs new file mode 100644 index 0000000..ea1502d --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_update_job_input.rs @@ -0,0 +1,23 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub fn ser_update_job_input_input( + object: &mut ::aws_smithy_json::serialize::JsonObjectWriter, + input: &crate::operation::update_job::UpdateJobInput, + ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> { + if let Some(var_1) = &input.cron { + object.key("cron").string(var_1.as_str()); + } + if let Some(var_2) = &input.ends_at { + object.key("ends_at").date_time(var_2, ::aws_smithy_types::date_time::Format::DateTime)?; + } + if let Some(var_3) = &input.input { + object.key("input").document(var_3); + } + if let Some(var_4) = &input.starts_at { + object.key("starts_at").date_time(var_4, ::aws_smithy_types::date_time::Format::DateTime)?; + } + if let Some(var_5) = &input.timezone { + object.key("timezone").string(var_5.as_str()); + } + Ok(()) +} + diff --git a/sdks/rust/src/protocol_serde/shape_update_payload_spec.rs b/sdks/rust/src/protocol_serde/shape_update_payload_spec.rs new file mode 100644 index 0000000..cb3a6c4 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_update_payload_spec.rs @@ -0,0 +1,172 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(clippy::unnecessary_wraps)] +pub fn de_update_payload_spec_http_error(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + #[allow(unused_mut)] + let mut generic_builder = crate::protocol_serde::parse_http_error_metadata(_response_status, _response_headers, _response_body).map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)?; + let generic = generic_builder.build(); + let error_code = match generic.code() { + Some(code) => code, + None => return Err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled(generic)) + }; + + let _error_message = generic.message().map(|msg|msg.to_owned()); + Err(match error_code { + "NotFoundError" => crate::operation::update_payload_spec::UpdatePayloadSpecError::NotFoundError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::NotFoundErrorBuilder::default(); + output = crate::protocol_serde::shape_not_found_error::de_not_found_error_json_err(_response_body, output).map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::not_found_error_correct_errors(output).build().map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InvalidRequestError" => crate::operation::update_payload_spec::UpdatePayloadSpecError::InvalidRequestError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InvalidRequestErrorBuilder::default(); + output = crate::protocol_serde::shape_invalid_request_error::de_invalid_request_error_json_err(_response_body, output).map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::invalid_request_error_correct_errors(output).build().map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "UnauthorizedError" => crate::operation::update_payload_spec::UpdatePayloadSpecError::UnauthorizedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::UnauthorizedErrorBuilder::default(); + output = crate::protocol_serde::shape_unauthorized_error::de_unauthorized_error_json_err(_response_body, output).map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::unauthorized_error_correct_errors(output).build().map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "InternalError" => crate::operation::update_payload_spec::UpdatePayloadSpecError::InternalError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::InternalErrorBuilder::default(); + output = crate::protocol_serde::shape_internal_error::de_internal_error_json_err(_response_body, output).map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::internal_error_correct_errors(output).build().map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + "RateLimitedError" => crate::operation::update_payload_spec::UpdatePayloadSpecError::RateLimitedError({ + #[allow(unused_mut)] + let mut tmp = + { + #[allow(unused_mut)] + let mut output = crate::types::error::builders::RateLimitedErrorBuilder::default(); + output = crate::protocol_serde::shape_rate_limited_error::de_rate_limited_error_json_err(_response_body, output).map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)?; + let output = output.meta(generic); + crate::serde_util::rate_limited_error_correct_errors(output).build().map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)? + } + ; + if tmp.message.is_none() { + tmp.message = _error_message; + } + tmp + }), + _ => crate::operation::update_payload_spec::UpdatePayloadSpecError::generic(generic) + }) +} + +#[allow(clippy::unnecessary_wraps)] +pub fn de_update_payload_spec_http_response(_response_status: u16, _response_headers: &::aws_smithy_runtime_api::http::Headers, _response_body: &[u8]) -> std::result::Result { + Ok({ + #[allow(unused_mut)] + let mut output = crate::operation::update_payload_spec::builders::UpdatePayloadSpecOutputBuilder::default(); + output = crate::protocol_serde::shape_update_payload_spec::de_update_payload_spec(_response_body, output).map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)?; + crate::serde_util::update_payload_spec_output_output_correct_errors(output).build().map_err(crate::operation::update_payload_spec::UpdatePayloadSpecError::unhandled)? + }) +} + +pub fn ser_update_payload_spec_headers( + input: &crate::operation::update_payload_spec::UpdatePayloadSpecInput, + mut builder: ::http::request::Builder + ) -> std::result::Result<::http::request::Builder, ::aws_smithy_types::error::operation::BuildError> { + if let ::std::option::Option::Some(inner_1) = &input.org_id { + let formatted_2 = inner_1.as_str(); + let header_value = formatted_2; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("org_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-org-id", header_value); + } + if let ::std::option::Option::Some(inner_3) = &input.workspace_id { + let formatted_4 = inner_3.as_str(); + let header_value = formatted_4; + let header_value: ::http::HeaderValue = header_value.parse().map_err(|err| { + ::aws_smithy_types::error::operation::BuildError::invalid_field("workspace_id", format!( + "`{}` cannot be used as a header value: {}", + &header_value, + err + )) + })?; + builder = builder.header("x-workspace-id", header_value); + } + Ok(builder) +} + +pub fn ser_update_payload_spec_input(input: &crate::operation::update_payload_spec::UpdatePayloadSpecInput) -> ::std::result::Result<::aws_smithy_types::body::SdkBody, ::aws_smithy_types::error::operation::SerializationError> { + let mut out = String::new(); + let mut object = ::aws_smithy_json::serialize::JsonObjectWriter::new(&mut out); + crate::protocol_serde::shape_update_payload_spec_input::ser_update_payload_spec_input_input(&mut object, input)?; + object.finish(); + Ok(::aws_smithy_types::body::SdkBody::from(out)) +} + +pub(crate) fn de_update_payload_spec(value: &[u8], mut builder: crate::operation::update_payload_spec::builders::UpdatePayloadSpecOutputBuilder) -> ::std::result::Result { + let mut tokens_owned = ::aws_smithy_json::deserialize::json_token_iter(crate::protocol_serde::or_empty_doc(value)).peekable(); + let tokens = &mut tokens_owned; + ::aws_smithy_json::deserialize::token::expect_start_object(tokens.next())?; + loop { + match tokens.next().transpose()? { + Some(::aws_smithy_json::deserialize::Token::EndObject { .. }) => break, + Some(::aws_smithy_json::deserialize::Token::ObjectKey { key, .. }) => { + match key.to_unescaped()?.as_ref() { + "data" => { + builder = builder.set_data( + crate::protocol_serde::shape_payload_spec_resource::de_payload_spec_resource(tokens)? + ); + } + _ => ::aws_smithy_json::deserialize::token::skip_value(tokens)? + } + } + other => return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom(format!("expected object key or end object, found: {:?}", other))) + } + } + if tokens.next().is_some() { + return Err(::aws_smithy_json::deserialize::error::DeserializeError::custom("found more JSON tokens after completing parsing")); + } + Ok(builder) +} + diff --git a/sdks/rust/src/protocol_serde/shape_update_payload_spec_input.rs b/sdks/rust/src/protocol_serde/shape_update_payload_spec_input.rs new file mode 100644 index 0000000..3bddd02 --- /dev/null +++ b/sdks/rust/src/protocol_serde/shape_update_payload_spec_input.rs @@ -0,0 +1,11 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub fn ser_update_payload_spec_input_input( + object: &mut ::aws_smithy_json::serialize::JsonObjectWriter, + input: &crate::operation::update_payload_spec::UpdatePayloadSpecInput, + ) -> ::std::result::Result<(), ::aws_smithy_types::error::operation::SerializationError> { + if let Some(var_1) = &input.schema { + object.key("schema").document(var_1); + } + Ok(()) +} + diff --git a/sdks/rust/src/sdk_feature_tracker.rs b/sdks/rust/src/sdk_feature_tracker.rs new file mode 100644 index 0000000..be4a8d4 --- /dev/null +++ b/sdks/rust/src/sdk_feature_tracker.rs @@ -0,0 +1,222 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#[allow(dead_code)] +pub(crate) mod rpc_v2_cbor { + use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature; + use aws_smithy_runtime_api::box_error::BoxError; + use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut; + use aws_smithy_runtime_api::client::interceptors::Intercept; + use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; + use aws_smithy_types::config_bag::ConfigBag; + + #[derive(Debug)] + pub(crate) struct RpcV2CborFeatureTrackerInterceptor; + + impl RpcV2CborFeatureTrackerInterceptor { + pub(crate) fn new() -> Self { + Self + } + } + + impl Intercept for RpcV2CborFeatureTrackerInterceptor { + fn name(&self) -> &'static str { + "RpcV2CborFeatureTrackerInterceptor" + } + + fn modify_before_serialization( + &self, + _context: &mut BeforeSerializationInterceptorContextMut<'_>, + _runtime_components: &RuntimeComponents, + cfg: &mut ConfigBag, + ) -> Result<(), BoxError> { + cfg.interceptor_state() + .store_append::(SmithySdkFeature::ProtocolRpcV2Cbor); + Ok(()) + } + } +} + +#[allow(dead_code)] +pub(crate) mod paginator { + use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature; + use aws_smithy_runtime_api::box_error::BoxError; + use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut; + use aws_smithy_runtime_api::client::interceptors::{Intercept, SharedInterceptor}; + use aws_smithy_runtime_api::client::runtime_components::{ + RuntimeComponents, RuntimeComponentsBuilder, + }; + use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin; + use aws_smithy_types::config_bag::ConfigBag; + use std::borrow::Cow; + + #[derive(Debug)] + struct PaginatorFeatureTrackerInterceptor; + + impl PaginatorFeatureTrackerInterceptor { + pub(crate) fn new() -> Self { + Self + } + } + + impl Intercept for PaginatorFeatureTrackerInterceptor { + fn name(&self) -> &'static str { + "PaginatorFeatureTrackerInterceptor" + } + + fn modify_before_serialization( + &self, + _context: &mut BeforeSerializationInterceptorContextMut<'_>, + _runtime_components: &RuntimeComponents, + cfg: &mut ConfigBag, + ) -> Result<(), BoxError> { + cfg.interceptor_state() + .store_append::(SmithySdkFeature::Paginator); + Ok(()) + } + } + + #[derive(Debug)] + pub(crate) struct PaginatorFeatureTrackerRuntimePlugin { + runtime_components: RuntimeComponentsBuilder, + } + + impl PaginatorFeatureTrackerRuntimePlugin { + pub(crate) fn new() -> Self { + Self { + runtime_components: RuntimeComponentsBuilder::new( + "PaginatorFeatureTrackerRuntimePlugin", + ) + .with_interceptor(SharedInterceptor::new( + PaginatorFeatureTrackerInterceptor::new(), + )), + } + } + } + + impl RuntimePlugin for PaginatorFeatureTrackerRuntimePlugin { + fn runtime_components( + &self, + _: &RuntimeComponentsBuilder, + ) -> Cow<'_, RuntimeComponentsBuilder> { + Cow::Borrowed(&self.runtime_components) + } + } +} + +#[allow(dead_code)] +pub(crate) mod waiter { + use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature; + use aws_smithy_runtime_api::box_error::BoxError; + use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextMut; + use aws_smithy_runtime_api::client::interceptors::{Intercept, SharedInterceptor}; + use aws_smithy_runtime_api::client::runtime_components::{ + RuntimeComponents, RuntimeComponentsBuilder, + }; + use aws_smithy_runtime_api::client::runtime_plugin::RuntimePlugin; + use aws_smithy_types::config_bag::ConfigBag; + use std::borrow::Cow; + + #[derive(Debug)] + struct WaiterFeatureTrackerInterceptor; + + impl WaiterFeatureTrackerInterceptor { + pub(crate) fn new() -> Self { + Self + } + } + + impl Intercept for WaiterFeatureTrackerInterceptor { + fn name(&self) -> &'static str { + "WaiterFeatureTrackerInterceptor" + } + + fn modify_before_serialization( + &self, + _context: &mut BeforeSerializationInterceptorContextMut<'_>, + _runtime_components: &RuntimeComponents, + cfg: &mut ConfigBag, + ) -> Result<(), BoxError> { + cfg.interceptor_state() + .store_append::(SmithySdkFeature::Waiter); + Ok(()) + } + } + + #[derive(Debug)] + pub(crate) struct WaiterFeatureTrackerRuntimePlugin { + runtime_components: RuntimeComponentsBuilder, + } + + impl WaiterFeatureTrackerRuntimePlugin { + pub(crate) fn new() -> Self { + Self { + runtime_components: RuntimeComponentsBuilder::new( + "WaiterFeatureTrackerRuntimePlugin", + ) + .with_interceptor(SharedInterceptor::new( + WaiterFeatureTrackerInterceptor::new(), + )), + } + } + } + + impl RuntimePlugin for WaiterFeatureTrackerRuntimePlugin { + fn runtime_components( + &self, + _: &RuntimeComponentsBuilder, + ) -> Cow<'_, RuntimeComponentsBuilder> { + Cow::Borrowed(&self.runtime_components) + } + } +} + +#[allow(dead_code)] +pub(crate) mod retry_mode { + use aws_smithy_runtime::client::sdk_feature::SmithySdkFeature; + use aws_smithy_runtime_api::box_error::BoxError; + use aws_smithy_runtime_api::client::interceptors::context::BeforeSerializationInterceptorContextRef; + use aws_smithy_runtime_api::client::interceptors::Intercept; + use aws_smithy_runtime_api::client::runtime_components::RuntimeComponents; + use aws_smithy_types::config_bag::ConfigBag; + use aws_smithy_types::retry::{RetryConfig, RetryMode}; + + #[derive(Debug)] + pub(crate) struct RetryModeFeatureTrackerInterceptor; + + impl RetryModeFeatureTrackerInterceptor { + pub(crate) fn new() -> Self { + Self + } + } + + impl Intercept for RetryModeFeatureTrackerInterceptor { + fn name(&self) -> &'static str { + "RetryModeFeatureTrackerInterceptor" + } + + fn read_before_serialization( + &self, + _context: &BeforeSerializationInterceptorContextRef<'_>, + _runtime_components: &RuntimeComponents, + cfg: &mut ConfigBag, + ) -> Result<(), BoxError> { + cfg.load::() + .map(|retry_config| match retry_config.mode() { + RetryMode::Standard => SmithySdkFeature::RetryModeStandard, + RetryMode::Adaptive => SmithySdkFeature::RetryModeAdaptive, + _ => unreachable!("retry mode must be standard or adaptive"), + }) + .map(|feature| { + cfg.interceptor_state() + .store_append::(feature) + }); + + Ok(()) + } + } +} + diff --git a/sdks/rust/src/serde_util.rs b/sdks/rust/src/serde_util.rs new file mode 100644 index 0000000..8953ee3 --- /dev/null +++ b/sdks/rust/src/serde_util.rs @@ -0,0 +1,227 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub(crate) fn not_found_error_correct_errors(mut builder: crate::types::error::builders::NotFoundErrorBuilder) -> crate::types::error::builders::NotFoundErrorBuilder { + if builder.error.is_none() { builder.error = { let builder = crate::types::builders::ErrorDetailBuilder::default(); crate::serde_util::error_detail_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn conflict_error_correct_errors(mut builder: crate::types::error::builders::ConflictErrorBuilder) -> crate::types::error::builders::ConflictErrorBuilder { + if builder.error.is_none() { builder.error = { let builder = crate::types::builders::ErrorDetailBuilder::default(); crate::serde_util::error_detail_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn unauthorized_error_correct_errors(mut builder: crate::types::error::builders::UnauthorizedErrorBuilder) -> crate::types::error::builders::UnauthorizedErrorBuilder { + if builder.error.is_none() { builder.error = { let builder = crate::types::builders::ErrorDetailBuilder::default(); crate::serde_util::error_detail_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn internal_error_correct_errors(mut builder: crate::types::error::builders::InternalErrorBuilder) -> crate::types::error::builders::InternalErrorBuilder { + if builder.error.is_none() { builder.error = { let builder = crate::types::builders::ErrorDetailBuilder::default(); crate::serde_util::error_detail_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn rate_limited_error_correct_errors(mut builder: crate::types::error::builders::RateLimitedErrorBuilder) -> crate::types::error::builders::RateLimitedErrorBuilder { + if builder.error.is_none() { builder.error = { let builder = crate::types::builders::ErrorDetailBuilder::default(); crate::serde_util::error_detail_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn cancel_execution_output_output_correct_errors(mut builder: crate::operation::cancel_execution::builders::CancelExecutionOutputBuilder) -> crate::operation::cancel_execution::builders::CancelExecutionOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::ExecutionResourceBuilder::default(); crate::serde_util::execution_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn cancel_job_output_output_correct_errors(mut builder: crate::operation::cancel_job::builders::CancelJobOutputBuilder) -> crate::operation::cancel_job::builders::CancelJobOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::JobResourceBuilder::default(); crate::serde_util::job_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn invalid_request_error_correct_errors(mut builder: crate::types::error::builders::InvalidRequestErrorBuilder) -> crate::types::error::builders::InvalidRequestErrorBuilder { + if builder.error.is_none() { builder.error = { let builder = crate::types::builders::ErrorDetailBuilder::default(); crate::serde_util::error_detail_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn unprocessable_entity_error_correct_errors(mut builder: crate::types::error::builders::UnprocessableEntityErrorBuilder) -> crate::types::error::builders::UnprocessableEntityErrorBuilder { + if builder.error.is_none() { builder.error = { let builder = crate::types::builders::ErrorDetailBuilder::default(); crate::serde_util::error_detail_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn create_endpoint_output_output_correct_errors(mut builder: crate::operation::create_endpoint::builders::CreateEndpointOutputBuilder) -> crate::operation::create_endpoint::builders::CreateEndpointOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::EndpointResourceBuilder::default(); crate::serde_util::endpoint_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn create_job_output_output_correct_errors(mut builder: crate::operation::create_job::builders::CreateJobOutputBuilder) -> crate::operation::create_job::builders::CreateJobOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::JobResourceBuilder::default(); crate::serde_util::job_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn create_payload_spec_output_output_correct_errors(mut builder: crate::operation::create_payload_spec::builders::CreatePayloadSpecOutputBuilder) -> crate::operation::create_payload_spec::builders::CreatePayloadSpecOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::PayloadSpecResourceBuilder::default(); crate::serde_util::payload_spec_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn get_endpoint_output_output_correct_errors(mut builder: crate::operation::get_endpoint::builders::GetEndpointOutputBuilder) -> crate::operation::get_endpoint::builders::GetEndpointOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::EndpointResourceBuilder::default(); crate::serde_util::endpoint_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn get_execution_output_output_correct_errors(mut builder: crate::operation::get_execution::builders::GetExecutionOutputBuilder) -> crate::operation::get_execution::builders::GetExecutionOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::ExecutionResourceBuilder::default(); crate::serde_util::execution_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn get_job_output_output_correct_errors(mut builder: crate::operation::get_job::builders::GetJobOutputBuilder) -> crate::operation::get_job::builders::GetJobOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::JobResourceBuilder::default(); crate::serde_util::job_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn get_job_status_output_output_correct_errors(mut builder: crate::operation::get_job_status::builders::GetJobStatusOutputBuilder) -> crate::operation::get_job_status::builders::GetJobStatusOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::JobStatusResponseBuilder::default(); crate::serde_util::job_status_response_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn get_job_versions_output_output_correct_errors(mut builder: crate::operation::get_job_versions::builders::GetJobVersionsOutputBuilder) -> crate::operation::get_job_versions::builders::GetJobVersionsOutputBuilder { + if builder.data.is_none() { builder.data = Some(Default::default()) } + builder + } + +pub(crate) fn get_payload_spec_output_output_correct_errors(mut builder: crate::operation::get_payload_spec::builders::GetPayloadSpecOutputBuilder) -> crate::operation::get_payload_spec::builders::GetPayloadSpecOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::PayloadSpecResourceBuilder::default(); crate::serde_util::payload_spec_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn list_endpoints_output_output_correct_errors(mut builder: crate::operation::list_endpoints::builders::ListEndpointsOutputBuilder) -> crate::operation::list_endpoints::builders::ListEndpointsOutputBuilder { + if builder.data.is_none() { builder.data = Some(Default::default()) } + builder + } + +pub(crate) fn list_execution_attempts_output_output_correct_errors(mut builder: crate::operation::list_execution_attempts::builders::ListExecutionAttemptsOutputBuilder) -> crate::operation::list_execution_attempts::builders::ListExecutionAttemptsOutputBuilder { + if builder.data.is_none() { builder.data = Some(Default::default()) } + builder + } + +pub(crate) fn list_execution_logs_output_output_correct_errors(mut builder: crate::operation::list_execution_logs::builders::ListExecutionLogsOutputBuilder) -> crate::operation::list_execution_logs::builders::ListExecutionLogsOutputBuilder { + if builder.data.is_none() { builder.data = Some(Default::default()) } + builder + } + +pub(crate) fn list_job_executions_output_output_correct_errors(mut builder: crate::operation::list_job_executions::builders::ListJobExecutionsOutputBuilder) -> crate::operation::list_job_executions::builders::ListJobExecutionsOutputBuilder { + if builder.data.is_none() { builder.data = Some(Default::default()) } + builder + } + +pub(crate) fn list_jobs_output_output_correct_errors(mut builder: crate::operation::list_jobs::builders::ListJobsOutputBuilder) -> crate::operation::list_jobs::builders::ListJobsOutputBuilder { + if builder.data.is_none() { builder.data = Some(Default::default()) } + builder + } + +pub(crate) fn list_payload_specs_output_output_correct_errors(mut builder: crate::operation::list_payload_specs::builders::ListPayloadSpecsOutputBuilder) -> crate::operation::list_payload_specs::builders::ListPayloadSpecsOutputBuilder { + if builder.data.is_none() { builder.data = Some(Default::default()) } + builder + } + +pub(crate) fn update_endpoint_output_output_correct_errors(mut builder: crate::operation::update_endpoint::builders::UpdateEndpointOutputBuilder) -> crate::operation::update_endpoint::builders::UpdateEndpointOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::EndpointResourceBuilder::default(); crate::serde_util::endpoint_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn update_job_output_output_correct_errors(mut builder: crate::operation::update_job::builders::UpdateJobOutputBuilder) -> crate::operation::update_job::builders::UpdateJobOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::JobResourceBuilder::default(); crate::serde_util::job_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn update_payload_spec_output_output_correct_errors(mut builder: crate::operation::update_payload_spec::builders::UpdatePayloadSpecOutputBuilder) -> crate::operation::update_payload_spec::builders::UpdatePayloadSpecOutputBuilder { + if builder.data.is_none() { builder.data = { let builder = crate::types::builders::PayloadSpecResourceBuilder::default(); crate::serde_util::payload_spec_resource_correct_errors(builder).build().ok() } } + builder + } + +pub(crate) fn error_detail_correct_errors(mut builder: crate::types::builders::ErrorDetailBuilder) -> crate::types::builders::ErrorDetailBuilder { + if builder.code.is_none() { builder.code = Some(Default::default()) } +if builder.message.is_none() { builder.message = Some(Default::default()) } + builder + } + +pub(crate) fn execution_resource_correct_errors(mut builder: crate::types::builders::ExecutionResourceBuilder) -> crate::types::builders::ExecutionResourceBuilder { + if builder.execution_id.is_none() { builder.execution_id = Some(Default::default()) } +if builder.job_id.is_none() { builder.job_id = Some(Default::default()) } +if builder.endpoint.is_none() { builder.endpoint = Some(Default::default()) } +if builder.endpoint_type.is_none() { builder.endpoint_type = "no value was set".parse::().ok() } +if builder.status.is_none() { builder.status = "no value was set".parse::().ok() } +if builder.attempt_count.is_none() { builder.attempt_count = Some(Default::default()) } +if builder.max_attempts.is_none() { builder.max_attempts = Some(Default::default()) } +if builder.run_at.is_none() { builder.run_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } +if builder.created_at.is_none() { builder.created_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } + builder + } + +pub(crate) fn job_resource_correct_errors(mut builder: crate::types::builders::JobResourceBuilder) -> crate::types::builders::JobResourceBuilder { + if builder.job_id.is_none() { builder.job_id = Some(Default::default()) } +if builder.endpoint.is_none() { builder.endpoint = Some(Default::default()) } +if builder.endpoint_type.is_none() { builder.endpoint_type = "no value was set".parse::().ok() } +if builder.trigger_type.is_none() { builder.trigger_type = "no value was set".parse::().ok() } +if builder.status.is_none() { builder.status = "no value was set".parse::().ok() } +if builder.version.is_none() { builder.version = Some(Default::default()) } +if builder.created_at.is_none() { builder.created_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } + builder + } + +pub(crate) fn endpoint_resource_correct_errors(mut builder: crate::types::builders::EndpointResourceBuilder) -> crate::types::builders::EndpointResourceBuilder { + if builder.name.is_none() { builder.name = Some(Default::default()) } +if builder.endpoint_type.is_none() { builder.endpoint_type = "no value was set".parse::().ok() } +if builder.spec.is_none() { builder.spec = Some(Default::default()) } +if builder.created_at.is_none() { builder.created_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } +if builder.updated_at.is_none() { builder.updated_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } + builder + } + +pub(crate) fn payload_spec_resource_correct_errors(mut builder: crate::types::builders::PayloadSpecResourceBuilder) -> crate::types::builders::PayloadSpecResourceBuilder { + if builder.name.is_none() { builder.name = Some(Default::default()) } +if builder.schema.is_none() { builder.schema = Some(Default::default()) } +if builder.created_at.is_none() { builder.created_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } +if builder.updated_at.is_none() { builder.updated_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } + builder + } + +pub(crate) fn job_status_response_correct_errors(mut builder: crate::types::builders::JobStatusResponseBuilder) -> crate::types::builders::JobStatusResponseBuilder { + if builder.job_id.is_none() { builder.job_id = Some(Default::default()) } +if builder.job_status.is_none() { builder.job_status = "no value was set".parse::().ok() } + builder + } + +pub(crate) fn attempt_resource_correct_errors(mut builder: crate::types::builders::AttemptResourceBuilder) -> crate::types::builders::AttemptResourceBuilder { + if builder.attempt_id.is_none() { builder.attempt_id = Some(Default::default()) } +if builder.execution_id.is_none() { builder.execution_id = Some(Default::default()) } +if builder.attempt_number.is_none() { builder.attempt_number = Some(Default::default()) } +if builder.status.is_none() { builder.status = "no value was set".parse::().ok() } +if builder.started_at.is_none() { builder.started_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } +if builder.created_at.is_none() { builder.created_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } + builder + } + +pub(crate) fn execution_log_resource_correct_errors(mut builder: crate::types::builders::ExecutionLogResourceBuilder) -> crate::types::builders::ExecutionLogResourceBuilder { + if builder.log_id.is_none() { builder.log_id = Some(Default::default()) } +if builder.execution_id.is_none() { builder.execution_id = Some(Default::default()) } +if builder.attempt_number.is_none() { builder.attempt_number = Some(Default::default()) } +if builder.level.is_none() { builder.level = "no value was set".parse::().ok() } +if builder.message.is_none() { builder.message = Some(Default::default()) } +if builder.logged_at.is_none() { builder.logged_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } + builder + } + +pub(crate) fn execution_summary_correct_errors(mut builder: crate::types::builders::ExecutionSummaryBuilder) -> crate::types::builders::ExecutionSummaryBuilder { + if builder.execution_id.is_none() { builder.execution_id = Some(Default::default()) } +if builder.status.is_none() { builder.status = "no value was set".parse::().ok() } +if builder.attempt_count.is_none() { builder.attempt_count = Some(Default::default()) } +if builder.max_attempts.is_none() { builder.max_attempts = Some(Default::default()) } + builder + } + +pub(crate) fn job_summary_correct_errors(mut builder: crate::types::builders::JobSummaryBuilder) -> crate::types::builders::JobSummaryBuilder { + if builder.job_id.is_none() { builder.job_id = Some(Default::default()) } +if builder.endpoint.is_none() { builder.endpoint = Some(Default::default()) } +if builder.trigger_type.is_none() { builder.trigger_type = "no value was set".parse::().ok() } +if builder.status.is_none() { builder.status = "no value was set".parse::().ok() } +if builder.version.is_none() { builder.version = Some(Default::default()) } +if builder.created_at.is_none() { builder.created_at = Some(::aws_smithy_types::DateTime::from_fractional_secs(0, 0_f64)) } + builder + } + diff --git a/sdks/rust/src/serialization_settings.rs b/sdks/rust/src/serialization_settings.rs new file mode 100644 index 0000000..ad5b64f --- /dev/null +++ b/sdks/rust/src/serialization_settings.rs @@ -0,0 +1,91 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +/* + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0 + */ + +#![allow(dead_code)] + +use aws_smithy_http::header::set_request_header_if_absent; +use aws_smithy_types::config_bag::{Storable, StoreReplace}; +use http::header::{HeaderName, CONTENT_LENGTH, CONTENT_TYPE}; + +/// Configuration for how default protocol headers are serialized +#[derive(Clone, Debug, Default)] +pub(crate) struct HeaderSerializationSettings { + omit_default_content_length: bool, + omit_default_content_type: bool, +} + +impl HeaderSerializationSettings { + /// Creates new [`HeaderSerializationSettings`] + pub(crate) fn new() -> Self { + Default::default() + } + + /// Omit the default `Content-Length` header during serialization + pub(crate) fn omit_default_content_length(self) -> Self { + Self { + omit_default_content_length: true, + ..self + } + } + + /// Omit the default `Content-Type` header during serialization + pub(crate) fn omit_default_content_type(self) -> Self { + Self { + omit_default_content_type: true, + ..self + } + } + + /// Returns true if the given default header name should be serialized + fn include_header(&self, header: &HeaderName) -> bool { + (!self.omit_default_content_length || header != CONTENT_LENGTH) + && (!self.omit_default_content_type || header != CONTENT_TYPE) + } + + /// Sets a default header on the given request builder if it should be serialized + pub(crate) fn set_default_header( + &self, + mut request: http::request::Builder, + header_name: HeaderName, + value: &str, + ) -> http::request::Builder { + if self.include_header(&header_name) { + request = set_request_header_if_absent(request, header_name, value); + } + request + } +} + +impl Storable for HeaderSerializationSettings { + type Storer = StoreReplace; +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_include_header() { + let settings = HeaderSerializationSettings::default(); + assert!(settings.include_header(&CONTENT_LENGTH)); + assert!(settings.include_header(&CONTENT_TYPE)); + + let settings = HeaderSerializationSettings::default().omit_default_content_length(); + assert!(!settings.include_header(&CONTENT_LENGTH)); + assert!(settings.include_header(&CONTENT_TYPE)); + + let settings = HeaderSerializationSettings::default().omit_default_content_type(); + assert!(settings.include_header(&CONTENT_LENGTH)); + assert!(!settings.include_header(&CONTENT_TYPE)); + + let settings = HeaderSerializationSettings::default() + .omit_default_content_type() + .omit_default_content_length(); + assert!(!settings.include_header(&CONTENT_LENGTH)); + assert!(!settings.include_header(&CONTENT_TYPE)); + } +} + diff --git a/sdks/rust/src/types.rs b/sdks/rust/src/types.rs new file mode 100644 index 0000000..eee802b --- /dev/null +++ b/sdks/rust/src/types.rs @@ -0,0 +1,79 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::types::_error_detail::ErrorDetail; + +pub use crate::types::_payload_spec_resource::PayloadSpecResource; + +pub use crate::types::_endpoint_type_enum::EndpointTypeEnum; + +pub use crate::types::_retry_policy::RetryPolicy; + +pub use crate::types::_endpoint_resource::EndpointResource; + +pub use crate::types::_trigger_type_enum::TriggerTypeEnum; + +pub use crate::types::_job_resource::JobResource; + +pub use crate::types::_job_status_enum::JobStatusEnum; + +pub use crate::types::_job_status_response::JobStatusResponse; + +pub use crate::types::_execution_status_enum::ExecutionStatusEnum; + +pub use crate::types::_execution_resource::ExecutionResource; + +pub use crate::types::_backoff_type_enum::BackoffTypeEnum; + +pub use crate::types::_job_summary::JobSummary; + +pub use crate::types::_execution_summary::ExecutionSummary; + +pub use crate::types::_attempt_resource::AttemptResource; + +pub use crate::types::_execution_log_resource::ExecutionLogResource; + +pub use crate::types::_attempt_status_enum::AttemptStatusEnum; + +pub use crate::types::_log_level_enum::LogLevelEnum; + +mod _attempt_resource; + +mod _attempt_status_enum; + +mod _backoff_type_enum; + +mod _endpoint_resource; + +mod _endpoint_type_enum; + +mod _error_detail; + +mod _execution_log_resource; + +mod _execution_resource; + +mod _execution_status_enum; + +mod _execution_summary; + +mod _job_resource; + +mod _job_status_enum; + +mod _job_status_response; + +mod _job_summary; + +mod _log_level_enum; + +mod _payload_spec_resource; + +mod _retry_policy; + +mod _trigger_type_enum; + +/// Builders +pub mod builders; + +/// Error types that Kronos Task Executor API can respond with. +pub mod error; + diff --git a/sdks/rust/src/types/_attempt_resource.rs b/sdks/rust/src/types/_attempt_resource.rs new file mode 100644 index 0000000..fe9bbb3 --- /dev/null +++ b/sdks/rust/src/types/_attempt_resource.rs @@ -0,0 +1,281 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct AttemptResource { + #[allow(missing_docs)] // documentation missing in model + pub attempt_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub execution_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub attempt_number: i32, + #[allow(missing_docs)] // documentation missing in model + pub status: crate::types::AttemptStatusEnum, + #[allow(missing_docs)] // documentation missing in model + pub started_at: ::aws_smithy_types::DateTime, + #[allow(missing_docs)] // documentation missing in model + pub completed_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub duration_ms: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub output: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub error: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub created_at: ::aws_smithy_types::DateTime, +} +impl AttemptResource { + #[allow(missing_docs)] // documentation missing in model + pub fn attempt_id(&self) -> &str { + use std::ops::Deref; self.attempt_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(&self) -> &str { + use std::ops::Deref; self.execution_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn attempt_number(&self) -> i32 { + self.attempt_number + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(&self) -> &crate::types::AttemptStatusEnum { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + pub fn started_at(&self) -> &::aws_smithy_types::DateTime { + &self.started_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn completed_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.completed_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn duration_ms(&self) -> ::std::option::Option { + self.duration_ms + } + #[allow(missing_docs)] // documentation missing in model + pub fn output(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.output.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn error(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.error.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn created_at(&self) -> &::aws_smithy_types::DateTime { + &self.created_at + } +} +impl AttemptResource { + /// Creates a new builder-style object to manufacture [`AttemptResource`](crate::types::AttemptResource). + pub fn builder() -> crate::types::builders::AttemptResourceBuilder { + crate::types::builders::AttemptResourceBuilder::default() + } +} + +/// A builder for [`AttemptResource`](crate::types::AttemptResource). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct AttemptResourceBuilder { + pub(crate) attempt_id: ::std::option::Option<::std::string::String>, + pub(crate) execution_id: ::std::option::Option<::std::string::String>, + pub(crate) attempt_number: ::std::option::Option, + pub(crate) status: ::std::option::Option, + pub(crate) started_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) completed_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) duration_ms: ::std::option::Option, + pub(crate) output: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) error: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl AttemptResourceBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn attempt_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.attempt_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_attempt_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.attempt_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_attempt_id(&self) -> &::std::option::Option<::std::string::String> { + &self.attempt_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.execution_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.execution_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + &self.execution_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn attempt_number(mut self, input: i32) -> Self { + self.attempt_number = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_attempt_number(mut self, input: ::std::option::Option) -> Self { + self.attempt_number = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_attempt_number(&self) -> &::std::option::Option { + &self.attempt_number + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn status(mut self, input: crate::types::AttemptStatusEnum) -> Self { + self.status = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.status = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn started_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.started_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_started_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.started_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_started_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.started_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn completed_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.completed_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_completed_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.completed_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_completed_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.completed_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn duration_ms(mut self, input: i32) -> Self { + self.duration_ms = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_duration_ms(mut self, input: ::std::option::Option) -> Self { + self.duration_ms = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_duration_ms(&self) -> &::std::option::Option { + &self.duration_ms + } + #[allow(missing_docs)] // documentation missing in model + pub fn output(mut self, input: ::aws_smithy_types::Document) -> Self { + self.output = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_output(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.output = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_output(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.output + } + #[allow(missing_docs)] // documentation missing in model + pub fn error(mut self, input: ::aws_smithy_types::Document) -> Self { + self.error = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_error(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.error = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_error(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.error + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.created_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.created_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.created_at + } + /// Consumes the builder and constructs a [`AttemptResource`](crate::types::AttemptResource). + /// This method will fail if any of the following fields are not set: + /// - [`attempt_id`](crate::types::builders::AttemptResourceBuilder::attempt_id) + /// - [`execution_id`](crate::types::builders::AttemptResourceBuilder::execution_id) + /// - [`attempt_number`](crate::types::builders::AttemptResourceBuilder::attempt_number) + /// - [`status`](crate::types::builders::AttemptResourceBuilder::status) + /// - [`started_at`](crate::types::builders::AttemptResourceBuilder::started_at) + /// - [`created_at`](crate::types::builders::AttemptResourceBuilder::created_at) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::AttemptResource { + attempt_id: self.attempt_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("attempt_id", "attempt_id was not specified but it is required when building AttemptResource") + )? + , + execution_id: self.execution_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "execution_id was not specified but it is required when building AttemptResource") + )? + , + attempt_number: self.attempt_number + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("attempt_number", "attempt_number was not specified but it is required when building AttemptResource") + )? + , + status: self.status + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("status", "status was not specified but it is required when building AttemptResource") + )? + , + started_at: self.started_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("started_at", "started_at was not specified but it is required when building AttemptResource") + )? + , + completed_at: self.completed_at + , + duration_ms: self.duration_ms + , + output: self.output + , + error: self.error + , + created_at: self.created_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("created_at", "created_at was not specified but it is required when building AttemptResource") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_attempt_status_enum.rs b/sdks/rust/src/types/_attempt_status_enum.rs new file mode 100644 index 0000000..d9e8692 --- /dev/null +++ b/sdks/rust/src/types/_attempt_status_enum.rs @@ -0,0 +1,107 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// When writing a match expression against `AttemptStatusEnum`, it is important to ensure +/// your code is forward-compatible. That is, if a match arm handles a case for a +/// feature that is supported by the service but has not been represented as an enum +/// variant in a current version of SDK, your code should continue to work when you +/// upgrade SDK to a future version in which the enum does include a variant for that +/// feature. +/// +/// Here is an example of how you can make a match expression forward-compatible: +/// +/// ```text +/// # let attemptstatusenum = unimplemented!(); +/// match attemptstatusenum { +/// AttemptStatusEnum::Failed => { /* ... */ }, +/// AttemptStatusEnum::Success => { /* ... */ }, +/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ }, +/// _ => { /* ... */ }, +/// } +/// ``` +/// The above code demonstrates that when `attemptstatusenum` represents +/// `NewFeature`, the execution path will lead to the second last match arm, +/// even though the enum does not contain a variant `AttemptStatusEnum::NewFeature` +/// in the current version of SDK. The reason is that the variable `other`, +/// created by the `@` operator, is bound to +/// `AttemptStatusEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))` +/// and calling `as_str` on it yields `"NewFeature"`. +/// This match expression is forward-compatible when executed with a newer +/// version of SDK where the variant `AttemptStatusEnum::NewFeature` is defined. +/// Specifically, when `attemptstatusenum` represents `NewFeature`, +/// the execution path will hit the second last match arm as before by virtue of +/// calling `as_str` on `AttemptStatusEnum::NewFeature` also yielding `"NewFeature"`. +/// +/// Explicitly matching on the `Unknown` variant should +/// be avoided for two reasons: +/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted. +/// - It might inadvertently shadow other intended match arms. +/// +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash)] +pub enum AttemptStatusEnum { + #[allow(missing_docs)] // documentation missing in model + Failed, + #[allow(missing_docs)] // documentation missing in model + Success, + /// `Unknown` contains new variants that have been added since this code was generated. + #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")] + Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue) +} +impl ::std::convert::From<&str> for AttemptStatusEnum { + fn from(s: &str) -> Self { + match s { + "FAILED" => AttemptStatusEnum::Failed, +"SUCCESS" => AttemptStatusEnum::Success, +other => AttemptStatusEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())) + } + } + } +impl ::std::str::FromStr for AttemptStatusEnum { + type Err = ::std::convert::Infallible; + + fn from_str(s: &str) -> ::std::result::Result::Err> { + ::std::result::Result::Ok(AttemptStatusEnum::from(s)) + } + } +impl AttemptStatusEnum { + /// Returns the `&str` value of the enum member. + pub fn as_str(&self) -> &str { + match self { + AttemptStatusEnum::Failed => "FAILED", + AttemptStatusEnum::Success => "SUCCESS", + AttemptStatusEnum::Unknown(value) => value.as_str() +} + } + /// Returns all the `&str` representations of the enum members. + pub const fn values() -> &'static [&'static str] { + &["FAILED", "SUCCESS"] + } + } +impl ::std::convert::AsRef for AttemptStatusEnum { + fn as_ref(&self) -> &str { + self.as_str() + } + } +impl AttemptStatusEnum { + /// Parses the enum value while disallowing unknown variants. + /// + /// Unknown variants will result in an error. + pub fn try_parse(value: &str) -> ::std::result::Result { + match Self::from(value) { + #[allow(deprecated)] + Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)), + known => Ok(known), + } + } + } +impl ::std::fmt::Display for AttemptStatusEnum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + AttemptStatusEnum::Failed => write!(f, "FAILED"), +AttemptStatusEnum::Success => write!(f, "SUCCESS"), +AttemptStatusEnum::Unknown(value) => write!(f, "{}", value) + } + } + } + diff --git a/sdks/rust/src/types/_backoff_type_enum.rs b/sdks/rust/src/types/_backoff_type_enum.rs new file mode 100644 index 0000000..0683a2b --- /dev/null +++ b/sdks/rust/src/types/_backoff_type_enum.rs @@ -0,0 +1,113 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// When writing a match expression against `BackoffTypeEnum`, it is important to ensure +/// your code is forward-compatible. That is, if a match arm handles a case for a +/// feature that is supported by the service but has not been represented as an enum +/// variant in a current version of SDK, your code should continue to work when you +/// upgrade SDK to a future version in which the enum does include a variant for that +/// feature. +/// +/// Here is an example of how you can make a match expression forward-compatible: +/// +/// ```text +/// # let backofftypeenum = unimplemented!(); +/// match backofftypeenum { +/// BackoffTypeEnum::Exponential => { /* ... */ }, +/// BackoffTypeEnum::Fixed => { /* ... */ }, +/// BackoffTypeEnum::Linear => { /* ... */ }, +/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ }, +/// _ => { /* ... */ }, +/// } +/// ``` +/// The above code demonstrates that when `backofftypeenum` represents +/// `NewFeature`, the execution path will lead to the second last match arm, +/// even though the enum does not contain a variant `BackoffTypeEnum::NewFeature` +/// in the current version of SDK. The reason is that the variable `other`, +/// created by the `@` operator, is bound to +/// `BackoffTypeEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))` +/// and calling `as_str` on it yields `"NewFeature"`. +/// This match expression is forward-compatible when executed with a newer +/// version of SDK where the variant `BackoffTypeEnum::NewFeature` is defined. +/// Specifically, when `backofftypeenum` represents `NewFeature`, +/// the execution path will hit the second last match arm as before by virtue of +/// calling `as_str` on `BackoffTypeEnum::NewFeature` also yielding `"NewFeature"`. +/// +/// Explicitly matching on the `Unknown` variant should +/// be avoided for two reasons: +/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted. +/// - It might inadvertently shadow other intended match arms. +/// +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash)] +pub enum BackoffTypeEnum { + #[allow(missing_docs)] // documentation missing in model + Exponential, + #[allow(missing_docs)] // documentation missing in model + Fixed, + #[allow(missing_docs)] // documentation missing in model + Linear, + /// `Unknown` contains new variants that have been added since this code was generated. + #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")] + Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue) +} +impl ::std::convert::From<&str> for BackoffTypeEnum { + fn from(s: &str) -> Self { + match s { + "exponential" => BackoffTypeEnum::Exponential, +"fixed" => BackoffTypeEnum::Fixed, +"linear" => BackoffTypeEnum::Linear, +other => BackoffTypeEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())) + } + } + } +impl ::std::str::FromStr for BackoffTypeEnum { + type Err = ::std::convert::Infallible; + + fn from_str(s: &str) -> ::std::result::Result::Err> { + ::std::result::Result::Ok(BackoffTypeEnum::from(s)) + } + } +impl BackoffTypeEnum { + /// Returns the `&str` value of the enum member. + pub fn as_str(&self) -> &str { + match self { + BackoffTypeEnum::Exponential => "exponential", + BackoffTypeEnum::Fixed => "fixed", + BackoffTypeEnum::Linear => "linear", + BackoffTypeEnum::Unknown(value) => value.as_str() +} + } + /// Returns all the `&str` representations of the enum members. + pub const fn values() -> &'static [&'static str] { + &["exponential", "fixed", "linear"] + } + } +impl ::std::convert::AsRef for BackoffTypeEnum { + fn as_ref(&self) -> &str { + self.as_str() + } + } +impl BackoffTypeEnum { + /// Parses the enum value while disallowing unknown variants. + /// + /// Unknown variants will result in an error. + pub fn try_parse(value: &str) -> ::std::result::Result { + match Self::from(value) { + #[allow(deprecated)] + Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)), + known => Ok(known), + } + } + } +impl ::std::fmt::Display for BackoffTypeEnum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + BackoffTypeEnum::Exponential => write!(f, "exponential"), +BackoffTypeEnum::Fixed => write!(f, "fixed"), +BackoffTypeEnum::Linear => write!(f, "linear"), +BackoffTypeEnum::Unknown(value) => write!(f, "{}", value) + } + } + } + diff --git a/sdks/rust/src/types/_endpoint_resource.rs b/sdks/rust/src/types/_endpoint_resource.rs new file mode 100644 index 0000000..dfe6c19 --- /dev/null +++ b/sdks/rust/src/types/_endpoint_resource.rs @@ -0,0 +1,232 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct EndpointResource { + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub endpoint_type: crate::types::EndpointTypeEnum, + #[allow(missing_docs)] // documentation missing in model + pub payload_spec: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub config: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub spec: ::aws_smithy_types::Document, + #[allow(missing_docs)] // documentation missing in model + pub retry_policy: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub created_at: ::aws_smithy_types::DateTime, + #[allow(missing_docs)] // documentation missing in model + pub updated_at: ::aws_smithy_types::DateTime, +} +impl EndpointResource { + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> &str { + use std::ops::Deref; self.name.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint_type(&self) -> &crate::types::EndpointTypeEnum { + &self.endpoint_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn payload_spec(&self) -> ::std::option::Option<&str> { + self.payload_spec.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn config(&self) -> ::std::option::Option<&str> { + self.config.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn spec(&self) -> &::aws_smithy_types::Document { + &self.spec + } + #[allow(missing_docs)] // documentation missing in model + pub fn retry_policy(&self) -> ::std::option::Option<&crate::types::RetryPolicy> { + self.retry_policy.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn created_at(&self) -> &::aws_smithy_types::DateTime { + &self.created_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn updated_at(&self) -> &::aws_smithy_types::DateTime { + &self.updated_at + } +} +impl EndpointResource { + /// Creates a new builder-style object to manufacture [`EndpointResource`](crate::types::EndpointResource). + pub fn builder() -> crate::types::builders::EndpointResourceBuilder { + crate::types::builders::EndpointResourceBuilder::default() + } +} + +/// A builder for [`EndpointResource`](crate::types::EndpointResource). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct EndpointResourceBuilder { + pub(crate) name: ::std::option::Option<::std::string::String>, + pub(crate) endpoint_type: ::std::option::Option, + pub(crate) payload_spec: ::std::option::Option<::std::string::String>, + pub(crate) config: ::std::option::Option<::std::string::String>, + pub(crate) spec: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) retry_policy: ::std::option::Option, + pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl EndpointResourceBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn endpoint_type(mut self, input: crate::types::EndpointTypeEnum) -> Self { + self.endpoint_type = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint_type(mut self, input: ::std::option::Option) -> Self { + self.endpoint_type = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint_type(&self) -> &::std::option::Option { + &self.endpoint_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn payload_spec(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.payload_spec = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_payload_spec(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.payload_spec = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_payload_spec(&self) -> &::std::option::Option<::std::string::String> { + &self.payload_spec + } + #[allow(missing_docs)] // documentation missing in model + pub fn config(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.config = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_config(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.config = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_config(&self) -> &::std::option::Option<::std::string::String> { + &self.config + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn spec(mut self, input: ::aws_smithy_types::Document) -> Self { + self.spec = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_spec(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.spec = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_spec(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.spec + } + #[allow(missing_docs)] // documentation missing in model + pub fn retry_policy(mut self, input: crate::types::RetryPolicy) -> Self { + self.retry_policy = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_retry_policy(mut self, input: ::std::option::Option) -> Self { + self.retry_policy = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_retry_policy(&self) -> &::std::option::Option { + &self.retry_policy + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.created_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.created_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.created_at + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.updated_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.updated_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.updated_at + } + /// Consumes the builder and constructs a [`EndpointResource`](crate::types::EndpointResource). + /// This method will fail if any of the following fields are not set: + /// - [`name`](crate::types::builders::EndpointResourceBuilder::name) + /// - [`endpoint_type`](crate::types::builders::EndpointResourceBuilder::endpoint_type) + /// - [`spec`](crate::types::builders::EndpointResourceBuilder::spec) + /// - [`created_at`](crate::types::builders::EndpointResourceBuilder::created_at) + /// - [`updated_at`](crate::types::builders::EndpointResourceBuilder::updated_at) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::EndpointResource { + name: self.name + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("name", "name was not specified but it is required when building EndpointResource") + )? + , + endpoint_type: self.endpoint_type + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("endpoint_type", "endpoint_type was not specified but it is required when building EndpointResource") + )? + , + payload_spec: self.payload_spec + , + config: self.config + , + spec: self.spec + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("spec", "spec was not specified but it is required when building EndpointResource") + )? + , + retry_policy: self.retry_policy + , + created_at: self.created_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("created_at", "created_at was not specified but it is required when building EndpointResource") + )? + , + updated_at: self.updated_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("updated_at", "updated_at was not specified but it is required when building EndpointResource") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_endpoint_type_enum.rs b/sdks/rust/src/types/_endpoint_type_enum.rs new file mode 100644 index 0000000..6ba270d --- /dev/null +++ b/sdks/rust/src/types/_endpoint_type_enum.rs @@ -0,0 +1,113 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// When writing a match expression against `EndpointTypeEnum`, it is important to ensure +/// your code is forward-compatible. That is, if a match arm handles a case for a +/// feature that is supported by the service but has not been represented as an enum +/// variant in a current version of SDK, your code should continue to work when you +/// upgrade SDK to a future version in which the enum does include a variant for that +/// feature. +/// +/// Here is an example of how you can make a match expression forward-compatible: +/// +/// ```text +/// # let endpointtypeenum = unimplemented!(); +/// match endpointtypeenum { +/// EndpointTypeEnum::Http => { /* ... */ }, +/// EndpointTypeEnum::Kafka => { /* ... */ }, +/// EndpointTypeEnum::RedisStream => { /* ... */ }, +/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ }, +/// _ => { /* ... */ }, +/// } +/// ``` +/// The above code demonstrates that when `endpointtypeenum` represents +/// `NewFeature`, the execution path will lead to the second last match arm, +/// even though the enum does not contain a variant `EndpointTypeEnum::NewFeature` +/// in the current version of SDK. The reason is that the variable `other`, +/// created by the `@` operator, is bound to +/// `EndpointTypeEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))` +/// and calling `as_str` on it yields `"NewFeature"`. +/// This match expression is forward-compatible when executed with a newer +/// version of SDK where the variant `EndpointTypeEnum::NewFeature` is defined. +/// Specifically, when `endpointtypeenum` represents `NewFeature`, +/// the execution path will hit the second last match arm as before by virtue of +/// calling `as_str` on `EndpointTypeEnum::NewFeature` also yielding `"NewFeature"`. +/// +/// Explicitly matching on the `Unknown` variant should +/// be avoided for two reasons: +/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted. +/// - It might inadvertently shadow other intended match arms. +/// +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash)] +pub enum EndpointTypeEnum { + #[allow(missing_docs)] // documentation missing in model + Http, + #[allow(missing_docs)] // documentation missing in model + Kafka, + #[allow(missing_docs)] // documentation missing in model + RedisStream, + /// `Unknown` contains new variants that have been added since this code was generated. + #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")] + Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue) +} +impl ::std::convert::From<&str> for EndpointTypeEnum { + fn from(s: &str) -> Self { + match s { + "HTTP" => EndpointTypeEnum::Http, +"KAFKA" => EndpointTypeEnum::Kafka, +"REDIS_STREAM" => EndpointTypeEnum::RedisStream, +other => EndpointTypeEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())) + } + } + } +impl ::std::str::FromStr for EndpointTypeEnum { + type Err = ::std::convert::Infallible; + + fn from_str(s: &str) -> ::std::result::Result::Err> { + ::std::result::Result::Ok(EndpointTypeEnum::from(s)) + } + } +impl EndpointTypeEnum { + /// Returns the `&str` value of the enum member. + pub fn as_str(&self) -> &str { + match self { + EndpointTypeEnum::Http => "HTTP", + EndpointTypeEnum::Kafka => "KAFKA", + EndpointTypeEnum::RedisStream => "REDIS_STREAM", + EndpointTypeEnum::Unknown(value) => value.as_str() +} + } + /// Returns all the `&str` representations of the enum members. + pub const fn values() -> &'static [&'static str] { + &["HTTP", "KAFKA", "REDIS_STREAM"] + } + } +impl ::std::convert::AsRef for EndpointTypeEnum { + fn as_ref(&self) -> &str { + self.as_str() + } + } +impl EndpointTypeEnum { + /// Parses the enum value while disallowing unknown variants. + /// + /// Unknown variants will result in an error. + pub fn try_parse(value: &str) -> ::std::result::Result { + match Self::from(value) { + #[allow(deprecated)] + Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)), + known => Ok(known), + } + } + } +impl ::std::fmt::Display for EndpointTypeEnum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + EndpointTypeEnum::Http => write!(f, "HTTP"), +EndpointTypeEnum::Kafka => write!(f, "KAFKA"), +EndpointTypeEnum::RedisStream => write!(f, "REDIS_STREAM"), +EndpointTypeEnum::Unknown(value) => write!(f, "{}", value) + } + } + } + diff --git a/sdks/rust/src/types/_error_detail.rs b/sdks/rust/src/types/_error_detail.rs new file mode 100644 index 0000000..a365c4a --- /dev/null +++ b/sdks/rust/src/types/_error_detail.rs @@ -0,0 +1,107 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ErrorDetail { + #[allow(missing_docs)] // documentation missing in model + pub code: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub request_id: ::std::option::Option<::std::string::String>, +} +impl ErrorDetail { + #[allow(missing_docs)] // documentation missing in model + pub fn code(&self) -> &str { + use std::ops::Deref; self.code.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(&self) -> &str { + use std::ops::Deref; self.message.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn request_id(&self) -> ::std::option::Option<&str> { + self.request_id.as_deref() + } +} +impl ErrorDetail { + /// Creates a new builder-style object to manufacture [`ErrorDetail`](crate::types::ErrorDetail). + pub fn builder() -> crate::types::builders::ErrorDetailBuilder { + crate::types::builders::ErrorDetailBuilder::default() + } +} + +/// A builder for [`ErrorDetail`](crate::types::ErrorDetail). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ErrorDetailBuilder { + pub(crate) code: ::std::option::Option<::std::string::String>, + pub(crate) message: ::std::option::Option<::std::string::String>, + pub(crate) request_id: ::std::option::Option<::std::string::String>, +} +impl ErrorDetailBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn code(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.code = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_code(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.code = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_code(&self) -> &::std::option::Option<::std::string::String> { + &self.code + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + #[allow(missing_docs)] // documentation missing in model + pub fn request_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.request_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_request_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.request_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_request_id(&self) -> &::std::option::Option<::std::string::String> { + &self.request_id + } + /// Consumes the builder and constructs a [`ErrorDetail`](crate::types::ErrorDetail). + /// This method will fail if any of the following fields are not set: + /// - [`code`](crate::types::builders::ErrorDetailBuilder::code) + /// - [`message`](crate::types::builders::ErrorDetailBuilder::message) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::ErrorDetail { + code: self.code + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("code", "code was not specified but it is required when building ErrorDetail") + )? + , + message: self.message + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("message", "message was not specified but it is required when building ErrorDetail") + )? + , + request_id: self.request_id + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_execution_log_resource.rs b/sdks/rust/src/types/_execution_log_resource.rs new file mode 100644 index 0000000..11f52ba --- /dev/null +++ b/sdks/rust/src/types/_execution_log_resource.rs @@ -0,0 +1,193 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ExecutionLogResource { + #[allow(missing_docs)] // documentation missing in model + pub log_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub execution_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub attempt_number: i32, + #[allow(missing_docs)] // documentation missing in model + pub level: crate::types::LogLevelEnum, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub logged_at: ::aws_smithy_types::DateTime, +} +impl ExecutionLogResource { + #[allow(missing_docs)] // documentation missing in model + pub fn log_id(&self) -> &str { + use std::ops::Deref; self.log_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(&self) -> &str { + use std::ops::Deref; self.execution_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn attempt_number(&self) -> i32 { + self.attempt_number + } + #[allow(missing_docs)] // documentation missing in model + pub fn level(&self) -> &crate::types::LogLevelEnum { + &self.level + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(&self) -> &str { + use std::ops::Deref; self.message.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn logged_at(&self) -> &::aws_smithy_types::DateTime { + &self.logged_at + } +} +impl ExecutionLogResource { + /// Creates a new builder-style object to manufacture [`ExecutionLogResource`](crate::types::ExecutionLogResource). + pub fn builder() -> crate::types::builders::ExecutionLogResourceBuilder { + crate::types::builders::ExecutionLogResourceBuilder::default() + } +} + +/// A builder for [`ExecutionLogResource`](crate::types::ExecutionLogResource). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ExecutionLogResourceBuilder { + pub(crate) log_id: ::std::option::Option<::std::string::String>, + pub(crate) execution_id: ::std::option::Option<::std::string::String>, + pub(crate) attempt_number: ::std::option::Option, + pub(crate) level: ::std::option::Option, + pub(crate) message: ::std::option::Option<::std::string::String>, + pub(crate) logged_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl ExecutionLogResourceBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn log_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.log_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_log_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.log_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_log_id(&self) -> &::std::option::Option<::std::string::String> { + &self.log_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.execution_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.execution_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + &self.execution_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn attempt_number(mut self, input: i32) -> Self { + self.attempt_number = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_attempt_number(mut self, input: ::std::option::Option) -> Self { + self.attempt_number = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_attempt_number(&self) -> &::std::option::Option { + &self.attempt_number + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn level(mut self, input: crate::types::LogLevelEnum) -> Self { + self.level = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_level(mut self, input: ::std::option::Option) -> Self { + self.level = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_level(&self) -> &::std::option::Option { + &self.level + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn logged_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.logged_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_logged_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.logged_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_logged_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.logged_at + } + /// Consumes the builder and constructs a [`ExecutionLogResource`](crate::types::ExecutionLogResource). + /// This method will fail if any of the following fields are not set: + /// - [`log_id`](crate::types::builders::ExecutionLogResourceBuilder::log_id) + /// - [`execution_id`](crate::types::builders::ExecutionLogResourceBuilder::execution_id) + /// - [`attempt_number`](crate::types::builders::ExecutionLogResourceBuilder::attempt_number) + /// - [`level`](crate::types::builders::ExecutionLogResourceBuilder::level) + /// - [`message`](crate::types::builders::ExecutionLogResourceBuilder::message) + /// - [`logged_at`](crate::types::builders::ExecutionLogResourceBuilder::logged_at) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::ExecutionLogResource { + log_id: self.log_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("log_id", "log_id was not specified but it is required when building ExecutionLogResource") + )? + , + execution_id: self.execution_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "execution_id was not specified but it is required when building ExecutionLogResource") + )? + , + attempt_number: self.attempt_number + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("attempt_number", "attempt_number was not specified but it is required when building ExecutionLogResource") + )? + , + level: self.level + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("level", "level was not specified but it is required when building ExecutionLogResource") + )? + , + message: self.message + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("message", "message was not specified but it is required when building ExecutionLogResource") + )? + , + logged_at: self.logged_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("logged_at", "logged_at was not specified but it is required when building ExecutionLogResource") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_execution_resource.rs b/sdks/rust/src/types/_execution_resource.rs new file mode 100644 index 0000000..e1ed94e --- /dev/null +++ b/sdks/rust/src/types/_execution_resource.rs @@ -0,0 +1,428 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ExecutionResource { + #[allow(missing_docs)] // documentation missing in model + pub execution_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub endpoint: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub endpoint_type: crate::types::EndpointTypeEnum, + #[allow(missing_docs)] // documentation missing in model + pub idempotency_key: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub status: crate::types::ExecutionStatusEnum, + #[allow(missing_docs)] // documentation missing in model + pub input: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub output: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub attempt_count: i32, + #[allow(missing_docs)] // documentation missing in model + pub max_attempts: i32, + #[allow(missing_docs)] // documentation missing in model + pub worker_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub run_at: ::aws_smithy_types::DateTime, + #[allow(missing_docs)] // documentation missing in model + pub started_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub completed_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub duration_ms: ::std::option::Option, + #[allow(missing_docs)] // documentation missing in model + pub created_at: ::aws_smithy_types::DateTime, +} +impl ExecutionResource { + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(&self) -> &str { + use std::ops::Deref; self.execution_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> &str { + use std::ops::Deref; self.job_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint(&self) -> &str { + use std::ops::Deref; self.endpoint.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint_type(&self) -> &crate::types::EndpointTypeEnum { + &self.endpoint_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn idempotency_key(&self) -> ::std::option::Option<&str> { + self.idempotency_key.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(&self) -> &crate::types::ExecutionStatusEnum { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.input.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn output(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.output.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn attempt_count(&self) -> i32 { + self.attempt_count + } + #[allow(missing_docs)] // documentation missing in model + pub fn max_attempts(&self) -> i32 { + self.max_attempts + } + #[allow(missing_docs)] // documentation missing in model + pub fn worker_id(&self) -> ::std::option::Option<&str> { + self.worker_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn run_at(&self) -> &::aws_smithy_types::DateTime { + &self.run_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn started_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.started_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn completed_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.completed_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn duration_ms(&self) -> ::std::option::Option { + self.duration_ms + } + #[allow(missing_docs)] // documentation missing in model + pub fn created_at(&self) -> &::aws_smithy_types::DateTime { + &self.created_at + } +} +impl ExecutionResource { + /// Creates a new builder-style object to manufacture [`ExecutionResource`](crate::types::ExecutionResource). + pub fn builder() -> crate::types::builders::ExecutionResourceBuilder { + crate::types::builders::ExecutionResourceBuilder::default() + } +} + +/// A builder for [`ExecutionResource`](crate::types::ExecutionResource). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ExecutionResourceBuilder { + pub(crate) execution_id: ::std::option::Option<::std::string::String>, + pub(crate) job_id: ::std::option::Option<::std::string::String>, + pub(crate) endpoint: ::std::option::Option<::std::string::String>, + pub(crate) endpoint_type: ::std::option::Option, + pub(crate) idempotency_key: ::std::option::Option<::std::string::String>, + pub(crate) status: ::std::option::Option, + pub(crate) input: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) output: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) attempt_count: ::std::option::Option, + pub(crate) max_attempts: ::std::option::Option, + pub(crate) worker_id: ::std::option::Option<::std::string::String>, + pub(crate) run_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) started_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) completed_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) duration_ms: ::std::option::Option, + pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl ExecutionResourceBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.execution_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.execution_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + &self.execution_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.endpoint = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.endpoint = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint(&self) -> &::std::option::Option<::std::string::String> { + &self.endpoint + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn endpoint_type(mut self, input: crate::types::EndpointTypeEnum) -> Self { + self.endpoint_type = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint_type(mut self, input: ::std::option::Option) -> Self { + self.endpoint_type = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint_type(&self) -> &::std::option::Option { + &self.endpoint_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn idempotency_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.idempotency_key = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_idempotency_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.idempotency_key = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_idempotency_key(&self) -> &::std::option::Option<::std::string::String> { + &self.idempotency_key + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn status(mut self, input: crate::types::ExecutionStatusEnum) -> Self { + self.status = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.status = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(mut self, input: ::aws_smithy_types::Document) -> Self { + self.input = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_input(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.input = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_input(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.input + } + #[allow(missing_docs)] // documentation missing in model + pub fn output(mut self, input: ::aws_smithy_types::Document) -> Self { + self.output = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_output(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.output = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_output(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.output + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn attempt_count(mut self, input: i32) -> Self { + self.attempt_count = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_attempt_count(mut self, input: ::std::option::Option) -> Self { + self.attempt_count = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_attempt_count(&self) -> &::std::option::Option { + &self.attempt_count + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn max_attempts(mut self, input: i32) -> Self { + self.max_attempts = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_max_attempts(mut self, input: ::std::option::Option) -> Self { + self.max_attempts = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_max_attempts(&self) -> &::std::option::Option { + &self.max_attempts + } + #[allow(missing_docs)] // documentation missing in model + pub fn worker_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.worker_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_worker_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.worker_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_worker_id(&self) -> &::std::option::Option<::std::string::String> { + &self.worker_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn run_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.run_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_run_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.run_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_run_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.run_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn started_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.started_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_started_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.started_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_started_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.started_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn completed_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.completed_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_completed_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.completed_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_completed_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.completed_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn duration_ms(mut self, input: i32) -> Self { + self.duration_ms = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_duration_ms(mut self, input: ::std::option::Option) -> Self { + self.duration_ms = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_duration_ms(&self) -> &::std::option::Option { + &self.duration_ms + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.created_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.created_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.created_at + } + /// Consumes the builder and constructs a [`ExecutionResource`](crate::types::ExecutionResource). + /// This method will fail if any of the following fields are not set: + /// - [`execution_id`](crate::types::builders::ExecutionResourceBuilder::execution_id) + /// - [`job_id`](crate::types::builders::ExecutionResourceBuilder::job_id) + /// - [`endpoint`](crate::types::builders::ExecutionResourceBuilder::endpoint) + /// - [`endpoint_type`](crate::types::builders::ExecutionResourceBuilder::endpoint_type) + /// - [`status`](crate::types::builders::ExecutionResourceBuilder::status) + /// - [`attempt_count`](crate::types::builders::ExecutionResourceBuilder::attempt_count) + /// - [`max_attempts`](crate::types::builders::ExecutionResourceBuilder::max_attempts) + /// - [`run_at`](crate::types::builders::ExecutionResourceBuilder::run_at) + /// - [`created_at`](crate::types::builders::ExecutionResourceBuilder::created_at) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::ExecutionResource { + execution_id: self.execution_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "execution_id was not specified but it is required when building ExecutionResource") + )? + , + job_id: self.job_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "job_id was not specified but it is required when building ExecutionResource") + )? + , + endpoint: self.endpoint + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("endpoint", "endpoint was not specified but it is required when building ExecutionResource") + )? + , + endpoint_type: self.endpoint_type + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("endpoint_type", "endpoint_type was not specified but it is required when building ExecutionResource") + )? + , + idempotency_key: self.idempotency_key + , + status: self.status + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("status", "status was not specified but it is required when building ExecutionResource") + )? + , + input: self.input + , + output: self.output + , + attempt_count: self.attempt_count + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("attempt_count", "attempt_count was not specified but it is required when building ExecutionResource") + )? + , + max_attempts: self.max_attempts + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("max_attempts", "max_attempts was not specified but it is required when building ExecutionResource") + )? + , + worker_id: self.worker_id + , + run_at: self.run_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("run_at", "run_at was not specified but it is required when building ExecutionResource") + )? + , + started_at: self.started_at + , + completed_at: self.completed_at + , + duration_ms: self.duration_ms + , + created_at: self.created_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("created_at", "created_at was not specified but it is required when building ExecutionResource") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_execution_status_enum.rs b/sdks/rust/src/types/_execution_status_enum.rs new file mode 100644 index 0000000..9a31171 --- /dev/null +++ b/sdks/rust/src/types/_execution_status_enum.rs @@ -0,0 +1,137 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// When writing a match expression against `ExecutionStatusEnum`, it is important to ensure +/// your code is forward-compatible. That is, if a match arm handles a case for a +/// feature that is supported by the service but has not been represented as an enum +/// variant in a current version of SDK, your code should continue to work when you +/// upgrade SDK to a future version in which the enum does include a variant for that +/// feature. +/// +/// Here is an example of how you can make a match expression forward-compatible: +/// +/// ```text +/// # let executionstatusenum = unimplemented!(); +/// match executionstatusenum { +/// ExecutionStatusEnum::Cancelled => { /* ... */ }, +/// ExecutionStatusEnum::Failed => { /* ... */ }, +/// ExecutionStatusEnum::Pending => { /* ... */ }, +/// ExecutionStatusEnum::Queued => { /* ... */ }, +/// ExecutionStatusEnum::Retrying => { /* ... */ }, +/// ExecutionStatusEnum::Running => { /* ... */ }, +/// ExecutionStatusEnum::Success => { /* ... */ }, +/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ }, +/// _ => { /* ... */ }, +/// } +/// ``` +/// The above code demonstrates that when `executionstatusenum` represents +/// `NewFeature`, the execution path will lead to the second last match arm, +/// even though the enum does not contain a variant `ExecutionStatusEnum::NewFeature` +/// in the current version of SDK. The reason is that the variable `other`, +/// created by the `@` operator, is bound to +/// `ExecutionStatusEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))` +/// and calling `as_str` on it yields `"NewFeature"`. +/// This match expression is forward-compatible when executed with a newer +/// version of SDK where the variant `ExecutionStatusEnum::NewFeature` is defined. +/// Specifically, when `executionstatusenum` represents `NewFeature`, +/// the execution path will hit the second last match arm as before by virtue of +/// calling `as_str` on `ExecutionStatusEnum::NewFeature` also yielding `"NewFeature"`. +/// +/// Explicitly matching on the `Unknown` variant should +/// be avoided for two reasons: +/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted. +/// - It might inadvertently shadow other intended match arms. +/// +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash)] +pub enum ExecutionStatusEnum { + #[allow(missing_docs)] // documentation missing in model + Cancelled, + #[allow(missing_docs)] // documentation missing in model + Failed, + #[allow(missing_docs)] // documentation missing in model + Pending, + #[allow(missing_docs)] // documentation missing in model + Queued, + #[allow(missing_docs)] // documentation missing in model + Retrying, + #[allow(missing_docs)] // documentation missing in model + Running, + #[allow(missing_docs)] // documentation missing in model + Success, + /// `Unknown` contains new variants that have been added since this code was generated. + #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")] + Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue) +} +impl ::std::convert::From<&str> for ExecutionStatusEnum { + fn from(s: &str) -> Self { + match s { + "CANCELLED" => ExecutionStatusEnum::Cancelled, +"FAILED" => ExecutionStatusEnum::Failed, +"PENDING" => ExecutionStatusEnum::Pending, +"QUEUED" => ExecutionStatusEnum::Queued, +"RETRYING" => ExecutionStatusEnum::Retrying, +"RUNNING" => ExecutionStatusEnum::Running, +"SUCCESS" => ExecutionStatusEnum::Success, +other => ExecutionStatusEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())) + } + } + } +impl ::std::str::FromStr for ExecutionStatusEnum { + type Err = ::std::convert::Infallible; + + fn from_str(s: &str) -> ::std::result::Result::Err> { + ::std::result::Result::Ok(ExecutionStatusEnum::from(s)) + } + } +impl ExecutionStatusEnum { + /// Returns the `&str` value of the enum member. + pub fn as_str(&self) -> &str { + match self { + ExecutionStatusEnum::Cancelled => "CANCELLED", + ExecutionStatusEnum::Failed => "FAILED", + ExecutionStatusEnum::Pending => "PENDING", + ExecutionStatusEnum::Queued => "QUEUED", + ExecutionStatusEnum::Retrying => "RETRYING", + ExecutionStatusEnum::Running => "RUNNING", + ExecutionStatusEnum::Success => "SUCCESS", + ExecutionStatusEnum::Unknown(value) => value.as_str() +} + } + /// Returns all the `&str` representations of the enum members. + pub const fn values() -> &'static [&'static str] { + &["CANCELLED", "FAILED", "PENDING", "QUEUED", "RETRYING", "RUNNING", "SUCCESS"] + } + } +impl ::std::convert::AsRef for ExecutionStatusEnum { + fn as_ref(&self) -> &str { + self.as_str() + } + } +impl ExecutionStatusEnum { + /// Parses the enum value while disallowing unknown variants. + /// + /// Unknown variants will result in an error. + pub fn try_parse(value: &str) -> ::std::result::Result { + match Self::from(value) { + #[allow(deprecated)] + Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)), + known => Ok(known), + } + } + } +impl ::std::fmt::Display for ExecutionStatusEnum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + ExecutionStatusEnum::Cancelled => write!(f, "CANCELLED"), +ExecutionStatusEnum::Failed => write!(f, "FAILED"), +ExecutionStatusEnum::Pending => write!(f, "PENDING"), +ExecutionStatusEnum::Queued => write!(f, "QUEUED"), +ExecutionStatusEnum::Retrying => write!(f, "RETRYING"), +ExecutionStatusEnum::Running => write!(f, "RUNNING"), +ExecutionStatusEnum::Success => write!(f, "SUCCESS"), +ExecutionStatusEnum::Unknown(value) => write!(f, "{}", value) + } + } + } + diff --git a/sdks/rust/src/types/_execution_summary.rs b/sdks/rust/src/types/_execution_summary.rs new file mode 100644 index 0000000..7dab277 --- /dev/null +++ b/sdks/rust/src/types/_execution_summary.rs @@ -0,0 +1,183 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ExecutionSummary { + #[allow(missing_docs)] // documentation missing in model + pub execution_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub status: crate::types::ExecutionStatusEnum, + #[allow(missing_docs)] // documentation missing in model + pub attempt_count: i32, + #[allow(missing_docs)] // documentation missing in model + pub max_attempts: i32, + #[allow(missing_docs)] // documentation missing in model + pub started_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub completed_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl ExecutionSummary { + #[allow(missing_docs)] // documentation missing in model + pub fn execution_id(&self) -> &str { + use std::ops::Deref; self.execution_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(&self) -> &crate::types::ExecutionStatusEnum { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + pub fn attempt_count(&self) -> i32 { + self.attempt_count + } + #[allow(missing_docs)] // documentation missing in model + pub fn max_attempts(&self) -> i32 { + self.max_attempts + } + #[allow(missing_docs)] // documentation missing in model + pub fn started_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.started_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn completed_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.completed_at.as_ref() + } +} +impl ExecutionSummary { + /// Creates a new builder-style object to manufacture [`ExecutionSummary`](crate::types::ExecutionSummary). + pub fn builder() -> crate::types::builders::ExecutionSummaryBuilder { + crate::types::builders::ExecutionSummaryBuilder::default() + } +} + +/// A builder for [`ExecutionSummary`](crate::types::ExecutionSummary). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ExecutionSummaryBuilder { + pub(crate) execution_id: ::std::option::Option<::std::string::String>, + pub(crate) status: ::std::option::Option, + pub(crate) attempt_count: ::std::option::Option, + pub(crate) max_attempts: ::std::option::Option, + pub(crate) started_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) completed_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl ExecutionSummaryBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn execution_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.execution_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_execution_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.execution_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_execution_id(&self) -> &::std::option::Option<::std::string::String> { + &self.execution_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn status(mut self, input: crate::types::ExecutionStatusEnum) -> Self { + self.status = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.status = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn attempt_count(mut self, input: i32) -> Self { + self.attempt_count = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_attempt_count(mut self, input: ::std::option::Option) -> Self { + self.attempt_count = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_attempt_count(&self) -> &::std::option::Option { + &self.attempt_count + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn max_attempts(mut self, input: i32) -> Self { + self.max_attempts = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_max_attempts(mut self, input: ::std::option::Option) -> Self { + self.max_attempts = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_max_attempts(&self) -> &::std::option::Option { + &self.max_attempts + } + #[allow(missing_docs)] // documentation missing in model + pub fn started_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.started_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_started_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.started_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_started_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.started_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn completed_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.completed_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_completed_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.completed_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_completed_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.completed_at + } + /// Consumes the builder and constructs a [`ExecutionSummary`](crate::types::ExecutionSummary). + /// This method will fail if any of the following fields are not set: + /// - [`execution_id`](crate::types::builders::ExecutionSummaryBuilder::execution_id) + /// - [`status`](crate::types::builders::ExecutionSummaryBuilder::status) + /// - [`attempt_count`](crate::types::builders::ExecutionSummaryBuilder::attempt_count) + /// - [`max_attempts`](crate::types::builders::ExecutionSummaryBuilder::max_attempts) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::ExecutionSummary { + execution_id: self.execution_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("execution_id", "execution_id was not specified but it is required when building ExecutionSummary") + )? + , + status: self.status + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("status", "status was not specified but it is required when building ExecutionSummary") + )? + , + attempt_count: self.attempt_count + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("attempt_count", "attempt_count was not specified but it is required when building ExecutionSummary") + )? + , + max_attempts: self.max_attempts + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("max_attempts", "max_attempts was not specified but it is required when building ExecutionSummary") + )? + , + started_at: self.started_at + , + completed_at: self.completed_at + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_job_resource.rs b/sdks/rust/src/types/_job_resource.rs new file mode 100644 index 0000000..fc3e3a4 --- /dev/null +++ b/sdks/rust/src/types/_job_resource.rs @@ -0,0 +1,484 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct JobResource { + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub endpoint: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub endpoint_type: crate::types::EndpointTypeEnum, + #[allow(missing_docs)] // documentation missing in model + pub trigger_type: crate::types::TriggerTypeEnum, + #[allow(missing_docs)] // documentation missing in model + pub status: crate::types::JobStatusEnum, + #[allow(missing_docs)] // documentation missing in model + pub version: i32, + #[allow(missing_docs)] // documentation missing in model + pub previous_version_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub replaced_by_id: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub idempotency_key: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub input: ::std::option::Option<::aws_smithy_types::Document>, + #[allow(missing_docs)] // documentation missing in model + pub run_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub cron_expression: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cron_timezone: ::std::option::Option<::std::string::String>, + #[allow(missing_docs)] // documentation missing in model + pub cron_starts_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub cron_ends_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub cron_next_run_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub cron_last_tick_at: ::std::option::Option<::aws_smithy_types::DateTime>, + #[allow(missing_docs)] // documentation missing in model + pub created_at: ::aws_smithy_types::DateTime, + #[allow(missing_docs)] // documentation missing in model + pub retired_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl JobResource { + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> &str { + use std::ops::Deref; self.job_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint(&self) -> &str { + use std::ops::Deref; self.endpoint.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint_type(&self) -> &crate::types::EndpointTypeEnum { + &self.endpoint_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn trigger_type(&self) -> &crate::types::TriggerTypeEnum { + &self.trigger_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(&self) -> &crate::types::JobStatusEnum { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + pub fn version(&self) -> i32 { + self.version + } + #[allow(missing_docs)] // documentation missing in model + pub fn previous_version_id(&self) -> ::std::option::Option<&str> { + self.previous_version_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn replaced_by_id(&self) -> ::std::option::Option<&str> { + self.replaced_by_id.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn idempotency_key(&self) -> ::std::option::Option<&str> { + self.idempotency_key.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(&self) -> ::std::option::Option<&::aws_smithy_types::Document> { + self.input.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn run_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.run_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_expression(&self) -> ::std::option::Option<&str> { + self.cron_expression.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_timezone(&self) -> ::std::option::Option<&str> { + self.cron_timezone.as_deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_starts_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.cron_starts_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_ends_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.cron_ends_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_next_run_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.cron_next_run_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_last_tick_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.cron_last_tick_at.as_ref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn created_at(&self) -> &::aws_smithy_types::DateTime { + &self.created_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn retired_at(&self) -> ::std::option::Option<&::aws_smithy_types::DateTime> { + self.retired_at.as_ref() + } +} +impl JobResource { + /// Creates a new builder-style object to manufacture [`JobResource`](crate::types::JobResource). + pub fn builder() -> crate::types::builders::JobResourceBuilder { + crate::types::builders::JobResourceBuilder::default() + } +} + +/// A builder for [`JobResource`](crate::types::JobResource). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct JobResourceBuilder { + pub(crate) job_id: ::std::option::Option<::std::string::String>, + pub(crate) endpoint: ::std::option::Option<::std::string::String>, + pub(crate) endpoint_type: ::std::option::Option, + pub(crate) trigger_type: ::std::option::Option, + pub(crate) status: ::std::option::Option, + pub(crate) version: ::std::option::Option, + pub(crate) previous_version_id: ::std::option::Option<::std::string::String>, + pub(crate) replaced_by_id: ::std::option::Option<::std::string::String>, + pub(crate) idempotency_key: ::std::option::Option<::std::string::String>, + pub(crate) input: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) run_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) cron_expression: ::std::option::Option<::std::string::String>, + pub(crate) cron_timezone: ::std::option::Option<::std::string::String>, + pub(crate) cron_starts_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) cron_ends_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) cron_next_run_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) cron_last_tick_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) retired_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl JobResourceBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.endpoint = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.endpoint = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint(&self) -> &::std::option::Option<::std::string::String> { + &self.endpoint + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn endpoint_type(mut self, input: crate::types::EndpointTypeEnum) -> Self { + self.endpoint_type = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint_type(mut self, input: ::std::option::Option) -> Self { + self.endpoint_type = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint_type(&self) -> &::std::option::Option { + &self.endpoint_type + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn trigger_type(mut self, input: crate::types::TriggerTypeEnum) -> Self { + self.trigger_type = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_trigger_type(mut self, input: ::std::option::Option) -> Self { + self.trigger_type = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_trigger_type(&self) -> &::std::option::Option { + &self.trigger_type + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn status(mut self, input: crate::types::JobStatusEnum) -> Self { + self.status = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.status = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn version(mut self, input: i32) -> Self { + self.version = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_version(mut self, input: ::std::option::Option) -> Self { + self.version = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_version(&self) -> &::std::option::Option { + &self.version + } + #[allow(missing_docs)] // documentation missing in model + pub fn previous_version_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.previous_version_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_previous_version_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.previous_version_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_previous_version_id(&self) -> &::std::option::Option<::std::string::String> { + &self.previous_version_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn replaced_by_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.replaced_by_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_replaced_by_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.replaced_by_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_replaced_by_id(&self) -> &::std::option::Option<::std::string::String> { + &self.replaced_by_id + } + #[allow(missing_docs)] // documentation missing in model + pub fn idempotency_key(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.idempotency_key = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_idempotency_key(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.idempotency_key = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_idempotency_key(&self) -> &::std::option::Option<::std::string::String> { + &self.idempotency_key + } + #[allow(missing_docs)] // documentation missing in model + pub fn input(mut self, input: ::aws_smithy_types::Document) -> Self { + self.input = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_input(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.input = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_input(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.input + } + #[allow(missing_docs)] // documentation missing in model + pub fn run_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.run_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_run_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.run_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_run_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.run_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_expression(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cron_expression = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron_expression(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cron_expression = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron_expression(&self) -> &::std::option::Option<::std::string::String> { + &self.cron_expression + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_timezone(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.cron_timezone = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron_timezone(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.cron_timezone = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron_timezone(&self) -> &::std::option::Option<::std::string::String> { + &self.cron_timezone + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_starts_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.cron_starts_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron_starts_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.cron_starts_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron_starts_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.cron_starts_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_ends_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.cron_ends_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron_ends_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.cron_ends_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron_ends_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.cron_ends_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_next_run_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.cron_next_run_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron_next_run_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.cron_next_run_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron_next_run_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.cron_next_run_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn cron_last_tick_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.cron_last_tick_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_cron_last_tick_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.cron_last_tick_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_cron_last_tick_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.cron_last_tick_at + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.created_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.created_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.created_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn retired_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.retired_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_retired_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.retired_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_retired_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.retired_at + } + /// Consumes the builder and constructs a [`JobResource`](crate::types::JobResource). + /// This method will fail if any of the following fields are not set: + /// - [`job_id`](crate::types::builders::JobResourceBuilder::job_id) + /// - [`endpoint`](crate::types::builders::JobResourceBuilder::endpoint) + /// - [`endpoint_type`](crate::types::builders::JobResourceBuilder::endpoint_type) + /// - [`trigger_type`](crate::types::builders::JobResourceBuilder::trigger_type) + /// - [`status`](crate::types::builders::JobResourceBuilder::status) + /// - [`version`](crate::types::builders::JobResourceBuilder::version) + /// - [`created_at`](crate::types::builders::JobResourceBuilder::created_at) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::JobResource { + job_id: self.job_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "job_id was not specified but it is required when building JobResource") + )? + , + endpoint: self.endpoint + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("endpoint", "endpoint was not specified but it is required when building JobResource") + )? + , + endpoint_type: self.endpoint_type + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("endpoint_type", "endpoint_type was not specified but it is required when building JobResource") + )? + , + trigger_type: self.trigger_type + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("trigger_type", "trigger_type was not specified but it is required when building JobResource") + )? + , + status: self.status + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("status", "status was not specified but it is required when building JobResource") + )? + , + version: self.version + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("version", "version was not specified but it is required when building JobResource") + )? + , + previous_version_id: self.previous_version_id + , + replaced_by_id: self.replaced_by_id + , + idempotency_key: self.idempotency_key + , + input: self.input + , + run_at: self.run_at + , + cron_expression: self.cron_expression + , + cron_timezone: self.cron_timezone + , + cron_starts_at: self.cron_starts_at + , + cron_ends_at: self.cron_ends_at + , + cron_next_run_at: self.cron_next_run_at + , + cron_last_tick_at: self.cron_last_tick_at + , + created_at: self.created_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("created_at", "created_at was not specified but it is required when building JobResource") + )? + , + retired_at: self.retired_at + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_job_status_enum.rs b/sdks/rust/src/types/_job_status_enum.rs new file mode 100644 index 0000000..deb0fdc --- /dev/null +++ b/sdks/rust/src/types/_job_status_enum.rs @@ -0,0 +1,107 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// When writing a match expression against `JobStatusEnum`, it is important to ensure +/// your code is forward-compatible. That is, if a match arm handles a case for a +/// feature that is supported by the service but has not been represented as an enum +/// variant in a current version of SDK, your code should continue to work when you +/// upgrade SDK to a future version in which the enum does include a variant for that +/// feature. +/// +/// Here is an example of how you can make a match expression forward-compatible: +/// +/// ```text +/// # let jobstatusenum = unimplemented!(); +/// match jobstatusenum { +/// JobStatusEnum::Active => { /* ... */ }, +/// JobStatusEnum::Retired => { /* ... */ }, +/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ }, +/// _ => { /* ... */ }, +/// } +/// ``` +/// The above code demonstrates that when `jobstatusenum` represents +/// `NewFeature`, the execution path will lead to the second last match arm, +/// even though the enum does not contain a variant `JobStatusEnum::NewFeature` +/// in the current version of SDK. The reason is that the variable `other`, +/// created by the `@` operator, is bound to +/// `JobStatusEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))` +/// and calling `as_str` on it yields `"NewFeature"`. +/// This match expression is forward-compatible when executed with a newer +/// version of SDK where the variant `JobStatusEnum::NewFeature` is defined. +/// Specifically, when `jobstatusenum` represents `NewFeature`, +/// the execution path will hit the second last match arm as before by virtue of +/// calling `as_str` on `JobStatusEnum::NewFeature` also yielding `"NewFeature"`. +/// +/// Explicitly matching on the `Unknown` variant should +/// be avoided for two reasons: +/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted. +/// - It might inadvertently shadow other intended match arms. +/// +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash)] +pub enum JobStatusEnum { + #[allow(missing_docs)] // documentation missing in model + Active, + #[allow(missing_docs)] // documentation missing in model + Retired, + /// `Unknown` contains new variants that have been added since this code was generated. + #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")] + Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue) +} +impl ::std::convert::From<&str> for JobStatusEnum { + fn from(s: &str) -> Self { + match s { + "ACTIVE" => JobStatusEnum::Active, +"RETIRED" => JobStatusEnum::Retired, +other => JobStatusEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())) + } + } + } +impl ::std::str::FromStr for JobStatusEnum { + type Err = ::std::convert::Infallible; + + fn from_str(s: &str) -> ::std::result::Result::Err> { + ::std::result::Result::Ok(JobStatusEnum::from(s)) + } + } +impl JobStatusEnum { + /// Returns the `&str` value of the enum member. + pub fn as_str(&self) -> &str { + match self { + JobStatusEnum::Active => "ACTIVE", + JobStatusEnum::Retired => "RETIRED", + JobStatusEnum::Unknown(value) => value.as_str() +} + } + /// Returns all the `&str` representations of the enum members. + pub const fn values() -> &'static [&'static str] { + &["ACTIVE", "RETIRED"] + } + } +impl ::std::convert::AsRef for JobStatusEnum { + fn as_ref(&self) -> &str { + self.as_str() + } + } +impl JobStatusEnum { + /// Parses the enum value while disallowing unknown variants. + /// + /// Unknown variants will result in an error. + pub fn try_parse(value: &str) -> ::std::result::Result { + match Self::from(value) { + #[allow(deprecated)] + Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)), + known => Ok(known), + } + } + } +impl ::std::fmt::Display for JobStatusEnum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + JobStatusEnum::Active => write!(f, "ACTIVE"), +JobStatusEnum::Retired => write!(f, "RETIRED"), +JobStatusEnum::Unknown(value) => write!(f, "{}", value) + } + } + } + diff --git a/sdks/rust/src/types/_job_status_response.rs b/sdks/rust/src/types/_job_status_response.rs new file mode 100644 index 0000000..aca13a4 --- /dev/null +++ b/sdks/rust/src/types/_job_status_response.rs @@ -0,0 +1,107 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct JobStatusResponse { + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub job_status: crate::types::JobStatusEnum, + #[allow(missing_docs)] // documentation missing in model + pub latest_execution: ::std::option::Option, +} +impl JobStatusResponse { + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> &str { + use std::ops::Deref; self.job_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn job_status(&self) -> &crate::types::JobStatusEnum { + &self.job_status + } + #[allow(missing_docs)] // documentation missing in model + pub fn latest_execution(&self) -> ::std::option::Option<&crate::types::ExecutionSummary> { + self.latest_execution.as_ref() + } +} +impl JobStatusResponse { + /// Creates a new builder-style object to manufacture [`JobStatusResponse`](crate::types::JobStatusResponse). + pub fn builder() -> crate::types::builders::JobStatusResponseBuilder { + crate::types::builders::JobStatusResponseBuilder::default() + } +} + +/// A builder for [`JobStatusResponse`](crate::types::JobStatusResponse). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct JobStatusResponseBuilder { + pub(crate) job_id: ::std::option::Option<::std::string::String>, + pub(crate) job_status: ::std::option::Option, + pub(crate) latest_execution: ::std::option::Option, +} +impl JobStatusResponseBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_status(mut self, input: crate::types::JobStatusEnum) -> Self { + self.job_status = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_status(mut self, input: ::std::option::Option) -> Self { + self.job_status = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_status(&self) -> &::std::option::Option { + &self.job_status + } + #[allow(missing_docs)] // documentation missing in model + pub fn latest_execution(mut self, input: crate::types::ExecutionSummary) -> Self { + self.latest_execution = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_latest_execution(mut self, input: ::std::option::Option) -> Self { + self.latest_execution = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_latest_execution(&self) -> &::std::option::Option { + &self.latest_execution + } + /// Consumes the builder and constructs a [`JobStatusResponse`](crate::types::JobStatusResponse). + /// This method will fail if any of the following fields are not set: + /// - [`job_id`](crate::types::builders::JobStatusResponseBuilder::job_id) + /// - [`job_status`](crate::types::builders::JobStatusResponseBuilder::job_status) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::JobStatusResponse { + job_id: self.job_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "job_id was not specified but it is required when building JobStatusResponse") + )? + , + job_status: self.job_status + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("job_status", "job_status was not specified but it is required when building JobStatusResponse") + )? + , + latest_execution: self.latest_execution + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_job_summary.rs b/sdks/rust/src/types/_job_summary.rs new file mode 100644 index 0000000..6dbef83 --- /dev/null +++ b/sdks/rust/src/types/_job_summary.rs @@ -0,0 +1,193 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct JobSummary { + #[allow(missing_docs)] // documentation missing in model + pub job_id: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub endpoint: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub trigger_type: crate::types::TriggerTypeEnum, + #[allow(missing_docs)] // documentation missing in model + pub status: crate::types::JobStatusEnum, + #[allow(missing_docs)] // documentation missing in model + pub version: i32, + #[allow(missing_docs)] // documentation missing in model + pub created_at: ::aws_smithy_types::DateTime, +} +impl JobSummary { + #[allow(missing_docs)] // documentation missing in model + pub fn job_id(&self) -> &str { + use std::ops::Deref; self.job_id.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn endpoint(&self) -> &str { + use std::ops::Deref; self.endpoint.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn trigger_type(&self) -> &crate::types::TriggerTypeEnum { + &self.trigger_type + } + #[allow(missing_docs)] // documentation missing in model + pub fn status(&self) -> &crate::types::JobStatusEnum { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + pub fn version(&self) -> i32 { + self.version + } + #[allow(missing_docs)] // documentation missing in model + pub fn created_at(&self) -> &::aws_smithy_types::DateTime { + &self.created_at + } +} +impl JobSummary { + /// Creates a new builder-style object to manufacture [`JobSummary`](crate::types::JobSummary). + pub fn builder() -> crate::types::builders::JobSummaryBuilder { + crate::types::builders::JobSummaryBuilder::default() + } +} + +/// A builder for [`JobSummary`](crate::types::JobSummary). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct JobSummaryBuilder { + pub(crate) job_id: ::std::option::Option<::std::string::String>, + pub(crate) endpoint: ::std::option::Option<::std::string::String>, + pub(crate) trigger_type: ::std::option::Option, + pub(crate) status: ::std::option::Option, + pub(crate) version: ::std::option::Option, + pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl JobSummaryBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn job_id(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.job_id = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_job_id(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.job_id = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_job_id(&self) -> &::std::option::Option<::std::string::String> { + &self.job_id + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn endpoint(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.endpoint = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_endpoint(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.endpoint = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_endpoint(&self) -> &::std::option::Option<::std::string::String> { + &self.endpoint + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn trigger_type(mut self, input: crate::types::TriggerTypeEnum) -> Self { + self.trigger_type = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_trigger_type(mut self, input: ::std::option::Option) -> Self { + self.trigger_type = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_trigger_type(&self) -> &::std::option::Option { + &self.trigger_type + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn status(mut self, input: crate::types::JobStatusEnum) -> Self { + self.status = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_status(mut self, input: ::std::option::Option) -> Self { + self.status = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_status(&self) -> &::std::option::Option { + &self.status + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn version(mut self, input: i32) -> Self { + self.version = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_version(mut self, input: ::std::option::Option) -> Self { + self.version = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_version(&self) -> &::std::option::Option { + &self.version + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.created_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.created_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.created_at + } + /// Consumes the builder and constructs a [`JobSummary`](crate::types::JobSummary). + /// This method will fail if any of the following fields are not set: + /// - [`job_id`](crate::types::builders::JobSummaryBuilder::job_id) + /// - [`endpoint`](crate::types::builders::JobSummaryBuilder::endpoint) + /// - [`trigger_type`](crate::types::builders::JobSummaryBuilder::trigger_type) + /// - [`status`](crate::types::builders::JobSummaryBuilder::status) + /// - [`version`](crate::types::builders::JobSummaryBuilder::version) + /// - [`created_at`](crate::types::builders::JobSummaryBuilder::created_at) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::JobSummary { + job_id: self.job_id + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("job_id", "job_id was not specified but it is required when building JobSummary") + )? + , + endpoint: self.endpoint + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("endpoint", "endpoint was not specified but it is required when building JobSummary") + )? + , + trigger_type: self.trigger_type + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("trigger_type", "trigger_type was not specified but it is required when building JobSummary") + )? + , + status: self.status + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("status", "status was not specified but it is required when building JobSummary") + )? + , + version: self.version + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("version", "version was not specified but it is required when building JobSummary") + )? + , + created_at: self.created_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("created_at", "created_at was not specified but it is required when building JobSummary") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_log_level_enum.rs b/sdks/rust/src/types/_log_level_enum.rs new file mode 100644 index 0000000..ca032de --- /dev/null +++ b/sdks/rust/src/types/_log_level_enum.rs @@ -0,0 +1,119 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// When writing a match expression against `LogLevelEnum`, it is important to ensure +/// your code is forward-compatible. That is, if a match arm handles a case for a +/// feature that is supported by the service but has not been represented as an enum +/// variant in a current version of SDK, your code should continue to work when you +/// upgrade SDK to a future version in which the enum does include a variant for that +/// feature. +/// +/// Here is an example of how you can make a match expression forward-compatible: +/// +/// ```text +/// # let loglevelenum = unimplemented!(); +/// match loglevelenum { +/// LogLevelEnum::Debug => { /* ... */ }, +/// LogLevelEnum::Error => { /* ... */ }, +/// LogLevelEnum::Info => { /* ... */ }, +/// LogLevelEnum::Warn => { /* ... */ }, +/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ }, +/// _ => { /* ... */ }, +/// } +/// ``` +/// The above code demonstrates that when `loglevelenum` represents +/// `NewFeature`, the execution path will lead to the second last match arm, +/// even though the enum does not contain a variant `LogLevelEnum::NewFeature` +/// in the current version of SDK. The reason is that the variable `other`, +/// created by the `@` operator, is bound to +/// `LogLevelEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))` +/// and calling `as_str` on it yields `"NewFeature"`. +/// This match expression is forward-compatible when executed with a newer +/// version of SDK where the variant `LogLevelEnum::NewFeature` is defined. +/// Specifically, when `loglevelenum` represents `NewFeature`, +/// the execution path will hit the second last match arm as before by virtue of +/// calling `as_str` on `LogLevelEnum::NewFeature` also yielding `"NewFeature"`. +/// +/// Explicitly matching on the `Unknown` variant should +/// be avoided for two reasons: +/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted. +/// - It might inadvertently shadow other intended match arms. +/// +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash)] +pub enum LogLevelEnum { + #[allow(missing_docs)] // documentation missing in model + Debug, + #[allow(missing_docs)] // documentation missing in model + Error, + #[allow(missing_docs)] // documentation missing in model + Info, + #[allow(missing_docs)] // documentation missing in model + Warn, + /// `Unknown` contains new variants that have been added since this code was generated. + #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")] + Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue) +} +impl ::std::convert::From<&str> for LogLevelEnum { + fn from(s: &str) -> Self { + match s { + "DEBUG" => LogLevelEnum::Debug, +"ERROR" => LogLevelEnum::Error, +"INFO" => LogLevelEnum::Info, +"WARN" => LogLevelEnum::Warn, +other => LogLevelEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())) + } + } + } +impl ::std::str::FromStr for LogLevelEnum { + type Err = ::std::convert::Infallible; + + fn from_str(s: &str) -> ::std::result::Result::Err> { + ::std::result::Result::Ok(LogLevelEnum::from(s)) + } + } +impl LogLevelEnum { + /// Returns the `&str` value of the enum member. + pub fn as_str(&self) -> &str { + match self { + LogLevelEnum::Debug => "DEBUG", + LogLevelEnum::Error => "ERROR", + LogLevelEnum::Info => "INFO", + LogLevelEnum::Warn => "WARN", + LogLevelEnum::Unknown(value) => value.as_str() +} + } + /// Returns all the `&str` representations of the enum members. + pub const fn values() -> &'static [&'static str] { + &["DEBUG", "ERROR", "INFO", "WARN"] + } + } +impl ::std::convert::AsRef for LogLevelEnum { + fn as_ref(&self) -> &str { + self.as_str() + } + } +impl LogLevelEnum { + /// Parses the enum value while disallowing unknown variants. + /// + /// Unknown variants will result in an error. + pub fn try_parse(value: &str) -> ::std::result::Result { + match Self::from(value) { + #[allow(deprecated)] + Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)), + known => Ok(known), + } + } + } +impl ::std::fmt::Display for LogLevelEnum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + LogLevelEnum::Debug => write!(f, "DEBUG"), +LogLevelEnum::Error => write!(f, "ERROR"), +LogLevelEnum::Info => write!(f, "INFO"), +LogLevelEnum::Warn => write!(f, "WARN"), +LogLevelEnum::Unknown(value) => write!(f, "{}", value) + } + } + } + diff --git a/sdks/rust/src/types/_payload_spec_resource.rs b/sdks/rust/src/types/_payload_spec_resource.rs new file mode 100644 index 0000000..640fae2 --- /dev/null +++ b/sdks/rust/src/types/_payload_spec_resource.rs @@ -0,0 +1,139 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct PayloadSpecResource { + #[allow(missing_docs)] // documentation missing in model + pub name: ::std::string::String, + #[allow(missing_docs)] // documentation missing in model + pub schema: ::aws_smithy_types::Document, + #[allow(missing_docs)] // documentation missing in model + pub created_at: ::aws_smithy_types::DateTime, + #[allow(missing_docs)] // documentation missing in model + pub updated_at: ::aws_smithy_types::DateTime, +} +impl PayloadSpecResource { + #[allow(missing_docs)] // documentation missing in model + pub fn name(&self) -> &str { + use std::ops::Deref; self.name.deref() + } + #[allow(missing_docs)] // documentation missing in model + pub fn schema(&self) -> &::aws_smithy_types::Document { + &self.schema + } + #[allow(missing_docs)] // documentation missing in model + pub fn created_at(&self) -> &::aws_smithy_types::DateTime { + &self.created_at + } + #[allow(missing_docs)] // documentation missing in model + pub fn updated_at(&self) -> &::aws_smithy_types::DateTime { + &self.updated_at + } +} +impl PayloadSpecResource { + /// Creates a new builder-style object to manufacture [`PayloadSpecResource`](crate::types::PayloadSpecResource). + pub fn builder() -> crate::types::builders::PayloadSpecResourceBuilder { + crate::types::builders::PayloadSpecResourceBuilder::default() + } +} + +/// A builder for [`PayloadSpecResource`](crate::types::PayloadSpecResource). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct PayloadSpecResourceBuilder { + pub(crate) name: ::std::option::Option<::std::string::String>, + pub(crate) schema: ::std::option::Option<::aws_smithy_types::Document>, + pub(crate) created_at: ::std::option::Option<::aws_smithy_types::DateTime>, + pub(crate) updated_at: ::std::option::Option<::aws_smithy_types::DateTime>, +} +impl PayloadSpecResourceBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn name(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.name = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_name(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.name = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_name(&self) -> &::std::option::Option<::std::string::String> { + &self.name + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn schema(mut self, input: ::aws_smithy_types::Document) -> Self { + self.schema = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_schema(mut self, input: ::std::option::Option<::aws_smithy_types::Document>) -> Self { + self.schema = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_schema(&self) -> &::std::option::Option<::aws_smithy_types::Document> { + &self.schema + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn created_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.created_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_created_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.created_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_created_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.created_at + } + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn updated_at(mut self, input: ::aws_smithy_types::DateTime) -> Self { + self.updated_at = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_updated_at(mut self, input: ::std::option::Option<::aws_smithy_types::DateTime>) -> Self { + self.updated_at = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_updated_at(&self) -> &::std::option::Option<::aws_smithy_types::DateTime> { + &self.updated_at + } + /// Consumes the builder and constructs a [`PayloadSpecResource`](crate::types::PayloadSpecResource). + /// This method will fail if any of the following fields are not set: + /// - [`name`](crate::types::builders::PayloadSpecResourceBuilder::name) + /// - [`schema`](crate::types::builders::PayloadSpecResourceBuilder::schema) + /// - [`created_at`](crate::types::builders::PayloadSpecResourceBuilder::created_at) + /// - [`updated_at`](crate::types::builders::PayloadSpecResourceBuilder::updated_at) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::PayloadSpecResource { + name: self.name + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("name", "name was not specified but it is required when building PayloadSpecResource") + )? + , + schema: self.schema + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("schema", "schema was not specified but it is required when building PayloadSpecResource") + )? + , + created_at: self.created_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("created_at", "created_at was not specified but it is required when building PayloadSpecResource") + )? + , + updated_at: self.updated_at + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("updated_at", "updated_at was not specified but it is required when building PayloadSpecResource") + )? + , + } + ) + } +} + diff --git a/sdks/rust/src/types/_retry_policy.rs b/sdks/rust/src/types/_retry_policy.rs new file mode 100644 index 0000000..df90013 --- /dev/null +++ b/sdks/rust/src/types/_retry_policy.rs @@ -0,0 +1,116 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct RetryPolicy { + /// Total attempts including first. Default: 1 + pub max_attempts: ::std::option::Option, + /// fixed | linear | exponential. Default: exponential + pub backoff: ::std::option::Option, + /// Delay before first retry in ms. Default: 1000 + pub initial_delay_ms: ::std::option::Option, + /// Upper bound on backoff in ms. Default: 60000 + pub max_delay_ms: ::std::option::Option, +} +impl RetryPolicy { + /// Total attempts including first. Default: 1 + pub fn max_attempts(&self) -> ::std::option::Option { + self.max_attempts + } + /// fixed | linear | exponential. Default: exponential + pub fn backoff(&self) -> ::std::option::Option<&crate::types::BackoffTypeEnum> { + self.backoff.as_ref() + } + /// Delay before first retry in ms. Default: 1000 + pub fn initial_delay_ms(&self) -> ::std::option::Option { + self.initial_delay_ms + } + /// Upper bound on backoff in ms. Default: 60000 + pub fn max_delay_ms(&self) -> ::std::option::Option { + self.max_delay_ms + } +} +impl RetryPolicy { + /// Creates a new builder-style object to manufacture [`RetryPolicy`](crate::types::RetryPolicy). + pub fn builder() -> crate::types::builders::RetryPolicyBuilder { + crate::types::builders::RetryPolicyBuilder::default() + } +} + +/// A builder for [`RetryPolicy`](crate::types::RetryPolicy). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct RetryPolicyBuilder { + pub(crate) max_attempts: ::std::option::Option, + pub(crate) backoff: ::std::option::Option, + pub(crate) initial_delay_ms: ::std::option::Option, + pub(crate) max_delay_ms: ::std::option::Option, +} +impl RetryPolicyBuilder { + /// Total attempts including first. Default: 1 + pub fn max_attempts(mut self, input: i32) -> Self { + self.max_attempts = ::std::option::Option::Some(input); + self + } + /// Total attempts including first. Default: 1 + pub fn set_max_attempts(mut self, input: ::std::option::Option) -> Self { + self.max_attempts = input; self + } + /// Total attempts including first. Default: 1 + pub fn get_max_attempts(&self) -> &::std::option::Option { + &self.max_attempts + } + /// fixed | linear | exponential. Default: exponential + pub fn backoff(mut self, input: crate::types::BackoffTypeEnum) -> Self { + self.backoff = ::std::option::Option::Some(input); + self + } + /// fixed | linear | exponential. Default: exponential + pub fn set_backoff(mut self, input: ::std::option::Option) -> Self { + self.backoff = input; self + } + /// fixed | linear | exponential. Default: exponential + pub fn get_backoff(&self) -> &::std::option::Option { + &self.backoff + } + /// Delay before first retry in ms. Default: 1000 + pub fn initial_delay_ms(mut self, input: i64) -> Self { + self.initial_delay_ms = ::std::option::Option::Some(input); + self + } + /// Delay before first retry in ms. Default: 1000 + pub fn set_initial_delay_ms(mut self, input: ::std::option::Option) -> Self { + self.initial_delay_ms = input; self + } + /// Delay before first retry in ms. Default: 1000 + pub fn get_initial_delay_ms(&self) -> &::std::option::Option { + &self.initial_delay_ms + } + /// Upper bound on backoff in ms. Default: 60000 + pub fn max_delay_ms(mut self, input: i64) -> Self { + self.max_delay_ms = ::std::option::Option::Some(input); + self + } + /// Upper bound on backoff in ms. Default: 60000 + pub fn set_max_delay_ms(mut self, input: ::std::option::Option) -> Self { + self.max_delay_ms = input; self + } + /// Upper bound on backoff in ms. Default: 60000 + pub fn get_max_delay_ms(&self) -> &::std::option::Option { + &self.max_delay_ms + } + /// Consumes the builder and constructs a [`RetryPolicy`](crate::types::RetryPolicy). + pub fn build(self) -> crate::types::RetryPolicy { + crate::types::RetryPolicy { + max_attempts: self.max_attempts + , + backoff: self.backoff + , + initial_delay_ms: self.initial_delay_ms + , + max_delay_ms: self.max_delay_ms + , + } + } +} + diff --git a/sdks/rust/src/types/_trigger_type_enum.rs b/sdks/rust/src/types/_trigger_type_enum.rs new file mode 100644 index 0000000..5bda87f --- /dev/null +++ b/sdks/rust/src/types/_trigger_type_enum.rs @@ -0,0 +1,113 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. + +/// When writing a match expression against `TriggerTypeEnum`, it is important to ensure +/// your code is forward-compatible. That is, if a match arm handles a case for a +/// feature that is supported by the service but has not been represented as an enum +/// variant in a current version of SDK, your code should continue to work when you +/// upgrade SDK to a future version in which the enum does include a variant for that +/// feature. +/// +/// Here is an example of how you can make a match expression forward-compatible: +/// +/// ```text +/// # let triggertypeenum = unimplemented!(); +/// match triggertypeenum { +/// TriggerTypeEnum::Cron => { /* ... */ }, +/// TriggerTypeEnum::Delayed => { /* ... */ }, +/// TriggerTypeEnum::Immediate => { /* ... */ }, +/// other @ _ if other.as_str() == "NewFeature" => { /* handles a case for `NewFeature` */ }, +/// _ => { /* ... */ }, +/// } +/// ``` +/// The above code demonstrates that when `triggertypeenum` represents +/// `NewFeature`, the execution path will lead to the second last match arm, +/// even though the enum does not contain a variant `TriggerTypeEnum::NewFeature` +/// in the current version of SDK. The reason is that the variable `other`, +/// created by the `@` operator, is bound to +/// `TriggerTypeEnum::Unknown(UnknownVariantValue("NewFeature".to_owned()))` +/// and calling `as_str` on it yields `"NewFeature"`. +/// This match expression is forward-compatible when executed with a newer +/// version of SDK where the variant `TriggerTypeEnum::NewFeature` is defined. +/// Specifically, when `triggertypeenum` represents `NewFeature`, +/// the execution path will hit the second last match arm as before by virtue of +/// calling `as_str` on `TriggerTypeEnum::NewFeature` also yielding `"NewFeature"`. +/// +/// Explicitly matching on the `Unknown` variant should +/// be avoided for two reasons: +/// - The inner data `UnknownVariantValue` is opaque, and no further information can be extracted. +/// - It might inadvertently shadow other intended match arms. +/// +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::Eq, ::std::cmp::Ord, ::std::cmp::PartialEq, ::std::cmp::PartialOrd, ::std::fmt::Debug, ::std::hash::Hash)] +pub enum TriggerTypeEnum { + #[allow(missing_docs)] // documentation missing in model + Cron, + #[allow(missing_docs)] // documentation missing in model + Delayed, + #[allow(missing_docs)] // documentation missing in model + Immediate, + /// `Unknown` contains new variants that have been added since this code was generated. + #[deprecated(note = "Don't directly match on `Unknown`. See the docs on this enum for the correct way to handle unknown variants.")] + Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue) +} +impl ::std::convert::From<&str> for TriggerTypeEnum { + fn from(s: &str) -> Self { + match s { + "CRON" => TriggerTypeEnum::Cron, +"DELAYED" => TriggerTypeEnum::Delayed, +"IMMEDIATE" => TriggerTypeEnum::Immediate, +other => TriggerTypeEnum::Unknown(crate::primitives::sealed_enum_unknown::UnknownVariantValue(other.to_owned())) + } + } + } +impl ::std::str::FromStr for TriggerTypeEnum { + type Err = ::std::convert::Infallible; + + fn from_str(s: &str) -> ::std::result::Result::Err> { + ::std::result::Result::Ok(TriggerTypeEnum::from(s)) + } + } +impl TriggerTypeEnum { + /// Returns the `&str` value of the enum member. + pub fn as_str(&self) -> &str { + match self { + TriggerTypeEnum::Cron => "CRON", + TriggerTypeEnum::Delayed => "DELAYED", + TriggerTypeEnum::Immediate => "IMMEDIATE", + TriggerTypeEnum::Unknown(value) => value.as_str() +} + } + /// Returns all the `&str` representations of the enum members. + pub const fn values() -> &'static [&'static str] { + &["CRON", "DELAYED", "IMMEDIATE"] + } + } +impl ::std::convert::AsRef for TriggerTypeEnum { + fn as_ref(&self) -> &str { + self.as_str() + } + } +impl TriggerTypeEnum { + /// Parses the enum value while disallowing unknown variants. + /// + /// Unknown variants will result in an error. + pub fn try_parse(value: &str) -> ::std::result::Result { + match Self::from(value) { + #[allow(deprecated)] + Self::Unknown(_) => ::std::result::Result::Err(crate::error::UnknownVariantError::new(value)), + known => Ok(known), + } + } + } +impl ::std::fmt::Display for TriggerTypeEnum { + fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + match self { + TriggerTypeEnum::Cron => write!(f, "CRON"), +TriggerTypeEnum::Delayed => write!(f, "DELAYED"), +TriggerTypeEnum::Immediate => write!(f, "IMMEDIATE"), +TriggerTypeEnum::Unknown(value) => write!(f, "{}", value) + } + } + } + diff --git a/sdks/rust/src/types/builders.rs b/sdks/rust/src/types/builders.rs new file mode 100644 index 0000000..b18c0a5 --- /dev/null +++ b/sdks/rust/src/types/builders.rs @@ -0,0 +1,23 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::types::_error_detail::ErrorDetailBuilder; + +pub use crate::types::_payload_spec_resource::PayloadSpecResourceBuilder; + +pub use crate::types::_retry_policy::RetryPolicyBuilder; + +pub use crate::types::_endpoint_resource::EndpointResourceBuilder; + +pub use crate::types::_job_resource::JobResourceBuilder; + +pub use crate::types::_job_status_response::JobStatusResponseBuilder; + +pub use crate::types::_execution_resource::ExecutionResourceBuilder; + +pub use crate::types::_job_summary::JobSummaryBuilder; + +pub use crate::types::_execution_summary::ExecutionSummaryBuilder; + +pub use crate::types::_attempt_resource::AttemptResourceBuilder; + +pub use crate::types::_execution_log_resource::ExecutionLogResourceBuilder; + diff --git a/sdks/rust/src/types/error.rs b/sdks/rust/src/types/error.rs new file mode 100644 index 0000000..a547e15 --- /dev/null +++ b/sdks/rust/src/types/error.rs @@ -0,0 +1,32 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::types::error::_unauthorized_error::UnauthorizedError; + +pub use crate::types::error::_internal_error::InternalError; + +pub use crate::types::error::_rate_limited_error::RateLimitedError; + +pub use crate::types::error::_invalid_request_error::InvalidRequestError; + +pub use crate::types::error::_conflict_error::ConflictError; + +pub use crate::types::error::_not_found_error::NotFoundError; + +pub use crate::types::error::_unprocessable_entity_error::UnprocessableEntityError; + +mod _conflict_error; + +mod _internal_error; + +mod _invalid_request_error; + +mod _not_found_error; + +mod _rate_limited_error; + +mod _unauthorized_error; + +mod _unprocessable_entity_error; + +/// Builders +pub mod builders; + diff --git a/sdks/rust/src/types/error/_conflict_error.rs b/sdks/rust/src/types/error/_conflict_error.rs new file mode 100644 index 0000000..4a21b1e --- /dev/null +++ b/sdks/rust/src/types/error/_conflict_error.rs @@ -0,0 +1,109 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct ConflictError { + #[allow(missing_docs)] // documentation missing in model + pub error: crate::types::ErrorDetail, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::option::Option<::std::string::String>, + pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata, +} +impl ConflictError { + #[allow(missing_docs)] // documentation missing in model + pub fn error(&self) -> &crate::types::ErrorDetail { + &self.error + } +} +impl ConflictError { + /// Returns the error message. + pub fn message(&self) -> ::std::option::Option<&str> { self.message.as_deref() } +} +impl ::std::fmt::Display for ConflictError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + ::std::write!(f, "ConflictError")?; + if let ::std::option::Option::Some(inner_1) = &self.message { + { + ::std::write!(f, ": {}", inner_1)?; + } + } + Ok(()) + } +} +impl ::std::error::Error for ConflictError {} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for ConflictError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { &self.meta } +} +impl ConflictError { + /// Creates a new builder-style object to manufacture [`ConflictError`](crate::types::error::ConflictError). + pub fn builder() -> crate::types::error::builders::ConflictErrorBuilder { + crate::types::error::builders::ConflictErrorBuilder::default() + } +} + +/// A builder for [`ConflictError`](crate::types::error::ConflictError). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct ConflictErrorBuilder { + pub(crate) error: ::std::option::Option, + pub(crate) message: ::std::option::Option<::std::string::String>, + meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>, +} +impl ConflictErrorBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn error(mut self, input: crate::types::ErrorDetail) -> Self { + self.error = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_error(mut self, input: ::std::option::Option) -> Self { + self.error = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_error(&self) -> &::std::option::Option { + &self.error + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + /// Sets error metadata + pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self { + self.meta = Some(meta); + self + } + + /// Sets error metadata + pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self { + self.meta = meta; + self + } + /// Consumes the builder and constructs a [`ConflictError`](crate::types::error::ConflictError). + /// This method will fail if any of the following fields are not set: + /// - [`error`](crate::types::error::builders::ConflictErrorBuilder::error) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::error::ConflictError { + error: self.error + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("error", "error was not specified but it is required when building ConflictError") + )? + , + message: self.message + , + meta: self.meta.unwrap_or_default(), + } + ) + } +} + diff --git a/sdks/rust/src/types/error/_internal_error.rs b/sdks/rust/src/types/error/_internal_error.rs new file mode 100644 index 0000000..b46b10b --- /dev/null +++ b/sdks/rust/src/types/error/_internal_error.rs @@ -0,0 +1,109 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct InternalError { + #[allow(missing_docs)] // documentation missing in model + pub error: crate::types::ErrorDetail, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::option::Option<::std::string::String>, + pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata, +} +impl InternalError { + #[allow(missing_docs)] // documentation missing in model + pub fn error(&self) -> &crate::types::ErrorDetail { + &self.error + } +} +impl InternalError { + /// Returns the error message. + pub fn message(&self) -> ::std::option::Option<&str> { self.message.as_deref() } +} +impl ::std::fmt::Display for InternalError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + ::std::write!(f, "InternalError")?; + if let ::std::option::Option::Some(inner_1) = &self.message { + { + ::std::write!(f, ": {}", inner_1)?; + } + } + Ok(()) + } +} +impl ::std::error::Error for InternalError {} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for InternalError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { &self.meta } +} +impl InternalError { + /// Creates a new builder-style object to manufacture [`InternalError`](crate::types::error::InternalError). + pub fn builder() -> crate::types::error::builders::InternalErrorBuilder { + crate::types::error::builders::InternalErrorBuilder::default() + } +} + +/// A builder for [`InternalError`](crate::types::error::InternalError). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct InternalErrorBuilder { + pub(crate) error: ::std::option::Option, + pub(crate) message: ::std::option::Option<::std::string::String>, + meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>, +} +impl InternalErrorBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn error(mut self, input: crate::types::ErrorDetail) -> Self { + self.error = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_error(mut self, input: ::std::option::Option) -> Self { + self.error = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_error(&self) -> &::std::option::Option { + &self.error + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + /// Sets error metadata + pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self { + self.meta = Some(meta); + self + } + + /// Sets error metadata + pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self { + self.meta = meta; + self + } + /// Consumes the builder and constructs a [`InternalError`](crate::types::error::InternalError). + /// This method will fail if any of the following fields are not set: + /// - [`error`](crate::types::error::builders::InternalErrorBuilder::error) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::error::InternalError { + error: self.error + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("error", "error was not specified but it is required when building InternalError") + )? + , + message: self.message + , + meta: self.meta.unwrap_or_default(), + } + ) + } +} + diff --git a/sdks/rust/src/types/error/_invalid_request_error.rs b/sdks/rust/src/types/error/_invalid_request_error.rs new file mode 100644 index 0000000..f4f31ce --- /dev/null +++ b/sdks/rust/src/types/error/_invalid_request_error.rs @@ -0,0 +1,109 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct InvalidRequestError { + #[allow(missing_docs)] // documentation missing in model + pub error: crate::types::ErrorDetail, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::option::Option<::std::string::String>, + pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata, +} +impl InvalidRequestError { + #[allow(missing_docs)] // documentation missing in model + pub fn error(&self) -> &crate::types::ErrorDetail { + &self.error + } +} +impl InvalidRequestError { + /// Returns the error message. + pub fn message(&self) -> ::std::option::Option<&str> { self.message.as_deref() } +} +impl ::std::fmt::Display for InvalidRequestError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + ::std::write!(f, "InvalidRequestError")?; + if let ::std::option::Option::Some(inner_1) = &self.message { + { + ::std::write!(f, ": {}", inner_1)?; + } + } + Ok(()) + } +} +impl ::std::error::Error for InvalidRequestError {} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for InvalidRequestError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { &self.meta } +} +impl InvalidRequestError { + /// Creates a new builder-style object to manufacture [`InvalidRequestError`](crate::types::error::InvalidRequestError). + pub fn builder() -> crate::types::error::builders::InvalidRequestErrorBuilder { + crate::types::error::builders::InvalidRequestErrorBuilder::default() + } +} + +/// A builder for [`InvalidRequestError`](crate::types::error::InvalidRequestError). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct InvalidRequestErrorBuilder { + pub(crate) error: ::std::option::Option, + pub(crate) message: ::std::option::Option<::std::string::String>, + meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>, +} +impl InvalidRequestErrorBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn error(mut self, input: crate::types::ErrorDetail) -> Self { + self.error = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_error(mut self, input: ::std::option::Option) -> Self { + self.error = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_error(&self) -> &::std::option::Option { + &self.error + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + /// Sets error metadata + pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self { + self.meta = Some(meta); + self + } + + /// Sets error metadata + pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self { + self.meta = meta; + self + } + /// Consumes the builder and constructs a [`InvalidRequestError`](crate::types::error::InvalidRequestError). + /// This method will fail if any of the following fields are not set: + /// - [`error`](crate::types::error::builders::InvalidRequestErrorBuilder::error) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::error::InvalidRequestError { + error: self.error + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("error", "error was not specified but it is required when building InvalidRequestError") + )? + , + message: self.message + , + meta: self.meta.unwrap_or_default(), + } + ) + } +} + diff --git a/sdks/rust/src/types/error/_not_found_error.rs b/sdks/rust/src/types/error/_not_found_error.rs new file mode 100644 index 0000000..602a078 --- /dev/null +++ b/sdks/rust/src/types/error/_not_found_error.rs @@ -0,0 +1,109 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct NotFoundError { + #[allow(missing_docs)] // documentation missing in model + pub error: crate::types::ErrorDetail, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::option::Option<::std::string::String>, + pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata, +} +impl NotFoundError { + #[allow(missing_docs)] // documentation missing in model + pub fn error(&self) -> &crate::types::ErrorDetail { + &self.error + } +} +impl NotFoundError { + /// Returns the error message. + pub fn message(&self) -> ::std::option::Option<&str> { self.message.as_deref() } +} +impl ::std::fmt::Display for NotFoundError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + ::std::write!(f, "NotFoundError")?; + if let ::std::option::Option::Some(inner_1) = &self.message { + { + ::std::write!(f, ": {}", inner_1)?; + } + } + Ok(()) + } +} +impl ::std::error::Error for NotFoundError {} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for NotFoundError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { &self.meta } +} +impl NotFoundError { + /// Creates a new builder-style object to manufacture [`NotFoundError`](crate::types::error::NotFoundError). + pub fn builder() -> crate::types::error::builders::NotFoundErrorBuilder { + crate::types::error::builders::NotFoundErrorBuilder::default() + } +} + +/// A builder for [`NotFoundError`](crate::types::error::NotFoundError). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct NotFoundErrorBuilder { + pub(crate) error: ::std::option::Option, + pub(crate) message: ::std::option::Option<::std::string::String>, + meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>, +} +impl NotFoundErrorBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn error(mut self, input: crate::types::ErrorDetail) -> Self { + self.error = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_error(mut self, input: ::std::option::Option) -> Self { + self.error = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_error(&self) -> &::std::option::Option { + &self.error + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + /// Sets error metadata + pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self { + self.meta = Some(meta); + self + } + + /// Sets error metadata + pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self { + self.meta = meta; + self + } + /// Consumes the builder and constructs a [`NotFoundError`](crate::types::error::NotFoundError). + /// This method will fail if any of the following fields are not set: + /// - [`error`](crate::types::error::builders::NotFoundErrorBuilder::error) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::error::NotFoundError { + error: self.error + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("error", "error was not specified but it is required when building NotFoundError") + )? + , + message: self.message + , + meta: self.meta.unwrap_or_default(), + } + ) + } +} + diff --git a/sdks/rust/src/types/error/_rate_limited_error.rs b/sdks/rust/src/types/error/_rate_limited_error.rs new file mode 100644 index 0000000..39bd005 --- /dev/null +++ b/sdks/rust/src/types/error/_rate_limited_error.rs @@ -0,0 +1,109 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct RateLimitedError { + #[allow(missing_docs)] // documentation missing in model + pub error: crate::types::ErrorDetail, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::option::Option<::std::string::String>, + pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata, +} +impl RateLimitedError { + #[allow(missing_docs)] // documentation missing in model + pub fn error(&self) -> &crate::types::ErrorDetail { + &self.error + } +} +impl RateLimitedError { + /// Returns the error message. + pub fn message(&self) -> ::std::option::Option<&str> { self.message.as_deref() } +} +impl ::std::fmt::Display for RateLimitedError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + ::std::write!(f, "RateLimitedError")?; + if let ::std::option::Option::Some(inner_1) = &self.message { + { + ::std::write!(f, ": {}", inner_1)?; + } + } + Ok(()) + } +} +impl ::std::error::Error for RateLimitedError {} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for RateLimitedError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { &self.meta } +} +impl RateLimitedError { + /// Creates a new builder-style object to manufacture [`RateLimitedError`](crate::types::error::RateLimitedError). + pub fn builder() -> crate::types::error::builders::RateLimitedErrorBuilder { + crate::types::error::builders::RateLimitedErrorBuilder::default() + } +} + +/// A builder for [`RateLimitedError`](crate::types::error::RateLimitedError). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct RateLimitedErrorBuilder { + pub(crate) error: ::std::option::Option, + pub(crate) message: ::std::option::Option<::std::string::String>, + meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>, +} +impl RateLimitedErrorBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn error(mut self, input: crate::types::ErrorDetail) -> Self { + self.error = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_error(mut self, input: ::std::option::Option) -> Self { + self.error = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_error(&self) -> &::std::option::Option { + &self.error + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + /// Sets error metadata + pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self { + self.meta = Some(meta); + self + } + + /// Sets error metadata + pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self { + self.meta = meta; + self + } + /// Consumes the builder and constructs a [`RateLimitedError`](crate::types::error::RateLimitedError). + /// This method will fail if any of the following fields are not set: + /// - [`error`](crate::types::error::builders::RateLimitedErrorBuilder::error) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::error::RateLimitedError { + error: self.error + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("error", "error was not specified but it is required when building RateLimitedError") + )? + , + message: self.message + , + meta: self.meta.unwrap_or_default(), + } + ) + } +} + diff --git a/sdks/rust/src/types/error/_unauthorized_error.rs b/sdks/rust/src/types/error/_unauthorized_error.rs new file mode 100644 index 0000000..6b73903 --- /dev/null +++ b/sdks/rust/src/types/error/_unauthorized_error.rs @@ -0,0 +1,109 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct UnauthorizedError { + #[allow(missing_docs)] // documentation missing in model + pub error: crate::types::ErrorDetail, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::option::Option<::std::string::String>, + pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata, +} +impl UnauthorizedError { + #[allow(missing_docs)] // documentation missing in model + pub fn error(&self) -> &crate::types::ErrorDetail { + &self.error + } +} +impl UnauthorizedError { + /// Returns the error message. + pub fn message(&self) -> ::std::option::Option<&str> { self.message.as_deref() } +} +impl ::std::fmt::Display for UnauthorizedError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + ::std::write!(f, "UnauthorizedError")?; + if let ::std::option::Option::Some(inner_1) = &self.message { + { + ::std::write!(f, ": {}", inner_1)?; + } + } + Ok(()) + } +} +impl ::std::error::Error for UnauthorizedError {} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UnauthorizedError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { &self.meta } +} +impl UnauthorizedError { + /// Creates a new builder-style object to manufacture [`UnauthorizedError`](crate::types::error::UnauthorizedError). + pub fn builder() -> crate::types::error::builders::UnauthorizedErrorBuilder { + crate::types::error::builders::UnauthorizedErrorBuilder::default() + } +} + +/// A builder for [`UnauthorizedError`](crate::types::error::UnauthorizedError). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UnauthorizedErrorBuilder { + pub(crate) error: ::std::option::Option, + pub(crate) message: ::std::option::Option<::std::string::String>, + meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>, +} +impl UnauthorizedErrorBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn error(mut self, input: crate::types::ErrorDetail) -> Self { + self.error = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_error(mut self, input: ::std::option::Option) -> Self { + self.error = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_error(&self) -> &::std::option::Option { + &self.error + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + /// Sets error metadata + pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self { + self.meta = Some(meta); + self + } + + /// Sets error metadata + pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self { + self.meta = meta; + self + } + /// Consumes the builder and constructs a [`UnauthorizedError`](crate::types::error::UnauthorizedError). + /// This method will fail if any of the following fields are not set: + /// - [`error`](crate::types::error::builders::UnauthorizedErrorBuilder::error) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::error::UnauthorizedError { + error: self.error + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("error", "error was not specified but it is required when building UnauthorizedError") + )? + , + message: self.message + , + meta: self.meta.unwrap_or_default(), + } + ) + } +} + diff --git a/sdks/rust/src/types/error/_unprocessable_entity_error.rs b/sdks/rust/src/types/error/_unprocessable_entity_error.rs new file mode 100644 index 0000000..468a5bf --- /dev/null +++ b/sdks/rust/src/types/error/_unprocessable_entity_error.rs @@ -0,0 +1,109 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +#[allow(missing_docs)] // documentation missing in model +#[non_exhaustive] +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)] +pub struct UnprocessableEntityError { + #[allow(missing_docs)] // documentation missing in model + pub error: crate::types::ErrorDetail, + #[allow(missing_docs)] // documentation missing in model + pub message: ::std::option::Option<::std::string::String>, + pub(crate) meta: ::aws_smithy_types::error::ErrorMetadata, +} +impl UnprocessableEntityError { + #[allow(missing_docs)] // documentation missing in model + pub fn error(&self) -> &crate::types::ErrorDetail { + &self.error + } +} +impl UnprocessableEntityError { + /// Returns the error message. + pub fn message(&self) -> ::std::option::Option<&str> { self.message.as_deref() } +} +impl ::std::fmt::Display for UnprocessableEntityError { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + ::std::write!(f, "UnprocessableEntityError")?; + if let ::std::option::Option::Some(inner_1) = &self.message { + { + ::std::write!(f, ": {}", inner_1)?; + } + } + Ok(()) + } +} +impl ::std::error::Error for UnprocessableEntityError {} +impl ::aws_smithy_types::error::metadata::ProvideErrorMetadata for UnprocessableEntityError { + fn meta(&self) -> &::aws_smithy_types::error::ErrorMetadata { &self.meta } +} +impl UnprocessableEntityError { + /// Creates a new builder-style object to manufacture [`UnprocessableEntityError`](crate::types::error::UnprocessableEntityError). + pub fn builder() -> crate::types::error::builders::UnprocessableEntityErrorBuilder { + crate::types::error::builders::UnprocessableEntityErrorBuilder::default() + } +} + +/// A builder for [`UnprocessableEntityError`](crate::types::error::UnprocessableEntityError). +#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)] +#[non_exhaustive] +pub struct UnprocessableEntityErrorBuilder { + pub(crate) error: ::std::option::Option, + pub(crate) message: ::std::option::Option<::std::string::String>, + meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>, +} +impl UnprocessableEntityErrorBuilder { + #[allow(missing_docs)] // documentation missing in model + /// This field is required. + pub fn error(mut self, input: crate::types::ErrorDetail) -> Self { + self.error = ::std::option::Option::Some(input); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_error(mut self, input: ::std::option::Option) -> Self { + self.error = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_error(&self) -> &::std::option::Option { + &self.error + } + #[allow(missing_docs)] // documentation missing in model + pub fn message(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self { + self.message = ::std::option::Option::Some(input.into()); + self + } + #[allow(missing_docs)] // documentation missing in model + pub fn set_message(mut self, input: ::std::option::Option<::std::string::String>) -> Self { + self.message = input; self + } + #[allow(missing_docs)] // documentation missing in model + pub fn get_message(&self) -> &::std::option::Option<::std::string::String> { + &self.message + } + /// Sets error metadata + pub fn meta(mut self, meta: ::aws_smithy_types::error::ErrorMetadata) -> Self { + self.meta = Some(meta); + self + } + + /// Sets error metadata + pub fn set_meta(&mut self, meta: std::option::Option<::aws_smithy_types::error::ErrorMetadata>) -> &mut Self { + self.meta = meta; + self + } + /// Consumes the builder and constructs a [`UnprocessableEntityError`](crate::types::error::UnprocessableEntityError). + /// This method will fail if any of the following fields are not set: + /// - [`error`](crate::types::error::builders::UnprocessableEntityErrorBuilder::error) + pub fn build(self) -> ::std::result::Result { + ::std::result::Result::Ok( + crate::types::error::UnprocessableEntityError { + error: self.error + .ok_or_else(|| + ::aws_smithy_types::error::operation::BuildError::missing_field("error", "error was not specified but it is required when building UnprocessableEntityError") + )? + , + message: self.message + , + meta: self.meta.unwrap_or_default(), + } + ) + } +} + diff --git a/sdks/rust/src/types/error/builders.rs b/sdks/rust/src/types/error/builders.rs new file mode 100644 index 0000000..32e8977 --- /dev/null +++ b/sdks/rust/src/types/error/builders.rs @@ -0,0 +1,15 @@ +// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. +pub use crate::types::error::_unauthorized_error::UnauthorizedErrorBuilder; + +pub use crate::types::error::_internal_error::InternalErrorBuilder; + +pub use crate::types::error::_rate_limited_error::RateLimitedErrorBuilder; + +pub use crate::types::error::_invalid_request_error::InvalidRequestErrorBuilder; + +pub use crate::types::error::_conflict_error::ConflictErrorBuilder; + +pub use crate::types::error::_not_found_error::NotFoundErrorBuilder; + +pub use crate::types::error::_unprocessable_entity_error::UnprocessableEntityErrorBuilder; + From fdc912571da33d68baa6cddc227c42b13714b7f3 Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Date: Tue, 5 May 2026 12:35:39 +0530 Subject: [PATCH 2/6] ci: add smithy-check workflow to enforce sdks/rust drift on PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Runs 'just smithy-check' (validate + regenerate + git diff guard) on any PR that touches smithy/, sdks/rust/, or the justfile. Fails the build if the committed Rust SDK has drifted from the model — eliminates the 'forgot to regenerate' footgun. --- .github/workflows/smithy-check.yml | 39 ++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/smithy-check.yml diff --git a/.github/workflows/smithy-check.yml b/.github/workflows/smithy-check.yml new file mode 100644 index 0000000..ec2b50a --- /dev/null +++ b/.github/workflows/smithy-check.yml @@ -0,0 +1,39 @@ +name: Smithy SDK Drift Check + +on: + pull_request: + paths: + - 'smithy/**' + - 'sdks/rust/**' + - 'justfile' + - '.github/workflows/smithy-check.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + rust-sdk-drift: + name: Verify sdks/rust matches smithy/model + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + + - name: Install Smithy CLI + run: | + curl -L -o smithy.zip https://github.com/smithy-lang/smithy/releases/download/1.55.0/smithy-cli-linux-x86_64.zip + unzip -q smithy.zip + sudo ./smithy-cli-linux-x86_64/install + smithy --version + + - name: Install just + uses: extractions/setup-just@v2 + + - name: Regenerate Rust SDK and check for drift + run: just smithy-check From 176d1caf1c4302b70e9f44a1e104f79213c66ba0 Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Date: Tue, 5 May 2026 12:45:00 +0530 Subject: [PATCH 3/6] fix: sort pub use block in error mod files for stable smithy-rs output smithy-rs emits the `pub use` re-exports in sdks/rust/src/types/error.rs and sdks/rust/src/types/error/builders.rs in JVM HashMap iteration order, which differs across processes due to randomized hash seeds. CI regeneration produced a different ordering than local generation, failing the drift guard. Inline 3-command pipeline (head + grep|sort|sed + sed) in just smithy-build sorts only those two known-affected files; other generated files (operation unions, error_meta enum) are already model-driven and stable. --- justfile | 7 +++++++ sdks/rust/src/types/error.rs | 10 +++++----- sdks/rust/src/types/error/builders.rs | 10 +++++----- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/justfile b/justfile index 8f5daad..76d84fe 100644 --- a/justfile +++ b/justfile @@ -82,6 +82,13 @@ smithy-build: smithy-validate # Wipe everything except README.md (which warns "DO NOT EDIT" and must survive regeneration) find sdks/rust -mindepth 1 -maxdepth 1 ! -name 'README.md' -exec rm -rf {} + cp -R smithy/build/smithy/source/rust-client-codegen/. sdks/rust/ + # smithy-rs emits the `pub use` block in error mod files in JVM HashMap + # iteration order (nondeterministic across processes). Sort that block so + # the committed SDK is byte-stable across regenerations. Narrow scope — + # only the two known-affected files; other generated files are stable. + for f in sdks/rust/src/types/error.rs sdks/rust/src/types/error/builders.rs; do \ + { head -n 1 "$f"; grep '^pub use ' "$f" | sort | sed 'G'; sed -n '/^mod /,$p' "$f"; } > "$f.tmp" && mv "$f.tmp" "$f"; \ + done @echo "Regenerated sdks/rust. Review with: git diff -- sdks/rust" # Build the generated TypeScript SDK (npm install + compile) diff --git a/sdks/rust/src/types/error.rs b/sdks/rust/src/types/error.rs index a547e15..b759e02 100644 --- a/sdks/rust/src/types/error.rs +++ b/sdks/rust/src/types/error.rs @@ -1,16 +1,16 @@ // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::types::error::_unauthorized_error::UnauthorizedError; +pub use crate::types::error::_conflict_error::ConflictError; pub use crate::types::error::_internal_error::InternalError; -pub use crate::types::error::_rate_limited_error::RateLimitedError; - pub use crate::types::error::_invalid_request_error::InvalidRequestError; -pub use crate::types::error::_conflict_error::ConflictError; - pub use crate::types::error::_not_found_error::NotFoundError; +pub use crate::types::error::_rate_limited_error::RateLimitedError; + +pub use crate::types::error::_unauthorized_error::UnauthorizedError; + pub use crate::types::error::_unprocessable_entity_error::UnprocessableEntityError; mod _conflict_error; diff --git a/sdks/rust/src/types/error/builders.rs b/sdks/rust/src/types/error/builders.rs index 32e8977..61d006b 100644 --- a/sdks/rust/src/types/error/builders.rs +++ b/sdks/rust/src/types/error/builders.rs @@ -1,15 +1,15 @@ // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::types::error::_unauthorized_error::UnauthorizedErrorBuilder; +pub use crate::types::error::_conflict_error::ConflictErrorBuilder; pub use crate::types::error::_internal_error::InternalErrorBuilder; -pub use crate::types::error::_rate_limited_error::RateLimitedErrorBuilder; - pub use crate::types::error::_invalid_request_error::InvalidRequestErrorBuilder; -pub use crate::types::error::_conflict_error::ConflictErrorBuilder; - pub use crate::types::error::_not_found_error::NotFoundErrorBuilder; +pub use crate::types::error::_rate_limited_error::RateLimitedErrorBuilder; + +pub use crate::types::error::_unauthorized_error::UnauthorizedErrorBuilder; + pub use crate::types::error::_unprocessable_entity_error::UnprocessableEntityErrorBuilder; From 4d8c491bf173bf4af180029e0c9c19c38e13931f Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Date: Tue, 5 May 2026 13:08:58 +0530 Subject: [PATCH 4/6] revert: drop smithy-check CI guard and inline canonicalization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit smithy-rs emits pub use blocks in error mod files (and on closer inspection, operation/*.rs and types.rs) in JVM HashMap iteration order — non-stable across processes. A naive git diff drift check produces false positives on every regeneration on a different machine. Removing the CI guard and the inline canonicalization for now: - .github/workflows/smithy-check.yml deleted - 'just smithy-check' recipe removed from justfile - Inline sort pipeline removed from 'just smithy-build' - sdks/rust/{types/error.rs,types/error/builders.rs} re-regenerated cleanly (smithy-rs natural output, no post-processing) - sdks/rust/README.md updated to flag the missing drift guard Will add a proper canonicalization helper + CI guard in a follow-up. --- .github/workflows/smithy-check.yml | 39 --------------------------- justfile | 13 --------- sdks/rust/README.md | 7 +++-- sdks/rust/src/types/error.rs | 10 +++---- sdks/rust/src/types/error/builders.rs | 10 +++---- 5 files changed, 15 insertions(+), 64 deletions(-) delete mode 100644 .github/workflows/smithy-check.yml diff --git a/.github/workflows/smithy-check.yml b/.github/workflows/smithy-check.yml deleted file mode 100644 index ec2b50a..0000000 --- a/.github/workflows/smithy-check.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Smithy SDK Drift Check - -on: - pull_request: - paths: - - 'smithy/**' - - 'sdks/rust/**' - - 'justfile' - - '.github/workflows/smithy-check.yml' - workflow_dispatch: - -permissions: - contents: read - -jobs: - rust-sdk-drift: - name: Verify sdks/rust matches smithy/model - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - distribution: temurin - java-version: '17' - - - name: Install Smithy CLI - run: | - curl -L -o smithy.zip https://github.com/smithy-lang/smithy/releases/download/1.55.0/smithy-cli-linux-x86_64.zip - unzip -q smithy.zip - sudo ./smithy-cli-linux-x86_64/install - smithy --version - - - name: Install just - uses: extractions/setup-just@v2 - - - name: Regenerate Rust SDK and check for drift - run: just smithy-check diff --git a/justfile b/justfile index 76d84fe..05f998c 100644 --- a/justfile +++ b/justfile @@ -82,13 +82,6 @@ smithy-build: smithy-validate # Wipe everything except README.md (which warns "DO NOT EDIT" and must survive regeneration) find sdks/rust -mindepth 1 -maxdepth 1 ! -name 'README.md' -exec rm -rf {} + cp -R smithy/build/smithy/source/rust-client-codegen/. sdks/rust/ - # smithy-rs emits the `pub use` block in error mod files in JVM HashMap - # iteration order (nondeterministic across processes). Sort that block so - # the committed SDK is byte-stable across regenerations. Narrow scope — - # only the two known-affected files; other generated files are stable. - for f in sdks/rust/src/types/error.rs sdks/rust/src/types/error/builders.rs; do \ - { head -n 1 "$f"; grep '^pub use ' "$f" | sort | sed 'G'; sed -n '/^mod /,$p' "$f"; } > "$f.tmp" && mv "$f.tmp" "$f"; \ - done @echo "Regenerated sdks/rust. Review with: git diff -- sdks/rust" # Build the generated TypeScript SDK (npm install + compile) @@ -102,12 +95,6 @@ cli-install: build-sdk # Regenerate SDK and reinstall CLI (after Smithy model changes) sdk-refresh: build-sdk cli-install -# CI guard: regenerate everything and fail if sdks/rust/ has drifted from -# the model. Keeps the committed SDK honest without trusting contributor discipline. -smithy-check: smithy-build - @git diff --exit-code -- sdks/rust || \ - (echo "ERROR: sdks/rust is out of sync with smithy/model/. Run 'just smithy-build' and commit." && exit 1) - # ─── Run Services ───────────────────────────────────────────── # Run the API server (port 8080) diff --git a/sdks/rust/README.md b/sdks/rust/README.md index 111489d..c7ddb7a 100644 --- a/sdks/rust/README.md +++ b/sdks/rust/README.md @@ -17,8 +17,11 @@ git add smithy/ sdks/rust/ git commit # commit model + generated SDK in the same PR ``` -CI runs `just smithy-check` to fail builds where the committed SDK has -drifted from the model. +> **Note:** there is no CI guard for drift right now. smithy-rs codegen +> emits some `pub use` blocks in JVM HashMap iteration order (non-stable +> across processes), so a naive `git diff --exit-code` check is too noisy +> to enforce. A canonicalization step + drift check will be added in a +> follow-up. Until then, please regenerate before committing model changes. ## Why is this committed? diff --git a/sdks/rust/src/types/error.rs b/sdks/rust/src/types/error.rs index b759e02..a547e15 100644 --- a/sdks/rust/src/types/error.rs +++ b/sdks/rust/src/types/error.rs @@ -1,15 +1,15 @@ // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::types::error::_conflict_error::ConflictError; +pub use crate::types::error::_unauthorized_error::UnauthorizedError; pub use crate::types::error::_internal_error::InternalError; -pub use crate::types::error::_invalid_request_error::InvalidRequestError; +pub use crate::types::error::_rate_limited_error::RateLimitedError; -pub use crate::types::error::_not_found_error::NotFoundError; +pub use crate::types::error::_invalid_request_error::InvalidRequestError; -pub use crate::types::error::_rate_limited_error::RateLimitedError; +pub use crate::types::error::_conflict_error::ConflictError; -pub use crate::types::error::_unauthorized_error::UnauthorizedError; +pub use crate::types::error::_not_found_error::NotFoundError; pub use crate::types::error::_unprocessable_entity_error::UnprocessableEntityError; diff --git a/sdks/rust/src/types/error/builders.rs b/sdks/rust/src/types/error/builders.rs index 61d006b..32e8977 100644 --- a/sdks/rust/src/types/error/builders.rs +++ b/sdks/rust/src/types/error/builders.rs @@ -1,15 +1,15 @@ // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. -pub use crate::types::error::_conflict_error::ConflictErrorBuilder; +pub use crate::types::error::_unauthorized_error::UnauthorizedErrorBuilder; pub use crate::types::error::_internal_error::InternalErrorBuilder; -pub use crate::types::error::_invalid_request_error::InvalidRequestErrorBuilder; +pub use crate::types::error::_rate_limited_error::RateLimitedErrorBuilder; -pub use crate::types::error::_not_found_error::NotFoundErrorBuilder; +pub use crate::types::error::_invalid_request_error::InvalidRequestErrorBuilder; -pub use crate::types::error::_rate_limited_error::RateLimitedErrorBuilder; +pub use crate::types::error::_conflict_error::ConflictErrorBuilder; -pub use crate::types::error::_unauthorized_error::UnauthorizedErrorBuilder; +pub use crate::types::error::_not_found_error::NotFoundErrorBuilder; pub use crate::types::error::_unprocessable_entity_error::UnprocessableEntityErrorBuilder; From 3abcd788b6a876ac5945ffed65f069612c8fc142 Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Date: Tue, 5 May 2026 15:41:37 +0530 Subject: [PATCH 5/6] refactor: move generated SDK to crates/client, simplify regen recipe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Review feedback: 1. SDKs alongside other Rust crates rather than a separate sdks/ tree. sdks/rust/ -> crates/client/ (git mv preserves history). Cargo.toml workspace exclude updated accordingly. 2. Cleaner regeneration recipe — replace the 'find ... ! -name README.md' wipe with 'rm -rf crates/client; cp ...; git checkout -- README.md'. Intent is obvious; the README is restored from the index, so it works pre- and post-commit and protects against accidental hand-edits. README and Cargo.toml workspace exclude updated to reference crates/client. --- .claude/plans/aarokya-integration.md | 289 +++++++ Cargo.toml | 2 +- {sdks/rust => crates/client}/Cargo.toml | 0 {sdks/rust => crates/client}/README.md | 6 +- .../rust => crates/client}/src/auth_plugin.rs | 0 {sdks/rust => crates/client}/src/client.rs | 0 .../client}/src/client/cancel_execution.rs | 0 .../client}/src/client/cancel_job.rs | 0 .../client}/src/client/create_endpoint.rs | 0 .../client}/src/client/create_job.rs | 0 .../client}/src/client/create_payload_spec.rs | 0 .../client}/src/client/customize.rs | 0 .../client}/src/client/customize/internal.rs | 0 .../client}/src/client/delete_endpoint.rs | 0 .../client}/src/client/delete_payload_spec.rs | 0 .../client}/src/client/get_endpoint.rs | 0 .../client}/src/client/get_execution.rs | 0 .../client}/src/client/get_job.rs | 0 .../client}/src/client/get_job_status.rs | 0 .../client}/src/client/get_job_versions.rs | 0 .../client}/src/client/get_payload_spec.rs | 0 .../client}/src/client/list_endpoints.rs | 0 .../src/client/list_execution_attempts.rs | 0 .../client}/src/client/list_execution_logs.rs | 0 .../client}/src/client/list_job_executions.rs | 0 .../client}/src/client/list_jobs.rs | 0 .../client}/src/client/list_payload_specs.rs | 0 .../client}/src/client/update_endpoint.rs | 0 .../client}/src/client/update_job.rs | 0 .../client}/src/client/update_payload_spec.rs | 0 {sdks/rust => crates/client}/src/config.rs | 0 .../client}/src/config/endpoint.rs | 0 .../rust => crates/client}/src/config/http.rs | 0 .../client}/src/config/interceptors.rs | 0 .../client}/src/config/retry.rs | 0 .../client}/src/config/timeout.rs | 0 {sdks/rust => crates/client}/src/error.rs | 0 .../client}/src/error/sealed_unhandled.rs | 0 .../rust => crates/client}/src/error_meta.rs | 0 .../rust => crates/client}/src/json_errors.rs | 0 {sdks/rust => crates/client}/src/lib.rs | 0 {sdks/rust => crates/client}/src/meta.rs | 0 {sdks/rust => crates/client}/src/operation.rs | 0 .../client}/src/operation/cancel_execution.rs | 0 .../_cancel_execution_input.rs | 0 .../_cancel_execution_output.rs | 0 .../operation/cancel_execution/builders.rs | 0 .../client}/src/operation/cancel_job.rs | 0 .../operation/cancel_job/_cancel_job_input.rs | 0 .../cancel_job/_cancel_job_output.rs | 0 .../src/operation/cancel_job/builders.rs | 0 .../client}/src/operation/create_endpoint.rs | 0 .../create_endpoint/_create_endpoint_input.rs | 0 .../_create_endpoint_output.rs | 0 .../src/operation/create_endpoint/builders.rs | 0 .../client}/src/operation/create_job.rs | 0 .../operation/create_job/_create_job_input.rs | 0 .../create_job/_create_job_output.rs | 0 .../src/operation/create_job/builders.rs | 0 .../src/operation/create_payload_spec.rs | 0 .../_create_payload_spec_input.rs | 0 .../_create_payload_spec_output.rs | 0 .../operation/create_payload_spec/builders.rs | 0 .../client}/src/operation/delete_endpoint.rs | 0 .../delete_endpoint/_delete_endpoint_input.rs | 0 .../_delete_endpoint_output.rs | 0 .../src/operation/delete_endpoint/builders.rs | 0 .../src/operation/delete_payload_spec.rs | 0 .../_delete_payload_spec_input.rs | 0 .../_delete_payload_spec_output.rs | 0 .../operation/delete_payload_spec/builders.rs | 0 .../client}/src/operation/get_endpoint.rs | 0 .../get_endpoint/_get_endpoint_input.rs | 0 .../get_endpoint/_get_endpoint_output.rs | 0 .../src/operation/get_endpoint/builders.rs | 0 .../client}/src/operation/get_execution.rs | 0 .../get_execution/_get_execution_input.rs | 0 .../get_execution/_get_execution_output.rs | 0 .../src/operation/get_execution/builders.rs | 0 .../client}/src/operation/get_job.rs | 0 .../src/operation/get_job/_get_job_input.rs | 0 .../src/operation/get_job/_get_job_output.rs | 0 .../client}/src/operation/get_job/builders.rs | 0 .../client}/src/operation/get_job_status.rs | 0 .../get_job_status/_get_job_status_input.rs | 0 .../get_job_status/_get_job_status_output.rs | 0 .../src/operation/get_job_status/builders.rs | 0 .../client}/src/operation/get_job_versions.rs | 0 .../_get_job_versions_input.rs | 0 .../_get_job_versions_output.rs | 0 .../operation/get_job_versions/builders.rs | 0 .../client}/src/operation/get_payload_spec.rs | 0 .../_get_payload_spec_input.rs | 0 .../_get_payload_spec_output.rs | 0 .../operation/get_payload_spec/builders.rs | 0 .../client}/src/operation/list_endpoints.rs | 0 .../list_endpoints/_list_endpoints_input.rs | 0 .../list_endpoints/_list_endpoints_output.rs | 0 .../src/operation/list_endpoints/builders.rs | 0 .../src/operation/list_execution_attempts.rs | 0 .../_list_execution_attempts_input.rs | 0 .../_list_execution_attempts_output.rs | 0 .../list_execution_attempts/builders.rs | 0 .../src/operation/list_execution_logs.rs | 0 .../_list_execution_logs_input.rs | 0 .../_list_execution_logs_output.rs | 0 .../operation/list_execution_logs/builders.rs | 0 .../src/operation/list_job_executions.rs | 0 .../_list_job_executions_input.rs | 0 .../_list_job_executions_output.rs | 0 .../operation/list_job_executions/builders.rs | 0 .../client}/src/operation/list_jobs.rs | 0 .../operation/list_jobs/_list_jobs_input.rs | 0 .../operation/list_jobs/_list_jobs_output.rs | 0 .../src/operation/list_jobs/builders.rs | 0 .../src/operation/list_payload_specs.rs | 0 .../_list_payload_specs_input.rs | 0 .../_list_payload_specs_output.rs | 0 .../operation/list_payload_specs/builders.rs | 0 .../client}/src/operation/update_endpoint.rs | 0 .../update_endpoint/_update_endpoint_input.rs | 0 .../_update_endpoint_output.rs | 0 .../src/operation/update_endpoint/builders.rs | 0 .../client}/src/operation/update_job.rs | 0 .../operation/update_job/_update_job_input.rs | 0 .../update_job/_update_job_output.rs | 0 .../src/operation/update_job/builders.rs | 0 .../src/operation/update_payload_spec.rs | 0 .../_update_payload_spec_input.rs | 0 .../_update_payload_spec_output.rs | 0 .../operation/update_payload_spec/builders.rs | 0 .../rust => crates/client}/src/primitives.rs | 0 .../client}/src/primitives/event_stream.rs | 0 .../src/primitives/sealed_enum_unknown.rs | 0 .../client}/src/protocol_serde.rs | 0 .../protocol_serde/shape_attempt_resource.rs | 0 .../shape_attempt_resource_list.rs | 0 .../protocol_serde/shape_cancel_execution.rs | 0 .../src/protocol_serde/shape_cancel_job.rs | 0 .../protocol_serde/shape_conflict_error.rs | 0 .../protocol_serde/shape_create_endpoint.rs | 0 .../shape_create_endpoint_input.rs | 0 .../src/protocol_serde/shape_create_job.rs | 0 .../protocol_serde/shape_create_job_input.rs | 0 .../shape_create_payload_spec.rs | 0 .../shape_create_payload_spec_input.rs | 0 .../protocol_serde/shape_delete_endpoint.rs | 0 .../shape_delete_payload_spec.rs | 0 .../src/protocol_serde/shape_endpoint_list.rs | 0 .../protocol_serde/shape_endpoint_resource.rs | 0 .../src/protocol_serde/shape_error_detail.rs | 0 .../shape_execution_log_list.rs | 0 .../shape_execution_log_resource.rs | 0 .../shape_execution_resource.rs | 0 .../shape_execution_resource_list.rs | 0 .../protocol_serde/shape_execution_summary.rs | 0 .../src/protocol_serde/shape_get_endpoint.rs | 0 .../src/protocol_serde/shape_get_execution.rs | 0 .../src/protocol_serde/shape_get_job.rs | 0 .../protocol_serde/shape_get_job_status.rs | 0 .../protocol_serde/shape_get_job_versions.rs | 0 .../protocol_serde/shape_get_payload_spec.rs | 0 .../protocol_serde/shape_internal_error.rs | 0 .../shape_invalid_request_error.rs | 0 .../src/protocol_serde/shape_job_resource.rs | 0 .../shape_job_status_response.rs | 0 .../src/protocol_serde/shape_job_summary.rs | 0 .../protocol_serde/shape_job_summary_list.rs | 0 .../protocol_serde/shape_job_version_list.rs | 0 .../protocol_serde/shape_list_endpoints.rs | 0 .../shape_list_execution_attempts.rs | 0 .../shape_list_execution_logs.rs | 0 .../shape_list_job_executions.rs | 0 .../src/protocol_serde/shape_list_jobs.rs | 0 .../shape_list_payload_specs.rs | 0 .../protocol_serde/shape_not_found_error.rs | 0 .../protocol_serde/shape_payload_spec_list.rs | 0 .../shape_payload_spec_resource.rs | 0 .../shape_rate_limited_error.rs | 0 .../src/protocol_serde/shape_retry_policy.rs | 0 .../shape_unauthorized_error.rs | 0 .../shape_unprocessable_entity_error.rs | 0 .../protocol_serde/shape_update_endpoint.rs | 0 .../shape_update_endpoint_input.rs | 0 .../src/protocol_serde/shape_update_job.rs | 0 .../protocol_serde/shape_update_job_input.rs | 0 .../shape_update_payload_spec.rs | 0 .../shape_update_payload_spec_input.rs | 0 .../client}/src/sdk_feature_tracker.rs | 0 .../rust => crates/client}/src/serde_util.rs | 0 .../client}/src/serialization_settings.rs | 0 {sdks/rust => crates/client}/src/types.rs | 0 .../client}/src/types/_attempt_resource.rs | 0 .../client}/src/types/_attempt_status_enum.rs | 0 .../client}/src/types/_backoff_type_enum.rs | 0 .../client}/src/types/_endpoint_resource.rs | 0 .../client}/src/types/_endpoint_type_enum.rs | 0 .../client}/src/types/_error_detail.rs | 0 .../src/types/_execution_log_resource.rs | 0 .../client}/src/types/_execution_resource.rs | 0 .../src/types/_execution_status_enum.rs | 0 .../client}/src/types/_execution_summary.rs | 0 .../client}/src/types/_job_resource.rs | 0 .../client}/src/types/_job_status_enum.rs | 0 .../client}/src/types/_job_status_response.rs | 0 .../client}/src/types/_job_summary.rs | 0 .../client}/src/types/_log_level_enum.rs | 0 .../src/types/_payload_spec_resource.rs | 0 .../client}/src/types/_retry_policy.rs | 0 .../client}/src/types/_trigger_type_enum.rs | 0 .../client}/src/types/builders.rs | 0 .../rust => crates/client}/src/types/error.rs | 0 .../src/types/error/_conflict_error.rs | 0 .../src/types/error/_internal_error.rs | 0 .../src/types/error/_invalid_request_error.rs | 0 .../src/types/error/_not_found_error.rs | 0 .../src/types/error/_rate_limited_error.rs | 0 .../src/types/error/_unauthorized_error.rs | 0 .../error/_unprocessable_entity_error.rs | 0 .../client}/src/types/error/builders.rs | 0 justfile | 9 +- kronos.postman_collection.json | 778 ++++++++++++++++++ 222 files changed, 1076 insertions(+), 8 deletions(-) create mode 100644 .claude/plans/aarokya-integration.md rename {sdks/rust => crates/client}/Cargo.toml (100%) rename {sdks/rust => crates/client}/README.md (88%) rename {sdks/rust => crates/client}/src/auth_plugin.rs (100%) rename {sdks/rust => crates/client}/src/client.rs (100%) rename {sdks/rust => crates/client}/src/client/cancel_execution.rs (100%) rename {sdks/rust => crates/client}/src/client/cancel_job.rs (100%) rename {sdks/rust => crates/client}/src/client/create_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/client/create_job.rs (100%) rename {sdks/rust => crates/client}/src/client/create_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/client/customize.rs (100%) rename {sdks/rust => crates/client}/src/client/customize/internal.rs (100%) rename {sdks/rust => crates/client}/src/client/delete_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/client/delete_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/client/get_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/client/get_execution.rs (100%) rename {sdks/rust => crates/client}/src/client/get_job.rs (100%) rename {sdks/rust => crates/client}/src/client/get_job_status.rs (100%) rename {sdks/rust => crates/client}/src/client/get_job_versions.rs (100%) rename {sdks/rust => crates/client}/src/client/get_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/client/list_endpoints.rs (100%) rename {sdks/rust => crates/client}/src/client/list_execution_attempts.rs (100%) rename {sdks/rust => crates/client}/src/client/list_execution_logs.rs (100%) rename {sdks/rust => crates/client}/src/client/list_job_executions.rs (100%) rename {sdks/rust => crates/client}/src/client/list_jobs.rs (100%) rename {sdks/rust => crates/client}/src/client/list_payload_specs.rs (100%) rename {sdks/rust => crates/client}/src/client/update_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/client/update_job.rs (100%) rename {sdks/rust => crates/client}/src/client/update_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/config.rs (100%) rename {sdks/rust => crates/client}/src/config/endpoint.rs (100%) rename {sdks/rust => crates/client}/src/config/http.rs (100%) rename {sdks/rust => crates/client}/src/config/interceptors.rs (100%) rename {sdks/rust => crates/client}/src/config/retry.rs (100%) rename {sdks/rust => crates/client}/src/config/timeout.rs (100%) rename {sdks/rust => crates/client}/src/error.rs (100%) rename {sdks/rust => crates/client}/src/error/sealed_unhandled.rs (100%) rename {sdks/rust => crates/client}/src/error_meta.rs (100%) rename {sdks/rust => crates/client}/src/json_errors.rs (100%) rename {sdks/rust => crates/client}/src/lib.rs (100%) rename {sdks/rust => crates/client}/src/meta.rs (100%) rename {sdks/rust => crates/client}/src/operation.rs (100%) rename {sdks/rust => crates/client}/src/operation/cancel_execution.rs (100%) rename {sdks/rust => crates/client}/src/operation/cancel_execution/_cancel_execution_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/cancel_execution/_cancel_execution_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/cancel_execution/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/cancel_job.rs (100%) rename {sdks/rust => crates/client}/src/operation/cancel_job/_cancel_job_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/cancel_job/_cancel_job_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/cancel_job/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_endpoint/_create_endpoint_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_endpoint/_create_endpoint_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_endpoint/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_job.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_job/_create_job_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_job/_create_job_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_job/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_payload_spec/_create_payload_spec_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_payload_spec/_create_payload_spec_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/create_payload_spec/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/delete_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/operation/delete_endpoint/_delete_endpoint_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/delete_endpoint/_delete_endpoint_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/delete_endpoint/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/delete_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/operation/delete_payload_spec/_delete_payload_spec_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/delete_payload_spec/_delete_payload_spec_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/delete_payload_spec/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_endpoint/_get_endpoint_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_endpoint/_get_endpoint_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_endpoint/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_execution.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_execution/_get_execution_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_execution/_get_execution_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_execution/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job/_get_job_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job/_get_job_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job_status.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job_status/_get_job_status_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job_status/_get_job_status_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job_status/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job_versions.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job_versions/_get_job_versions_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job_versions/_get_job_versions_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_job_versions/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_payload_spec/_get_payload_spec_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_payload_spec/_get_payload_spec_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/get_payload_spec/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_endpoints.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_endpoints/_list_endpoints_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_endpoints/_list_endpoints_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_endpoints/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_execution_attempts.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_execution_attempts/_list_execution_attempts_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_execution_attempts/_list_execution_attempts_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_execution_attempts/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_execution_logs.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_execution_logs/_list_execution_logs_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_execution_logs/_list_execution_logs_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_execution_logs/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_job_executions.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_job_executions/_list_job_executions_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_job_executions/_list_job_executions_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_job_executions/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_jobs.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_jobs/_list_jobs_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_jobs/_list_jobs_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_jobs/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_payload_specs.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_payload_specs/_list_payload_specs_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_payload_specs/_list_payload_specs_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/list_payload_specs/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_endpoint/_update_endpoint_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_endpoint/_update_endpoint_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_endpoint/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_job.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_job/_update_job_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_job/_update_job_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_job/builders.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_payload_spec/_update_payload_spec_input.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_payload_spec/_update_payload_spec_output.rs (100%) rename {sdks/rust => crates/client}/src/operation/update_payload_spec/builders.rs (100%) rename {sdks/rust => crates/client}/src/primitives.rs (100%) rename {sdks/rust => crates/client}/src/primitives/event_stream.rs (100%) rename {sdks/rust => crates/client}/src/primitives/sealed_enum_unknown.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_attempt_resource.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_attempt_resource_list.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_cancel_execution.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_cancel_job.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_conflict_error.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_create_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_create_endpoint_input.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_create_job.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_create_job_input.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_create_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_create_payload_spec_input.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_delete_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_delete_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_endpoint_list.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_endpoint_resource.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_error_detail.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_execution_log_list.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_execution_log_resource.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_execution_resource.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_execution_resource_list.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_execution_summary.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_get_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_get_execution.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_get_job.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_get_job_status.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_get_job_versions.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_get_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_internal_error.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_invalid_request_error.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_job_resource.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_job_status_response.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_job_summary.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_job_summary_list.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_job_version_list.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_list_endpoints.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_list_execution_attempts.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_list_execution_logs.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_list_job_executions.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_list_jobs.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_list_payload_specs.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_not_found_error.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_payload_spec_list.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_payload_spec_resource.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_rate_limited_error.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_retry_policy.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_unauthorized_error.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_unprocessable_entity_error.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_update_endpoint.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_update_endpoint_input.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_update_job.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_update_job_input.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_update_payload_spec.rs (100%) rename {sdks/rust => crates/client}/src/protocol_serde/shape_update_payload_spec_input.rs (100%) rename {sdks/rust => crates/client}/src/sdk_feature_tracker.rs (100%) rename {sdks/rust => crates/client}/src/serde_util.rs (100%) rename {sdks/rust => crates/client}/src/serialization_settings.rs (100%) rename {sdks/rust => crates/client}/src/types.rs (100%) rename {sdks/rust => crates/client}/src/types/_attempt_resource.rs (100%) rename {sdks/rust => crates/client}/src/types/_attempt_status_enum.rs (100%) rename {sdks/rust => crates/client}/src/types/_backoff_type_enum.rs (100%) rename {sdks/rust => crates/client}/src/types/_endpoint_resource.rs (100%) rename {sdks/rust => crates/client}/src/types/_endpoint_type_enum.rs (100%) rename {sdks/rust => crates/client}/src/types/_error_detail.rs (100%) rename {sdks/rust => crates/client}/src/types/_execution_log_resource.rs (100%) rename {sdks/rust => crates/client}/src/types/_execution_resource.rs (100%) rename {sdks/rust => crates/client}/src/types/_execution_status_enum.rs (100%) rename {sdks/rust => crates/client}/src/types/_execution_summary.rs (100%) rename {sdks/rust => crates/client}/src/types/_job_resource.rs (100%) rename {sdks/rust => crates/client}/src/types/_job_status_enum.rs (100%) rename {sdks/rust => crates/client}/src/types/_job_status_response.rs (100%) rename {sdks/rust => crates/client}/src/types/_job_summary.rs (100%) rename {sdks/rust => crates/client}/src/types/_log_level_enum.rs (100%) rename {sdks/rust => crates/client}/src/types/_payload_spec_resource.rs (100%) rename {sdks/rust => crates/client}/src/types/_retry_policy.rs (100%) rename {sdks/rust => crates/client}/src/types/_trigger_type_enum.rs (100%) rename {sdks/rust => crates/client}/src/types/builders.rs (100%) rename {sdks/rust => crates/client}/src/types/error.rs (100%) rename {sdks/rust => crates/client}/src/types/error/_conflict_error.rs (100%) rename {sdks/rust => crates/client}/src/types/error/_internal_error.rs (100%) rename {sdks/rust => crates/client}/src/types/error/_invalid_request_error.rs (100%) rename {sdks/rust => crates/client}/src/types/error/_not_found_error.rs (100%) rename {sdks/rust => crates/client}/src/types/error/_rate_limited_error.rs (100%) rename {sdks/rust => crates/client}/src/types/error/_unauthorized_error.rs (100%) rename {sdks/rust => crates/client}/src/types/error/_unprocessable_entity_error.rs (100%) rename {sdks/rust => crates/client}/src/types/error/builders.rs (100%) create mode 100644 kronos.postman_collection.json diff --git a/.claude/plans/aarokya-integration.md b/.claude/plans/aarokya-integration.md new file mode 100644 index 0000000..d5e4287 --- /dev/null +++ b/.claude/plans/aarokya-integration.md @@ -0,0 +1,289 @@ +# Kronos for Aarokya — Integration Plan & Contribution Roadmap + +## Context + +**Aarokya** is a health savings + insurance platform for Namma Yatri drivers. It piggybacks on the existing Namma Yatri autopay mandate (₹25/day subscription, ₹35 max) to enable daily micro-savings (e.g., ₹30/day) into a Transcorp wallet. + +**The daily flow:** +1. **Trigger**: Daily, for each enrolled driver, Aarokya must initiate autopay via Namma Yatri +2. **Execute**: Namma Yatri processes the autopay and calls back Aarokya with success/failure +3. **Load wallet**: On success, Aarokya calls Transcorp to credit the driver's wallet + +**The question:** Can Kronos power this? What's missing? + +--- + +## 1. Recommended Architecture (Option A — Kronos + Aarokya Backend) + +``` +┌─────────────────────────────────────────────────────────────┐ +│ DAILY FLOW │ +│ │ +│ Kronos CRON (daily per user) │ +│ │ │ +│ ▼ │ +│ HTTP Dispatch → Aarokya Backend /trigger-autopay/{user} │ +│ │ │ +│ ▼ │ +│ Aarokya calls Namma Yatri Autopay API │ +│ │ │ +│ ▼ (async, NY calls back later) │ +│ NY webhook → Aarokya /webhooks/autopay │ +│ │ │ +│ ├─ ON SUCCESS: │ +│ │ Aarokya creates IMMEDIATE job │ +│ │ in Kronos → Transcorp wallet load │ +│ │ (with retry + idempotency!) │ +│ │ │ +│ └─ ON FAILURE: │ +│ Log failure, notify user, retry next │ +│ day │ +└─────────────────────────────────────────────────────────────┘ +``` + +### What Kronos handles: +- **Daily scheduling** — CRON job per enrolled user +- **Reliable HTTP delivery** — Retry with backoff if Aarokya backend or Transcorp is down +- **Exactly-once** — Idempotency key `aarokya_{user_id}_{YYYY-MM-DD}` prevents double-charge +- **Observability** — Metrics + logs for every autopay attempt and wallet load + +### What Aarokya backend handles: +- **Webhook receiver** — Receives async callback from Namma Yatri +- **Orchestration** — Decides whether to trigger wallet load based on callback result +- **User enrollment** — Creates/cancels Kronos CRON jobs when users opt in/out + +--- + +## 2. Kronos Setup for Aarokya + +### Step 1: Create workspace +``` +POST /v1/orgs/{juspay_org}/workspaces +{ "name": "aarokya-prod" } +``` + +### Step 2: Create secrets +``` +POST /v1/secrets +{ "name": "ny-api-key", "value": "" } + +POST /v1/secrets +{ "name": "transcorp-api-key", "value": "" } +``` + +### Step 3: Create configs +``` +POST /v1/configs +{ "name": "aarokya-config", "values": { + "aarokya_base_url": "https://aarokya-backend.juspay.in", + "transcorp_base_url": "https://api.transcorp.in" +}} +``` + +### Step 4: Create endpoints + +**Endpoint A — Trigger autopay (daily CRON target)** +``` +POST /v1/endpoints +{ + "name": "trigger-autopay", + "endpoint_type": "HTTP", + "config_ref": "aarokya-config", + "spec": { + "url": "{{config.aarokya_base_url}}/api/v1/autopay/trigger", + "method": "POST", + "headers": { + "Content-Type": "application/json", + "Authorization": "Bearer {{secret.ny-api-key}}" + }, + "body_template": { + "user_id": "{{input.user_id}}", + "amount": "{{input.amount}}", + "mandate_id": "{{input.mandate_id}}", + "date": "{{input.date}}" + }, + "timeout_ms": 10000, + "expected_status_codes": [200, 201, 202] + }, + "retry_policy": { + "max_attempts": 3, + "backoff": "exponential", + "initial_delay_ms": 2000, + "max_delay_ms": 30000 + } +} +``` + +**Endpoint B — Load Transcorp wallet (triggered on autopay success)** +``` +POST /v1/endpoints +{ + "name": "load-wallet", + "endpoint_type": "HTTP", + "config_ref": "aarokya-config", + "spec": { + "url": "{{config.transcorp_base_url}}/api/v1/wallet/credit", + "method": "POST", + "headers": { + "Content-Type": "application/json", + "Authorization": "Bearer {{secret.transcorp-api-key}}" + }, + "body_template": { + "user_id": "{{input.user_id}}", + "amount": "{{input.amount}}", + "reference_id": "{{input.reference_id}}", + "source": "aarokya_autopay" + }, + "timeout_ms": 10000 + }, + "retry_policy": { + "max_attempts": 5, + "backoff": "exponential", + "initial_delay_ms": 1000, + "max_delay_ms": 60000 + } +} +``` + +### Step 5: Create CRON jobs (per enrolled user) +``` +POST /v1/jobs +{ + "endpoint": "trigger-autopay", + "trigger": "CRON", + "cron_expression": "0 8 * * *", + "cron_timezone": "Asia/Kolkata", + "input": { + "user_id": "driver_12345", + "amount": 3000, + "mandate_id": "mandate_abc" + } +} +``` + +### Step 6: Aarokya backend webhook handler (on NY callback success) +``` +// In Aarokya backend code: +// When Namma Yatri calls POST /webhooks/autopay with success: + +POST /v1/jobs (to Kronos) +{ + "endpoint": "load-wallet", + "trigger": "IMMEDIATE", + "idempotency_key": "wallet_load_driver_12345_2026-04-03", + "input": { + "user_id": "driver_12345", + "amount": 3000, + "reference_id": "ny_txn_xyz789" + } +} +``` + +--- + +## 3. Scale Considerations + +| Factor | Estimate | Kronos handles? | +|--------|----------|----------------| +| Enrolled drivers | 10K → 100K+ | One CRON job per user could be heavy at 100K+ | +| Daily executions | 10K-100K (autopay) + 10K-100K (wallet load) | Worker scales horizontally | +| Idempotency | Critical — no double-charging | Built-in | +| Failure rate | NY API may fail 1-5% | Retry with backoff | +| Timing | All fire at same time (8 AM IST) | Thundering herd — needs staggering | + +### Thundering herd problem +If 100K CRON jobs all fire at `0 8 * * *`, the worker gets 100K executions at once. Solutions: +- **Stagger CRON times**: `0 8 * * *`, `5 8 * * *`, `10 8 * * *` across user cohorts +- **OR: Bulk trigger pattern** (better): One CRON job that triggers a batch endpoint in Aarokya, which then fans out + +--- + +## 4. Contributions Needed in Kronos + +### Must-have for Aarokya (Tier 1 priorities) + +| # | Feature | Why | Effort | Key files | +|---|---------|-----|--------|-----------| +| 1 | **Batch job creation** | Enroll 1000+ users at once; `POST /v1/jobs/batch` | 1-2 days | `handlers/jobs.rs`, `db/jobs.rs` | +| 2 | **Bulk CRON (fan-out)** | Single CRON that triggers one batch endpoint instead of N individual CRONs | 2-3 days | `handlers/jobs.rs`, `pipeline.rs` | +| 3 | **Job cancellation by endpoint** | When user opts out, cancel their CRON job by user_id lookup | 1 day | `handlers/jobs.rs`, `db/jobs.rs` — add query by endpoint + input filter | + +### Nice-to-have (Tier 2) + +| # | Feature | Why | Effort | +|---|---------|-----|--------| +| 4 | **Job chaining** | On success of autopay job → auto-create wallet-load job (eliminates Aarokya backend orchestration) | 1 week | +| 5 | **Webhook receiver** | `POST /v1/webhooks/{id}/callback` — Kronos receives NY callback directly and chains | 1 week | +| 6 | **Execution dashboard filtering** | Filter by user_id in input, date range, status — for ops debugging | 2-3 days | +| 7 | **Metrics by endpoint** | Track success rate per endpoint (trigger-autopay vs load-wallet separately) | 1 day | + +### If scale exceeds 100K users (Tier 3) + +| # | Feature | Why | +|---|---------|-----| +| 8 | **Batch execution** | Single execution that processes N users instead of N executions | +| 9 | **Execution priorities** | Retries should be higher priority than new daily triggers | +| 10 | **Worker sharding** | Shard by workspace or endpoint to avoid contention | + +--- + +## 5. Is Kronos the Right Tool? + +### Verdict: YES, with Option A architecture + +Kronos is the right tool because this problem is fundamentally about: +- **Reliable, scheduled HTTP delivery** (Kronos's core strength) +- **Retry with exactly-once guarantees** (critical for financial transactions) +- **Observability** (you need to know which autopays failed and why) + +### What Kronos is NOT (and you shouldn't try to make it): +- A workflow orchestrator (use Aarokya backend for the callback choreography) +- A payment gateway (Kronos triggers the calls, doesn't process payments) +- A user database (user enrollment state lives in Aarokya's DB) + +### Alternatives considered: +| Tool | Why not | +|------|---------| +| Raw cron + curl | No retry, no idempotency, no observability, no multi-tenant | +| Temporal/Cadence | Overkill for this — heavyweight workflow engine for a 2-step flow | +| AWS Step Functions | Cloud lock-in, doesn't run on-prem, cost at scale | +| Custom queue (Redis/Kafka) | You'd rebuild half of Kronos — scheduling, retry, idempotency | + +Kronos gives you all of the above out of the box, and it's already in-house at Juspay. + +--- + +## 6. Implementation Order + +``` +Phase 1: Get it working (1 week) + ├── Set up Aarokya workspace in Kronos + ├── Create endpoints (trigger-autopay, load-wallet) + ├── Create CRON jobs for pilot users (100 drivers) + ├── Build webhook handler in Aarokya backend + └── E2E test with mock NY + Transcorp APIs + +Phase 2: Scale contributions (1-2 weeks) + ├── Contribute batch job creation to Kronos + ├── Contribute job lookup/cancel by endpoint+input + ├── Implement bulk CRON or staggered scheduling + └── Load test with 10K simulated users + +Phase 3: Production hardening + ├── Contribute execution filtering for ops + ├── Set up Grafana alerts (failure rate > 5%) + ├── Add per-endpoint metrics + └── Document runbook for autopay failures +``` + +--- + +## Verification + +1. `just dev` — Start Kronos locally +2. Create Aarokya workspace + endpoints + test CRON job +3. Run `just test-e2e` to verify Kronos basics +4. Mock Namma Yatri + Transcorp APIs using `mock-server` +5. Verify full flow: CRON fires → autopay triggered → callback received → wallet loaded +6. Check idempotency: re-trigger same day → no duplicate wallet load +7. Check retry: mock NY API failure → Kronos retries with backoff diff --git a/Cargo.toml b/Cargo.toml index cd857c6..fec1d99 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ exclude = [ # Generated client SDK — committed for downstream consumers (e.g. aarokya) # to depend on via `git`. Pins a different MSRV (1.82) and runtime stack # than the server workspace, so it stays out of the workspace build graph. - "sdks/rust", + "crates/client", ] resolver = "2" diff --git a/sdks/rust/Cargo.toml b/crates/client/Cargo.toml similarity index 100% rename from sdks/rust/Cargo.toml rename to crates/client/Cargo.toml diff --git a/sdks/rust/README.md b/crates/client/README.md similarity index 88% rename from sdks/rust/README.md rename to crates/client/README.md index c7ddb7a..6a26b69 100644 --- a/sdks/rust/README.md +++ b/crates/client/README.md @@ -11,9 +11,9 @@ silently. After changing anything under `smithy/model/`: ```bash -just smithy-build # validates model, regenerates, syncs sdks/rust/ -git diff -- sdks/rust # review the resulting diff -git add smithy/ sdks/rust/ +just smithy-build # validates model, regenerates, syncs crates/client/ +git diff -- crates/client # review the resulting diff +git add smithy/ crates/client/ git commit # commit model + generated SDK in the same PR ``` diff --git a/sdks/rust/src/auth_plugin.rs b/crates/client/src/auth_plugin.rs similarity index 100% rename from sdks/rust/src/auth_plugin.rs rename to crates/client/src/auth_plugin.rs diff --git a/sdks/rust/src/client.rs b/crates/client/src/client.rs similarity index 100% rename from sdks/rust/src/client.rs rename to crates/client/src/client.rs diff --git a/sdks/rust/src/client/cancel_execution.rs b/crates/client/src/client/cancel_execution.rs similarity index 100% rename from sdks/rust/src/client/cancel_execution.rs rename to crates/client/src/client/cancel_execution.rs diff --git a/sdks/rust/src/client/cancel_job.rs b/crates/client/src/client/cancel_job.rs similarity index 100% rename from sdks/rust/src/client/cancel_job.rs rename to crates/client/src/client/cancel_job.rs diff --git a/sdks/rust/src/client/create_endpoint.rs b/crates/client/src/client/create_endpoint.rs similarity index 100% rename from sdks/rust/src/client/create_endpoint.rs rename to crates/client/src/client/create_endpoint.rs diff --git a/sdks/rust/src/client/create_job.rs b/crates/client/src/client/create_job.rs similarity index 100% rename from sdks/rust/src/client/create_job.rs rename to crates/client/src/client/create_job.rs diff --git a/sdks/rust/src/client/create_payload_spec.rs b/crates/client/src/client/create_payload_spec.rs similarity index 100% rename from sdks/rust/src/client/create_payload_spec.rs rename to crates/client/src/client/create_payload_spec.rs diff --git a/sdks/rust/src/client/customize.rs b/crates/client/src/client/customize.rs similarity index 100% rename from sdks/rust/src/client/customize.rs rename to crates/client/src/client/customize.rs diff --git a/sdks/rust/src/client/customize/internal.rs b/crates/client/src/client/customize/internal.rs similarity index 100% rename from sdks/rust/src/client/customize/internal.rs rename to crates/client/src/client/customize/internal.rs diff --git a/sdks/rust/src/client/delete_endpoint.rs b/crates/client/src/client/delete_endpoint.rs similarity index 100% rename from sdks/rust/src/client/delete_endpoint.rs rename to crates/client/src/client/delete_endpoint.rs diff --git a/sdks/rust/src/client/delete_payload_spec.rs b/crates/client/src/client/delete_payload_spec.rs similarity index 100% rename from sdks/rust/src/client/delete_payload_spec.rs rename to crates/client/src/client/delete_payload_spec.rs diff --git a/sdks/rust/src/client/get_endpoint.rs b/crates/client/src/client/get_endpoint.rs similarity index 100% rename from sdks/rust/src/client/get_endpoint.rs rename to crates/client/src/client/get_endpoint.rs diff --git a/sdks/rust/src/client/get_execution.rs b/crates/client/src/client/get_execution.rs similarity index 100% rename from sdks/rust/src/client/get_execution.rs rename to crates/client/src/client/get_execution.rs diff --git a/sdks/rust/src/client/get_job.rs b/crates/client/src/client/get_job.rs similarity index 100% rename from sdks/rust/src/client/get_job.rs rename to crates/client/src/client/get_job.rs diff --git a/sdks/rust/src/client/get_job_status.rs b/crates/client/src/client/get_job_status.rs similarity index 100% rename from sdks/rust/src/client/get_job_status.rs rename to crates/client/src/client/get_job_status.rs diff --git a/sdks/rust/src/client/get_job_versions.rs b/crates/client/src/client/get_job_versions.rs similarity index 100% rename from sdks/rust/src/client/get_job_versions.rs rename to crates/client/src/client/get_job_versions.rs diff --git a/sdks/rust/src/client/get_payload_spec.rs b/crates/client/src/client/get_payload_spec.rs similarity index 100% rename from sdks/rust/src/client/get_payload_spec.rs rename to crates/client/src/client/get_payload_spec.rs diff --git a/sdks/rust/src/client/list_endpoints.rs b/crates/client/src/client/list_endpoints.rs similarity index 100% rename from sdks/rust/src/client/list_endpoints.rs rename to crates/client/src/client/list_endpoints.rs diff --git a/sdks/rust/src/client/list_execution_attempts.rs b/crates/client/src/client/list_execution_attempts.rs similarity index 100% rename from sdks/rust/src/client/list_execution_attempts.rs rename to crates/client/src/client/list_execution_attempts.rs diff --git a/sdks/rust/src/client/list_execution_logs.rs b/crates/client/src/client/list_execution_logs.rs similarity index 100% rename from sdks/rust/src/client/list_execution_logs.rs rename to crates/client/src/client/list_execution_logs.rs diff --git a/sdks/rust/src/client/list_job_executions.rs b/crates/client/src/client/list_job_executions.rs similarity index 100% rename from sdks/rust/src/client/list_job_executions.rs rename to crates/client/src/client/list_job_executions.rs diff --git a/sdks/rust/src/client/list_jobs.rs b/crates/client/src/client/list_jobs.rs similarity index 100% rename from sdks/rust/src/client/list_jobs.rs rename to crates/client/src/client/list_jobs.rs diff --git a/sdks/rust/src/client/list_payload_specs.rs b/crates/client/src/client/list_payload_specs.rs similarity index 100% rename from sdks/rust/src/client/list_payload_specs.rs rename to crates/client/src/client/list_payload_specs.rs diff --git a/sdks/rust/src/client/update_endpoint.rs b/crates/client/src/client/update_endpoint.rs similarity index 100% rename from sdks/rust/src/client/update_endpoint.rs rename to crates/client/src/client/update_endpoint.rs diff --git a/sdks/rust/src/client/update_job.rs b/crates/client/src/client/update_job.rs similarity index 100% rename from sdks/rust/src/client/update_job.rs rename to crates/client/src/client/update_job.rs diff --git a/sdks/rust/src/client/update_payload_spec.rs b/crates/client/src/client/update_payload_spec.rs similarity index 100% rename from sdks/rust/src/client/update_payload_spec.rs rename to crates/client/src/client/update_payload_spec.rs diff --git a/sdks/rust/src/config.rs b/crates/client/src/config.rs similarity index 100% rename from sdks/rust/src/config.rs rename to crates/client/src/config.rs diff --git a/sdks/rust/src/config/endpoint.rs b/crates/client/src/config/endpoint.rs similarity index 100% rename from sdks/rust/src/config/endpoint.rs rename to crates/client/src/config/endpoint.rs diff --git a/sdks/rust/src/config/http.rs b/crates/client/src/config/http.rs similarity index 100% rename from sdks/rust/src/config/http.rs rename to crates/client/src/config/http.rs diff --git a/sdks/rust/src/config/interceptors.rs b/crates/client/src/config/interceptors.rs similarity index 100% rename from sdks/rust/src/config/interceptors.rs rename to crates/client/src/config/interceptors.rs diff --git a/sdks/rust/src/config/retry.rs b/crates/client/src/config/retry.rs similarity index 100% rename from sdks/rust/src/config/retry.rs rename to crates/client/src/config/retry.rs diff --git a/sdks/rust/src/config/timeout.rs b/crates/client/src/config/timeout.rs similarity index 100% rename from sdks/rust/src/config/timeout.rs rename to crates/client/src/config/timeout.rs diff --git a/sdks/rust/src/error.rs b/crates/client/src/error.rs similarity index 100% rename from sdks/rust/src/error.rs rename to crates/client/src/error.rs diff --git a/sdks/rust/src/error/sealed_unhandled.rs b/crates/client/src/error/sealed_unhandled.rs similarity index 100% rename from sdks/rust/src/error/sealed_unhandled.rs rename to crates/client/src/error/sealed_unhandled.rs diff --git a/sdks/rust/src/error_meta.rs b/crates/client/src/error_meta.rs similarity index 100% rename from sdks/rust/src/error_meta.rs rename to crates/client/src/error_meta.rs diff --git a/sdks/rust/src/json_errors.rs b/crates/client/src/json_errors.rs similarity index 100% rename from sdks/rust/src/json_errors.rs rename to crates/client/src/json_errors.rs diff --git a/sdks/rust/src/lib.rs b/crates/client/src/lib.rs similarity index 100% rename from sdks/rust/src/lib.rs rename to crates/client/src/lib.rs diff --git a/sdks/rust/src/meta.rs b/crates/client/src/meta.rs similarity index 100% rename from sdks/rust/src/meta.rs rename to crates/client/src/meta.rs diff --git a/sdks/rust/src/operation.rs b/crates/client/src/operation.rs similarity index 100% rename from sdks/rust/src/operation.rs rename to crates/client/src/operation.rs diff --git a/sdks/rust/src/operation/cancel_execution.rs b/crates/client/src/operation/cancel_execution.rs similarity index 100% rename from sdks/rust/src/operation/cancel_execution.rs rename to crates/client/src/operation/cancel_execution.rs diff --git a/sdks/rust/src/operation/cancel_execution/_cancel_execution_input.rs b/crates/client/src/operation/cancel_execution/_cancel_execution_input.rs similarity index 100% rename from sdks/rust/src/operation/cancel_execution/_cancel_execution_input.rs rename to crates/client/src/operation/cancel_execution/_cancel_execution_input.rs diff --git a/sdks/rust/src/operation/cancel_execution/_cancel_execution_output.rs b/crates/client/src/operation/cancel_execution/_cancel_execution_output.rs similarity index 100% rename from sdks/rust/src/operation/cancel_execution/_cancel_execution_output.rs rename to crates/client/src/operation/cancel_execution/_cancel_execution_output.rs diff --git a/sdks/rust/src/operation/cancel_execution/builders.rs b/crates/client/src/operation/cancel_execution/builders.rs similarity index 100% rename from sdks/rust/src/operation/cancel_execution/builders.rs rename to crates/client/src/operation/cancel_execution/builders.rs diff --git a/sdks/rust/src/operation/cancel_job.rs b/crates/client/src/operation/cancel_job.rs similarity index 100% rename from sdks/rust/src/operation/cancel_job.rs rename to crates/client/src/operation/cancel_job.rs diff --git a/sdks/rust/src/operation/cancel_job/_cancel_job_input.rs b/crates/client/src/operation/cancel_job/_cancel_job_input.rs similarity index 100% rename from sdks/rust/src/operation/cancel_job/_cancel_job_input.rs rename to crates/client/src/operation/cancel_job/_cancel_job_input.rs diff --git a/sdks/rust/src/operation/cancel_job/_cancel_job_output.rs b/crates/client/src/operation/cancel_job/_cancel_job_output.rs similarity index 100% rename from sdks/rust/src/operation/cancel_job/_cancel_job_output.rs rename to crates/client/src/operation/cancel_job/_cancel_job_output.rs diff --git a/sdks/rust/src/operation/cancel_job/builders.rs b/crates/client/src/operation/cancel_job/builders.rs similarity index 100% rename from sdks/rust/src/operation/cancel_job/builders.rs rename to crates/client/src/operation/cancel_job/builders.rs diff --git a/sdks/rust/src/operation/create_endpoint.rs b/crates/client/src/operation/create_endpoint.rs similarity index 100% rename from sdks/rust/src/operation/create_endpoint.rs rename to crates/client/src/operation/create_endpoint.rs diff --git a/sdks/rust/src/operation/create_endpoint/_create_endpoint_input.rs b/crates/client/src/operation/create_endpoint/_create_endpoint_input.rs similarity index 100% rename from sdks/rust/src/operation/create_endpoint/_create_endpoint_input.rs rename to crates/client/src/operation/create_endpoint/_create_endpoint_input.rs diff --git a/sdks/rust/src/operation/create_endpoint/_create_endpoint_output.rs b/crates/client/src/operation/create_endpoint/_create_endpoint_output.rs similarity index 100% rename from sdks/rust/src/operation/create_endpoint/_create_endpoint_output.rs rename to crates/client/src/operation/create_endpoint/_create_endpoint_output.rs diff --git a/sdks/rust/src/operation/create_endpoint/builders.rs b/crates/client/src/operation/create_endpoint/builders.rs similarity index 100% rename from sdks/rust/src/operation/create_endpoint/builders.rs rename to crates/client/src/operation/create_endpoint/builders.rs diff --git a/sdks/rust/src/operation/create_job.rs b/crates/client/src/operation/create_job.rs similarity index 100% rename from sdks/rust/src/operation/create_job.rs rename to crates/client/src/operation/create_job.rs diff --git a/sdks/rust/src/operation/create_job/_create_job_input.rs b/crates/client/src/operation/create_job/_create_job_input.rs similarity index 100% rename from sdks/rust/src/operation/create_job/_create_job_input.rs rename to crates/client/src/operation/create_job/_create_job_input.rs diff --git a/sdks/rust/src/operation/create_job/_create_job_output.rs b/crates/client/src/operation/create_job/_create_job_output.rs similarity index 100% rename from sdks/rust/src/operation/create_job/_create_job_output.rs rename to crates/client/src/operation/create_job/_create_job_output.rs diff --git a/sdks/rust/src/operation/create_job/builders.rs b/crates/client/src/operation/create_job/builders.rs similarity index 100% rename from sdks/rust/src/operation/create_job/builders.rs rename to crates/client/src/operation/create_job/builders.rs diff --git a/sdks/rust/src/operation/create_payload_spec.rs b/crates/client/src/operation/create_payload_spec.rs similarity index 100% rename from sdks/rust/src/operation/create_payload_spec.rs rename to crates/client/src/operation/create_payload_spec.rs diff --git a/sdks/rust/src/operation/create_payload_spec/_create_payload_spec_input.rs b/crates/client/src/operation/create_payload_spec/_create_payload_spec_input.rs similarity index 100% rename from sdks/rust/src/operation/create_payload_spec/_create_payload_spec_input.rs rename to crates/client/src/operation/create_payload_spec/_create_payload_spec_input.rs diff --git a/sdks/rust/src/operation/create_payload_spec/_create_payload_spec_output.rs b/crates/client/src/operation/create_payload_spec/_create_payload_spec_output.rs similarity index 100% rename from sdks/rust/src/operation/create_payload_spec/_create_payload_spec_output.rs rename to crates/client/src/operation/create_payload_spec/_create_payload_spec_output.rs diff --git a/sdks/rust/src/operation/create_payload_spec/builders.rs b/crates/client/src/operation/create_payload_spec/builders.rs similarity index 100% rename from sdks/rust/src/operation/create_payload_spec/builders.rs rename to crates/client/src/operation/create_payload_spec/builders.rs diff --git a/sdks/rust/src/operation/delete_endpoint.rs b/crates/client/src/operation/delete_endpoint.rs similarity index 100% rename from sdks/rust/src/operation/delete_endpoint.rs rename to crates/client/src/operation/delete_endpoint.rs diff --git a/sdks/rust/src/operation/delete_endpoint/_delete_endpoint_input.rs b/crates/client/src/operation/delete_endpoint/_delete_endpoint_input.rs similarity index 100% rename from sdks/rust/src/operation/delete_endpoint/_delete_endpoint_input.rs rename to crates/client/src/operation/delete_endpoint/_delete_endpoint_input.rs diff --git a/sdks/rust/src/operation/delete_endpoint/_delete_endpoint_output.rs b/crates/client/src/operation/delete_endpoint/_delete_endpoint_output.rs similarity index 100% rename from sdks/rust/src/operation/delete_endpoint/_delete_endpoint_output.rs rename to crates/client/src/operation/delete_endpoint/_delete_endpoint_output.rs diff --git a/sdks/rust/src/operation/delete_endpoint/builders.rs b/crates/client/src/operation/delete_endpoint/builders.rs similarity index 100% rename from sdks/rust/src/operation/delete_endpoint/builders.rs rename to crates/client/src/operation/delete_endpoint/builders.rs diff --git a/sdks/rust/src/operation/delete_payload_spec.rs b/crates/client/src/operation/delete_payload_spec.rs similarity index 100% rename from sdks/rust/src/operation/delete_payload_spec.rs rename to crates/client/src/operation/delete_payload_spec.rs diff --git a/sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_input.rs b/crates/client/src/operation/delete_payload_spec/_delete_payload_spec_input.rs similarity index 100% rename from sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_input.rs rename to crates/client/src/operation/delete_payload_spec/_delete_payload_spec_input.rs diff --git a/sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_output.rs b/crates/client/src/operation/delete_payload_spec/_delete_payload_spec_output.rs similarity index 100% rename from sdks/rust/src/operation/delete_payload_spec/_delete_payload_spec_output.rs rename to crates/client/src/operation/delete_payload_spec/_delete_payload_spec_output.rs diff --git a/sdks/rust/src/operation/delete_payload_spec/builders.rs b/crates/client/src/operation/delete_payload_spec/builders.rs similarity index 100% rename from sdks/rust/src/operation/delete_payload_spec/builders.rs rename to crates/client/src/operation/delete_payload_spec/builders.rs diff --git a/sdks/rust/src/operation/get_endpoint.rs b/crates/client/src/operation/get_endpoint.rs similarity index 100% rename from sdks/rust/src/operation/get_endpoint.rs rename to crates/client/src/operation/get_endpoint.rs diff --git a/sdks/rust/src/operation/get_endpoint/_get_endpoint_input.rs b/crates/client/src/operation/get_endpoint/_get_endpoint_input.rs similarity index 100% rename from sdks/rust/src/operation/get_endpoint/_get_endpoint_input.rs rename to crates/client/src/operation/get_endpoint/_get_endpoint_input.rs diff --git a/sdks/rust/src/operation/get_endpoint/_get_endpoint_output.rs b/crates/client/src/operation/get_endpoint/_get_endpoint_output.rs similarity index 100% rename from sdks/rust/src/operation/get_endpoint/_get_endpoint_output.rs rename to crates/client/src/operation/get_endpoint/_get_endpoint_output.rs diff --git a/sdks/rust/src/operation/get_endpoint/builders.rs b/crates/client/src/operation/get_endpoint/builders.rs similarity index 100% rename from sdks/rust/src/operation/get_endpoint/builders.rs rename to crates/client/src/operation/get_endpoint/builders.rs diff --git a/sdks/rust/src/operation/get_execution.rs b/crates/client/src/operation/get_execution.rs similarity index 100% rename from sdks/rust/src/operation/get_execution.rs rename to crates/client/src/operation/get_execution.rs diff --git a/sdks/rust/src/operation/get_execution/_get_execution_input.rs b/crates/client/src/operation/get_execution/_get_execution_input.rs similarity index 100% rename from sdks/rust/src/operation/get_execution/_get_execution_input.rs rename to crates/client/src/operation/get_execution/_get_execution_input.rs diff --git a/sdks/rust/src/operation/get_execution/_get_execution_output.rs b/crates/client/src/operation/get_execution/_get_execution_output.rs similarity index 100% rename from sdks/rust/src/operation/get_execution/_get_execution_output.rs rename to crates/client/src/operation/get_execution/_get_execution_output.rs diff --git a/sdks/rust/src/operation/get_execution/builders.rs b/crates/client/src/operation/get_execution/builders.rs similarity index 100% rename from sdks/rust/src/operation/get_execution/builders.rs rename to crates/client/src/operation/get_execution/builders.rs diff --git a/sdks/rust/src/operation/get_job.rs b/crates/client/src/operation/get_job.rs similarity index 100% rename from sdks/rust/src/operation/get_job.rs rename to crates/client/src/operation/get_job.rs diff --git a/sdks/rust/src/operation/get_job/_get_job_input.rs b/crates/client/src/operation/get_job/_get_job_input.rs similarity index 100% rename from sdks/rust/src/operation/get_job/_get_job_input.rs rename to crates/client/src/operation/get_job/_get_job_input.rs diff --git a/sdks/rust/src/operation/get_job/_get_job_output.rs b/crates/client/src/operation/get_job/_get_job_output.rs similarity index 100% rename from sdks/rust/src/operation/get_job/_get_job_output.rs rename to crates/client/src/operation/get_job/_get_job_output.rs diff --git a/sdks/rust/src/operation/get_job/builders.rs b/crates/client/src/operation/get_job/builders.rs similarity index 100% rename from sdks/rust/src/operation/get_job/builders.rs rename to crates/client/src/operation/get_job/builders.rs diff --git a/sdks/rust/src/operation/get_job_status.rs b/crates/client/src/operation/get_job_status.rs similarity index 100% rename from sdks/rust/src/operation/get_job_status.rs rename to crates/client/src/operation/get_job_status.rs diff --git a/sdks/rust/src/operation/get_job_status/_get_job_status_input.rs b/crates/client/src/operation/get_job_status/_get_job_status_input.rs similarity index 100% rename from sdks/rust/src/operation/get_job_status/_get_job_status_input.rs rename to crates/client/src/operation/get_job_status/_get_job_status_input.rs diff --git a/sdks/rust/src/operation/get_job_status/_get_job_status_output.rs b/crates/client/src/operation/get_job_status/_get_job_status_output.rs similarity index 100% rename from sdks/rust/src/operation/get_job_status/_get_job_status_output.rs rename to crates/client/src/operation/get_job_status/_get_job_status_output.rs diff --git a/sdks/rust/src/operation/get_job_status/builders.rs b/crates/client/src/operation/get_job_status/builders.rs similarity index 100% rename from sdks/rust/src/operation/get_job_status/builders.rs rename to crates/client/src/operation/get_job_status/builders.rs diff --git a/sdks/rust/src/operation/get_job_versions.rs b/crates/client/src/operation/get_job_versions.rs similarity index 100% rename from sdks/rust/src/operation/get_job_versions.rs rename to crates/client/src/operation/get_job_versions.rs diff --git a/sdks/rust/src/operation/get_job_versions/_get_job_versions_input.rs b/crates/client/src/operation/get_job_versions/_get_job_versions_input.rs similarity index 100% rename from sdks/rust/src/operation/get_job_versions/_get_job_versions_input.rs rename to crates/client/src/operation/get_job_versions/_get_job_versions_input.rs diff --git a/sdks/rust/src/operation/get_job_versions/_get_job_versions_output.rs b/crates/client/src/operation/get_job_versions/_get_job_versions_output.rs similarity index 100% rename from sdks/rust/src/operation/get_job_versions/_get_job_versions_output.rs rename to crates/client/src/operation/get_job_versions/_get_job_versions_output.rs diff --git a/sdks/rust/src/operation/get_job_versions/builders.rs b/crates/client/src/operation/get_job_versions/builders.rs similarity index 100% rename from sdks/rust/src/operation/get_job_versions/builders.rs rename to crates/client/src/operation/get_job_versions/builders.rs diff --git a/sdks/rust/src/operation/get_payload_spec.rs b/crates/client/src/operation/get_payload_spec.rs similarity index 100% rename from sdks/rust/src/operation/get_payload_spec.rs rename to crates/client/src/operation/get_payload_spec.rs diff --git a/sdks/rust/src/operation/get_payload_spec/_get_payload_spec_input.rs b/crates/client/src/operation/get_payload_spec/_get_payload_spec_input.rs similarity index 100% rename from sdks/rust/src/operation/get_payload_spec/_get_payload_spec_input.rs rename to crates/client/src/operation/get_payload_spec/_get_payload_spec_input.rs diff --git a/sdks/rust/src/operation/get_payload_spec/_get_payload_spec_output.rs b/crates/client/src/operation/get_payload_spec/_get_payload_spec_output.rs similarity index 100% rename from sdks/rust/src/operation/get_payload_spec/_get_payload_spec_output.rs rename to crates/client/src/operation/get_payload_spec/_get_payload_spec_output.rs diff --git a/sdks/rust/src/operation/get_payload_spec/builders.rs b/crates/client/src/operation/get_payload_spec/builders.rs similarity index 100% rename from sdks/rust/src/operation/get_payload_spec/builders.rs rename to crates/client/src/operation/get_payload_spec/builders.rs diff --git a/sdks/rust/src/operation/list_endpoints.rs b/crates/client/src/operation/list_endpoints.rs similarity index 100% rename from sdks/rust/src/operation/list_endpoints.rs rename to crates/client/src/operation/list_endpoints.rs diff --git a/sdks/rust/src/operation/list_endpoints/_list_endpoints_input.rs b/crates/client/src/operation/list_endpoints/_list_endpoints_input.rs similarity index 100% rename from sdks/rust/src/operation/list_endpoints/_list_endpoints_input.rs rename to crates/client/src/operation/list_endpoints/_list_endpoints_input.rs diff --git a/sdks/rust/src/operation/list_endpoints/_list_endpoints_output.rs b/crates/client/src/operation/list_endpoints/_list_endpoints_output.rs similarity index 100% rename from sdks/rust/src/operation/list_endpoints/_list_endpoints_output.rs rename to crates/client/src/operation/list_endpoints/_list_endpoints_output.rs diff --git a/sdks/rust/src/operation/list_endpoints/builders.rs b/crates/client/src/operation/list_endpoints/builders.rs similarity index 100% rename from sdks/rust/src/operation/list_endpoints/builders.rs rename to crates/client/src/operation/list_endpoints/builders.rs diff --git a/sdks/rust/src/operation/list_execution_attempts.rs b/crates/client/src/operation/list_execution_attempts.rs similarity index 100% rename from sdks/rust/src/operation/list_execution_attempts.rs rename to crates/client/src/operation/list_execution_attempts.rs diff --git a/sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_input.rs b/crates/client/src/operation/list_execution_attempts/_list_execution_attempts_input.rs similarity index 100% rename from sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_input.rs rename to crates/client/src/operation/list_execution_attempts/_list_execution_attempts_input.rs diff --git a/sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_output.rs b/crates/client/src/operation/list_execution_attempts/_list_execution_attempts_output.rs similarity index 100% rename from sdks/rust/src/operation/list_execution_attempts/_list_execution_attempts_output.rs rename to crates/client/src/operation/list_execution_attempts/_list_execution_attempts_output.rs diff --git a/sdks/rust/src/operation/list_execution_attempts/builders.rs b/crates/client/src/operation/list_execution_attempts/builders.rs similarity index 100% rename from sdks/rust/src/operation/list_execution_attempts/builders.rs rename to crates/client/src/operation/list_execution_attempts/builders.rs diff --git a/sdks/rust/src/operation/list_execution_logs.rs b/crates/client/src/operation/list_execution_logs.rs similarity index 100% rename from sdks/rust/src/operation/list_execution_logs.rs rename to crates/client/src/operation/list_execution_logs.rs diff --git a/sdks/rust/src/operation/list_execution_logs/_list_execution_logs_input.rs b/crates/client/src/operation/list_execution_logs/_list_execution_logs_input.rs similarity index 100% rename from sdks/rust/src/operation/list_execution_logs/_list_execution_logs_input.rs rename to crates/client/src/operation/list_execution_logs/_list_execution_logs_input.rs diff --git a/sdks/rust/src/operation/list_execution_logs/_list_execution_logs_output.rs b/crates/client/src/operation/list_execution_logs/_list_execution_logs_output.rs similarity index 100% rename from sdks/rust/src/operation/list_execution_logs/_list_execution_logs_output.rs rename to crates/client/src/operation/list_execution_logs/_list_execution_logs_output.rs diff --git a/sdks/rust/src/operation/list_execution_logs/builders.rs b/crates/client/src/operation/list_execution_logs/builders.rs similarity index 100% rename from sdks/rust/src/operation/list_execution_logs/builders.rs rename to crates/client/src/operation/list_execution_logs/builders.rs diff --git a/sdks/rust/src/operation/list_job_executions.rs b/crates/client/src/operation/list_job_executions.rs similarity index 100% rename from sdks/rust/src/operation/list_job_executions.rs rename to crates/client/src/operation/list_job_executions.rs diff --git a/sdks/rust/src/operation/list_job_executions/_list_job_executions_input.rs b/crates/client/src/operation/list_job_executions/_list_job_executions_input.rs similarity index 100% rename from sdks/rust/src/operation/list_job_executions/_list_job_executions_input.rs rename to crates/client/src/operation/list_job_executions/_list_job_executions_input.rs diff --git a/sdks/rust/src/operation/list_job_executions/_list_job_executions_output.rs b/crates/client/src/operation/list_job_executions/_list_job_executions_output.rs similarity index 100% rename from sdks/rust/src/operation/list_job_executions/_list_job_executions_output.rs rename to crates/client/src/operation/list_job_executions/_list_job_executions_output.rs diff --git a/sdks/rust/src/operation/list_job_executions/builders.rs b/crates/client/src/operation/list_job_executions/builders.rs similarity index 100% rename from sdks/rust/src/operation/list_job_executions/builders.rs rename to crates/client/src/operation/list_job_executions/builders.rs diff --git a/sdks/rust/src/operation/list_jobs.rs b/crates/client/src/operation/list_jobs.rs similarity index 100% rename from sdks/rust/src/operation/list_jobs.rs rename to crates/client/src/operation/list_jobs.rs diff --git a/sdks/rust/src/operation/list_jobs/_list_jobs_input.rs b/crates/client/src/operation/list_jobs/_list_jobs_input.rs similarity index 100% rename from sdks/rust/src/operation/list_jobs/_list_jobs_input.rs rename to crates/client/src/operation/list_jobs/_list_jobs_input.rs diff --git a/sdks/rust/src/operation/list_jobs/_list_jobs_output.rs b/crates/client/src/operation/list_jobs/_list_jobs_output.rs similarity index 100% rename from sdks/rust/src/operation/list_jobs/_list_jobs_output.rs rename to crates/client/src/operation/list_jobs/_list_jobs_output.rs diff --git a/sdks/rust/src/operation/list_jobs/builders.rs b/crates/client/src/operation/list_jobs/builders.rs similarity index 100% rename from sdks/rust/src/operation/list_jobs/builders.rs rename to crates/client/src/operation/list_jobs/builders.rs diff --git a/sdks/rust/src/operation/list_payload_specs.rs b/crates/client/src/operation/list_payload_specs.rs similarity index 100% rename from sdks/rust/src/operation/list_payload_specs.rs rename to crates/client/src/operation/list_payload_specs.rs diff --git a/sdks/rust/src/operation/list_payload_specs/_list_payload_specs_input.rs b/crates/client/src/operation/list_payload_specs/_list_payload_specs_input.rs similarity index 100% rename from sdks/rust/src/operation/list_payload_specs/_list_payload_specs_input.rs rename to crates/client/src/operation/list_payload_specs/_list_payload_specs_input.rs diff --git a/sdks/rust/src/operation/list_payload_specs/_list_payload_specs_output.rs b/crates/client/src/operation/list_payload_specs/_list_payload_specs_output.rs similarity index 100% rename from sdks/rust/src/operation/list_payload_specs/_list_payload_specs_output.rs rename to crates/client/src/operation/list_payload_specs/_list_payload_specs_output.rs diff --git a/sdks/rust/src/operation/list_payload_specs/builders.rs b/crates/client/src/operation/list_payload_specs/builders.rs similarity index 100% rename from sdks/rust/src/operation/list_payload_specs/builders.rs rename to crates/client/src/operation/list_payload_specs/builders.rs diff --git a/sdks/rust/src/operation/update_endpoint.rs b/crates/client/src/operation/update_endpoint.rs similarity index 100% rename from sdks/rust/src/operation/update_endpoint.rs rename to crates/client/src/operation/update_endpoint.rs diff --git a/sdks/rust/src/operation/update_endpoint/_update_endpoint_input.rs b/crates/client/src/operation/update_endpoint/_update_endpoint_input.rs similarity index 100% rename from sdks/rust/src/operation/update_endpoint/_update_endpoint_input.rs rename to crates/client/src/operation/update_endpoint/_update_endpoint_input.rs diff --git a/sdks/rust/src/operation/update_endpoint/_update_endpoint_output.rs b/crates/client/src/operation/update_endpoint/_update_endpoint_output.rs similarity index 100% rename from sdks/rust/src/operation/update_endpoint/_update_endpoint_output.rs rename to crates/client/src/operation/update_endpoint/_update_endpoint_output.rs diff --git a/sdks/rust/src/operation/update_endpoint/builders.rs b/crates/client/src/operation/update_endpoint/builders.rs similarity index 100% rename from sdks/rust/src/operation/update_endpoint/builders.rs rename to crates/client/src/operation/update_endpoint/builders.rs diff --git a/sdks/rust/src/operation/update_job.rs b/crates/client/src/operation/update_job.rs similarity index 100% rename from sdks/rust/src/operation/update_job.rs rename to crates/client/src/operation/update_job.rs diff --git a/sdks/rust/src/operation/update_job/_update_job_input.rs b/crates/client/src/operation/update_job/_update_job_input.rs similarity index 100% rename from sdks/rust/src/operation/update_job/_update_job_input.rs rename to crates/client/src/operation/update_job/_update_job_input.rs diff --git a/sdks/rust/src/operation/update_job/_update_job_output.rs b/crates/client/src/operation/update_job/_update_job_output.rs similarity index 100% rename from sdks/rust/src/operation/update_job/_update_job_output.rs rename to crates/client/src/operation/update_job/_update_job_output.rs diff --git a/sdks/rust/src/operation/update_job/builders.rs b/crates/client/src/operation/update_job/builders.rs similarity index 100% rename from sdks/rust/src/operation/update_job/builders.rs rename to crates/client/src/operation/update_job/builders.rs diff --git a/sdks/rust/src/operation/update_payload_spec.rs b/crates/client/src/operation/update_payload_spec.rs similarity index 100% rename from sdks/rust/src/operation/update_payload_spec.rs rename to crates/client/src/operation/update_payload_spec.rs diff --git a/sdks/rust/src/operation/update_payload_spec/_update_payload_spec_input.rs b/crates/client/src/operation/update_payload_spec/_update_payload_spec_input.rs similarity index 100% rename from sdks/rust/src/operation/update_payload_spec/_update_payload_spec_input.rs rename to crates/client/src/operation/update_payload_spec/_update_payload_spec_input.rs diff --git a/sdks/rust/src/operation/update_payload_spec/_update_payload_spec_output.rs b/crates/client/src/operation/update_payload_spec/_update_payload_spec_output.rs similarity index 100% rename from sdks/rust/src/operation/update_payload_spec/_update_payload_spec_output.rs rename to crates/client/src/operation/update_payload_spec/_update_payload_spec_output.rs diff --git a/sdks/rust/src/operation/update_payload_spec/builders.rs b/crates/client/src/operation/update_payload_spec/builders.rs similarity index 100% rename from sdks/rust/src/operation/update_payload_spec/builders.rs rename to crates/client/src/operation/update_payload_spec/builders.rs diff --git a/sdks/rust/src/primitives.rs b/crates/client/src/primitives.rs similarity index 100% rename from sdks/rust/src/primitives.rs rename to crates/client/src/primitives.rs diff --git a/sdks/rust/src/primitives/event_stream.rs b/crates/client/src/primitives/event_stream.rs similarity index 100% rename from sdks/rust/src/primitives/event_stream.rs rename to crates/client/src/primitives/event_stream.rs diff --git a/sdks/rust/src/primitives/sealed_enum_unknown.rs b/crates/client/src/primitives/sealed_enum_unknown.rs similarity index 100% rename from sdks/rust/src/primitives/sealed_enum_unknown.rs rename to crates/client/src/primitives/sealed_enum_unknown.rs diff --git a/sdks/rust/src/protocol_serde.rs b/crates/client/src/protocol_serde.rs similarity index 100% rename from sdks/rust/src/protocol_serde.rs rename to crates/client/src/protocol_serde.rs diff --git a/sdks/rust/src/protocol_serde/shape_attempt_resource.rs b/crates/client/src/protocol_serde/shape_attempt_resource.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_attempt_resource.rs rename to crates/client/src/protocol_serde/shape_attempt_resource.rs diff --git a/sdks/rust/src/protocol_serde/shape_attempt_resource_list.rs b/crates/client/src/protocol_serde/shape_attempt_resource_list.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_attempt_resource_list.rs rename to crates/client/src/protocol_serde/shape_attempt_resource_list.rs diff --git a/sdks/rust/src/protocol_serde/shape_cancel_execution.rs b/crates/client/src/protocol_serde/shape_cancel_execution.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_cancel_execution.rs rename to crates/client/src/protocol_serde/shape_cancel_execution.rs diff --git a/sdks/rust/src/protocol_serde/shape_cancel_job.rs b/crates/client/src/protocol_serde/shape_cancel_job.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_cancel_job.rs rename to crates/client/src/protocol_serde/shape_cancel_job.rs diff --git a/sdks/rust/src/protocol_serde/shape_conflict_error.rs b/crates/client/src/protocol_serde/shape_conflict_error.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_conflict_error.rs rename to crates/client/src/protocol_serde/shape_conflict_error.rs diff --git a/sdks/rust/src/protocol_serde/shape_create_endpoint.rs b/crates/client/src/protocol_serde/shape_create_endpoint.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_create_endpoint.rs rename to crates/client/src/protocol_serde/shape_create_endpoint.rs diff --git a/sdks/rust/src/protocol_serde/shape_create_endpoint_input.rs b/crates/client/src/protocol_serde/shape_create_endpoint_input.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_create_endpoint_input.rs rename to crates/client/src/protocol_serde/shape_create_endpoint_input.rs diff --git a/sdks/rust/src/protocol_serde/shape_create_job.rs b/crates/client/src/protocol_serde/shape_create_job.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_create_job.rs rename to crates/client/src/protocol_serde/shape_create_job.rs diff --git a/sdks/rust/src/protocol_serde/shape_create_job_input.rs b/crates/client/src/protocol_serde/shape_create_job_input.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_create_job_input.rs rename to crates/client/src/protocol_serde/shape_create_job_input.rs diff --git a/sdks/rust/src/protocol_serde/shape_create_payload_spec.rs b/crates/client/src/protocol_serde/shape_create_payload_spec.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_create_payload_spec.rs rename to crates/client/src/protocol_serde/shape_create_payload_spec.rs diff --git a/sdks/rust/src/protocol_serde/shape_create_payload_spec_input.rs b/crates/client/src/protocol_serde/shape_create_payload_spec_input.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_create_payload_spec_input.rs rename to crates/client/src/protocol_serde/shape_create_payload_spec_input.rs diff --git a/sdks/rust/src/protocol_serde/shape_delete_endpoint.rs b/crates/client/src/protocol_serde/shape_delete_endpoint.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_delete_endpoint.rs rename to crates/client/src/protocol_serde/shape_delete_endpoint.rs diff --git a/sdks/rust/src/protocol_serde/shape_delete_payload_spec.rs b/crates/client/src/protocol_serde/shape_delete_payload_spec.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_delete_payload_spec.rs rename to crates/client/src/protocol_serde/shape_delete_payload_spec.rs diff --git a/sdks/rust/src/protocol_serde/shape_endpoint_list.rs b/crates/client/src/protocol_serde/shape_endpoint_list.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_endpoint_list.rs rename to crates/client/src/protocol_serde/shape_endpoint_list.rs diff --git a/sdks/rust/src/protocol_serde/shape_endpoint_resource.rs b/crates/client/src/protocol_serde/shape_endpoint_resource.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_endpoint_resource.rs rename to crates/client/src/protocol_serde/shape_endpoint_resource.rs diff --git a/sdks/rust/src/protocol_serde/shape_error_detail.rs b/crates/client/src/protocol_serde/shape_error_detail.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_error_detail.rs rename to crates/client/src/protocol_serde/shape_error_detail.rs diff --git a/sdks/rust/src/protocol_serde/shape_execution_log_list.rs b/crates/client/src/protocol_serde/shape_execution_log_list.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_execution_log_list.rs rename to crates/client/src/protocol_serde/shape_execution_log_list.rs diff --git a/sdks/rust/src/protocol_serde/shape_execution_log_resource.rs b/crates/client/src/protocol_serde/shape_execution_log_resource.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_execution_log_resource.rs rename to crates/client/src/protocol_serde/shape_execution_log_resource.rs diff --git a/sdks/rust/src/protocol_serde/shape_execution_resource.rs b/crates/client/src/protocol_serde/shape_execution_resource.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_execution_resource.rs rename to crates/client/src/protocol_serde/shape_execution_resource.rs diff --git a/sdks/rust/src/protocol_serde/shape_execution_resource_list.rs b/crates/client/src/protocol_serde/shape_execution_resource_list.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_execution_resource_list.rs rename to crates/client/src/protocol_serde/shape_execution_resource_list.rs diff --git a/sdks/rust/src/protocol_serde/shape_execution_summary.rs b/crates/client/src/protocol_serde/shape_execution_summary.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_execution_summary.rs rename to crates/client/src/protocol_serde/shape_execution_summary.rs diff --git a/sdks/rust/src/protocol_serde/shape_get_endpoint.rs b/crates/client/src/protocol_serde/shape_get_endpoint.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_get_endpoint.rs rename to crates/client/src/protocol_serde/shape_get_endpoint.rs diff --git a/sdks/rust/src/protocol_serde/shape_get_execution.rs b/crates/client/src/protocol_serde/shape_get_execution.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_get_execution.rs rename to crates/client/src/protocol_serde/shape_get_execution.rs diff --git a/sdks/rust/src/protocol_serde/shape_get_job.rs b/crates/client/src/protocol_serde/shape_get_job.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_get_job.rs rename to crates/client/src/protocol_serde/shape_get_job.rs diff --git a/sdks/rust/src/protocol_serde/shape_get_job_status.rs b/crates/client/src/protocol_serde/shape_get_job_status.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_get_job_status.rs rename to crates/client/src/protocol_serde/shape_get_job_status.rs diff --git a/sdks/rust/src/protocol_serde/shape_get_job_versions.rs b/crates/client/src/protocol_serde/shape_get_job_versions.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_get_job_versions.rs rename to crates/client/src/protocol_serde/shape_get_job_versions.rs diff --git a/sdks/rust/src/protocol_serde/shape_get_payload_spec.rs b/crates/client/src/protocol_serde/shape_get_payload_spec.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_get_payload_spec.rs rename to crates/client/src/protocol_serde/shape_get_payload_spec.rs diff --git a/sdks/rust/src/protocol_serde/shape_internal_error.rs b/crates/client/src/protocol_serde/shape_internal_error.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_internal_error.rs rename to crates/client/src/protocol_serde/shape_internal_error.rs diff --git a/sdks/rust/src/protocol_serde/shape_invalid_request_error.rs b/crates/client/src/protocol_serde/shape_invalid_request_error.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_invalid_request_error.rs rename to crates/client/src/protocol_serde/shape_invalid_request_error.rs diff --git a/sdks/rust/src/protocol_serde/shape_job_resource.rs b/crates/client/src/protocol_serde/shape_job_resource.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_job_resource.rs rename to crates/client/src/protocol_serde/shape_job_resource.rs diff --git a/sdks/rust/src/protocol_serde/shape_job_status_response.rs b/crates/client/src/protocol_serde/shape_job_status_response.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_job_status_response.rs rename to crates/client/src/protocol_serde/shape_job_status_response.rs diff --git a/sdks/rust/src/protocol_serde/shape_job_summary.rs b/crates/client/src/protocol_serde/shape_job_summary.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_job_summary.rs rename to crates/client/src/protocol_serde/shape_job_summary.rs diff --git a/sdks/rust/src/protocol_serde/shape_job_summary_list.rs b/crates/client/src/protocol_serde/shape_job_summary_list.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_job_summary_list.rs rename to crates/client/src/protocol_serde/shape_job_summary_list.rs diff --git a/sdks/rust/src/protocol_serde/shape_job_version_list.rs b/crates/client/src/protocol_serde/shape_job_version_list.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_job_version_list.rs rename to crates/client/src/protocol_serde/shape_job_version_list.rs diff --git a/sdks/rust/src/protocol_serde/shape_list_endpoints.rs b/crates/client/src/protocol_serde/shape_list_endpoints.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_list_endpoints.rs rename to crates/client/src/protocol_serde/shape_list_endpoints.rs diff --git a/sdks/rust/src/protocol_serde/shape_list_execution_attempts.rs b/crates/client/src/protocol_serde/shape_list_execution_attempts.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_list_execution_attempts.rs rename to crates/client/src/protocol_serde/shape_list_execution_attempts.rs diff --git a/sdks/rust/src/protocol_serde/shape_list_execution_logs.rs b/crates/client/src/protocol_serde/shape_list_execution_logs.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_list_execution_logs.rs rename to crates/client/src/protocol_serde/shape_list_execution_logs.rs diff --git a/sdks/rust/src/protocol_serde/shape_list_job_executions.rs b/crates/client/src/protocol_serde/shape_list_job_executions.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_list_job_executions.rs rename to crates/client/src/protocol_serde/shape_list_job_executions.rs diff --git a/sdks/rust/src/protocol_serde/shape_list_jobs.rs b/crates/client/src/protocol_serde/shape_list_jobs.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_list_jobs.rs rename to crates/client/src/protocol_serde/shape_list_jobs.rs diff --git a/sdks/rust/src/protocol_serde/shape_list_payload_specs.rs b/crates/client/src/protocol_serde/shape_list_payload_specs.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_list_payload_specs.rs rename to crates/client/src/protocol_serde/shape_list_payload_specs.rs diff --git a/sdks/rust/src/protocol_serde/shape_not_found_error.rs b/crates/client/src/protocol_serde/shape_not_found_error.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_not_found_error.rs rename to crates/client/src/protocol_serde/shape_not_found_error.rs diff --git a/sdks/rust/src/protocol_serde/shape_payload_spec_list.rs b/crates/client/src/protocol_serde/shape_payload_spec_list.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_payload_spec_list.rs rename to crates/client/src/protocol_serde/shape_payload_spec_list.rs diff --git a/sdks/rust/src/protocol_serde/shape_payload_spec_resource.rs b/crates/client/src/protocol_serde/shape_payload_spec_resource.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_payload_spec_resource.rs rename to crates/client/src/protocol_serde/shape_payload_spec_resource.rs diff --git a/sdks/rust/src/protocol_serde/shape_rate_limited_error.rs b/crates/client/src/protocol_serde/shape_rate_limited_error.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_rate_limited_error.rs rename to crates/client/src/protocol_serde/shape_rate_limited_error.rs diff --git a/sdks/rust/src/protocol_serde/shape_retry_policy.rs b/crates/client/src/protocol_serde/shape_retry_policy.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_retry_policy.rs rename to crates/client/src/protocol_serde/shape_retry_policy.rs diff --git a/sdks/rust/src/protocol_serde/shape_unauthorized_error.rs b/crates/client/src/protocol_serde/shape_unauthorized_error.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_unauthorized_error.rs rename to crates/client/src/protocol_serde/shape_unauthorized_error.rs diff --git a/sdks/rust/src/protocol_serde/shape_unprocessable_entity_error.rs b/crates/client/src/protocol_serde/shape_unprocessable_entity_error.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_unprocessable_entity_error.rs rename to crates/client/src/protocol_serde/shape_unprocessable_entity_error.rs diff --git a/sdks/rust/src/protocol_serde/shape_update_endpoint.rs b/crates/client/src/protocol_serde/shape_update_endpoint.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_update_endpoint.rs rename to crates/client/src/protocol_serde/shape_update_endpoint.rs diff --git a/sdks/rust/src/protocol_serde/shape_update_endpoint_input.rs b/crates/client/src/protocol_serde/shape_update_endpoint_input.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_update_endpoint_input.rs rename to crates/client/src/protocol_serde/shape_update_endpoint_input.rs diff --git a/sdks/rust/src/protocol_serde/shape_update_job.rs b/crates/client/src/protocol_serde/shape_update_job.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_update_job.rs rename to crates/client/src/protocol_serde/shape_update_job.rs diff --git a/sdks/rust/src/protocol_serde/shape_update_job_input.rs b/crates/client/src/protocol_serde/shape_update_job_input.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_update_job_input.rs rename to crates/client/src/protocol_serde/shape_update_job_input.rs diff --git a/sdks/rust/src/protocol_serde/shape_update_payload_spec.rs b/crates/client/src/protocol_serde/shape_update_payload_spec.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_update_payload_spec.rs rename to crates/client/src/protocol_serde/shape_update_payload_spec.rs diff --git a/sdks/rust/src/protocol_serde/shape_update_payload_spec_input.rs b/crates/client/src/protocol_serde/shape_update_payload_spec_input.rs similarity index 100% rename from sdks/rust/src/protocol_serde/shape_update_payload_spec_input.rs rename to crates/client/src/protocol_serde/shape_update_payload_spec_input.rs diff --git a/sdks/rust/src/sdk_feature_tracker.rs b/crates/client/src/sdk_feature_tracker.rs similarity index 100% rename from sdks/rust/src/sdk_feature_tracker.rs rename to crates/client/src/sdk_feature_tracker.rs diff --git a/sdks/rust/src/serde_util.rs b/crates/client/src/serde_util.rs similarity index 100% rename from sdks/rust/src/serde_util.rs rename to crates/client/src/serde_util.rs diff --git a/sdks/rust/src/serialization_settings.rs b/crates/client/src/serialization_settings.rs similarity index 100% rename from sdks/rust/src/serialization_settings.rs rename to crates/client/src/serialization_settings.rs diff --git a/sdks/rust/src/types.rs b/crates/client/src/types.rs similarity index 100% rename from sdks/rust/src/types.rs rename to crates/client/src/types.rs diff --git a/sdks/rust/src/types/_attempt_resource.rs b/crates/client/src/types/_attempt_resource.rs similarity index 100% rename from sdks/rust/src/types/_attempt_resource.rs rename to crates/client/src/types/_attempt_resource.rs diff --git a/sdks/rust/src/types/_attempt_status_enum.rs b/crates/client/src/types/_attempt_status_enum.rs similarity index 100% rename from sdks/rust/src/types/_attempt_status_enum.rs rename to crates/client/src/types/_attempt_status_enum.rs diff --git a/sdks/rust/src/types/_backoff_type_enum.rs b/crates/client/src/types/_backoff_type_enum.rs similarity index 100% rename from sdks/rust/src/types/_backoff_type_enum.rs rename to crates/client/src/types/_backoff_type_enum.rs diff --git a/sdks/rust/src/types/_endpoint_resource.rs b/crates/client/src/types/_endpoint_resource.rs similarity index 100% rename from sdks/rust/src/types/_endpoint_resource.rs rename to crates/client/src/types/_endpoint_resource.rs diff --git a/sdks/rust/src/types/_endpoint_type_enum.rs b/crates/client/src/types/_endpoint_type_enum.rs similarity index 100% rename from sdks/rust/src/types/_endpoint_type_enum.rs rename to crates/client/src/types/_endpoint_type_enum.rs diff --git a/sdks/rust/src/types/_error_detail.rs b/crates/client/src/types/_error_detail.rs similarity index 100% rename from sdks/rust/src/types/_error_detail.rs rename to crates/client/src/types/_error_detail.rs diff --git a/sdks/rust/src/types/_execution_log_resource.rs b/crates/client/src/types/_execution_log_resource.rs similarity index 100% rename from sdks/rust/src/types/_execution_log_resource.rs rename to crates/client/src/types/_execution_log_resource.rs diff --git a/sdks/rust/src/types/_execution_resource.rs b/crates/client/src/types/_execution_resource.rs similarity index 100% rename from sdks/rust/src/types/_execution_resource.rs rename to crates/client/src/types/_execution_resource.rs diff --git a/sdks/rust/src/types/_execution_status_enum.rs b/crates/client/src/types/_execution_status_enum.rs similarity index 100% rename from sdks/rust/src/types/_execution_status_enum.rs rename to crates/client/src/types/_execution_status_enum.rs diff --git a/sdks/rust/src/types/_execution_summary.rs b/crates/client/src/types/_execution_summary.rs similarity index 100% rename from sdks/rust/src/types/_execution_summary.rs rename to crates/client/src/types/_execution_summary.rs diff --git a/sdks/rust/src/types/_job_resource.rs b/crates/client/src/types/_job_resource.rs similarity index 100% rename from sdks/rust/src/types/_job_resource.rs rename to crates/client/src/types/_job_resource.rs diff --git a/sdks/rust/src/types/_job_status_enum.rs b/crates/client/src/types/_job_status_enum.rs similarity index 100% rename from sdks/rust/src/types/_job_status_enum.rs rename to crates/client/src/types/_job_status_enum.rs diff --git a/sdks/rust/src/types/_job_status_response.rs b/crates/client/src/types/_job_status_response.rs similarity index 100% rename from sdks/rust/src/types/_job_status_response.rs rename to crates/client/src/types/_job_status_response.rs diff --git a/sdks/rust/src/types/_job_summary.rs b/crates/client/src/types/_job_summary.rs similarity index 100% rename from sdks/rust/src/types/_job_summary.rs rename to crates/client/src/types/_job_summary.rs diff --git a/sdks/rust/src/types/_log_level_enum.rs b/crates/client/src/types/_log_level_enum.rs similarity index 100% rename from sdks/rust/src/types/_log_level_enum.rs rename to crates/client/src/types/_log_level_enum.rs diff --git a/sdks/rust/src/types/_payload_spec_resource.rs b/crates/client/src/types/_payload_spec_resource.rs similarity index 100% rename from sdks/rust/src/types/_payload_spec_resource.rs rename to crates/client/src/types/_payload_spec_resource.rs diff --git a/sdks/rust/src/types/_retry_policy.rs b/crates/client/src/types/_retry_policy.rs similarity index 100% rename from sdks/rust/src/types/_retry_policy.rs rename to crates/client/src/types/_retry_policy.rs diff --git a/sdks/rust/src/types/_trigger_type_enum.rs b/crates/client/src/types/_trigger_type_enum.rs similarity index 100% rename from sdks/rust/src/types/_trigger_type_enum.rs rename to crates/client/src/types/_trigger_type_enum.rs diff --git a/sdks/rust/src/types/builders.rs b/crates/client/src/types/builders.rs similarity index 100% rename from sdks/rust/src/types/builders.rs rename to crates/client/src/types/builders.rs diff --git a/sdks/rust/src/types/error.rs b/crates/client/src/types/error.rs similarity index 100% rename from sdks/rust/src/types/error.rs rename to crates/client/src/types/error.rs diff --git a/sdks/rust/src/types/error/_conflict_error.rs b/crates/client/src/types/error/_conflict_error.rs similarity index 100% rename from sdks/rust/src/types/error/_conflict_error.rs rename to crates/client/src/types/error/_conflict_error.rs diff --git a/sdks/rust/src/types/error/_internal_error.rs b/crates/client/src/types/error/_internal_error.rs similarity index 100% rename from sdks/rust/src/types/error/_internal_error.rs rename to crates/client/src/types/error/_internal_error.rs diff --git a/sdks/rust/src/types/error/_invalid_request_error.rs b/crates/client/src/types/error/_invalid_request_error.rs similarity index 100% rename from sdks/rust/src/types/error/_invalid_request_error.rs rename to crates/client/src/types/error/_invalid_request_error.rs diff --git a/sdks/rust/src/types/error/_not_found_error.rs b/crates/client/src/types/error/_not_found_error.rs similarity index 100% rename from sdks/rust/src/types/error/_not_found_error.rs rename to crates/client/src/types/error/_not_found_error.rs diff --git a/sdks/rust/src/types/error/_rate_limited_error.rs b/crates/client/src/types/error/_rate_limited_error.rs similarity index 100% rename from sdks/rust/src/types/error/_rate_limited_error.rs rename to crates/client/src/types/error/_rate_limited_error.rs diff --git a/sdks/rust/src/types/error/_unauthorized_error.rs b/crates/client/src/types/error/_unauthorized_error.rs similarity index 100% rename from sdks/rust/src/types/error/_unauthorized_error.rs rename to crates/client/src/types/error/_unauthorized_error.rs diff --git a/sdks/rust/src/types/error/_unprocessable_entity_error.rs b/crates/client/src/types/error/_unprocessable_entity_error.rs similarity index 100% rename from sdks/rust/src/types/error/_unprocessable_entity_error.rs rename to crates/client/src/types/error/_unprocessable_entity_error.rs diff --git a/sdks/rust/src/types/error/builders.rs b/crates/client/src/types/error/builders.rs similarity index 100% rename from sdks/rust/src/types/error/builders.rs rename to crates/client/src/types/error/builders.rs diff --git a/justfile b/justfile index 05f998c..3812fc0 100644 --- a/justfile +++ b/justfile @@ -79,10 +79,11 @@ smithy-validate: # commit the resulting diff (model + sdks/rust/) in the same PR. smithy-build: smithy-validate cd smithy && smithy build - # Wipe everything except README.md (which warns "DO NOT EDIT" and must survive regeneration) - find sdks/rust -mindepth 1 -maxdepth 1 ! -name 'README.md' -exec rm -rf {} + - cp -R smithy/build/smithy/source/rust-client-codegen/. sdks/rust/ - @echo "Regenerated sdks/rust. Review with: git diff -- sdks/rust" + rm -rf crates/client + cp -R smithy/build/smithy/source/rust-client-codegen crates/client + # Restore the tracked README.md (DO NOT EDIT warning) that the wipe removed + git checkout -- crates/client/README.md + @echo "Regenerated crates/client. Review with: git diff -- crates/client" # Build the generated TypeScript SDK (npm install + compile) build-sdk: smithy-build diff --git a/kronos.postman_collection.json b/kronos.postman_collection.json new file mode 100644 index 0000000..e8a6a5e --- /dev/null +++ b/kronos.postman_collection.json @@ -0,0 +1,778 @@ +{ + "info": { + "name": "Kronos API", + "description": "Full workflow collection for the Kronos job-scheduler API.\n\nWorkflow order:\n1. Create Org\n2. Create Workspace\n3. Create Payload Spec\n4. Create Config\n5. Create Secret\n6. Create Endpoint\n7. Create Job (CRON or IMMEDIATE)\n8. Get Job / Get Job Status\n9. Cancel Job\n\nOrg ID and Workspace ID are auto-saved to collection variables after steps 1 & 2.", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" + }, + "variable": [ + { "key": "base_url", "value": "http://localhost:8090", "type": "string" }, + { "key": "api_key", "value": "dev-api-key", "type": "string" }, + { "key": "org_id", "value": "", "type": "string" }, + { "key": "workspace_id", "value": "", "type": "string" }, + { "key": "job_id", "value": "", "type": "string" } + ], + "auth": { + "type": "bearer", + "bearer": [{ "key": "token", "value": "{{api_key}}", "type": "string" }] + }, + "item": [ + { + "name": "1. Org & Workspace", + "item": [ + { + "name": "Create Org", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const json = pm.response.json();", + "if (json.data && json.data.org_id) {", + " pm.collectionVariables.set('org_id', json.data.org_id);", + " console.log('org_id saved:', json.data.org_id);", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [{ "key": "Content-Type", "value": "application/json" }], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"Aarokya\",\n \"slug\": \"aarokya\"\n}" + }, + "url": { "raw": "{{base_url}}/v1/orgs", "host": ["{{base_url}}"], "path": ["v1", "orgs"] } + } + }, + { + "name": "List Orgs", + "request": { + "method": "GET", + "url": { "raw": "{{base_url}}/v1/orgs", "host": ["{{base_url}}"], "path": ["v1", "orgs"] } + } + }, + { + "name": "Create Workspace", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const json = pm.response.json();", + "if (json.data && json.data.workspace_id) {", + " pm.collectionVariables.set('workspace_id', json.data.workspace_id);", + " console.log('workspace_id saved:', json.data.workspace_id);", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [{ "key": "Content-Type", "value": "application/json" }], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"aarokya-prod\",\n \"slug\": \"aarokya-prod\"\n}" + }, + "url": { + "raw": "{{base_url}}/v1/orgs/{{org_id}}/workspaces", + "host": ["{{base_url}}"], + "path": ["v1", "orgs", "{{org_id}}", "workspaces"] + } + } + }, + { + "name": "List Workspaces", + "request": { + "method": "GET", + "url": { + "raw": "{{base_url}}/v1/orgs/{{org_id}}/workspaces", + "host": ["{{base_url}}"], + "path": ["v1", "orgs", "{{org_id}}", "workspaces"] + } + } + } + ] + }, + { + "name": "2. Payload Specs", + "item": [ + { + "name": "Create Payload Spec", + "request": { + "method": "POST", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"policy-renewal-spec\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"user_id\": { \"type\": \"string\" },\n \"policy_id\": { \"type\": \"string\" }\n },\n \"required\": [\"user_id\", \"policy_id\"]\n }\n}" + }, + "url": { + "raw": "{{base_url}}/v1/payload-specs", + "host": ["{{base_url}}"], + "path": ["v1", "payload-specs"] + } + } + }, + { + "name": "List Payload Specs", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/payload-specs", + "host": ["{{base_url}}"], + "path": ["v1", "payload-specs"] + } + } + }, + { + "name": "Get Payload Spec", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/payload-specs/policy-renewal-spec", + "host": ["{{base_url}}"], + "path": ["v1", "payload-specs", "policy-renewal-spec"] + } + } + }, + { + "name": "Update Payload Spec", + "request": { + "method": "PUT", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"user_id\": { \"type\": \"string\" },\n \"policy_id\": { \"type\": \"string\" },\n \"reason\": { \"type\": \"string\" }\n },\n \"required\": [\"user_id\", \"policy_id\"]\n }\n}" + }, + "url": { + "raw": "{{base_url}}/v1/payload-specs/policy-renewal-spec", + "host": ["{{base_url}}"], + "path": ["v1", "payload-specs", "policy-renewal-spec"] + } + } + }, + { + "name": "Delete Payload Spec", + "request": { + "method": "DELETE", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/payload-specs/policy-renewal-spec", + "host": ["{{base_url}}"], + "path": ["v1", "payload-specs", "policy-renewal-spec"] + } + } + } + ] + }, + { + "name": "3. Configs", + "item": [ + { + "name": "Create Config", + "request": { + "method": "POST", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"aarokya-http-config\",\n \"values\": {\n \"timeout_ms\": 5000,\n \"max_retries\": 3\n }\n}" + }, + "url": { + "raw": "{{base_url}}/v1/configs", + "host": ["{{base_url}}"], + "path": ["v1", "configs"] + } + } + }, + { + "name": "List Configs", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/configs", + "host": ["{{base_url}}"], + "path": ["v1", "configs"] + } + } + }, + { + "name": "Get Config", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/configs/aarokya-http-config", + "host": ["{{base_url}}"], + "path": ["v1", "configs", "aarokya-http-config"] + } + } + }, + { + "name": "Update Config", + "request": { + "method": "PUT", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"values\": {\n \"timeout_ms\": 10000,\n \"max_retries\": 5\n }\n}" + }, + "url": { + "raw": "{{base_url}}/v1/configs/aarokya-http-config", + "host": ["{{base_url}}"], + "path": ["v1", "configs", "aarokya-http-config"] + } + } + }, + { + "name": "Delete Config", + "request": { + "method": "DELETE", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/configs/aarokya-http-config", + "host": ["{{base_url}}"], + "path": ["v1", "configs", "aarokya-http-config"] + } + } + } + ] + }, + { + "name": "4. Secrets", + "item": [ + { + "name": "Create Secret", + "request": { + "method": "POST", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"aarokya-internal-key\",\n \"value\": \"nh-key-2026\"\n}" + }, + "url": { + "raw": "{{base_url}}/v1/secrets", + "host": ["{{base_url}}"], + "path": ["v1", "secrets"] + } + } + }, + { + "name": "List Secrets", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/secrets", + "host": ["{{base_url}}"], + "path": ["v1", "secrets"] + } + } + }, + { + "name": "Get Secret", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/secrets/aarokya-internal-key", + "host": ["{{base_url}}"], + "path": ["v1", "secrets", "aarokya-internal-key"] + } + } + }, + { + "name": "Update Secret", + "request": { + "method": "PUT", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"value\": \"new-secret-value\"\n}" + }, + "url": { + "raw": "{{base_url}}/v1/secrets/aarokya-internal-key", + "host": ["{{base_url}}"], + "path": ["v1", "secrets", "aarokya-internal-key"] + } + } + }, + { + "name": "Delete Secret", + "request": { + "method": "DELETE", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/secrets/aarokya-internal-key", + "host": ["{{base_url}}"], + "path": ["v1", "secrets", "aarokya-internal-key"] + } + } + } + ] + }, + { + "name": "5. Endpoints", + "item": [ + { + "name": "Create Endpoint (HTTP)", + "request": { + "method": "POST", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"name\": \"aarokya-policy-renewal\",\n \"type\": \"HTTP\",\n \"payload_spec\": \"policy-renewal-spec\",\n \"config\": \"aarokya-http-config\",\n \"spec\": {\n \"url\": \"http://localhost:8080/internal/policies/renew\",\n \"method\": \"POST\",\n \"headers\": {\n \"Content-Type\": \"application/json\",\n \"X-Api-Key\": \"nh-key-2026\"\n }\n },\n \"retry_policy\": {\n \"max_attempts\": 3,\n \"backoff\": \"exponential\",\n \"initial_delay_ms\": 1000,\n \"max_delay_ms\": 30000\n }\n}" + }, + "url": { + "raw": "{{base_url}}/v1/endpoints", + "host": ["{{base_url}}"], + "path": ["v1", "endpoints"] + } + } + }, + { + "name": "List Endpoints", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/endpoints", + "host": ["{{base_url}}"], + "path": ["v1", "endpoints"] + } + } + }, + { + "name": "Get Endpoint", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/endpoints/aarokya-policy-renewal", + "host": ["{{base_url}}"], + "path": ["v1", "endpoints", "aarokya-policy-renewal"] + } + } + }, + { + "name": "Update Endpoint", + "request": { + "method": "PUT", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"spec\": {\n \"url\": \"http://localhost:8080/internal/policies/renew\",\n \"method\": \"POST\",\n \"headers\": {\n \"Content-Type\": \"application/json\",\n \"X-Api-Key\": \"nh-key-2026\"\n }\n },\n \"retry_policy\": {\n \"max_attempts\": 5,\n \"backoff\": \"exponential\",\n \"initial_delay_ms\": 2000,\n \"max_delay_ms\": 60000\n }\n}" + }, + "url": { + "raw": "{{base_url}}/v1/endpoints/aarokya-policy-renewal", + "host": ["{{base_url}}"], + "path": ["v1", "endpoints", "aarokya-policy-renewal"] + } + } + }, + { + "name": "Delete Endpoint", + "request": { + "method": "DELETE", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/endpoints/aarokya-policy-renewal", + "host": ["{{base_url}}"], + "path": ["v1", "endpoints", "aarokya-policy-renewal"] + } + } + } + ] + }, + { + "name": "6. Jobs", + "item": [ + { + "name": "Create Job — CRON (daily 10am IST)", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const json = pm.response.json();", + "if (json.data && json.data.job_id) {", + " pm.collectionVariables.set('job_id', json.data.job_id);", + " console.log('job_id saved:', json.data.job_id);", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"endpoint\": \"aarokya-policy-renewal\",\n \"trigger\": \"CRON\",\n \"cron\": \"0 30 4 * * *\",\n \"timezone\": \"Asia/Kolkata\",\n \"input\": {\n \"user_id\": \"usr_test_001\",\n \"policy_id\": \"pol_test_001\"\n }\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "description": "Cron format: `sec min hour dom month dow` (6 fields, not 5).\nThis runs daily at 04:30 UTC = 10:00 IST.", + "url": { + "raw": "{{base_url}}/v1/jobs", + "host": ["{{base_url}}"], + "path": ["v1", "jobs"] + } + } + }, + { + "name": "Create Job — IMMEDIATE", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const json = pm.response.json();", + "if (json.data && json.data.job_id) {", + " pm.collectionVariables.set('job_id', json.data.job_id);", + " console.log('job_id saved:', json.data.job_id);", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"endpoint\": \"aarokya-policy-renewal\",\n \"trigger\": \"IMMEDIATE\",\n \"input\": {\n \"user_id\": \"usr_test_001\",\n \"policy_id\": \"pol_test_001\"\n },\n \"idempotency_key\": \"renew-pol-test-001-v1\"\n}" + }, + "url": { + "raw": "{{base_url}}/v1/jobs", + "host": ["{{base_url}}"], + "path": ["v1", "jobs"] + } + } + }, + { + "name": "Create Job — DELAYED", + "event": [ + { + "listen": "test", + "script": { + "exec": [ + "const json = pm.response.json();", + "if (json.data && json.data.job_id) {", + " pm.collectionVariables.set('job_id', json.data.job_id);", + " console.log('job_id saved:', json.data.job_id);", + "}" + ], + "type": "text/javascript" + } + } + ], + "request": { + "method": "POST", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"endpoint\": \"aarokya-policy-renewal\",\n \"trigger\": \"DELAYED\",\n \"run_at\": \"2026-04-30T10:00:00Z\",\n \"input\": {\n \"user_id\": \"usr_test_001\",\n \"policy_id\": \"pol_test_001\"\n }\n}" + }, + "url": { + "raw": "{{base_url}}/v1/jobs", + "host": ["{{base_url}}"], + "path": ["v1", "jobs"] + } + } + }, + { + "name": "List Jobs", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/jobs", + "host": ["{{base_url}}"], + "path": ["v1", "jobs"] + } + } + }, + { + "name": "Get Job", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/jobs/{{job_id}}", + "host": ["{{base_url}}"], + "path": ["v1", "jobs", "{{job_id}}"] + } + } + }, + { + "name": "Get Job Status", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "description": "Returns health (IDLE/HEALTHY/DEGRADED), active execution counts, cron next_run_at, and last execution summary.", + "url": { + "raw": "{{base_url}}/v1/jobs/{{job_id}}/status", + "host": ["{{base_url}}"], + "path": ["v1", "jobs", "{{job_id}}", "status"] + } + } + }, + { + "name": "Get Job Versions", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/jobs/{{job_id}}/versions", + "host": ["{{base_url}}"], + "path": ["v1", "jobs", "{{job_id}}", "versions"] + } + } + }, + { + "name": "Update Job (CRON only)", + "request": { + "method": "PUT", + "header": [ + { "key": "Content-Type", "value": "application/json" }, + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "body": { + "mode": "raw", + "raw": "{\n \"cron\": \"0 0 5 * * *\",\n \"timezone\": \"Asia/Kolkata\"\n}" + }, + "url": { + "raw": "{{base_url}}/v1/jobs/{{job_id}}", + "host": ["{{base_url}}"], + "path": ["v1", "jobs", "{{job_id}}"] + } + } + }, + { + "name": "Cancel Job", + "request": { + "method": "POST", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "description": "Retires the job (status → RETIRED). For CRON jobs, no more ticks are scheduled.", + "url": { + "raw": "{{base_url}}/v1/jobs/{{job_id}}/cancel", + "host": ["{{base_url}}"], + "path": ["v1", "jobs", "{{job_id}}", "cancel"] + } + } + } + ] + }, + { + "name": "7. Executions", + "item": [ + { + "name": "List Executions for Job", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/jobs/{{job_id}}/executions", + "host": ["{{base_url}}"], + "path": ["v1", "jobs", "{{job_id}}", "executions"] + } + } + }, + { + "name": "Get Execution", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/executions/:execution_id", + "host": ["{{base_url}}"], + "path": ["v1", "executions", ":execution_id"], + "variable": [{ "key": "execution_id", "value": "" }] + } + } + }, + { + "name": "Cancel Execution", + "request": { + "method": "POST", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/executions/:execution_id/cancel", + "host": ["{{base_url}}"], + "path": ["v1", "executions", ":execution_id", "cancel"], + "variable": [{ "key": "execution_id", "value": "" }] + } + } + }, + { + "name": "List Attempts for Execution", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/executions/:execution_id/attempts", + "host": ["{{base_url}}"], + "path": ["v1", "executions", ":execution_id", "attempts"], + "variable": [{ "key": "execution_id", "value": "" }] + } + } + }, + { + "name": "List Logs for Execution", + "request": { + "method": "GET", + "header": [ + { "key": "X-Org-Id", "value": "{{org_id}}" }, + { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } + ], + "url": { + "raw": "{{base_url}}/v1/executions/:execution_id/logs", + "host": ["{{base_url}}"], + "path": ["v1", "executions", ":execution_id", "logs"], + "variable": [{ "key": "execution_id", "value": "" }] + } + } + } + ] + }, + { + "name": "Health", + "item": [ + { + "name": "Health Check", + "request": { + "auth": { "type": "noauth" }, + "method": "GET", + "url": { "raw": "{{base_url}}/health", "host": ["{{base_url}}"], "path": ["health"] } + } + }, + { + "name": "Metrics", + "request": { + "method": "GET", + "url": { "raw": "{{base_url}}/metrics", "host": ["{{base_url}}"], "path": ["metrics"] } + } + } + ] + } + ] +} From 0f7a23d5f46e4d7ad70e0c9f73f73ec8ec5bb06c Mon Sep 17 00:00:00 2001 From: Sandeep Kumar Date: Tue, 5 May 2026 15:41:54 +0530 Subject: [PATCH 6/6] chore: remove accidentally-committed local artifacts The previous commit (3abcd78) used 'git add -A' which swept in two files that shouldn't be in the kronos repo: - .claude/plans/aarokya-integration.md (local AI tooling artifact) - kronos.postman_collection.json (local dev artifact) Removing both. They remain in the working tree as untracked. --- .claude/plans/aarokya-integration.md | 289 ---------- kronos.postman_collection.json | 778 --------------------------- 2 files changed, 1067 deletions(-) delete mode 100644 .claude/plans/aarokya-integration.md delete mode 100644 kronos.postman_collection.json diff --git a/.claude/plans/aarokya-integration.md b/.claude/plans/aarokya-integration.md deleted file mode 100644 index d5e4287..0000000 --- a/.claude/plans/aarokya-integration.md +++ /dev/null @@ -1,289 +0,0 @@ -# Kronos for Aarokya — Integration Plan & Contribution Roadmap - -## Context - -**Aarokya** is a health savings + insurance platform for Namma Yatri drivers. It piggybacks on the existing Namma Yatri autopay mandate (₹25/day subscription, ₹35 max) to enable daily micro-savings (e.g., ₹30/day) into a Transcorp wallet. - -**The daily flow:** -1. **Trigger**: Daily, for each enrolled driver, Aarokya must initiate autopay via Namma Yatri -2. **Execute**: Namma Yatri processes the autopay and calls back Aarokya with success/failure -3. **Load wallet**: On success, Aarokya calls Transcorp to credit the driver's wallet - -**The question:** Can Kronos power this? What's missing? - ---- - -## 1. Recommended Architecture (Option A — Kronos + Aarokya Backend) - -``` -┌─────────────────────────────────────────────────────────────┐ -│ DAILY FLOW │ -│ │ -│ Kronos CRON (daily per user) │ -│ │ │ -│ ▼ │ -│ HTTP Dispatch → Aarokya Backend /trigger-autopay/{user} │ -│ │ │ -│ ▼ │ -│ Aarokya calls Namma Yatri Autopay API │ -│ │ │ -│ ▼ (async, NY calls back later) │ -│ NY webhook → Aarokya /webhooks/autopay │ -│ │ │ -│ ├─ ON SUCCESS: │ -│ │ Aarokya creates IMMEDIATE job │ -│ │ in Kronos → Transcorp wallet load │ -│ │ (with retry + idempotency!) │ -│ │ │ -│ └─ ON FAILURE: │ -│ Log failure, notify user, retry next │ -│ day │ -└─────────────────────────────────────────────────────────────┘ -``` - -### What Kronos handles: -- **Daily scheduling** — CRON job per enrolled user -- **Reliable HTTP delivery** — Retry with backoff if Aarokya backend or Transcorp is down -- **Exactly-once** — Idempotency key `aarokya_{user_id}_{YYYY-MM-DD}` prevents double-charge -- **Observability** — Metrics + logs for every autopay attempt and wallet load - -### What Aarokya backend handles: -- **Webhook receiver** — Receives async callback from Namma Yatri -- **Orchestration** — Decides whether to trigger wallet load based on callback result -- **User enrollment** — Creates/cancels Kronos CRON jobs when users opt in/out - ---- - -## 2. Kronos Setup for Aarokya - -### Step 1: Create workspace -``` -POST /v1/orgs/{juspay_org}/workspaces -{ "name": "aarokya-prod" } -``` - -### Step 2: Create secrets -``` -POST /v1/secrets -{ "name": "ny-api-key", "value": "" } - -POST /v1/secrets -{ "name": "transcorp-api-key", "value": "" } -``` - -### Step 3: Create configs -``` -POST /v1/configs -{ "name": "aarokya-config", "values": { - "aarokya_base_url": "https://aarokya-backend.juspay.in", - "transcorp_base_url": "https://api.transcorp.in" -}} -``` - -### Step 4: Create endpoints - -**Endpoint A — Trigger autopay (daily CRON target)** -``` -POST /v1/endpoints -{ - "name": "trigger-autopay", - "endpoint_type": "HTTP", - "config_ref": "aarokya-config", - "spec": { - "url": "{{config.aarokya_base_url}}/api/v1/autopay/trigger", - "method": "POST", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer {{secret.ny-api-key}}" - }, - "body_template": { - "user_id": "{{input.user_id}}", - "amount": "{{input.amount}}", - "mandate_id": "{{input.mandate_id}}", - "date": "{{input.date}}" - }, - "timeout_ms": 10000, - "expected_status_codes": [200, 201, 202] - }, - "retry_policy": { - "max_attempts": 3, - "backoff": "exponential", - "initial_delay_ms": 2000, - "max_delay_ms": 30000 - } -} -``` - -**Endpoint B — Load Transcorp wallet (triggered on autopay success)** -``` -POST /v1/endpoints -{ - "name": "load-wallet", - "endpoint_type": "HTTP", - "config_ref": "aarokya-config", - "spec": { - "url": "{{config.transcorp_base_url}}/api/v1/wallet/credit", - "method": "POST", - "headers": { - "Content-Type": "application/json", - "Authorization": "Bearer {{secret.transcorp-api-key}}" - }, - "body_template": { - "user_id": "{{input.user_id}}", - "amount": "{{input.amount}}", - "reference_id": "{{input.reference_id}}", - "source": "aarokya_autopay" - }, - "timeout_ms": 10000 - }, - "retry_policy": { - "max_attempts": 5, - "backoff": "exponential", - "initial_delay_ms": 1000, - "max_delay_ms": 60000 - } -} -``` - -### Step 5: Create CRON jobs (per enrolled user) -``` -POST /v1/jobs -{ - "endpoint": "trigger-autopay", - "trigger": "CRON", - "cron_expression": "0 8 * * *", - "cron_timezone": "Asia/Kolkata", - "input": { - "user_id": "driver_12345", - "amount": 3000, - "mandate_id": "mandate_abc" - } -} -``` - -### Step 6: Aarokya backend webhook handler (on NY callback success) -``` -// In Aarokya backend code: -// When Namma Yatri calls POST /webhooks/autopay with success: - -POST /v1/jobs (to Kronos) -{ - "endpoint": "load-wallet", - "trigger": "IMMEDIATE", - "idempotency_key": "wallet_load_driver_12345_2026-04-03", - "input": { - "user_id": "driver_12345", - "amount": 3000, - "reference_id": "ny_txn_xyz789" - } -} -``` - ---- - -## 3. Scale Considerations - -| Factor | Estimate | Kronos handles? | -|--------|----------|----------------| -| Enrolled drivers | 10K → 100K+ | One CRON job per user could be heavy at 100K+ | -| Daily executions | 10K-100K (autopay) + 10K-100K (wallet load) | Worker scales horizontally | -| Idempotency | Critical — no double-charging | Built-in | -| Failure rate | NY API may fail 1-5% | Retry with backoff | -| Timing | All fire at same time (8 AM IST) | Thundering herd — needs staggering | - -### Thundering herd problem -If 100K CRON jobs all fire at `0 8 * * *`, the worker gets 100K executions at once. Solutions: -- **Stagger CRON times**: `0 8 * * *`, `5 8 * * *`, `10 8 * * *` across user cohorts -- **OR: Bulk trigger pattern** (better): One CRON job that triggers a batch endpoint in Aarokya, which then fans out - ---- - -## 4. Contributions Needed in Kronos - -### Must-have for Aarokya (Tier 1 priorities) - -| # | Feature | Why | Effort | Key files | -|---|---------|-----|--------|-----------| -| 1 | **Batch job creation** | Enroll 1000+ users at once; `POST /v1/jobs/batch` | 1-2 days | `handlers/jobs.rs`, `db/jobs.rs` | -| 2 | **Bulk CRON (fan-out)** | Single CRON that triggers one batch endpoint instead of N individual CRONs | 2-3 days | `handlers/jobs.rs`, `pipeline.rs` | -| 3 | **Job cancellation by endpoint** | When user opts out, cancel their CRON job by user_id lookup | 1 day | `handlers/jobs.rs`, `db/jobs.rs` — add query by endpoint + input filter | - -### Nice-to-have (Tier 2) - -| # | Feature | Why | Effort | -|---|---------|-----|--------| -| 4 | **Job chaining** | On success of autopay job → auto-create wallet-load job (eliminates Aarokya backend orchestration) | 1 week | -| 5 | **Webhook receiver** | `POST /v1/webhooks/{id}/callback` — Kronos receives NY callback directly and chains | 1 week | -| 6 | **Execution dashboard filtering** | Filter by user_id in input, date range, status — for ops debugging | 2-3 days | -| 7 | **Metrics by endpoint** | Track success rate per endpoint (trigger-autopay vs load-wallet separately) | 1 day | - -### If scale exceeds 100K users (Tier 3) - -| # | Feature | Why | -|---|---------|-----| -| 8 | **Batch execution** | Single execution that processes N users instead of N executions | -| 9 | **Execution priorities** | Retries should be higher priority than new daily triggers | -| 10 | **Worker sharding** | Shard by workspace or endpoint to avoid contention | - ---- - -## 5. Is Kronos the Right Tool? - -### Verdict: YES, with Option A architecture - -Kronos is the right tool because this problem is fundamentally about: -- **Reliable, scheduled HTTP delivery** (Kronos's core strength) -- **Retry with exactly-once guarantees** (critical for financial transactions) -- **Observability** (you need to know which autopays failed and why) - -### What Kronos is NOT (and you shouldn't try to make it): -- A workflow orchestrator (use Aarokya backend for the callback choreography) -- A payment gateway (Kronos triggers the calls, doesn't process payments) -- A user database (user enrollment state lives in Aarokya's DB) - -### Alternatives considered: -| Tool | Why not | -|------|---------| -| Raw cron + curl | No retry, no idempotency, no observability, no multi-tenant | -| Temporal/Cadence | Overkill for this — heavyweight workflow engine for a 2-step flow | -| AWS Step Functions | Cloud lock-in, doesn't run on-prem, cost at scale | -| Custom queue (Redis/Kafka) | You'd rebuild half of Kronos — scheduling, retry, idempotency | - -Kronos gives you all of the above out of the box, and it's already in-house at Juspay. - ---- - -## 6. Implementation Order - -``` -Phase 1: Get it working (1 week) - ├── Set up Aarokya workspace in Kronos - ├── Create endpoints (trigger-autopay, load-wallet) - ├── Create CRON jobs for pilot users (100 drivers) - ├── Build webhook handler in Aarokya backend - └── E2E test with mock NY + Transcorp APIs - -Phase 2: Scale contributions (1-2 weeks) - ├── Contribute batch job creation to Kronos - ├── Contribute job lookup/cancel by endpoint+input - ├── Implement bulk CRON or staggered scheduling - └── Load test with 10K simulated users - -Phase 3: Production hardening - ├── Contribute execution filtering for ops - ├── Set up Grafana alerts (failure rate > 5%) - ├── Add per-endpoint metrics - └── Document runbook for autopay failures -``` - ---- - -## Verification - -1. `just dev` — Start Kronos locally -2. Create Aarokya workspace + endpoints + test CRON job -3. Run `just test-e2e` to verify Kronos basics -4. Mock Namma Yatri + Transcorp APIs using `mock-server` -5. Verify full flow: CRON fires → autopay triggered → callback received → wallet loaded -6. Check idempotency: re-trigger same day → no duplicate wallet load -7. Check retry: mock NY API failure → Kronos retries with backoff diff --git a/kronos.postman_collection.json b/kronos.postman_collection.json deleted file mode 100644 index e8a6a5e..0000000 --- a/kronos.postman_collection.json +++ /dev/null @@ -1,778 +0,0 @@ -{ - "info": { - "name": "Kronos API", - "description": "Full workflow collection for the Kronos job-scheduler API.\n\nWorkflow order:\n1. Create Org\n2. Create Workspace\n3. Create Payload Spec\n4. Create Config\n5. Create Secret\n6. Create Endpoint\n7. Create Job (CRON or IMMEDIATE)\n8. Get Job / Get Job Status\n9. Cancel Job\n\nOrg ID and Workspace ID are auto-saved to collection variables after steps 1 & 2.", - "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json" - }, - "variable": [ - { "key": "base_url", "value": "http://localhost:8090", "type": "string" }, - { "key": "api_key", "value": "dev-api-key", "type": "string" }, - { "key": "org_id", "value": "", "type": "string" }, - { "key": "workspace_id", "value": "", "type": "string" }, - { "key": "job_id", "value": "", "type": "string" } - ], - "auth": { - "type": "bearer", - "bearer": [{ "key": "token", "value": "{{api_key}}", "type": "string" }] - }, - "item": [ - { - "name": "1. Org & Workspace", - "item": [ - { - "name": "Create Org", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const json = pm.response.json();", - "if (json.data && json.data.org_id) {", - " pm.collectionVariables.set('org_id', json.data.org_id);", - " console.log('org_id saved:', json.data.org_id);", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [{ "key": "Content-Type", "value": "application/json" }], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"Aarokya\",\n \"slug\": \"aarokya\"\n}" - }, - "url": { "raw": "{{base_url}}/v1/orgs", "host": ["{{base_url}}"], "path": ["v1", "orgs"] } - } - }, - { - "name": "List Orgs", - "request": { - "method": "GET", - "url": { "raw": "{{base_url}}/v1/orgs", "host": ["{{base_url}}"], "path": ["v1", "orgs"] } - } - }, - { - "name": "Create Workspace", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const json = pm.response.json();", - "if (json.data && json.data.workspace_id) {", - " pm.collectionVariables.set('workspace_id', json.data.workspace_id);", - " console.log('workspace_id saved:', json.data.workspace_id);", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [{ "key": "Content-Type", "value": "application/json" }], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"aarokya-prod\",\n \"slug\": \"aarokya-prod\"\n}" - }, - "url": { - "raw": "{{base_url}}/v1/orgs/{{org_id}}/workspaces", - "host": ["{{base_url}}"], - "path": ["v1", "orgs", "{{org_id}}", "workspaces"] - } - } - }, - { - "name": "List Workspaces", - "request": { - "method": "GET", - "url": { - "raw": "{{base_url}}/v1/orgs/{{org_id}}/workspaces", - "host": ["{{base_url}}"], - "path": ["v1", "orgs", "{{org_id}}", "workspaces"] - } - } - } - ] - }, - { - "name": "2. Payload Specs", - "item": [ - { - "name": "Create Payload Spec", - "request": { - "method": "POST", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"policy-renewal-spec\",\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"user_id\": { \"type\": \"string\" },\n \"policy_id\": { \"type\": \"string\" }\n },\n \"required\": [\"user_id\", \"policy_id\"]\n }\n}" - }, - "url": { - "raw": "{{base_url}}/v1/payload-specs", - "host": ["{{base_url}}"], - "path": ["v1", "payload-specs"] - } - } - }, - { - "name": "List Payload Specs", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/payload-specs", - "host": ["{{base_url}}"], - "path": ["v1", "payload-specs"] - } - } - }, - { - "name": "Get Payload Spec", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/payload-specs/policy-renewal-spec", - "host": ["{{base_url}}"], - "path": ["v1", "payload-specs", "policy-renewal-spec"] - } - } - }, - { - "name": "Update Payload Spec", - "request": { - "method": "PUT", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"user_id\": { \"type\": \"string\" },\n \"policy_id\": { \"type\": \"string\" },\n \"reason\": { \"type\": \"string\" }\n },\n \"required\": [\"user_id\", \"policy_id\"]\n }\n}" - }, - "url": { - "raw": "{{base_url}}/v1/payload-specs/policy-renewal-spec", - "host": ["{{base_url}}"], - "path": ["v1", "payload-specs", "policy-renewal-spec"] - } - } - }, - { - "name": "Delete Payload Spec", - "request": { - "method": "DELETE", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/payload-specs/policy-renewal-spec", - "host": ["{{base_url}}"], - "path": ["v1", "payload-specs", "policy-renewal-spec"] - } - } - } - ] - }, - { - "name": "3. Configs", - "item": [ - { - "name": "Create Config", - "request": { - "method": "POST", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"aarokya-http-config\",\n \"values\": {\n \"timeout_ms\": 5000,\n \"max_retries\": 3\n }\n}" - }, - "url": { - "raw": "{{base_url}}/v1/configs", - "host": ["{{base_url}}"], - "path": ["v1", "configs"] - } - } - }, - { - "name": "List Configs", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/configs", - "host": ["{{base_url}}"], - "path": ["v1", "configs"] - } - } - }, - { - "name": "Get Config", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/configs/aarokya-http-config", - "host": ["{{base_url}}"], - "path": ["v1", "configs", "aarokya-http-config"] - } - } - }, - { - "name": "Update Config", - "request": { - "method": "PUT", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"values\": {\n \"timeout_ms\": 10000,\n \"max_retries\": 5\n }\n}" - }, - "url": { - "raw": "{{base_url}}/v1/configs/aarokya-http-config", - "host": ["{{base_url}}"], - "path": ["v1", "configs", "aarokya-http-config"] - } - } - }, - { - "name": "Delete Config", - "request": { - "method": "DELETE", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/configs/aarokya-http-config", - "host": ["{{base_url}}"], - "path": ["v1", "configs", "aarokya-http-config"] - } - } - } - ] - }, - { - "name": "4. Secrets", - "item": [ - { - "name": "Create Secret", - "request": { - "method": "POST", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"aarokya-internal-key\",\n \"value\": \"nh-key-2026\"\n}" - }, - "url": { - "raw": "{{base_url}}/v1/secrets", - "host": ["{{base_url}}"], - "path": ["v1", "secrets"] - } - } - }, - { - "name": "List Secrets", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/secrets", - "host": ["{{base_url}}"], - "path": ["v1", "secrets"] - } - } - }, - { - "name": "Get Secret", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/secrets/aarokya-internal-key", - "host": ["{{base_url}}"], - "path": ["v1", "secrets", "aarokya-internal-key"] - } - } - }, - { - "name": "Update Secret", - "request": { - "method": "PUT", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"value\": \"new-secret-value\"\n}" - }, - "url": { - "raw": "{{base_url}}/v1/secrets/aarokya-internal-key", - "host": ["{{base_url}}"], - "path": ["v1", "secrets", "aarokya-internal-key"] - } - } - }, - { - "name": "Delete Secret", - "request": { - "method": "DELETE", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/secrets/aarokya-internal-key", - "host": ["{{base_url}}"], - "path": ["v1", "secrets", "aarokya-internal-key"] - } - } - } - ] - }, - { - "name": "5. Endpoints", - "item": [ - { - "name": "Create Endpoint (HTTP)", - "request": { - "method": "POST", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"name\": \"aarokya-policy-renewal\",\n \"type\": \"HTTP\",\n \"payload_spec\": \"policy-renewal-spec\",\n \"config\": \"aarokya-http-config\",\n \"spec\": {\n \"url\": \"http://localhost:8080/internal/policies/renew\",\n \"method\": \"POST\",\n \"headers\": {\n \"Content-Type\": \"application/json\",\n \"X-Api-Key\": \"nh-key-2026\"\n }\n },\n \"retry_policy\": {\n \"max_attempts\": 3,\n \"backoff\": \"exponential\",\n \"initial_delay_ms\": 1000,\n \"max_delay_ms\": 30000\n }\n}" - }, - "url": { - "raw": "{{base_url}}/v1/endpoints", - "host": ["{{base_url}}"], - "path": ["v1", "endpoints"] - } - } - }, - { - "name": "List Endpoints", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/endpoints", - "host": ["{{base_url}}"], - "path": ["v1", "endpoints"] - } - } - }, - { - "name": "Get Endpoint", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/endpoints/aarokya-policy-renewal", - "host": ["{{base_url}}"], - "path": ["v1", "endpoints", "aarokya-policy-renewal"] - } - } - }, - { - "name": "Update Endpoint", - "request": { - "method": "PUT", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"spec\": {\n \"url\": \"http://localhost:8080/internal/policies/renew\",\n \"method\": \"POST\",\n \"headers\": {\n \"Content-Type\": \"application/json\",\n \"X-Api-Key\": \"nh-key-2026\"\n }\n },\n \"retry_policy\": {\n \"max_attempts\": 5,\n \"backoff\": \"exponential\",\n \"initial_delay_ms\": 2000,\n \"max_delay_ms\": 60000\n }\n}" - }, - "url": { - "raw": "{{base_url}}/v1/endpoints/aarokya-policy-renewal", - "host": ["{{base_url}}"], - "path": ["v1", "endpoints", "aarokya-policy-renewal"] - } - } - }, - { - "name": "Delete Endpoint", - "request": { - "method": "DELETE", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/endpoints/aarokya-policy-renewal", - "host": ["{{base_url}}"], - "path": ["v1", "endpoints", "aarokya-policy-renewal"] - } - } - } - ] - }, - { - "name": "6. Jobs", - "item": [ - { - "name": "Create Job — CRON (daily 10am IST)", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const json = pm.response.json();", - "if (json.data && json.data.job_id) {", - " pm.collectionVariables.set('job_id', json.data.job_id);", - " console.log('job_id saved:', json.data.job_id);", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"endpoint\": \"aarokya-policy-renewal\",\n \"trigger\": \"CRON\",\n \"cron\": \"0 30 4 * * *\",\n \"timezone\": \"Asia/Kolkata\",\n \"input\": {\n \"user_id\": \"usr_test_001\",\n \"policy_id\": \"pol_test_001\"\n }\n}", - "options": { - "raw": { - "language": "json" - } - } - }, - "description": "Cron format: `sec min hour dom month dow` (6 fields, not 5).\nThis runs daily at 04:30 UTC = 10:00 IST.", - "url": { - "raw": "{{base_url}}/v1/jobs", - "host": ["{{base_url}}"], - "path": ["v1", "jobs"] - } - } - }, - { - "name": "Create Job — IMMEDIATE", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const json = pm.response.json();", - "if (json.data && json.data.job_id) {", - " pm.collectionVariables.set('job_id', json.data.job_id);", - " console.log('job_id saved:', json.data.job_id);", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"endpoint\": \"aarokya-policy-renewal\",\n \"trigger\": \"IMMEDIATE\",\n \"input\": {\n \"user_id\": \"usr_test_001\",\n \"policy_id\": \"pol_test_001\"\n },\n \"idempotency_key\": \"renew-pol-test-001-v1\"\n}" - }, - "url": { - "raw": "{{base_url}}/v1/jobs", - "host": ["{{base_url}}"], - "path": ["v1", "jobs"] - } - } - }, - { - "name": "Create Job — DELAYED", - "event": [ - { - "listen": "test", - "script": { - "exec": [ - "const json = pm.response.json();", - "if (json.data && json.data.job_id) {", - " pm.collectionVariables.set('job_id', json.data.job_id);", - " console.log('job_id saved:', json.data.job_id);", - "}" - ], - "type": "text/javascript" - } - } - ], - "request": { - "method": "POST", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"endpoint\": \"aarokya-policy-renewal\",\n \"trigger\": \"DELAYED\",\n \"run_at\": \"2026-04-30T10:00:00Z\",\n \"input\": {\n \"user_id\": \"usr_test_001\",\n \"policy_id\": \"pol_test_001\"\n }\n}" - }, - "url": { - "raw": "{{base_url}}/v1/jobs", - "host": ["{{base_url}}"], - "path": ["v1", "jobs"] - } - } - }, - { - "name": "List Jobs", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/jobs", - "host": ["{{base_url}}"], - "path": ["v1", "jobs"] - } - } - }, - { - "name": "Get Job", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/jobs/{{job_id}}", - "host": ["{{base_url}}"], - "path": ["v1", "jobs", "{{job_id}}"] - } - } - }, - { - "name": "Get Job Status", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "description": "Returns health (IDLE/HEALTHY/DEGRADED), active execution counts, cron next_run_at, and last execution summary.", - "url": { - "raw": "{{base_url}}/v1/jobs/{{job_id}}/status", - "host": ["{{base_url}}"], - "path": ["v1", "jobs", "{{job_id}}", "status"] - } - } - }, - { - "name": "Get Job Versions", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/jobs/{{job_id}}/versions", - "host": ["{{base_url}}"], - "path": ["v1", "jobs", "{{job_id}}", "versions"] - } - } - }, - { - "name": "Update Job (CRON only)", - "request": { - "method": "PUT", - "header": [ - { "key": "Content-Type", "value": "application/json" }, - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "body": { - "mode": "raw", - "raw": "{\n \"cron\": \"0 0 5 * * *\",\n \"timezone\": \"Asia/Kolkata\"\n}" - }, - "url": { - "raw": "{{base_url}}/v1/jobs/{{job_id}}", - "host": ["{{base_url}}"], - "path": ["v1", "jobs", "{{job_id}}"] - } - } - }, - { - "name": "Cancel Job", - "request": { - "method": "POST", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "description": "Retires the job (status → RETIRED). For CRON jobs, no more ticks are scheduled.", - "url": { - "raw": "{{base_url}}/v1/jobs/{{job_id}}/cancel", - "host": ["{{base_url}}"], - "path": ["v1", "jobs", "{{job_id}}", "cancel"] - } - } - } - ] - }, - { - "name": "7. Executions", - "item": [ - { - "name": "List Executions for Job", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/jobs/{{job_id}}/executions", - "host": ["{{base_url}}"], - "path": ["v1", "jobs", "{{job_id}}", "executions"] - } - } - }, - { - "name": "Get Execution", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/executions/:execution_id", - "host": ["{{base_url}}"], - "path": ["v1", "executions", ":execution_id"], - "variable": [{ "key": "execution_id", "value": "" }] - } - } - }, - { - "name": "Cancel Execution", - "request": { - "method": "POST", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/executions/:execution_id/cancel", - "host": ["{{base_url}}"], - "path": ["v1", "executions", ":execution_id", "cancel"], - "variable": [{ "key": "execution_id", "value": "" }] - } - } - }, - { - "name": "List Attempts for Execution", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/executions/:execution_id/attempts", - "host": ["{{base_url}}"], - "path": ["v1", "executions", ":execution_id", "attempts"], - "variable": [{ "key": "execution_id", "value": "" }] - } - } - }, - { - "name": "List Logs for Execution", - "request": { - "method": "GET", - "header": [ - { "key": "X-Org-Id", "value": "{{org_id}}" }, - { "key": "X-Workspace-Id", "value": "{{workspace_id}}" } - ], - "url": { - "raw": "{{base_url}}/v1/executions/:execution_id/logs", - "host": ["{{base_url}}"], - "path": ["v1", "executions", ":execution_id", "logs"], - "variable": [{ "key": "execution_id", "value": "" }] - } - } - } - ] - }, - { - "name": "Health", - "item": [ - { - "name": "Health Check", - "request": { - "auth": { "type": "noauth" }, - "method": "GET", - "url": { "raw": "{{base_url}}/health", "host": ["{{base_url}}"], "path": ["health"] } - } - }, - { - "name": "Metrics", - "request": { - "method": "GET", - "url": { "raw": "{{base_url}}/metrics", "host": ["{{base_url}}"], "path": ["metrics"] } - } - } - ] - } - ] -}