Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
"crates/client",
]
resolver = "2"

[workspace.package]
Expand Down
43 changes: 43 additions & 0 deletions crates/client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"]


35 changes: 35 additions & 0 deletions crates/client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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 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
```

> **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?

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.
41 changes: 41 additions & 0 deletions crates/client/src/auth_plugin.rs
Original file line number Diff line number Diff line change
@@ -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<AuthSchemeId>) -> 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)
}
}

177 changes: 177 additions & 0 deletions crates/client/src/client.rs
Original file line number Diff line number Diff line change
@@ -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<Handle>,
}

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;

16 changes: 16 additions & 0 deletions crates/client/src/client/cancel_execution.rs
Original file line number Diff line number Diff line change
@@ -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<String>)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::org_id) / [`set_org_id(Option<String>)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::set_org_id):<br>required: **true**<br>(undocumented)<br>
/// - [`workspace_id(impl Into<String>)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::workspace_id) / [`set_workspace_id(Option<String>)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::set_workspace_id):<br>required: **true**<br>(undocumented)<br>
/// - [`execution_id(impl Into<String>)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::execution_id) / [`set_execution_id(Option<String>)`](crate::operation::cancel_execution::builders::CancelExecutionFluentBuilder::set_execution_id):<br>required: **true**<br>(undocumented)<br>
/// - 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<CancelExecutionError>`](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())
}
}

16 changes: 16 additions & 0 deletions crates/client/src/client/cancel_job.rs
Original file line number Diff line number Diff line change
@@ -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<String>)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::org_id) / [`set_org_id(Option<String>)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::set_org_id):<br>required: **true**<br>(undocumented)<br>
/// - [`workspace_id(impl Into<String>)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::workspace_id) / [`set_workspace_id(Option<String>)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::set_workspace_id):<br>required: **true**<br>(undocumented)<br>
/// - [`job_id(impl Into<String>)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::job_id) / [`set_job_id(Option<String>)`](crate::operation::cancel_job::builders::CancelJobFluentBuilder::set_job_id):<br>required: **true**<br>(undocumented)<br>
/// - 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<CancelJobError>`](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())
}
}

21 changes: 21 additions & 0 deletions crates/client/src/client/create_endpoint.rs
Original file line number Diff line number Diff line change
@@ -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<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::org_id) / [`set_org_id(Option<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_org_id):<br>required: **true**<br>(undocumented)<br>
/// - [`workspace_id(impl Into<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::workspace_id) / [`set_workspace_id(Option<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_workspace_id):<br>required: **true**<br>(undocumented)<br>
/// - [`name(impl Into<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::name) / [`set_name(Option<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_name):<br>required: **true**<br>(undocumented)<br>
/// - [`endpoint_type(EndpointTypeEnum)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::endpoint_type) / [`set_endpoint_type(Option<EndpointTypeEnum>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_endpoint_type):<br>required: **true**<br>(undocumented)<br>
/// - [`payload_spec(impl Into<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::payload_spec) / [`set_payload_spec(Option<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_payload_spec):<br>required: **false**<br>(undocumented)<br>
/// - [`config(impl Into<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::config) / [`set_config(Option<String>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_config):<br>required: **false**<br>(undocumented)<br>
/// - [`spec(Document)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::spec) / [`set_spec(Option<Document>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_spec):<br>required: **true**<br>(undocumented)<br>
/// - [`retry_policy(RetryPolicy)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::retry_policy) / [`set_retry_policy(Option<RetryPolicy>)`](crate::operation::create_endpoint::builders::CreateEndpointFluentBuilder::set_retry_policy):<br>required: **false**<br>(undocumented)<br>
/// - 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<CreateEndpointError>`](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())
}
}

Loading