Skip to content

Commit

Permalink
rename some types exported from rust
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bonez committed Jan 14, 2025
1 parent 07b2756 commit 3dab252
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 9 deletions.
8 changes: 7 additions & 1 deletion core/startos/src/net/host/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@ use crate::net::acme::AcmeProvider;
use crate::prelude::*;
use crate::util::serde::{display_serializable, HandlerExtSerde};

#[derive(Clone, Debug, Deserialize, Serialize)]
#[derive(Clone, Debug, Deserialize, Serialize, TS)]
#[serde(rename_all = "kebab-case")]
#[serde(rename_all_fields = "camelCase")]
#[serde(tag = "kind")]
#[ts(export)]
pub enum HostAddress {
Onion {
#[ts(type = "string")]
address: OnionAddressV3,
},
Domain {
#[ts(type = "string")]
address: InternedString,
public: bool,
acme: Option<AcmeProvider>,
Expand Down
9 changes: 5 additions & 4 deletions core/startos/src/net/host/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,20 +221,21 @@ pub async fn list_bindings(
.de()
}

#[derive(Deserialize, Serialize, Parser)]
#[derive(Deserialize, Serialize, Parser, TS)]
#[serde(rename_all = "camelCase")]
pub struct SetPublicParams {
#[ts(export)]
pub struct BindingSetPublicParams {
internal_port: u16,
#[arg(long)]
public: Option<bool>,
}

pub async fn set_public(
ctx: RpcContext,
SetPublicParams {
BindingSetPublicParams {
internal_port,
public,
}: SetPublicParams,
}: BindingSetPublicParams,
(package, host): (PackageId, HostId),
) -> Result<(), Error> {
ctx.db
Expand Down
4 changes: 2 additions & 2 deletions core/startos/src/net/network_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,15 @@ async fn list_interfaces(

#[derive(Debug, Clone, Deserialize, Serialize, Parser, TS)]
#[ts(export)]
struct SetPublicParams {
struct NetworkInterfaceSetPublicParams {
#[ts(type = "string")]
interface: InternedString,
public: Option<bool>,
}

async fn set_public(
ctx: RpcContext,
SetPublicParams { interface, public }: SetPublicParams,
NetworkInterfaceSetPublicParams { interface, public }: NetworkInterfaceSetPublicParams,
) -> Result<(), Error> {
ctx.net_controller
.net_iface
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

export type SetPublicParams = { interface: string; public: boolean | null }
export type BindingSetPublicParams = {
internalPort: number
public: boolean | null
}
11 changes: 11 additions & 0 deletions sdk/base/lib/osBindings/HostAddress.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AcmeProvider } from "./AcmeProvider"

export type HostAddress =
| { kind: "onion"; address: string }
| {
kind: "domain"
address: string
public: boolean
acme: AcmeProvider | null
}
6 changes: 6 additions & 0 deletions sdk/base/lib/osBindings/NetworkInterfaceSetPublicParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.

export type NetworkInterfaceSetPublicParams = {
interface: string
public: boolean | null
}
4 changes: 3 additions & 1 deletion sdk/base/lib/osBindings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export { BackupTargetFS } from "./BackupTargetFS"
export { Base64 } from "./Base64"
export { BindId } from "./BindId"
export { BindInfo } from "./BindInfo"
export { BindingSetPublicParams } from "./BindingSetPublicParams"
export { BindOptions } from "./BindOptions"
export { BindParams } from "./BindParams"
export { Blake3Commitment } from "./Blake3Commitment"
Expand Down Expand Up @@ -97,6 +98,7 @@ export { Governor } from "./Governor"
export { Guid } from "./Guid"
export { HardwareRequirements } from "./HardwareRequirements"
export { HealthCheckId } from "./HealthCheckId"
export { HostAddress } from "./HostAddress"
export { HostId } from "./HostId"
export { HostKind } from "./HostKind"
export { HostnameInfo } from "./HostnameInfo"
Expand Down Expand Up @@ -131,6 +133,7 @@ export { NamedHealthCheckResult } from "./NamedHealthCheckResult"
export { NamedProgress } from "./NamedProgress"
export { NetInfo } from "./NetInfo"
export { NetworkInterfaceInfo } from "./NetworkInterfaceInfo"
export { NetworkInterfaceSetPublicParams } from "./NetworkInterfaceSetPublicParams"
export { NetworkInterfaceType } from "./NetworkInterfaceType"
export { OnionHostname } from "./OnionHostname"
export { OsIndex } from "./OsIndex"
Expand Down Expand Up @@ -176,7 +179,6 @@ export { SetIconParams } from "./SetIconParams"
export { SetMainStatusStatus } from "./SetMainStatusStatus"
export { SetMainStatus } from "./SetMainStatus"
export { SetNameParams } from "./SetNameParams"
export { SetPublicParams } from "./SetPublicParams"
export { SetStoreParams } from "./SetStoreParams"
export { SetupExecuteParams } from "./SetupExecuteParams"
export { SetupProgress } from "./SetupProgress"
Expand Down

0 comments on commit 3dab252

Please sign in to comment.