diff --git a/src/cli/Baseten.CLI/Commands/ApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/ApiCommand.g.cs index 719106b..a2c07aa 100644 --- a/src/cli/Baseten.CLI/Commands/ApiCommand.g.cs +++ b/src/cli/Baseten.CLI/Commands/ApiCommand.g.cs @@ -13,6 +13,8 @@ public static Command Create() var command = new Command("api", "Generated endpoint commands."); command.Subcommands.Add(DefaultApiGroupCommand.Create()); + command.Subcommands.Add(ImagesApiGroupCommand.Create()); + command.Subcommands.Add(SandboxesApiGroupCommand.Create()); CustomizeCommand(ref command); return command; } diff --git a/src/cli/Baseten.CLI/Commands/ImagesApiGroupCommand.g.cs b/src/cli/Baseten.CLI/Commands/ImagesApiGroupCommand.g.cs new file mode 100644 index 0000000..c5b1733 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/ImagesApiGroupCommand.g.cs @@ -0,0 +1,24 @@ +#nullable enable + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class ImagesApiGroupCommand +{ + static partial void CustomizeCommand(ref Command command); + + public static Command Create() + { + var command = new Command(@"images", @"Images endpoint commands."); + command.Subcommands.Add(ImagesCleanupImagesCommandApiCommand.Create()); + command.Subcommands.Add(ImagesDeleteImageCommandApiCommand.Create()); + command.Subcommands.Add(ImagesDeleteImageTagCommandApiCommand.Create()); + command.Subcommands.Add(ImagesGetImageCommandApiCommand.Create()); + command.Subcommands.Add(ImagesListImageTagsCommandApiCommand.Create()); + command.Subcommands.Add(ImagesListImagesCommandApiCommand.Create()); + command.Subcommands.Add(ImagesPushImageCommandApiCommand.Create()); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/ImagesCleanupImagesCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/ImagesCleanupImagesCommandApiCommand.g.cs new file mode 100644 index 0000000..3334e15 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/ImagesCleanupImagesCommandApiCommand.g.cs @@ -0,0 +1,76 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class ImagesCleanupImagesCommandApiCommand +{ + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.CleanupImagesResponseV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.CleanupImagesResponseV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"cleanup-images", @"Clean up unused images +Remove unused sandbox image versions. Versions referenced by active deployments are preserved."); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Images.CleanupImagesAsync( + teamId: teamId, + xTeamId: xTeamId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/ImagesDeleteImageCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/ImagesDeleteImageCommandApiCommand.g.cs new file mode 100644 index 0000000..5f6e74b --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/ImagesDeleteImageCommandApiCommand.g.cs @@ -0,0 +1,93 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class ImagesDeleteImageCommandApiCommand +{ + private static Argument ImageName { get; } = new( + name: @"image-name") + { + Description = @"This is a missing parameter that was added automatically. Please check the OpenAPI spec.", + }; + + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.ImageV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.ImageV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"delete-image", @"Delete a sandbox image +Delete the image repository and all its tags. Reject deletion if any version is referenced by an active deployment. Return the deleted image."); + command.Arguments.Add(ImageName); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var imageName = parseResult.GetRequiredValue(ImageName); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Images.DeleteImageAsync( + imageName: imageName, + teamId: teamId, + xTeamId: xTeamId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + if (!await CliRuntime.TryWriteOutputDirectoryAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + @"Tags", + cancellationToken).ConfigureAwait(false)) + { + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + } + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/ImagesDeleteImageTagCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/ImagesDeleteImageTagCommandApiCommand.g.cs new file mode 100644 index 0000000..1e828ae --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/ImagesDeleteImageTagCommandApiCommand.g.cs @@ -0,0 +1,102 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class ImagesDeleteImageTagCommandApiCommand +{ + private static Argument ImageName { get; } = new( + name: @"image-name") + { + Description = @"This is a missing parameter that was added automatically. Please check the OpenAPI spec.", + }; + + private static Argument TagName { get; } = new( + name: @"tag-name") + { + Description = @"This is a missing parameter that was added automatically. Please check the OpenAPI spec.", + }; + + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.ImageV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.ImageV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"delete-image-tag", @"Delete an image tag +Delete a specific image version. Reject deletion if the version is referenced by an active deployment. Return the updated image with its remaining tags, possibly empty."); + command.Arguments.Add(ImageName); + command.Arguments.Add(TagName); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var imageName = parseResult.GetRequiredValue(ImageName); + var tagName = parseResult.GetRequiredValue(TagName); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Images.DeleteImageTagAsync( + imageName: imageName, + tagName: tagName, + teamId: teamId, + xTeamId: xTeamId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + if (!await CliRuntime.TryWriteOutputDirectoryAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + @"Tags", + cancellationToken).ConfigureAwait(false)) + { + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + } + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/ImagesGetImageCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/ImagesGetImageCommandApiCommand.g.cs new file mode 100644 index 0000000..b0df4fe --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/ImagesGetImageCommandApiCommand.g.cs @@ -0,0 +1,93 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class ImagesGetImageCommandApiCommand +{ + private static Argument ImageName { get; } = new( + name: @"image-name") + { + Description = @"This is a missing parameter that was added automatically. Please check the OpenAPI spec.", + }; + + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.ImageV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.ImageV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"get-image", @"Get a sandbox image +Return the repository summary and processing status. Use the tag listing endpoint for image versions."); + command.Arguments.Add(ImageName); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var imageName = parseResult.GetRequiredValue(ImageName); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Images.GetImageAsync( + imageName: imageName, + teamId: teamId, + xTeamId: xTeamId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + if (!await CliRuntime.TryWriteOutputDirectoryAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + @"Tags", + cancellationToken).ConfigureAwait(false)) + { + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + } + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/ImagesListImageTagsCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/ImagesListImageTagsCommandApiCommand.g.cs new file mode 100644 index 0000000..d8166e5 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/ImagesListImageTagsCommandApiCommand.g.cs @@ -0,0 +1,138 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class ImagesListImageTagsCommandApiCommand +{ + private static Argument ImageName { get; } = new( + name: @"image-name") + { + Description = @"This is a missing parameter that was added automatically. Please check the OpenAPI spec.", + }; + + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option Cursor { get; } = new( + name: @"--cursor") + { + Description = @"Opaque cursor from the previous page; omit for the first page.", + }; + + private static Option Limit { get; } = new( + name: @"--limit") + { + Description = @"Maximum number of items to return.", + }; + + private static Option Sort { get; } = new( + name: @"--sort") + { + Description = @"Sort by tag name: name:asc or name:desc. Keep the same sort when following a cursor.", + }; + + private static Option Q { get; } = new( + name: @"--q") + { + Description = @"Case-sensitive tag name prefix. Cannot be combined with name. Forces ascending name order.", + }; + + private static Option NameOption { get; } = new( + name: @"--name") + { + Description = @"Exact tag name. Cannot be combined with q. Forces ascending name order.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.ListImageTagsResponseV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.ListImageTagsResponseV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"list-image-tags", @"List image tags +Return one cursor-paginated page of image versions."); + command.Arguments.Add(ImageName); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + command.Options.Add(Cursor); + command.Options.Add(Limit); + command.Options.Add(Sort); + command.Options.Add(Q); + command.Options.Add(NameOption); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var imageName = parseResult.GetRequiredValue(ImageName); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + var cursor = parseResult.GetValue(Cursor); + var limit = parseResult.GetValue(Limit); + var sort = parseResult.GetValue(Sort); + var q = parseResult.GetValue(Q); + var name = parseResult.GetValue(NameOption); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Images.ListImageTagsAsync( + imageName: imageName, + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + sort: sort, + q: q, + name: name, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + if (!await CliRuntime.TryWriteOutputDirectoryAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + @"Items", + cancellationToken).ConfigureAwait(false)) + { + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + } + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/ImagesListImagesCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/ImagesListImagesCommandApiCommand.g.cs new file mode 100644 index 0000000..b90ea2f --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/ImagesListImagesCommandApiCommand.g.cs @@ -0,0 +1,120 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class ImagesListImagesCommandApiCommand +{ + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option Cursor { get; } = new( + name: @"--cursor") + { + Description = @"Opaque cursor from the previous page; omit for the first page.", + }; + + private static Option Limit { get; } = new( + name: @"--limit") + { + Description = @"Maximum number of items to return.", + }; + + private static Option Sort { get; } = new( + name: @"--sort") + { + Description = @"Sort by repository name or creation time: name:asc, name:desc, createdAt:asc, or createdAt:desc. Keep the same sort when following a cursor.", + }; + + private static Option Q { get; } = new( + name: @"--q") + { + Description = @"Case-sensitive repository name prefix. Search is applied before pagination.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.ListImagesResponseV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.ListImagesResponseV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"list-images", @"List sandbox images +Return one cursor-paginated page of image repository summaries. Tags are listed separately. Pages can be empty when non-sandbox repositories are excluded; follow pagination.cursor while pagination.has_more is true. Prefix search forces ascending name order."); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + command.Options.Add(Cursor); + command.Options.Add(Limit); + command.Options.Add(Sort); + command.Options.Add(Q); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + var cursor = parseResult.GetValue(Cursor); + var limit = parseResult.GetValue(Limit); + var sort = parseResult.GetValue(Sort); + var q = parseResult.GetValue(Q); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Images.ListImagesAsync( + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + sort: sort, + q: q, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + if (!await CliRuntime.TryWriteOutputDirectoryAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + @"Items", + cancellationToken).ConfigureAwait(false)) + { + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + } + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/ImagesPushImageCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/ImagesPushImageCommandApiCommand.g.cs new file mode 100644 index 0000000..fd59140 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/ImagesPushImageCommandApiCommand.g.cs @@ -0,0 +1,139 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class ImagesPushImageCommandApiCommand +{ + private static Argument NameOption { get; } = new( + name: @"name") + { + Description = @"Target image repository name. Reusing a name pushes a new version to the existing repository.", + }; + + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option Image { get; } = new( + name: @"--image") + { + Description = @"Optional source registry image reference including a registry hostname. When omitted, the response provides an archive upload URL.", + }; + + private static Option DockerConfig { get; } = new( + name: @"--docker-config") + { + Description = @"Optional serialized registry authentication configuration for importing a private image. Used only when image is supplied; never returned.", + }; + private static Option Input { get; } = new(@"--input") + { + Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.", + }; + + private static Option RequestJson { get; } = new(@"--request-json") + { + Description = "Request body as JSON.", + Hidden = true, + }; + + private static Option RequestFile { get; } = new(@"--request-file") + { + Description = "Path to a JSON request file, or '-' for stdin.", + Hidden = true, + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.PushImageResponseV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.PushImageResponseV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"push-image", @"Push a sandbox image +With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED."); + command.Arguments.Add(NameOption); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + command.Options.Add(Image); + command.Options.Add(DockerConfig); + command.Options.Add(Input); + command.Options.Add(RequestJson); + command.Options.Add(RequestFile); + command.Validators.Add(result => + { + var hasInput = result.GetResult(Input) is not null; + var hasRequestJson = result.GetResult(RequestJson) is not null; + var hasRequestFile = result.GetResult(RequestFile) is not null; + var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0); + if (specifiedCount > 1) + { + result.AddError(@"Specify at most one of --input, --request-json, or --request-file."); + } + }); + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync( + parseResult, + Input, + RequestJson, + RequestFile, + global::Baseten.SourceGenerationContext.Default, + cancellationToken).ConfigureAwait(false); + var name = parseResult.GetRequiredValue(NameOption); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + var image = CliRuntime.WasSpecified(parseResult, Image) ? parseResult.GetValue(Image) : (__requestBase is { } __ImageBaseValue ? __ImageBaseValue.Image : default); + var dockerConfig = CliRuntime.WasSpecified(parseResult, DockerConfig) ? parseResult.GetValue(DockerConfig) : (__requestBase is { } __DockerConfigBaseValue ? __DockerConfigBaseValue.DockerConfig : default); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Images.PushImageAsync( + name: name, + teamId: teamId, + xTeamId: xTeamId, + image: image, + dockerConfig: dockerConfig, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/SandboxLifecycleV1OptionSet.g.cs b/src/cli/Baseten.CLI/Commands/SandboxLifecycleV1OptionSet.g.cs new file mode 100644 index 0000000..e985e87 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/SandboxLifecycleV1OptionSet.g.cs @@ -0,0 +1,22 @@ +#nullable enable + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal sealed record SandboxLifecycleV1OptionSet( + Option TerminatedRetention) +{ + public static SandboxLifecycleV1OptionSet Create(string? prefix = null) + { + var normalizedPrefix = string.IsNullOrWhiteSpace(prefix) + ? string.Empty + : prefix.Trim().Trim('-') + "-"; + return new SandboxLifecycleV1OptionSet( + TerminatedRetention: new Option($"--{normalizedPrefix}terminated-retention") + { + Description = @"Duration to keep the sandbox record after termination for log access (e.g., '1h', '24h', '7d'). Defaults to 5m. Subject to maximum quota limits.", + } + ); + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/SandboxesApiGroupCommand.g.cs b/src/cli/Baseten.CLI/Commands/SandboxesApiGroupCommand.g.cs new file mode 100644 index 0000000..5b375e6 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/SandboxesApiGroupCommand.g.cs @@ -0,0 +1,22 @@ +#nullable enable + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class SandboxesApiGroupCommand +{ + static partial void CustomizeCommand(ref Command command); + + public static Command Create() + { + var command = new Command(@"sandboxes", @"Sandboxes endpoint commands."); + command.Subcommands.Add(SandboxesCreateSandboxCommandApiCommand.Create()); + command.Subcommands.Add(SandboxesDeleteSandboxCommandApiCommand.Create()); + command.Subcommands.Add(SandboxesGetSandboxCommandApiCommand.Create()); + command.Subcommands.Add(SandboxesListSandboxesCommandApiCommand.Create()); + command.Subcommands.Add(SandboxesUpdateSandboxCommandApiCommand.Create()); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/SandboxesCreateSandboxCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/SandboxesCreateSandboxCommandApiCommand.g.cs new file mode 100644 index 0000000..b19d8eb --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/SandboxesCreateSandboxCommandApiCommand.g.cs @@ -0,0 +1,215 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class SandboxesCreateSandboxCommandApiCommand +{ + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option NameOption { get; } = new( + name: @"--name") + { + Description = @"Optional unique sandbox name. Generated by the server when omitted; immutable after creation.", + }; + + private static Option Network { get; } = new( + name: @"--network") + { + Description = @"Network configuration for a sandbox including subnet, domain filtering, and proxy settings", + }; + + private static Option Region { get; } = new( + name: @"--region") + { + Description = @"Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.", + }; + + private static Option?> Envs { get; } = new( + name: @"--envs") + { + Description = @"Environment variables injected into the sandbox.", + }; + + private static Option Image { get; } = new( + name: @"--image") + { + Description = @"Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.", + }; + + private static Option Memory { get; } = new( + name: @"--memory") + { + Description = @"Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).", + }; + + private static Option?> Ports { get; } = new( + name: @"--ports") + { + Description = @"Set of ports for a resource", + }; + + private static Option DisplayName { get; } = new( + name: @"--display-name") + { + Description = @"Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.", + }; + + private static Option ExternalId { get; } = new( + name: @"--external-id") + { + Description = @"Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.", + }; + + private static Option?> Labels { get; } = new( + name: @"--labels") + { + Description = @"Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.", + }; + private static readonly SandboxLifecycleV1OptionSet LifecycleOptions = SandboxLifecycleV1OptionSet.Create(@"lifecycle"); + private static Option Input { get; } = new(@"--input") + { + Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.", + }; + + private static Option RequestJson { get; } = new(@"--request-json") + { + Description = "Request body as JSON.", + Hidden = true, + }; + + private static Option RequestFile { get; } = new(@"--request-file") + { + Description = "Path to a JSON request file, or '-' for stdin.", + Hidden = true, + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.SandboxV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.SandboxV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"create-sandbox", @"Create a sandbox +Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key."); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + command.Options.Add(NameOption); + command.Options.Add(Network); + command.Options.Add(Region); + command.Options.Add(Envs); + command.Options.Add(Image); + command.Options.Add(Memory); + command.Options.Add(Ports); + command.Options.Add(DisplayName); + command.Options.Add(ExternalId); + command.Options.Add(Labels); command.Options.Add(LifecycleOptions.TerminatedRetention); + command.Options.Add(Input); + command.Options.Add(RequestJson); + command.Options.Add(RequestFile); + command.Validators.Add(result => + { + var hasInput = result.GetResult(Input) is not null; + var hasRequestJson = result.GetResult(RequestJson) is not null; + var hasRequestFile = result.GetResult(RequestFile) is not null; + var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0); + if (specifiedCount > 1) + { + result.AddError(@"Specify at most one of --input, --request-json, or --request-file."); + } + }); + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync( + parseResult, + Input, + RequestJson, + RequestFile, + global::Baseten.SourceGenerationContext.Default, + cancellationToken).ConfigureAwait(false); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + var name = CliRuntime.WasSpecified(parseResult, NameOption) ? parseResult.GetValue(NameOption) : (__requestBase is { } __NameBaseValue ? __NameBaseValue.Name : default); + var network = CliRuntime.WasSpecified(parseResult, Network) ? parseResult.GetValue(Network) : (__requestBase is { } __NetworkBaseValue ? __NetworkBaseValue.Network : default); + var region = CliRuntime.WasSpecified(parseResult, Region) ? parseResult.GetValue(Region) : (__requestBase is { } __RegionBaseValue ? __RegionBaseValue.Region : default); + var envs = CliRuntime.WasSpecified(parseResult, Envs) ? parseResult.GetValue(Envs) : (__requestBase is { } __EnvsBaseValue ? __EnvsBaseValue.Envs : default); + var image = CliRuntime.WasSpecified(parseResult, Image) ? parseResult.GetValue(Image) : (__requestBase is { } __ImageBaseValue ? __ImageBaseValue.Image : default); + var memory = CliRuntime.WasSpecified(parseResult, Memory) ? parseResult.GetValue(Memory) : (__requestBase is { } __MemoryBaseValue ? __MemoryBaseValue.Memory : default); + var ports = CliRuntime.WasSpecified(parseResult, Ports) ? parseResult.GetValue(Ports) : (__requestBase is { } __PortsBaseValue ? __PortsBaseValue.Ports : default); + var displayName = CliRuntime.WasSpecified(parseResult, DisplayName) ? parseResult.GetValue(DisplayName) : (__requestBase is { } __DisplayNameBaseValue ? __DisplayNameBaseValue.DisplayName : default); + var externalId = CliRuntime.WasSpecified(parseResult, ExternalId) ? parseResult.GetValue(ExternalId) : (__requestBase is { } __ExternalIdBaseValue ? __ExternalIdBaseValue.ExternalId : default); + var labels = CliRuntime.WasSpecified(parseResult, Labels) ? parseResult.GetValue(Labels) : (__requestBase is { } __LabelsBaseValue ? __LabelsBaseValue.Labels : default); + + var __LifecycleBase = __requestBase is { } __LifecycleBaseValue ? __LifecycleBaseValue.Lifecycle : default; var lifecycleTerminatedRetention = CliRuntime.WasSpecified(parseResult, LifecycleOptions.TerminatedRetention) ? parseResult.GetValue(LifecycleOptions.TerminatedRetention) : (__LifecycleBase is { } __LifecycleterminatedRetentionBaseValue ? __LifecycleterminatedRetentionBaseValue.TerminatedRetention : default); + var __LifecycleSpecified = CliRuntime.WasSpecified(parseResult, LifecycleOptions.TerminatedRetention); + var lifecycle = + __LifecycleSpecified || __LifecycleBase is not null + ? new global::Baseten.SandboxLifecycleV1 + { + TerminatedRetention = lifecycleTerminatedRetention, + + } + : __LifecycleBase; + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Sandboxes.CreateSandboxAsync( + teamId: teamId, + xTeamId: xTeamId, + name: name, + network: network, + region: region, + envs: envs, + image: image, + memory: memory, + ports: ports, + displayName: displayName, + externalId: externalId, + labels: labels, + lifecycle: lifecycle, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/SandboxesDeleteSandboxCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/SandboxesDeleteSandboxCommandApiCommand.g.cs new file mode 100644 index 0000000..52f6067 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/SandboxesDeleteSandboxCommandApiCommand.g.cs @@ -0,0 +1,85 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class SandboxesDeleteSandboxCommandApiCommand +{ + private static Argument SandboxName { get; } = new( + name: @"sandbox-name") + { + Description = @"This is a missing parameter that was added automatically. Please check the OpenAPI spec.", + }; + + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.SandboxV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.SandboxV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"delete-sandbox", @"Delete a sandbox +Permanently delete the sandbox and its local data asynchronously. The returned resource has status DELETING."); + command.Arguments.Add(SandboxName); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var sandboxName = parseResult.GetRequiredValue(SandboxName); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Sandboxes.DeleteSandboxAsync( + sandboxName: sandboxName, + teamId: teamId, + xTeamId: xTeamId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/SandboxesGetSandboxCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/SandboxesGetSandboxCommandApiCommand.g.cs new file mode 100644 index 0000000..541604c --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/SandboxesGetSandboxCommandApiCommand.g.cs @@ -0,0 +1,85 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class SandboxesGetSandboxCommandApiCommand +{ + private static Argument SandboxName { get; } = new( + name: @"sandbox-name") + { + Description = @"This is a missing parameter that was added automatically. Please check the OpenAPI spec.", + }; + + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.SandboxV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.SandboxV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"get-sandbox", @"Get a sandbox +Return the sandbox configuration and current state."); + command.Arguments.Add(SandboxName); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var sandboxName = parseResult.GetRequiredValue(SandboxName); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Sandboxes.GetSandboxAsync( + sandboxName: sandboxName, + teamId: teamId, + xTeamId: xTeamId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/SandboxesListSandboxesCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/SandboxesListSandboxesCommandApiCommand.g.cs new file mode 100644 index 0000000..4e551c0 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/SandboxesListSandboxesCommandApiCommand.g.cs @@ -0,0 +1,129 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class SandboxesListSandboxesCommandApiCommand +{ + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option Cursor { get; } = new( + name: @"--cursor") + { + Description = @"Opaque cursor from the previous page; omit for the first page.", + }; + + private static Option Limit { get; } = new( + name: @"--limit") + { + Description = @"Maximum number of items to return.", + }; + + private static Option Q { get; } = new( + name: @"--q") + { + Description = @"Search indexed sandbox names and labels. Search is applied before pagination.", + }; + + private static Option?> Status { get; } = new( + name: @"--status") + { + Description = @"Deployment statuses. Repeat the query parameter for each status, for example status=DEPLOYED&status=FAILED. Unknown values are rejected. Cannot be combined with external_id.", + }; + + private static Option ExternalId { get; } = new( + name: @"--external-id") + { + Description = @"Filter by a caller-owned external identifier. Cannot be combined with status.", + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.ListSandboxesResponseV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.ListSandboxesResponseV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"list-sandboxes", @"List sandboxes +Return a cursor-paginated page of sandboxes. Terminated sandboxes are hidden by default."); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + command.Options.Add(Cursor); + command.Options.Add(Limit); + command.Options.Add(Q); + command.Options.Add(Status); + command.Options.Add(ExternalId); + + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + var cursor = parseResult.GetValue(Cursor); + var limit = parseResult.GetValue(Limit); + var q = parseResult.GetValue(Q); + var status = parseResult.GetValue(Status); + var externalId = parseResult.GetValue(ExternalId); + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Sandboxes.ListSandboxesAsync( + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + q: q, + status: status, + externalId: externalId, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + if (!await CliRuntime.TryWriteOutputDirectoryAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + @"Items", + cancellationToken).ConfigureAwait(false)) + { + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + } + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/cli/Baseten.CLI/Commands/SandboxesUpdateSandboxCommandApiCommand.g.cs b/src/cli/Baseten.CLI/Commands/SandboxesUpdateSandboxCommandApiCommand.g.cs new file mode 100644 index 0000000..ce76436 --- /dev/null +++ b/src/cli/Baseten.CLI/Commands/SandboxesUpdateSandboxCommandApiCommand.g.cs @@ -0,0 +1,204 @@ +#nullable enable +#pragma warning disable CS0618 + +using System.CommandLine; + +namespace Baseten.CLI.Commands; + +internal static partial class SandboxesUpdateSandboxCommandApiCommand +{ + private static Argument SandboxName { get; } = new( + name: @"sandbox-name") + { + Description = @"This is a missing parameter that was added automatically. Please check the OpenAPI spec.", + }; + + private static Option TeamId { get; } = new( + name: @"--team-id") + { + Description = @"Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option XTeamId { get; } = new( + name: @"--x-team-id") + { + Description = @"Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + }; + + private static Option Enabled { get; } = CliRuntime.CreateNullableBoolOption( + name: @"--enabled", + description: @"When false, the sandbox is disabled and will not accept connections"); + + private static Option Region { get; } = new( + name: @"--region") + { + Description = @"Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.", + }; + + private static Option?> Envs { get; } = new( + name: @"--envs") + { + Description = @"Environment variables injected into the sandbox.", + }; + + private static Option Image { get; } = new( + name: @"--image") + { + Description = @"Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.", + }; + + private static Option?> Ports { get; } = new( + name: @"--ports") + { + Description = @"Set of ports for a resource", + }; + + private static Option DisplayName { get; } = new( + name: @"--display-name") + { + Description = @"Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.", + }; + + private static Option ExternalId { get; } = new( + name: @"--external-id") + { + Description = @"Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.", + }; + + private static Option?> Labels { get; } = new( + name: @"--labels") + { + Description = @"Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.", + }; + private static readonly SandboxLifecycleV1OptionSet LifecycleOptions = SandboxLifecycleV1OptionSet.Create(@"lifecycle"); + private static Option Input { get; } = new(@"--input") + { + Description = "Load request JSON from a file path, '-' for stdin, or an inline JSON object/array string.", + }; + + private static Option RequestJson { get; } = new(@"--request-json") + { + Description = "Request body as JSON.", + Hidden = true, + }; + + private static Option RequestFile { get; } = new(@"--request-file") + { + Description = "Path to a JSON request file, or '-' for stdin.", + Hidden = true, + }; + + private static string FormatResponse(ParseResult parseResult, global::Baseten.SandboxV1 value, global::System.Text.Json.Serialization.JsonSerializerContext context, bool truncateLongStrings) + { + string? text = null; + CustomizeResponseText(parseResult, value, ref text); + if (!string.IsNullOrWhiteSpace(text)) + { + return text; + } + + var hints = new Dictionary(StringComparer.OrdinalIgnoreCase) + { + }; + CustomizeResponseFormatHints(hints); + return CliRuntime.FormatHumanReadable(value, context, truncateLongStrings, hints); + } + + static partial void CustomizeResponseText(ParseResult parseResult, global::Baseten.SandboxV1 value, ref string? text); + static partial void CustomizeResponseFormatHints(Dictionary hints); + + + static partial void CustomizeCommand(ref Command command); + + public static Command Create(string? commandName = null) + { + var command = new Command(commandName ?? @"update-sandbox", @"Update a sandbox +Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values."); + command.Arguments.Add(SandboxName); + command.Options.Add(TeamId); + command.Options.Add(XTeamId); + command.Options.Add(Enabled); + command.Options.Add(Region); + command.Options.Add(Envs); + command.Options.Add(Image); + command.Options.Add(Ports); + command.Options.Add(DisplayName); + command.Options.Add(ExternalId); + command.Options.Add(Labels); command.Options.Add(LifecycleOptions.TerminatedRetention); + command.Options.Add(Input); + command.Options.Add(RequestJson); + command.Options.Add(RequestFile); + command.Validators.Add(result => + { + var hasInput = result.GetResult(Input) is not null; + var hasRequestJson = result.GetResult(RequestJson) is not null; + var hasRequestFile = result.GetResult(RequestFile) is not null; + var specifiedCount = (hasInput ? 1 : 0) + (hasRequestJson ? 1 : 0) + (hasRequestFile ? 1 : 0); + if (specifiedCount > 1) + { + result.AddError(@"Specify at most one of --input, --request-json, or --request-file."); + } + }); + + command.SetAction(async (ParseResult parseResult, CancellationToken cancellationToken) => + await CliRuntime.RunAsync(async () => + { + var __requestBase = await CliRuntime.ReadRequestOrDefaultAsync( + parseResult, + Input, + RequestJson, + RequestFile, + global::Baseten.SourceGenerationContext.Default, + cancellationToken).ConfigureAwait(false); + var sandboxName = parseResult.GetRequiredValue(SandboxName); + var teamId = parseResult.GetValue(TeamId); + var xTeamId = parseResult.GetValue(XTeamId); + var enabled = CliRuntime.WasSpecified(parseResult, Enabled) ? parseResult.GetValue(Enabled) : (__requestBase is { } __EnabledBaseValue ? __EnabledBaseValue.Enabled : default); + var region = CliRuntime.WasSpecified(parseResult, Region) ? parseResult.GetValue(Region) : (__requestBase is { } __RegionBaseValue ? __RegionBaseValue.Region : default); + var envs = CliRuntime.WasSpecified(parseResult, Envs) ? parseResult.GetValue(Envs) : (__requestBase is { } __EnvsBaseValue ? __EnvsBaseValue.Envs : default); + var image = CliRuntime.WasSpecified(parseResult, Image) ? parseResult.GetValue(Image) : (__requestBase is { } __ImageBaseValue ? __ImageBaseValue.Image : default); + var ports = CliRuntime.WasSpecified(parseResult, Ports) ? parseResult.GetValue(Ports) : (__requestBase is { } __PortsBaseValue ? __PortsBaseValue.Ports : default); + var displayName = CliRuntime.WasSpecified(parseResult, DisplayName) ? parseResult.GetValue(DisplayName) : (__requestBase is { } __DisplayNameBaseValue ? __DisplayNameBaseValue.DisplayName : default); + var externalId = CliRuntime.WasSpecified(parseResult, ExternalId) ? parseResult.GetValue(ExternalId) : (__requestBase is { } __ExternalIdBaseValue ? __ExternalIdBaseValue.ExternalId : default); + var labels = CliRuntime.WasSpecified(parseResult, Labels) ? parseResult.GetValue(Labels) : (__requestBase is { } __LabelsBaseValue ? __LabelsBaseValue.Labels : default); + + var __LifecycleBase = __requestBase is { } __LifecycleBaseValue ? __LifecycleBaseValue.Lifecycle : default; var lifecycleTerminatedRetention = CliRuntime.WasSpecified(parseResult, LifecycleOptions.TerminatedRetention) ? parseResult.GetValue(LifecycleOptions.TerminatedRetention) : (__LifecycleBase is { } __LifecycleterminatedRetentionBaseValue ? __LifecycleterminatedRetentionBaseValue.TerminatedRetention : default); + var __LifecycleSpecified = CliRuntime.WasSpecified(parseResult, LifecycleOptions.TerminatedRetention); + var lifecycle = + __LifecycleSpecified || __LifecycleBase is not null + ? new global::Baseten.SandboxLifecycleV1 + { + TerminatedRetention = lifecycleTerminatedRetention, + + } + : __LifecycleBase; + using var client = await CliRuntime.CreateClientAsync(parseResult, cancellationToken).ConfigureAwait(false); + + + var response = await client.Sandboxes.UpdateSandboxAsync( + sandboxName: sandboxName, + teamId: teamId, + xTeamId: xTeamId, + enabled: enabled, + region: region, + envs: envs, + image: image, + ports: ports, + displayName: displayName, + externalId: externalId, + labels: labels, + lifecycle: lifecycle, + cancellationToken: cancellationToken).ConfigureAwait(false); + + + await CliRuntime.WriteResponseAsync( + parseResult, + response, + global::Baseten.SourceGenerationContext.Default, + FormatResponse, + cancellationToken).ConfigureAwait(false); + }, cancellationToken).ConfigureAwait(false)); + CustomizeCommand(ref command); + return command; + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.BasetenClient.g.cs b/src/libs/Baseten/Generated/Baseten.BasetenClient.g.cs index 36bb409..ee61f9e 100644 --- a/src/libs/Baseten/Generated/Baseten.BasetenClient.g.cs +++ b/src/libs/Baseten/Generated/Baseten.BasetenClient.g.cs @@ -47,6 +47,24 @@ public sealed partial class BasetenClient : global::Baseten.IBasetenClient, glob } + /// + /// + /// + public ImagesClient Images => new ImagesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) + { + ReadResponseAsString = ReadResponseAsString, + JsonSerializerContextProvider = JsonSerializerContextProvider, + }; + + /// + /// + /// + public SandboxesClient Sandboxes => new SandboxesClient(HttpClient, baseUri: null, authorizations: Authorizations, options: Options) + { + ReadResponseAsString = ReadResponseAsString, + JsonSerializerContextProvider = JsonSerializerContextProvider, + }; + /// /// Creates a new instance of the BasetenClient. /// If no httpClient is provided, a new one will be created. diff --git a/src/libs/Baseten/Generated/Baseten.IBasetenClient.g.cs b/src/libs/Baseten/Generated/Baseten.IBasetenClient.g.cs index 3800ffe..8e042c1 100644 --- a/src/libs/Baseten/Generated/Baseten.IBasetenClient.g.cs +++ b/src/libs/Baseten/Generated/Baseten.IBasetenClient.g.cs @@ -45,5 +45,15 @@ public partial interface IBasetenClient : global::System.IDisposable global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + /// + /// + /// + public ImagesClient Images { get; } + + /// + /// + /// + public SandboxesClient Sandboxes { get; } + } } \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.Authorizations.Bearer.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.Authorizations.Bearer.g.cs new file mode 100644 index 0000000..6364f8c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.Authorizations.Bearer.g.cs @@ -0,0 +1,16 @@ + +#nullable enable + +namespace Baseten +{ + public partial interface IImagesClient + { + /// + /// Authorize using bearer authentication. + /// + /// + + public void AuthorizeUsingBearer( + string apiKey); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.CleanupImages.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.CleanupImages.g.cs new file mode 100644 index 0000000..5b2d514 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.CleanupImages.g.cs @@ -0,0 +1,36 @@ +#nullable enable + +namespace Baseten +{ + public partial interface IImagesClient + { + /// + /// Clean up unused images
+ /// Remove unused sandbox image versions. Versions referenced by active deployments are preserved. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CleanupImagesAsync( + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Clean up unused images
+ /// Remove unused sandbox image versions. Versions referenced by active deployments are preserved. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CleanupImagesAsResponseAsync( + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.DeleteImage.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.DeleteImage.g.cs new file mode 100644 index 0000000..2b1abf8 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.DeleteImage.g.cs @@ -0,0 +1,40 @@ +#nullable enable + +namespace Baseten +{ + public partial interface IImagesClient + { + /// + /// Delete a sandbox image
+ /// Delete the image repository and all its tags. Reject deletion if any version is referenced by an active deployment. Return the deleted image. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteImageAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a sandbox image
+ /// Delete the image repository and all its tags. Reject deletion if any version is referenced by an active deployment. Return the deleted image. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteImageAsResponseAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.DeleteImageTag.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.DeleteImageTag.g.cs new file mode 100644 index 0000000..d2890ce --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.DeleteImageTag.g.cs @@ -0,0 +1,44 @@ +#nullable enable + +namespace Baseten +{ + public partial interface IImagesClient + { + /// + /// Delete an image tag
+ /// Delete a specific image version. Reject deletion if the version is referenced by an active deployment. Return the updated image with its remaining tags, possibly empty. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteImageTagAsync( + string imageName, + string tagName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete an image tag
+ /// Delete a specific image version. Reject deletion if the version is referenced by an active deployment. Return the updated image with its remaining tags, possibly empty. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteImageTagAsResponseAsync( + string imageName, + string tagName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.GetImage.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.GetImage.g.cs new file mode 100644 index 0000000..f10d802 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.GetImage.g.cs @@ -0,0 +1,40 @@ +#nullable enable + +namespace Baseten +{ + public partial interface IImagesClient + { + /// + /// Get a sandbox image
+ /// Return the repository summary and processing status. Use the tag listing endpoint for image versions. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GetImageAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a sandbox image
+ /// Return the repository summary and processing status. Use the tag listing endpoint for image versions. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetImageAsResponseAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.ListImageTags.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.ListImageTags.g.cs new file mode 100644 index 0000000..b97727c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.ListImageTags.g.cs @@ -0,0 +1,74 @@ +#nullable enable + +namespace Baseten +{ + public partial interface IImagesClient + { + /// + /// List image tags
+ /// Return one cursor-paginated page of image versions. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Default Value: name:asc + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ListImageTagsAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? sort = default, + string? q = default, + string? name = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List image tags
+ /// Return one cursor-paginated page of image versions. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Default Value: name:asc + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListImageTagsAsResponseAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? sort = default, + string? q = default, + string? name = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.ListImages.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.ListImages.g.cs new file mode 100644 index 0000000..feb49f6 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.ListImages.g.cs @@ -0,0 +1,66 @@ +#nullable enable + +namespace Baseten +{ + public partial interface IImagesClient + { + /// + /// List sandbox images
+ /// Return one cursor-paginated page of image repository summaries. Tags are listed separately. Pages can be empty when non-sandbox repositories are excluded; follow pagination.cursor while pagination.has_more is true. Prefix search forces ascending name order. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Default Value: createdAt:desc + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ListImagesAsync( + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? sort = default, + string? q = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List sandbox images
+ /// Return one cursor-paginated page of image repository summaries. Tags are listed separately. Pages can be empty when non-sandbox repositories are excluded; follow pagination.cursor while pagination.has_more is true. Prefix search forces ascending name order. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Default Value: createdAt:desc + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListImagesAsResponseAsync( + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? sort = default, + string? q = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.PushImage.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.PushImage.g.cs new file mode 100644 index 0000000..431bd06 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.PushImage.g.cs @@ -0,0 +1,72 @@ +#nullable enable + +namespace Baseten +{ + public partial interface IImagesClient + { + /// + /// Push a sandbox image
+ /// With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PushImageAsync( + + global::Baseten.PushImageRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Push a sandbox image
+ /// With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> PushImageAsResponseAsync( + + global::Baseten.PushImageRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Push a sandbox image
+ /// With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED. + ///
+ /// + /// + /// + /// Target image repository name. Reusing a name pushes a new version to the existing repository.
+ /// Example: base-image + /// + /// + /// Optional source registry image reference including a registry hostname. When omitted, the response provides an archive upload URL.
+ /// Example: docker.io/b10/base-image:latest + /// + /// + /// Optional serialized registry authentication configuration for importing a private image. Used only when image is supplied; never returned.
+ /// Included only in requests
+ /// Example: {"auths":{"https://index.docker.io/v1/":{"auth":"YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu"}}} + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task PushImageAsync( + string name, + string? teamId = default, + string? xTeamId = default, + string? image = default, + string? dockerConfig = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.IImagesClient.g.cs b/src/libs/Baseten/Generated/Baseten.IImagesClient.g.cs new file mode 100644 index 0000000..7d4bcd7 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.IImagesClient.g.cs @@ -0,0 +1,48 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface IImagesClient : global::System.IDisposable + { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// When false, successful responses are deserialized directly from the response stream for better performance. + /// Error responses are always read as strings regardless of this setting, + /// ensuring is populated. + /// + public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::Baseten.AutoSDKClientOptions Options { get; } + + + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ISandboxesClient.Authorizations.Bearer.g.cs b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.Authorizations.Bearer.g.cs new file mode 100644 index 0000000..d57966d --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.Authorizations.Bearer.g.cs @@ -0,0 +1,16 @@ + +#nullable enable + +namespace Baseten +{ + public partial interface ISandboxesClient + { + /// + /// Authorize using bearer authentication. + /// + /// + + public void AuthorizeUsingBearer( + string apiKey); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ISandboxesClient.CreateSandbox.g.cs b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.CreateSandbox.g.cs new file mode 100644 index 0000000..ff1c380 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.CreateSandbox.g.cs @@ -0,0 +1,111 @@ +#nullable enable + +namespace Baseten +{ + public partial interface ISandboxesClient + { + /// + /// Create a sandbox
+ /// Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateSandboxAsync( + + global::Baseten.CreateSandboxRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a sandbox
+ /// Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> CreateSandboxAsResponseAsync( + + global::Baseten.CreateSandboxRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Create a sandbox
+ /// Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key. + ///
+ /// + /// + /// + /// Optional unique sandbox name. Generated by the server when omitted; immutable after creation.
+ /// Example: baseten-api-review-0916 + /// + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + /// + /// + /// Network configuration for a sandbox including subnet, domain filtering, and proxy settings
+ /// Example: {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + /// + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + /// + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + /// + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + /// + /// + /// Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
+ /// Example: 4096 + /// + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + /// + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review + /// + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + /// + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering"} + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task CreateSandboxAsync( + string? teamId = default, + string? xTeamId = default, + string? name = default, + global::Baseten.SandboxLifecycleV1? lifecycle = default, + global::Baseten.SandboxNetworkV1? network = default, + string? region = default, + global::System.Collections.Generic.IList? envs = default, + string? image = default, + long? memory = default, + global::System.Collections.Generic.IList? ports = default, + string? displayName = default, + string? externalId = default, + global::System.Collections.Generic.Dictionary? labels = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ISandboxesClient.DeleteSandbox.g.cs b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.DeleteSandbox.g.cs new file mode 100644 index 0000000..9449d38 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.DeleteSandbox.g.cs @@ -0,0 +1,40 @@ +#nullable enable + +namespace Baseten +{ + public partial interface ISandboxesClient + { + /// + /// Delete a sandbox
+ /// Permanently delete the sandbox and its local data asynchronously. The returned resource has status DELETING. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task DeleteSandboxAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Delete a sandbox
+ /// Permanently delete the sandbox and its local data asynchronously. The returned resource has status DELETING. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> DeleteSandboxAsResponseAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ISandboxesClient.GetSandbox.g.cs b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.GetSandbox.g.cs new file mode 100644 index 0000000..18bdf94 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.GetSandbox.g.cs @@ -0,0 +1,40 @@ +#nullable enable + +namespace Baseten +{ + public partial interface ISandboxesClient + { + /// + /// Get a sandbox
+ /// Return the sandbox configuration and current state. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task GetSandboxAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Get a sandbox
+ /// Return the sandbox configuration and current state. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> GetSandboxAsResponseAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ISandboxesClient.ListSandboxes.g.cs b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.ListSandboxes.g.cs new file mode 100644 index 0000000..2a63207 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.ListSandboxes.g.cs @@ -0,0 +1,78 @@ +#nullable enable + +namespace Baseten +{ + public partial interface ISandboxesClient + { + /// + /// List sandboxes
+ /// Return a cursor-paginated page of sandboxes. Terminated sandboxes are hidden by default. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Example: api-review + /// + /// + /// Example: [DEPLOYED, FAILED] + /// + /// + /// Example: api-review-20260916-001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task ListSandboxesAsync( + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? q = default, + global::System.Collections.Generic.IList? status = default, + string? externalId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// List sandboxes
+ /// Return a cursor-paginated page of sandboxes. Terminated sandboxes are hidden by default. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Example: api-review + /// + /// + /// Example: [DEPLOYED, FAILED] + /// + /// + /// Example: api-review-20260916-001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> ListSandboxesAsResponseAsync( + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? q = default, + global::System.Collections.Generic.IList? status = default, + string? externalId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ISandboxesClient.UpdateSandbox.g.cs b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.UpdateSandbox.g.cs new file mode 100644 index 0000000..d12bb7c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.UpdateSandbox.g.cs @@ -0,0 +1,107 @@ +#nullable enable + +namespace Baseten +{ + public partial interface ISandboxesClient + { + /// + /// Update a sandbox
+ /// Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UpdateSandboxAsync( + string sandboxName, + + global::Baseten.UpdateSandboxRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update a sandbox
+ /// Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> UpdateSandboxAsResponseAsync( + string sandboxName, + + global::Baseten.UpdateSandboxRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Update a sandbox
+ /// Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values. + ///
+ /// + /// + /// + /// + /// When false, the sandbox is disabled and will not accept connections
+ /// Example: true + /// + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + /// + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + /// + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + /// + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + /// + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + /// + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review - revised + /// + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + /// + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering","revision":"2"} + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task UpdateSandboxAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + bool? enabled = default, + global::Baseten.SandboxLifecycleV1? lifecycle = default, + string? region = default, + global::System.Collections.Generic.IList? envs = default, + string? image = default, + global::System.Collections.Generic.IList? ports = default, + string? displayName = default, + string? externalId = default, + global::System.Collections.Generic.Dictionary? labels = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ISandboxesClient.g.cs b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.g.cs new file mode 100644 index 0000000..a985bc4 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ISandboxesClient.g.cs @@ -0,0 +1,48 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public partial interface ISandboxesClient : global::System.IDisposable + { + /// + /// The HttpClient instance. + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + /// The base URL for the API. + /// + public System.Uri? BaseUri { get; } + + /// + /// The authorizations to use for the requests. + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + /// Gets or sets a value indicating whether the response content should be read as a string. + /// True by default in debug builds, false otherwise. + /// When false, successful responses are deserialized directly from the response stream for better performance. + /// Error responses are always read as strings regardless of this setting, + /// ensuring is populated. + /// + public bool ReadResponseAsString { get; set; } + /// + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// + public global::Baseten.AutoSDKClientOptions Options { get; } + + + /// + /// + /// + global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } + + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Images.JsonSerializerContext.g.cs b/src/libs/Baseten/Generated/Baseten.Images.JsonSerializerContext.g.cs new file mode 100644 index 0000000..39cd212 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Images.JsonSerializerContext.g.cs @@ -0,0 +1,195 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + [global::System.Text.Json.Serialization.JsonSourceGenerationOptions( + DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull + )] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.Dictionary))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.Dictionary))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "SystemCollectionsGeneric_ObjectList")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Text.Json.JsonElement?))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(bool))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(string))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.DateTime))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(int))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(long))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxApiPaginationV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ListImagesResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ImageV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ListImageTagsResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ImageTagV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ImageStatusV1), TypeInfoPropertyName = "ImageStatusV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.PushImageRequestV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.PushImageResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.CleanupImagesResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(bool?))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(int?))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(long?))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ImageStatusV1?), TypeInfoPropertyName = "NullableImageStatusV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + internal sealed partial class ImagesSourceGenerationContextChunk0 : global::System.Text.Json.Serialization.JsonSerializerContext + { + } + /// + /// + /// + public sealed partial class ImagesSourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext + { + private static readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver Resolver = new LazyChunkResolver(); + + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + internal static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver TypeInfoResolver => Resolver; + + + private static readonly global::System.Text.Json.JsonSerializerOptions DefaultOptions = CreateDefaultOptions(); + + /// + /// + /// + public static ImagesSourceGenerationContext Default { get; } = new(DefaultOptions); + + private ImagesSourceGenerationContext(global::System.Text.Json.JsonSerializerOptions options) + : base(options) + { + } + + /// + protected override global::System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions => DefaultOptions; + + /// + public override global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(global::System.Type type) + { + return Resolver.GetTypeInfo(type, Options); + } + + /// + /// Adds this package's converters to . + /// + /// + /// A converter has to be on the options a chained resolver builds its JsonTypeInfo against, + /// and a context resolves types from every package below it. Each package contributes only + /// what it owns and calls down the chain for the rest, so the family's converter table is + /// written once rather than copied into all of them. + /// + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public static void AddConverters(global::System.Text.Json.JsonSerializerOptions options) + { + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.UnixTimestampJsonConverter()); + options.Converters.Add(new LazyEnumJsonConverterFactory()); + } + + private static global::System.Text.Json.JsonSerializerOptions CreateDefaultOptions() + { + var options = new global::System.Text.Json.JsonSerializerOptions + { + DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, + TypeInfoResolver = Resolver, + }; + AddConverters(options); + + return options; + } + + + private sealed class LazyEnumJsonConverterFactory : global::System.Text.Json.Serialization.JsonConverterFactory + { + public override bool CanConvert(global::System.Type typeToConvert) + { + return + typeToConvert == typeof(global::Baseten.ImageStatusV1) + + || typeToConvert == typeof(global::Baseten.ImageStatusV1?); + } + + public override global::System.Text.Json.Serialization.JsonConverter CreateConverter( + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + if (typeToConvert == typeof(global::Baseten.ImageStatusV1)) + { + return new global::Baseten.JsonConverters.ImageStatusV1JsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.ImageStatusV1?)) + { + return new global::Baseten.JsonConverters.ImageStatusV1NullableJsonConverter(); + } + throw new global::System.NotSupportedException($"No generated enum converter is registered for '{typeToConvert}'."); + } + } + + private sealed class LazyChunkResolver : global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver + { + private readonly object _gate = new(); + private readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[] _resolvers = new global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[1]; + + public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo( + global::System.Type type, + global::System.Text.Json.JsonSerializerOptions options) + { + for (var index = 0; index < _resolvers.Length; index++) + { + var typeInfo = GetResolver(index).GetTypeInfo(type, options); + if (typeInfo is not null) + { + return typeInfo; + } + } + + return null; + } + + private global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver GetResolver(int index) + { + var resolver = global::System.Threading.Volatile.Read(ref _resolvers[index]); + if (resolver is not null) + { + return resolver; + } + + lock (_gate) + { + return _resolvers[index] ??= CreateResolver(index); + } + } + + private static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver CreateResolver(int index) + { + return index switch + { + 0 => new ImagesSourceGenerationContextChunk0(new global::System.Text.Json.JsonSerializerOptions()), + _ => throw new global::System.ArgumentOutOfRangeException(nameof(index)), + }; + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.Authorizations.Bearer.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.Authorizations.Bearer.g.cs new file mode 100644 index 0000000..5837724 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.Authorizations.Bearer.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Baseten +{ + public sealed partial class ImagesClient + { + + /// + public void AuthorizeUsingBearer( + string apiKey) + { + apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey)); + + for (var i = Authorizations.Count - 1; i >= 0; i--) + { + var __authorization = Authorizations[i]; + if (__authorization.Type == "Http" && + __authorization.Name == "Bearer") + { + Authorizations.RemoveAt(i); + } + } + + Authorizations.Add(new global::Baseten.EndPointAuthorization + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + Value = apiKey, + }); + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.CleanupImages.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.CleanupImages.g.cs new file mode 100644 index 0000000..dee503e --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.CleanupImages.g.cs @@ -0,0 +1,604 @@ + +#nullable enable + +namespace Baseten +{ + public partial class ImagesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_CleanupImagesSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_CleanupImagesSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_CleanupImagesSecurityRequirement0, + }; + partial void PrepareCleanupImagesArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId); + partial void PrepareCleanupImagesRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId); + partial void ProcessCleanupImagesResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessCleanupImagesResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Clean up unused images
+ /// Remove unused sandbox image versions. Versions referenced by active deployments are preserved. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CleanupImagesAsync( + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CleanupImagesAsResponseAsync( + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Clean up unused images
+ /// Remove unused sandbox image versions. Versions referenced by active deployments are preserved. + ///
+ /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CleanupImagesAsResponseAsync( + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareCleanupImagesArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CleanupImagesSecurityRequirements, + operationName: "CleanupImagesAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: "/v1/sandboxes/cleanup_images", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCleanupImagesRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CleanupImages", + methodName: "CleanupImagesAsync", + pathTemplate: "\"/v1/sandboxes/cleanup_images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CleanupImages", + methodName: "CleanupImagesAsync", + pathTemplate: "\"/v1/sandboxes/cleanup_images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CleanupImages", + methodName: "CleanupImagesAsync", + pathTemplate: "\"/v1/sandboxes/cleanup_images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessCleanupImagesResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CleanupImages", + methodName: "CleanupImagesAsync", + pathTemplate: "\"/v1/sandboxes/cleanup_images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CleanupImages", + methodName: "CleanupImagesAsync", + pathTemplate: "\"/v1/sandboxes/cleanup_images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Invalid request. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessCleanupImagesResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.CleanupImagesResponseV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.CleanupImagesResponseV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.Constructors.Bearer.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.Constructors.Bearer.g.cs new file mode 100644 index 0000000..9c1dde7 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.Constructors.Bearer.g.cs @@ -0,0 +1,31 @@ + +#nullable enable + +namespace Baseten +{ + public sealed partial class ImagesClient + { + /// + + public ImagesClient( + string apiKey, + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this(httpClient, baseUri, authorizations, disposeHttpClient) + { + Authorizing(HttpClient, ref apiKey); + + AuthorizeUsingBearer(apiKey); + + Authorized(HttpClient); + } + + partial void Authorizing( + global::System.Net.Http.HttpClient client, + ref string apiKey); + partial void Authorized( + global::System.Net.Http.HttpClient client); + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.DeleteImage.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.DeleteImage.g.cs new file mode 100644 index 0000000..e31e896 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.DeleteImage.g.cs @@ -0,0 +1,645 @@ + +#nullable enable + +namespace Baseten +{ + public partial class ImagesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_DeleteImageSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_DeleteImageSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_DeleteImageSecurityRequirement0, + }; + partial void PrepareDeleteImageArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string imageName); + partial void PrepareDeleteImageRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string imageName); + partial void ProcessDeleteImageResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessDeleteImageResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Delete a sandbox image
+ /// Delete the image repository and all its tags. Reject deletion if any version is referenced by an active deployment. Return the deleted image. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteImageAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteImageAsResponseAsync( + imageName: imageName, + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a sandbox image
+ /// Delete the image repository and all its tags. Reject deletion if any version is referenced by an active deployment. Return the deleted image. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> DeleteImageAsResponseAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareDeleteImageArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + imageName: ref imageName); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_DeleteImageSecurityRequirements, + operationName: "DeleteImageAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: $"/v1/sandboxes/images/{imageName}", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareDeleteImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + imageName: imageName); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImage", + methodName: "DeleteImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImage", + methodName: "DeleteImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImage", + methodName: "DeleteImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessDeleteImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImage", + methodName: "DeleteImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImage", + methodName: "DeleteImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource not found. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 409) + { + string? __content_409 = null; + global::System.Exception? __exception_409 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_409 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_409 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_409, + responseBody: __content_409, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessDeleteImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.ImageV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.ImageV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.DeleteImageTag.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.DeleteImageTag.g.cs new file mode 100644 index 0000000..94b7fe3 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.DeleteImageTag.g.cs @@ -0,0 +1,654 @@ + +#nullable enable + +namespace Baseten +{ + public partial class ImagesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_DeleteImageTagSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_DeleteImageTagSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_DeleteImageTagSecurityRequirement0, + }; + partial void PrepareDeleteImageTagArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string imageName, + ref string tagName); + partial void PrepareDeleteImageTagRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string imageName, + string tagName); + partial void ProcessDeleteImageTagResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessDeleteImageTagResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Delete an image tag
+ /// Delete a specific image version. Reject deletion if the version is referenced by an active deployment. Return the updated image with its remaining tags, possibly empty. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteImageTagAsync( + string imageName, + string tagName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteImageTagAsResponseAsync( + imageName: imageName, + tagName: tagName, + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete an image tag
+ /// Delete a specific image version. Reject deletion if the version is referenced by an active deployment. Return the updated image with its remaining tags, possibly empty. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> DeleteImageTagAsResponseAsync( + string imageName, + string tagName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareDeleteImageTagArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + imageName: ref imageName, + tagName: ref tagName); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_DeleteImageTagSecurityRequirements, + operationName: "DeleteImageTagAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: $"/v1/sandboxes/images/{imageName}/tags/{tagName}", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareDeleteImageTagRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + imageName: imageName, + tagName: tagName); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImageTag", + methodName: "DeleteImageTagAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags/{tagName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImageTag", + methodName: "DeleteImageTagAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags/{tagName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImageTag", + methodName: "DeleteImageTagAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags/{tagName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessDeleteImageTagResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImageTag", + methodName: "DeleteImageTagAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags/{tagName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteImageTag", + methodName: "DeleteImageTagAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags/{tagName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource not found. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 409) + { + string? __content_409 = null; + global::System.Exception? __exception_409 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_409 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_409 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_409, + responseBody: __content_409, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessDeleteImageTagResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.ImageV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.ImageV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.GetImage.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.GetImage.g.cs new file mode 100644 index 0000000..ff5c4f5 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.GetImage.g.cs @@ -0,0 +1,613 @@ + +#nullable enable + +namespace Baseten +{ + public partial class ImagesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_GetImageSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_GetImageSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_GetImageSecurityRequirement0, + }; + partial void PrepareGetImageArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string imageName); + partial void PrepareGetImageRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string imageName); + partial void ProcessGetImageResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGetImageResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Get a sandbox image
+ /// Return the repository summary and processing status. Use the tag listing endpoint for image versions. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task GetImageAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetImageAsResponseAsync( + imageName: imageName, + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a sandbox image
+ /// Return the repository summary and processing status. Use the tag listing endpoint for image versions. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetImageAsResponseAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareGetImageArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + imageName: ref imageName); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GetImageSecurityRequirements, + operationName: "GetImageAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: $"/v1/sandboxes/images/{imageName}", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + imageName: imageName); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetImage", + methodName: "GetImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetImage", + methodName: "GetImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetImage", + methodName: "GetImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetImage", + methodName: "GetImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetImage", + methodName: "GetImageAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource not found. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.ImageV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.ImageV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.ListImageTags.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.ListImageTags.g.cs new file mode 100644 index 0000000..52fb6eb --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.ListImageTags.g.cs @@ -0,0 +1,709 @@ + +#nullable enable + +namespace Baseten +{ + public partial class ImagesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_ListImageTagsSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_ListImageTagsSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_ListImageTagsSecurityRequirement0, + }; + partial void PrepareListImageTagsArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string? cursor, + ref int? limit, + ref string? sort, + ref string? q, + ref string? name, + ref string imageName); + partial void PrepareListImageTagsRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string? cursor, + int? limit, + string? sort, + string? q, + string? name, + string imageName); + partial void ProcessListImageTagsResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessListImageTagsResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List image tags
+ /// Return one cursor-paginated page of image versions. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Default Value: name:asc + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ListImageTagsAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? sort = default, + string? q = default, + string? name = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListImageTagsAsResponseAsync( + imageName: imageName, + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + sort: sort, + q: q, + name: name, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List image tags
+ /// Return one cursor-paginated page of image versions. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Default Value: name:asc + /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListImageTagsAsResponseAsync( + string imageName, + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? sort = default, + string? q = default, + string? name = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareListImageTagsArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + cursor: ref cursor, + limit: ref limit, + sort: ref sort, + q: ref q, + name: ref name, + imageName: ref imageName); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ListImageTagsSecurityRequirements, + operationName: "ListImageTagsAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: $"/v1/sandboxes/images/{imageName}/tags", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + .AddOptionalParameter("cursor", cursor) + .AddOptionalParameter("limit", limit?.ToString()) + .AddOptionalParameter("sort", sort) + .AddOptionalParameter("q", q) + .AddOptionalParameter("name", name) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareListImageTagsRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + sort: sort, + q: q, + name: name, + imageName: imageName); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImageTags", + methodName: "ListImageTagsAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImageTags", + methodName: "ListImageTagsAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImageTags", + methodName: "ListImageTagsAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessListImageTagsResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImageTags", + methodName: "ListImageTagsAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImageTags", + methodName: "ListImageTagsAsync", + pathTemplate: "$\"/v1/sandboxes/images/{imageName}/tags\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Invalid request. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource not found. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListImageTagsResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.ListImageTagsResponseV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.ListImageTagsResponseV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.ListImages.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.ListImages.g.cs new file mode 100644 index 0000000..77bb15d --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.ListImages.g.cs @@ -0,0 +1,658 @@ + +#nullable enable + +namespace Baseten +{ + public partial class ImagesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_ListImagesSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_ListImagesSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_ListImagesSecurityRequirement0, + }; + partial void PrepareListImagesArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string? cursor, + ref int? limit, + ref string? sort, + ref string? q); + partial void PrepareListImagesRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string? cursor, + int? limit, + string? sort, + string? q); + partial void ProcessListImagesResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessListImagesResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List sandbox images
+ /// Return one cursor-paginated page of image repository summaries. Tags are listed separately. Pages can be empty when non-sandbox repositories are excluded; follow pagination.cursor while pagination.has_more is true. Prefix search forces ascending name order. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Default Value: createdAt:desc + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ListImagesAsync( + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? sort = default, + string? q = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListImagesAsResponseAsync( + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + sort: sort, + q: q, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List sandbox images
+ /// Return one cursor-paginated page of image repository summaries. Tags are listed separately. Pages can be empty when non-sandbox repositories are excluded; follow pagination.cursor while pagination.has_more is true. Prefix search forces ascending name order. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Default Value: createdAt:desc + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListImagesAsResponseAsync( + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? sort = default, + string? q = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareListImagesArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + cursor: ref cursor, + limit: ref limit, + sort: ref sort, + q: ref q); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ListImagesSecurityRequirements, + operationName: "ListImagesAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: "/v1/sandboxes/images", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + .AddOptionalParameter("cursor", cursor) + .AddOptionalParameter("limit", limit?.ToString()) + .AddOptionalParameter("sort", sort) + .AddOptionalParameter("q", q) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareListImagesRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + sort: sort, + q: q); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImages", + methodName: "ListImagesAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImages", + methodName: "ListImagesAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImages", + methodName: "ListImagesAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessListImagesResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImages", + methodName: "ListImagesAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListImages", + methodName: "ListImagesAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Invalid request. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListImagesResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.ListImagesResponseV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.ListImagesResponseV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.PushImage.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.PushImage.g.cs new file mode 100644 index 0000000..d86c3eb --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.PushImage.g.cs @@ -0,0 +1,669 @@ + +#nullable enable + +namespace Baseten +{ + public partial class ImagesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_PushImageSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_PushImageSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_PushImageSecurityRequirement0, + }; + partial void PreparePushImageArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + global::Baseten.PushImageRequestV1 request); + partial void PreparePushImageRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + global::Baseten.PushImageRequestV1 request); + partial void ProcessPushImageResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessPushImageResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Push a sandbox image
+ /// With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PushImageAsync( + + global::Baseten.PushImageRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await PushImageAsResponseAsync( + + request: request, + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Push a sandbox image
+ /// With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> PushImageAsResponseAsync( + + global::Baseten.PushImageRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PreparePushImageArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + request: request); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_PushImageSecurityRequirements, + operationName: "PushImageAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: "/v1/sandboxes/images", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PreparePushImageRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PushImage", + methodName: "PushImageAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PushImage", + methodName: "PushImageAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PushImage", + methodName: "PushImageAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessPushImageResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PushImage", + methodName: "PushImageAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "PushImage", + methodName: "PushImageAsync", + pathTemplate: "\"/v1/sandboxes/images\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Invalid request. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessPushImageResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.PushImageResponseV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.PushImageResponseV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Push a sandbox image
+ /// With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED. + ///
+ /// + /// + /// + /// Target image repository name. Reusing a name pushes a new version to the existing repository.
+ /// Example: base-image + /// + /// + /// Optional source registry image reference including a registry hostname. When omitted, the response provides an archive upload URL.
+ /// Example: docker.io/b10/base-image:latest + /// + /// + /// Optional serialized registry authentication configuration for importing a private image. Used only when image is supplied; never returned.
+ /// Included only in requests
+ /// Example: {"auths":{"https://index.docker.io/v1/":{"auth":"YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu"}}} + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task PushImageAsync( + string name, + string? teamId = default, + string? xTeamId = default, + string? image = default, + string? dockerConfig = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Baseten.PushImageRequestV1 + { + Name = name, + Image = image, + DockerConfig = dockerConfig, + }; + + return await PushImageAsync( + teamId: teamId, + xTeamId: xTeamId, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.ImagesClient.g.cs b/src/libs/Baseten/Generated/Baseten.ImagesClient.g.cs new file mode 100644 index 0000000..b2d5503 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.ImagesClient.g.cs @@ -0,0 +1,143 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public sealed partial class ImagesClient : global::Baseten.IImagesClient, global::System.IDisposable + { + /// + /// + /// + public const string DefaultBaseUrl = "https://api.baseten.co/"; + + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif + + /// + public global::Baseten.AutoSDKClientOptions Options { get; } + + internal global::System.Lazy JsonSerializerContextProvider { get; set; } = new(() => global::Baseten.ImagesSourceGenerationContext.Default); + + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext + { + get => JsonSerializerContextProvider.Value; + set => JsonSerializerContextProvider = new(() => value); + } + + + /// + /// Creates a new instance of the ImagesClient. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ImagesClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the ImagesClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ImagesClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Baseten.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the ImagesClient. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public ImagesClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Baseten.AutoSDKClientOptions? options, + bool disposeHttpClient = true) + { + + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::Baseten.AutoSDKClientOptions(); + _disposeHttpClient = disposeHttpClient; + + Initialized(HttpClient); + } + + /// + public void Dispose() + { + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } + } + + partial void Initialized( + global::System.Net.Http.HttpClient client); + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.ImageStatusV1.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.ImageStatusV1.g.cs new file mode 100644 index 0000000..74c9547 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.ImageStatusV1.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class ImageStatusV1JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.ImageStatusV1 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.ImageStatusV1Extensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.ImageStatusV1)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.ImageStatusV1); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.ImageStatusV1 value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.ImageStatusV1Extensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.ImageStatusV1Nullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.ImageStatusV1Nullable.g.cs new file mode 100644 index 0000000..cdf2d9c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.ImageStatusV1Nullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class ImageStatusV1NullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.ImageStatusV1? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.ImageStatusV1Extensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.ImageStatusV1)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.ImageStatusV1?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.ImageStatusV1? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.ImageStatusV1Extensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1Action.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1Action.g.cs new file mode 100644 index 0000000..0fca266 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1Action.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxDateExpirationPolicyV1ActionJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxDateExpirationPolicyV1Action Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxDateExpirationPolicyV1ActionExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxDateExpirationPolicyV1Action)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxDateExpirationPolicyV1Action); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxDateExpirationPolicyV1Action value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxDateExpirationPolicyV1ActionExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1ActionNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1ActionNullable.g.cs new file mode 100644 index 0000000..82de9da --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1ActionNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxDateExpirationPolicyV1ActionNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxDateExpirationPolicyV1Action? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxDateExpirationPolicyV1ActionExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxDateExpirationPolicyV1Action)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxDateExpirationPolicyV1Action?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxDateExpirationPolicyV1Action? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxDateExpirationPolicyV1ActionExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1Type.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1Type.g.cs new file mode 100644 index 0000000..09c9b49 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1Type.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxDateExpirationPolicyV1TypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxDateExpirationPolicyV1Type Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxDateExpirationPolicyV1TypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxDateExpirationPolicyV1Type)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxDateExpirationPolicyV1Type); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxDateExpirationPolicyV1Type value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxDateExpirationPolicyV1TypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1TypeNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1TypeNullable.g.cs new file mode 100644 index 0000000..a71184a --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxDateExpirationPolicyV1TypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxDateExpirationPolicyV1TypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxDateExpirationPolicyV1Type? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxDateExpirationPolicyV1TypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxDateExpirationPolicyV1Type)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxDateExpirationPolicyV1Type?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxDateExpirationPolicyV1Type? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxDateExpirationPolicyV1TypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1.g.cs new file mode 100644 index 0000000..0cc96b1 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1.g.cs @@ -0,0 +1,87 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Baseten.JsonConverters +{ + /// + public class SandboxExpirationPolicyV1JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxExpirationPolicyV1 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + var readerCopy = reader; + var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxExpirationPolicyV1Discriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Baseten.SandboxExpirationPolicyV1Discriminator)}"); + var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo); + + global::Baseten.SandboxTTLIdleExpirationPolicyV1? ttlIdle = default; + if (discriminator?.Type == global::Baseten.SandboxExpirationPolicyV1DiscriminatorType.TtlIdle) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Baseten.SandboxTTLIdleExpirationPolicyV1)}"); + ttlIdle = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? ttlMaxAge = default; + if (discriminator?.Type == global::Baseten.SandboxExpirationPolicyV1DiscriminatorType.TtlMaxAge) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1)}"); + ttlMaxAge = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + global::Baseten.SandboxDateExpirationPolicyV1? date = default; + if (discriminator?.Type == global::Baseten.SandboxExpirationPolicyV1DiscriminatorType.Date) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxDateExpirationPolicyV1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Baseten.SandboxDateExpirationPolicyV1)}"); + date = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo); + } + + var __value = new global::Baseten.SandboxExpirationPolicyV1( + discriminator?.Type, + ttlIdle, + + ttlMaxAge, + + date + ); + + return __value; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxExpirationPolicyV1 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + if (value.IsTtlIdle) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickTtlIdle(), typeInfo); + } + else if (value.IsTtlMaxAge) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickTtlMaxAge(), typeInfo); + } + else if (value.IsDate) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxDateExpirationPolicyV1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Baseten.SandboxDateExpirationPolicyV1).Name}"); + global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickDate(), typeInfo); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorType.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorType.g.cs new file mode 100644 index 0000000..cf5e1d4 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorType.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxExpirationPolicyV1DiscriminatorTypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxExpirationPolicyV1DiscriminatorType Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxExpirationPolicyV1DiscriminatorTypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxExpirationPolicyV1DiscriminatorType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxExpirationPolicyV1DiscriminatorType value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxExpirationPolicyV1DiscriminatorTypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorTypeNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorTypeNullable.g.cs new file mode 100644 index 0000000..8e415e1 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorTypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxExpirationPolicyV1DiscriminatorTypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxExpirationPolicyV1DiscriminatorType? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxExpirationPolicyV1DiscriminatorTypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxExpirationPolicyV1DiscriminatorType)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxExpirationPolicyV1DiscriminatorType? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxExpirationPolicyV1DiscriminatorTypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxPortV1Protocol.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxPortV1Protocol.g.cs new file mode 100644 index 0000000..af98b5e --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxPortV1Protocol.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxPortV1ProtocolJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxPortV1Protocol Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxPortV1ProtocolExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxPortV1Protocol)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxPortV1Protocol); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxPortV1Protocol value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxPortV1ProtocolExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxPortV1ProtocolNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxPortV1ProtocolNullable.g.cs new file mode 100644 index 0000000..dc37ede --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxPortV1ProtocolNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxPortV1ProtocolNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxPortV1Protocol? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxPortV1ProtocolExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxPortV1Protocol)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxPortV1Protocol?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxPortV1Protocol? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxPortV1ProtocolExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxStatusV1.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxStatusV1.g.cs new file mode 100644 index 0000000..675862d --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxStatusV1.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxStatusV1JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxStatusV1 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxStatusV1Extensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxStatusV1)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxStatusV1); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxStatusV1 value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxStatusV1Extensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxStatusV1Nullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxStatusV1Nullable.g.cs new file mode 100644 index 0000000..c952b11 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxStatusV1Nullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxStatusV1NullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxStatusV1? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxStatusV1Extensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxStatusV1)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxStatusV1?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxStatusV1? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxStatusV1Extensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1Action.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1Action.g.cs new file mode 100644 index 0000000..f39eab6 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1Action.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxTTLIdleExpirationPolicyV1ActionJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxTTLIdleExpirationPolicyV1Action Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxTTLIdleExpirationPolicyV1ActionExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxTTLIdleExpirationPolicyV1Action)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxTTLIdleExpirationPolicyV1Action value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxTTLIdleExpirationPolicyV1ActionExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1ActionNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1ActionNullable.g.cs new file mode 100644 index 0000000..2aef304 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1ActionNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxTTLIdleExpirationPolicyV1ActionNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxTTLIdleExpirationPolicyV1Action? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxTTLIdleExpirationPolicyV1ActionExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxTTLIdleExpirationPolicyV1Action)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxTTLIdleExpirationPolicyV1Action? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxTTLIdleExpirationPolicyV1ActionExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1Type.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1Type.g.cs new file mode 100644 index 0000000..88a8efa --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1Type.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxTTLIdleExpirationPolicyV1TypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxTTLIdleExpirationPolicyV1Type Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxTTLIdleExpirationPolicyV1TypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxTTLIdleExpirationPolicyV1Type)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxTTLIdleExpirationPolicyV1Type value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxTTLIdleExpirationPolicyV1TypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1TypeNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1TypeNullable.g.cs new file mode 100644 index 0000000..34ca192 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1TypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxTTLIdleExpirationPolicyV1TypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxTTLIdleExpirationPolicyV1Type? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxTTLIdleExpirationPolicyV1TypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxTTLIdleExpirationPolicyV1Type)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxTTLIdleExpirationPolicyV1Type? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxTTLIdleExpirationPolicyV1TypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1Action.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1Action.g.cs new file mode 100644 index 0000000..c3f760e --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1Action.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxTTLMaxAgeExpirationPolicyV1ActionJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1ActionExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1ActionExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1ActionNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1ActionNullable.g.cs new file mode 100644 index 0000000..fa90513 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1ActionNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxTTLMaxAgeExpirationPolicyV1ActionNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1ActionExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1ActionExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1Type.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1Type.g.cs new file mode 100644 index 0000000..53b0174 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1Type.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxTTLMaxAgeExpirationPolicyV1TypeJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1TypeExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1TypeExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1TypeNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1TypeNullable.g.cs new file mode 100644 index 0000000..176f56f --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1TypeNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxTTLMaxAgeExpirationPolicyV1TypeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1TypeExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1TypeExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1.g.cs new file mode 100644 index 0000000..5113c73 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1.g.cs @@ -0,0 +1,108 @@ +#nullable enable +#pragma warning disable CS0618 // Type or member is obsolete + +namespace Baseten.JsonConverters +{ + /// + public class SandboxV1JsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxV1 Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + using var __jsonDocument = global::System.Text.Json.JsonDocument.ParseValue(ref reader); + var __rawJson = __jsonDocument.RootElement.GetRawText(); + + global::Baseten.SandboxConfigurationV1? configuration = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxConfigurationV1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Baseten.SandboxConfigurationV1).Name}"); + configuration = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { + } + + global::Baseten.SandboxV1Variant2? sandboxV1Variant2 = default; + try + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxV1Variant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Baseten.SandboxV1Variant2).Name}"); + sandboxV1Variant2 = global::System.Text.Json.JsonSerializer.Deserialize(__rawJson, typeInfo); + } + catch (global::System.Text.Json.JsonException) + { + } + catch (global::System.InvalidOperationException) + { + } + var __value = new global::Baseten.SandboxV1( + configuration, + + sandboxV1Variant2 + ); + + return __value; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxV1 value, + global::System.Text.Json.JsonSerializerOptions options) + { + options = options ?? throw new global::System.ArgumentNullException(nameof(options)); + var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set."); + + + writer.WriteStartObject(); + var __writtenPropertyNames = new global::System.Collections.Generic.HashSet(global::System.StringComparer.Ordinal); + if (value.IsConfiguration) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxConfigurationV1), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Baseten.SandboxConfigurationV1).Name}"); + var __element0 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PickConfiguration(), typeInfo); + if (__element0.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element0.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } + } + if (value.IsSandboxV1Variant2) + { + var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Baseten.SandboxV1Variant2), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo ?? + throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Baseten.SandboxV1Variant2).Name}"); + var __element1 = global::System.Text.Json.JsonSerializer.SerializeToElement(value.PickSandboxV1Variant2(), typeInfo); + if (__element1.ValueKind != global::System.Text.Json.JsonValueKind.Object) + { + throw new global::System.Text.Json.JsonException("AllOf values must serialize as JSON objects."); + } + + foreach (var __property in __element1.EnumerateObject()) + { + if (__writtenPropertyNames.Add(__property.Name)) + { + __property.WriteTo(writer); + } + } + } + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1Variant2State.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1Variant2State.g.cs new file mode 100644 index 0000000..67f07a9 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1Variant2State.g.cs @@ -0,0 +1,53 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxV1Variant2StateJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxV1Variant2State Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxV1Variant2StateExtensions.ToEnum(stringValue) ?? default; + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxV1Variant2State)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxV1Variant2State); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxV1Variant2State value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + writer.WriteStringValue(global::Baseten.SandboxV1Variant2StateExtensions.ToValueString(value)); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1Variant2StateNullable.g.cs b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1Variant2StateNullable.g.cs new file mode 100644 index 0000000..57ec6d5 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.JsonConverters.SandboxV1Variant2StateNullable.g.cs @@ -0,0 +1,60 @@ +#nullable enable + +namespace Baseten.JsonConverters +{ + /// + public sealed class SandboxV1Variant2StateNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter + { + /// + public override global::Baseten.SandboxV1Variant2State? Read( + ref global::System.Text.Json.Utf8JsonReader reader, + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + switch (reader.TokenType) + { + case global::System.Text.Json.JsonTokenType.String: + { + var stringValue = reader.GetString(); + if (stringValue != null) + { + return global::Baseten.SandboxV1Variant2StateExtensions.ToEnum(stringValue); + } + + break; + } + case global::System.Text.Json.JsonTokenType.Number: + { + var numValue = reader.GetInt32(); + return (global::Baseten.SandboxV1Variant2State)numValue; + } + case global::System.Text.Json.JsonTokenType.Null: + { + return default(global::Baseten.SandboxV1Variant2State?); + } + default: + throw new global::System.ArgumentOutOfRangeException(nameof(reader)); + } + + return default; + } + + /// + public override void Write( + global::System.Text.Json.Utf8JsonWriter writer, + global::Baseten.SandboxV1Variant2State? value, + global::System.Text.Json.JsonSerializerOptions options) + { + writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer)); + + if (value == null) + { + writer.WriteNullValue(); + } + else + { + writer.WriteStringValue(global::Baseten.SandboxV1Variant2StateExtensions.ToValueString(value.Value)); + } + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.JsonSerializerContext.g.cs b/src/libs/Baseten/Generated/Baseten.JsonSerializerContext.g.cs index 823674b..fcf1fcc 100644 --- a/src/libs/Baseten/Generated/Baseten.JsonSerializerContext.g.cs +++ b/src/libs/Baseten/Generated/Baseten.JsonSerializerContext.g.cs @@ -734,6 +734,49 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.CreateApiKeyForGroupResponseV1))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.RegisterAPIKeyRequestV1))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.RegisterAPIKeyResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxLifecycleV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1), TypeInfoPropertyName = "SandboxExpirationPolicyV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1Discriminator))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType), TypeInfoPropertyName = "SandboxExpirationPolicyV1DiscriminatorType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action), TypeInfoPropertyName = "SandboxTTLIdleExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type), TypeInfoPropertyName = "SandboxTTLIdleExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action), TypeInfoPropertyName = "SandboxTTLMaxAgeExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type), TypeInfoPropertyName = "SandboxTTLMaxAgeExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1Action), TypeInfoPropertyName = "SandboxDateExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1Type), TypeInfoPropertyName = "SandboxDateExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxNetworkV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxProxyConfigV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxProxyTargetV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxEnvV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxPortV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxPortV1Protocol), TypeInfoPropertyName = "SandboxPortV1Protocol2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxConfigurationV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.CreateSandboxRequestV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.UpdateSandboxRequestV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1), TypeInfoPropertyName = "SandboxV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1Variant2))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxStatusV1), TypeInfoPropertyName = "SandboxStatusV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1Variant2State), TypeInfoPropertyName = "SandboxV1Variant2State2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxApiPaginationV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ListSandboxesResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ListImagesResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ImageV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ListImageTagsResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ImageTagV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ImageStatusV1), TypeInfoPropertyName = "ImageStatusV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.PushImageRequestV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.PushImageResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.CleanupImagesResponseV1))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(bool?))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(int?))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(long?))] @@ -824,6 +867,19 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SharedEndpointRegionV1?), TypeInfoPropertyName = "NullableSharedEndpointRegionV12")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.UsageLimitUnitV1?), TypeInfoPropertyName = "NullableUsageLimitUnitV12")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.LimitEnforcementV1?), TypeInfoPropertyName = "NullableLimitEnforcementV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1?), TypeInfoPropertyName = "NullableSandboxExpirationPolicyV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType?), TypeInfoPropertyName = "NullableSandboxExpirationPolicyV1DiscriminatorType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action?), TypeInfoPropertyName = "NullableSandboxTTLIdleExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type?), TypeInfoPropertyName = "NullableSandboxTTLIdleExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action?), TypeInfoPropertyName = "NullableSandboxTTLMaxAgeExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type?), TypeInfoPropertyName = "NullableSandboxTTLMaxAgeExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1Action?), TypeInfoPropertyName = "NullableSandboxDateExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1Type?), TypeInfoPropertyName = "NullableSandboxDateExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxPortV1Protocol?), TypeInfoPropertyName = "NullableSandboxPortV1Protocol2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1?), TypeInfoPropertyName = "NullableSandboxV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxStatusV1?), TypeInfoPropertyName = "NullableSandboxStatusV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1Variant2State?), TypeInfoPropertyName = "NullableSandboxV1Variant2State2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ImageStatusV1?), TypeInfoPropertyName = "NullableImageStatusV12")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] @@ -927,6 +983,13 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] internal sealed partial class SourceGenerationContextChunk1 : global::System.Text.Json.Serialization.JsonSerializerContext { } @@ -979,6 +1042,8 @@ internal static void AddConverters(global::System.Text.Json.JsonSerializerOption options.Converters.Add(new global::Baseten.JsonConverters.Config2JsonConverter()); options.Converters.Add(new global::Baseten.JsonConverters.Config3JsonConverter()); options.Converters.Add(new global::Baseten.JsonConverters.TargetVariant1JsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.SandboxExpirationPolicyV1JsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.SandboxV1JsonConverter()); options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); @@ -1305,7 +1370,51 @@ public override bool CanConvert(global::System.Type typeToConvert) || typeToConvert == typeof(global::Baseten.UsageLimitUnitV1) - || typeToConvert == typeof(global::Baseten.UsageLimitUnitV1?); + || typeToConvert == typeof(global::Baseten.UsageLimitUnitV1?) + + || typeToConvert == typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType) + + || typeToConvert == typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType?) + + || typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action) + + || typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action?) + + || typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type) + + || typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type?) + + || typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action) + + || typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action?) + + || typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type) + + || typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type?) + + || typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Action) + + || typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Action?) + + || typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Type) + + || typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Type?) + + || typeToConvert == typeof(global::Baseten.SandboxPortV1Protocol) + + || typeToConvert == typeof(global::Baseten.SandboxPortV1Protocol?) + + || typeToConvert == typeof(global::Baseten.SandboxV1Variant2State) + + || typeToConvert == typeof(global::Baseten.SandboxV1Variant2State?) + + || typeToConvert == typeof(global::Baseten.SandboxStatusV1) + + || typeToConvert == typeof(global::Baseten.SandboxStatusV1?) + + || typeToConvert == typeof(global::Baseten.ImageStatusV1) + + || typeToConvert == typeof(global::Baseten.ImageStatusV1?); } public override global::System.Text.Json.Serialization.JsonConverter CreateConverter( @@ -2021,6 +2130,116 @@ public override bool CanConvert(global::System.Type typeToConvert) { return new global::Baseten.JsonConverters.UsageLimitUnitV1NullableJsonConverter(); } + + if (typeToConvert == typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType)) + { + return new global::Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorTypeJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType?)) + { + return new global::Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorTypeNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action)) + { + return new global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1ActionJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action?)) + { + return new global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1ActionNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type)) + { + return new global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1TypeJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type?)) + { + return new global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1TypeNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action)) + { + return new global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1ActionJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action?)) + { + return new global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1ActionNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type)) + { + return new global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1TypeJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type?)) + { + return new global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1TypeNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Action)) + { + return new global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1ActionJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Action?)) + { + return new global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1ActionNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Type)) + { + return new global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1TypeJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Type?)) + { + return new global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1TypeNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxPortV1Protocol)) + { + return new global::Baseten.JsonConverters.SandboxPortV1ProtocolJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxPortV1Protocol?)) + { + return new global::Baseten.JsonConverters.SandboxPortV1ProtocolNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxV1Variant2State)) + { + return new global::Baseten.JsonConverters.SandboxV1Variant2StateJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxV1Variant2State?)) + { + return new global::Baseten.JsonConverters.SandboxV1Variant2StateNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxStatusV1)) + { + return new global::Baseten.JsonConverters.SandboxStatusV1JsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxStatusV1?)) + { + return new global::Baseten.JsonConverters.SandboxStatusV1NullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.ImageStatusV1)) + { + return new global::Baseten.JsonConverters.ImageStatusV1JsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.ImageStatusV1?)) + { + return new global::Baseten.JsonConverters.ImageStatusV1NullableJsonConverter(); + } throw new global::System.NotSupportedException($"No generated enum converter is registered for '{typeToConvert}'."); } } diff --git a/src/libs/Baseten/Generated/Baseten.JsonSerializerContextTypes.g.cs b/src/libs/Baseten/Generated/Baseten.JsonSerializerContextTypes.g.cs index ccf71de..211521b 100644 --- a/src/libs/Baseten/Generated/Baseten.JsonSerializerContextTypes.g.cs +++ b/src/libs/Baseten/Generated/Baseten.JsonSerializerContextTypes.g.cs @@ -2878,6 +2878,178 @@ public sealed partial class JsonSerializerContextTypes /// /// public global::Baseten.RegisterAPIKeyResponseV1? Type711 { get; set; } + /// + /// + /// + public global::Baseten.SandboxLifecycleV1? Type712 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type713 { get; set; } + /// + /// + /// + public global::Baseten.SandboxExpirationPolicyV1? Type714 { get; set; } + /// + /// + /// + public global::Baseten.SandboxTTLIdleExpirationPolicyV1? Type715 { get; set; } + /// + /// + /// + public global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? Type716 { get; set; } + /// + /// + /// + public global::Baseten.SandboxDateExpirationPolicyV1? Type717 { get; set; } + /// + /// + /// + public global::Baseten.SandboxExpirationPolicyV1Discriminator? Type718 { get; set; } + /// + /// + /// + public global::Baseten.SandboxExpirationPolicyV1DiscriminatorType? Type719 { get; set; } + /// + /// + /// + public global::Baseten.SandboxTTLIdleExpirationPolicyV1Action? Type720 { get; set; } + /// + /// + /// + public global::Baseten.SandboxTTLIdleExpirationPolicyV1Type? Type721 { get; set; } + /// + /// + /// + public global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action? Type722 { get; set; } + /// + /// + /// + public global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type? Type723 { get; set; } + /// + /// + /// + public global::Baseten.SandboxDateExpirationPolicyV1Action? Type724 { get; set; } + /// + /// + /// + public global::Baseten.SandboxDateExpirationPolicyV1Type? Type725 { get; set; } + /// + /// + /// + public global::Baseten.SandboxNetworkV1? Type726 { get; set; } + /// + /// + /// + public global::Baseten.SandboxProxyConfigV1? Type727 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type728 { get; set; } + /// + /// + /// + public global::Baseten.SandboxProxyTargetV1? Type729 { get; set; } + /// + /// + /// + public global::Baseten.SandboxEnvV1? Type730 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type731 { get; set; } + /// + /// + /// + public global::Baseten.SandboxPortV1? Type732 { get; set; } + /// + /// + /// + public global::Baseten.SandboxPortV1Protocol? Type733 { get; set; } + /// + /// + /// + public global::Baseten.SandboxConfigurationV1? Type734 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type735 { get; set; } + /// + /// + /// + public global::Baseten.CreateSandboxRequestV1? Type736 { get; set; } + /// + /// + /// + public global::Baseten.UpdateSandboxRequestV1? Type737 { get; set; } + /// + /// + /// + public global::Baseten.SandboxV1? Type738 { get; set; } + /// + /// + /// + public global::Baseten.SandboxV1Variant2? Type739 { get; set; } + /// + /// + /// + public global::Baseten.SandboxStatusV1? Type740 { get; set; } + /// + /// + /// + public global::Baseten.SandboxV1Variant2State? Type741 { get; set; } + /// + /// + /// + public global::Baseten.SandboxApiPaginationV1? Type742 { get; set; } + /// + /// + /// + public global::Baseten.ListSandboxesResponseV1? Type743 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type744 { get; set; } + /// + /// + /// + public global::Baseten.ListImagesResponseV1? Type745 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type746 { get; set; } + /// + /// + /// + public global::Baseten.ImageV1? Type747 { get; set; } + /// + /// + /// + public global::Baseten.ListImageTagsResponseV1? Type748 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.IList? Type749 { get; set; } + /// + /// + /// + public global::Baseten.ImageTagV1? Type750 { get; set; } + /// + /// + /// + public global::Baseten.ImageStatusV1? Type751 { get; set; } + /// + /// + /// + public global::Baseten.PushImageRequestV1? Type752 { get; set; } + /// + /// + /// + public global::Baseten.PushImageResponseV1? Type753 { get; set; } + /// + /// + /// + public global::Baseten.CleanupImagesResponseV1? Type754 { get; set; } /// /// @@ -3295,5 +3467,33 @@ public sealed partial class JsonSerializerContextTypes /// /// public global::System.Collections.Generic.List? ListType103 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType104 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType105 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType106 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType107 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType108 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType109 { get; set; } + /// + /// + /// + public global::System.Collections.Generic.List? ListType110 { get; set; } } } \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.CleanupImagesResponseV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.CleanupImagesResponseV1.Json.g.cs new file mode 100644 index 0000000..eb2ffd7 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.CleanupImagesResponseV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class CleanupImagesResponseV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.CleanupImagesResponseV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.CleanupImagesResponseV1), + jsonSerializerContext) as global::Baseten.CleanupImagesResponseV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.CleanupImagesResponseV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.CleanupImagesResponseV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.CleanupImagesResponseV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.CleanupImagesResponseV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.CleanupImagesResponseV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.CleanupImagesResponseV1.g.cs new file mode 100644 index 0000000..c5260b6 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.CleanupImagesResponseV1.g.cs @@ -0,0 +1,66 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Result of cleaning up unused sandbox images.
+ /// Example: {"deleted":3,"message":"Removed 3 unused image versions. Image versions used by active sandboxes were retained."} + ///
+ public sealed partial class CleanupImagesResponseV1 + { + /// + /// Number of image versions removed.
+ /// Example: 3 + ///
+ /// 3 + [global::System.Text.Json.Serialization.JsonPropertyName("deleted")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Deleted { get; set; } + + /// + /// Human-readable cleanup result.
+ /// Example: Removed 3 unused image versions. Image versions used by active sandboxes were retained. + ///
+ /// Removed 3 unused image versions. Image versions used by active sandboxes were retained. + [global::System.Text.Json.Serialization.JsonPropertyName("message")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Message { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Number of image versions removed.
+ /// Example: 3 + /// + /// + /// Human-readable cleanup result.
+ /// Example: Removed 3 unused image versions. Image versions used by active sandboxes were retained. + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public CleanupImagesResponseV1( + int deleted, + string message) + { + this.Deleted = deleted; + this.Message = message ?? throw new global::System.ArgumentNullException(nameof(message)); + } + + /// + /// Initializes a new instance of the class. + /// + public CleanupImagesResponseV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.CreateSandboxRequestV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.CreateSandboxRequestV1.Json.g.cs new file mode 100644 index 0000000..98160c5 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.CreateSandboxRequestV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class CreateSandboxRequestV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.CreateSandboxRequestV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.CreateSandboxRequestV1), + jsonSerializerContext) as global::Baseten.CreateSandboxRequestV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.CreateSandboxRequestV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.CreateSandboxRequestV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.CreateSandboxRequestV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.CreateSandboxRequestV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.CreateSandboxRequestV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.CreateSandboxRequestV1.g.cs new file mode 100644 index 0000000..d9b8646 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.CreateSandboxRequestV1.g.cs @@ -0,0 +1,190 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Configuration for a new sandbox. The client may provide a name; otherwise the server generates one. The name is immutable after creation.
+ /// Example: {"name":"baseten-api-review-0916","lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"network":{"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","memory":4096,"ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering"}} + ///
+ public sealed partial class CreateSandboxRequestV1 + { + /// + /// Optional unique sandbox name. Generated by the server when omitted; immutable after creation.
+ /// Example: baseten-api-review-0916 + ///
+ /// baseten-api-review-0916 + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + ///
+ /// {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + [global::System.Text.Json.Serialization.JsonPropertyName("lifecycle")] + public global::Baseten.SandboxLifecycleV1? Lifecycle { get; set; } + + /// + /// Network configuration for a sandbox including subnet, domain filtering, and proxy settings
+ /// Example: {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + ///
+ /// {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + [global::System.Text.Json.Serialization.JsonPropertyName("network")] + public global::Baseten.SandboxNetworkV1? Network { get; set; } + + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + ///
+ /// us-pdx-1 + [global::System.Text.Json.Serialization.JsonPropertyName("region")] + public string? Region { get; set; } + + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + ///
+ /// [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + [global::System.Text.Json.Serialization.JsonPropertyName("envs")] + public global::System.Collections.Generic.IList? Envs { get; set; } + + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + ///
+ /// blaxel/base-image:latest + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + public string? Image { get; set; } + + /// + /// Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
+ /// Example: 4096 + ///
+ /// 4096 + [global::System.Text.Json.Serialization.JsonPropertyName("memory")] + public long? Memory { get; set; } + + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + ///
+ /// [{"name":"http","protocol":"HTTP","target":3000}] + [global::System.Text.Json.Serialization.JsonPropertyName("ports")] + public global::System.Collections.Generic.IList? Ports { get; set; } + + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review + ///
+ /// Baseten API review + [global::System.Text.Json.Serialization.JsonPropertyName("display_name")] + public string? DisplayName { get; set; } + + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + ///
+ /// api-review-20260916-001 + [global::System.Text.Json.Serialization.JsonPropertyName("external_id")] + public string? ExternalId { get; set; } + + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering"} + ///
+ /// {"env":"development","project":"api-review","team":"engineering"} + [global::System.Text.Json.Serialization.JsonPropertyName("labels")] + public global::System.Collections.Generic.Dictionary? Labels { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Optional unique sandbox name. Generated by the server when omitted; immutable after creation.
+ /// Example: baseten-api-review-0916 + /// + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + /// + /// + /// Network configuration for a sandbox including subnet, domain filtering, and proxy settings
+ /// Example: {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + /// + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + /// + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + /// + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + /// + /// + /// Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
+ /// Example: 4096 + /// + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + /// + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review + /// + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + /// + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering"} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public CreateSandboxRequestV1( + string? name, + global::Baseten.SandboxLifecycleV1? lifecycle, + global::Baseten.SandboxNetworkV1? network, + string? region, + global::System.Collections.Generic.IList? envs, + string? image, + long? memory, + global::System.Collections.Generic.IList? ports, + string? displayName, + string? externalId, + global::System.Collections.Generic.Dictionary? labels) + { + this.Name = name; + this.Lifecycle = lifecycle; + this.Network = network; + this.Region = region; + this.Envs = envs; + this.Image = image; + this.Memory = memory; + this.Ports = ports; + this.DisplayName = displayName; + this.ExternalId = externalId; + this.Labels = labels; + } + + /// + /// Initializes a new instance of the class. + /// + public CreateSandboxRequestV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.ImageStatusV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ImageStatusV1.g.cs new file mode 100644 index 0000000..e44d308 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ImageStatusV1.g.cs @@ -0,0 +1,65 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Image processing status. Only BUILT images are ready to use.
+ /// Included only in responses
+ /// Example: BUILT + ///
+ public enum ImageStatusV1 + { + /// + /// + /// + Building, + /// + /// + /// + Built, + /// + /// + /// + Failed, + /// + /// + /// + Uploading, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class ImageStatusV1Extensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this ImageStatusV1 value) + { + return value switch + { + ImageStatusV1.Building => "BUILDING", + ImageStatusV1.Built => "BUILT", + ImageStatusV1.Failed => "FAILED", + ImageStatusV1.Uploading => "UPLOADING", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static ImageStatusV1? ToEnum(string value) + { + return value switch + { + "BUILDING" => ImageStatusV1.Building, + "BUILT" => ImageStatusV1.Built, + "FAILED" => ImageStatusV1.Failed, + "UPLOADING" => ImageStatusV1.Uploading, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.ImageTagV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ImageTagV1.Json.g.cs new file mode 100644 index 0000000..918d093 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ImageTagV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class ImageTagV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.ImageTagV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.ImageTagV1), + jsonSerializerContext) as global::Baseten.ImageTagV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.ImageTagV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.ImageTagV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.ImageTagV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.ImageTagV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.ImageTagV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ImageTagV1.g.cs new file mode 100644 index 0000000..8193083 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ImageTagV1.g.cs @@ -0,0 +1,99 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// A tag identifying a version of a sandbox image.
+ /// Example: {"name":"latest","created_at":"2026-09-16T21:20:00Z","updated_at":"2026-09-16T21:25:00Z","size":134217728} + ///
+ public sealed partial class ImageTagV1 + { + /// + /// Image tag name.
+ /// Example: latest + ///
+ /// latest + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// Time the tag was created.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:20:00Z + ///
+ /// 2026-09-16T21:20:00Z + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + public global::System.DateTime? CreatedAt { get; set; } + + /// + /// Time the tag was last updated.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:25:00Z + ///
+ /// 2026-09-16T21:25:00Z + [global::System.Text.Json.Serialization.JsonPropertyName("updated_at")] + public global::System.DateTime? UpdatedAt { get; set; } + + /// + /// Image size in bytes.
+ /// Included only in responses
+ /// Example: 134217728 + ///
+ /// 134217728 + [global::System.Text.Json.Serialization.JsonPropertyName("size")] + public long? Size { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Image tag name.
+ /// Example: latest + /// + /// + /// Time the tag was created.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:20:00Z + /// + /// + /// Time the tag was last updated.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:25:00Z + /// + /// + /// Image size in bytes.
+ /// Included only in responses
+ /// Example: 134217728 + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ImageTagV1( + string name, + global::System.DateTime? createdAt, + global::System.DateTime? updatedAt, + long? size) + { + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.CreatedAt = createdAt; + this.UpdatedAt = updatedAt; + this.Size = size; + } + + /// + /// Initializes a new instance of the class. + /// + public ImageTagV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.ImageV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ImageV1.Json.g.cs new file mode 100644 index 0000000..571e50e --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ImageV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class ImageV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.ImageV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.ImageV1), + jsonSerializerContext) as global::Baseten.ImageV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.ImageV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.ImageV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.ImageV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.ImageV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.ImageV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ImageV1.g.cs new file mode 100644 index 0000000..231a662 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ImageV1.g.cs @@ -0,0 +1,176 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Sandbox image repository. List and get operations return a summary without embedded tags.
+ /// Example: {"name":"base-image","display_name":"b10/base-image","status":"BUILT","created_at":"2026-09-15T21:20:00Z","updated_at":"2026-09-16T21:25:00Z","last_deployed_at":"2026-09-16T21:26:58.545765901Z","size":260046848,"tags":[{"name":"latest","created_at":"2026-09-16T21:20:00Z","updated_at":"2026-09-16T21:25:00Z","size":134217728},{"name":"20260915212000","created_at":"2026-09-15T21:20:00Z","updated_at":"2026-09-15T21:25:00Z","size":125829120}]} + ///
+ public sealed partial class ImageV1 + { + /// + /// Stable repository name supplied when pushing the image.
+ /// Example: base-image + ///
+ /// base-image + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// Human-readable image repository name.
+ /// Example: b10/base-image + ///
+ /// b10/base-image + [global::System.Text.Json.Serialization.JsonPropertyName("display_name")] + public string? DisplayName { get; set; } + + /// + /// Image processing status. Only BUILT images are ready to use.
+ /// Example: BUILT + ///
+ /// BUILT + [global::System.Text.Json.Serialization.JsonPropertyName("status")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.ImageStatusV1JsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Baseten.ImageStatusV1 Status { get; set; } + + /// + /// Time the image was created.
+ /// Included only in responses
+ /// Example: 2026-09-15T21:20:00Z + ///
+ /// 2026-09-15T21:20:00Z + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + public global::System.DateTime? CreatedAt { get; set; } + + /// + /// Time the image was last updated.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:25:00Z + ///
+ /// 2026-09-16T21:25:00Z + [global::System.Text.Json.Serialization.JsonPropertyName("updated_at")] + public global::System.DateTime? UpdatedAt { get; set; } + + /// + /// Most recent deployment time across all tags, if deployed.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:26:58.545765901Z + ///
+ /// 2026-09-16T21:26:58.545765901Z + [global::System.Text.Json.Serialization.JsonPropertyName("last_deployed_at")] + public global::System.DateTime? LastDeployedAt { get; set; } + + /// + /// Total repository size in bytes.
+ /// Included only in responses
+ /// Example: 260046848 + ///
+ /// 260046848 + [global::System.Text.Json.Serialization.JsonPropertyName("size")] + public long? Size { get; set; } + + /// + /// Number of image versions in the repository.
+ /// Included only in responses
+ /// Example: 2 + ///
+ /// 2 + [global::System.Text.Json.Serialization.JsonPropertyName("tag_count")] + public long? TagCount { get; set; } + + /// + /// Empty for list and get summary responses. Use GET /sandboxes/images/{image_name}/tags to retrieve paginated image versions.
+ /// Example: [{"name":"latest","created_at":"2026-09-16T21:20:00Z","updated_at":"2026-09-16T21:25:00Z","size":134217728}, {"name":"20260915212000","created_at":"2026-09-15T21:20:00Z","updated_at":"2026-09-15T21:25:00Z","size":125829120}] + ///
+ /// [{"name":"latest","created_at":"2026-09-16T21:20:00Z","updated_at":"2026-09-16T21:25:00Z","size":134217728}, {"name":"20260915212000","created_at":"2026-09-15T21:20:00Z","updated_at":"2026-09-15T21:25:00Z","size":125829120}] + [global::System.Text.Json.Serialization.JsonPropertyName("tags")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Tags { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Stable repository name supplied when pushing the image.
+ /// Example: base-image + /// + /// + /// Image processing status. Only BUILT images are ready to use.
+ /// Example: BUILT + /// + /// + /// Empty for list and get summary responses. Use GET /sandboxes/images/{image_name}/tags to retrieve paginated image versions.
+ /// Example: [{"name":"latest","created_at":"2026-09-16T21:20:00Z","updated_at":"2026-09-16T21:25:00Z","size":134217728}, {"name":"20260915212000","created_at":"2026-09-15T21:20:00Z","updated_at":"2026-09-15T21:25:00Z","size":125829120}] + /// + /// + /// Human-readable image repository name.
+ /// Example: b10/base-image + /// + /// + /// Time the image was created.
+ /// Included only in responses
+ /// Example: 2026-09-15T21:20:00Z + /// + /// + /// Time the image was last updated.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:25:00Z + /// + /// + /// Most recent deployment time across all tags, if deployed.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:26:58.545765901Z + /// + /// + /// Total repository size in bytes.
+ /// Included only in responses
+ /// Example: 260046848 + /// + /// + /// Number of image versions in the repository.
+ /// Included only in responses
+ /// Example: 2 + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ImageV1( + string name, + global::Baseten.ImageStatusV1 status, + global::System.Collections.Generic.IList tags, + string? displayName, + global::System.DateTime? createdAt, + global::System.DateTime? updatedAt, + global::System.DateTime? lastDeployedAt, + long? size, + long? tagCount) + { + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.DisplayName = displayName; + this.Status = status; + this.CreatedAt = createdAt; + this.UpdatedAt = updatedAt; + this.LastDeployedAt = lastDeployedAt; + this.Size = size; + this.TagCount = tagCount; + this.Tags = tags ?? throw new global::System.ArgumentNullException(nameof(tags)); + } + + /// + /// Initializes a new instance of the class. + /// + public ImageV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.ListImageTagsResponseV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ListImageTagsResponseV1.Json.g.cs new file mode 100644 index 0000000..f39a212 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ListImageTagsResponseV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class ListImageTagsResponseV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.ListImageTagsResponseV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.ListImageTagsResponseV1), + jsonSerializerContext) as global::Baseten.ListImageTagsResponseV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.ListImageTagsResponseV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.ListImageTagsResponseV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.ListImageTagsResponseV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.ListImageTagsResponseV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.ListImageTagsResponseV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ListImageTagsResponseV1.g.cs new file mode 100644 index 0000000..e12ad91 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ListImageTagsResponseV1.g.cs @@ -0,0 +1,60 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// One page of image tags. + /// + public sealed partial class ListImageTagsResponseV1 + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("items")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Items { get; set; } + + /// + /// Cursor pagination information. The cursor is present only when another page is available.
+ /// Example: {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + ///
+ /// {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + [global::System.Text.Json.Serialization.JsonPropertyName("pagination")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Baseten.SandboxApiPaginationV1 Pagination { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// Cursor pagination information. The cursor is present only when another page is available.
+ /// Example: {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ListImageTagsResponseV1( + global::System.Collections.Generic.IList items, + global::Baseten.SandboxApiPaginationV1 pagination) + { + this.Items = items ?? throw new global::System.ArgumentNullException(nameof(items)); + this.Pagination = pagination ?? throw new global::System.ArgumentNullException(nameof(pagination)); + } + + /// + /// Initializes a new instance of the class. + /// + public ListImageTagsResponseV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.ListImagesResponseV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ListImagesResponseV1.Json.g.cs new file mode 100644 index 0000000..1025d67 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ListImagesResponseV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class ListImagesResponseV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.ListImagesResponseV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.ListImagesResponseV1), + jsonSerializerContext) as global::Baseten.ListImagesResponseV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.ListImagesResponseV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.ListImagesResponseV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.ListImagesResponseV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.ListImagesResponseV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.ListImagesResponseV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ListImagesResponseV1.g.cs new file mode 100644 index 0000000..d75c430 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ListImagesResponseV1.g.cs @@ -0,0 +1,62 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// One page of image repository summaries. Fetch tags through the separate tag listing endpoint. + /// + public sealed partial class ListImagesResponseV1 + { + /// + /// Image repositories on this page. + /// + [global::System.Text.Json.Serialization.JsonPropertyName("items")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Items { get; set; } + + /// + /// Cursor pagination information. The cursor is present only when another page is available.
+ /// Example: {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + ///
+ /// {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + [global::System.Text.Json.Serialization.JsonPropertyName("pagination")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Baseten.SandboxApiPaginationV1 Pagination { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Image repositories on this page. + /// + /// + /// Cursor pagination information. The cursor is present only when another page is available.
+ /// Example: {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ListImagesResponseV1( + global::System.Collections.Generic.IList items, + global::Baseten.SandboxApiPaginationV1 pagination) + { + this.Items = items ?? throw new global::System.ArgumentNullException(nameof(items)); + this.Pagination = pagination ?? throw new global::System.ArgumentNullException(nameof(pagination)); + } + + /// + /// Initializes a new instance of the class. + /// + public ListImagesResponseV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.ListSandboxesResponseV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ListSandboxesResponseV1.Json.g.cs new file mode 100644 index 0000000..e26c524 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ListSandboxesResponseV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class ListSandboxesResponseV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.ListSandboxesResponseV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.ListSandboxesResponseV1), + jsonSerializerContext) as global::Baseten.ListSandboxesResponseV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.ListSandboxesResponseV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.ListSandboxesResponseV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.ListSandboxesResponseV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.ListSandboxesResponseV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.ListSandboxesResponseV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.ListSandboxesResponseV1.g.cs new file mode 100644 index 0000000..0cfc114 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.ListSandboxesResponseV1.g.cs @@ -0,0 +1,66 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// One page of sandboxes.
+ /// Example: {"items":[{"enabled":true,"lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"network":{"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"}}]},"subnet":"default"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","memory":4096,"ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering"},"name":"baseten-api-review-0916","url":"https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run","status":"DEPLOYED","state":"RUNNING","created_at":"2026-09-16T21:26:58.545765901Z","updated_at":"2026-09-16T21:31:13Z","created_by":"sandbox-automation","updated_by":"sandbox-automation","last_used_at":"2026-09-16T21:31:13Z","expires_in":86400}],"pagination":{"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"}} + ///
+ public sealed partial class ListSandboxesResponseV1 + { + /// + /// Resources on this page.
+ /// Example: [{"enabled":true,"lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"network":{"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"}}]},"subnet":"default"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","memory":4096,"ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering"},"name":"baseten-api-review-0916","url":"https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run","status":"DEPLOYED","state":"RUNNING","created_at":"2026-09-16T21:26:58.545765901Z","updated_at":"2026-09-16T21:31:13Z","created_by":"sandbox-automation","updated_by":"sandbox-automation","last_used_at":"2026-09-16T21:31:13Z","expires_in":86400}] + ///
+ /// [{"enabled":true,"lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"network":{"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"}}]},"subnet":"default"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","memory":4096,"ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering"},"name":"baseten-api-review-0916","url":"https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run","status":"DEPLOYED","state":"RUNNING","created_at":"2026-09-16T21:26:58.545765901Z","updated_at":"2026-09-16T21:31:13Z","created_by":"sandbox-automation","updated_by":"sandbox-automation","last_used_at":"2026-09-16T21:31:13Z","expires_in":86400}] + [global::System.Text.Json.Serialization.JsonPropertyName("items")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.Collections.Generic.IList Items { get; set; } + + /// + /// Cursor pagination information. The cursor is present only when another page is available.
+ /// Example: {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + ///
+ /// {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + [global::System.Text.Json.Serialization.JsonPropertyName("pagination")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Baseten.SandboxApiPaginationV1 Pagination { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Resources on this page.
+ /// Example: [{"enabled":true,"lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"network":{"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"}}]},"subnet":"default"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","memory":4096,"ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering"},"name":"baseten-api-review-0916","url":"https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run","status":"DEPLOYED","state":"RUNNING","created_at":"2026-09-16T21:26:58.545765901Z","updated_at":"2026-09-16T21:31:13Z","created_by":"sandbox-automation","updated_by":"sandbox-automation","last_used_at":"2026-09-16T21:31:13Z","expires_in":86400}] + /// + /// + /// Cursor pagination information. The cursor is present only when another page is available.
+ /// Example: {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ListSandboxesResponseV1( + global::System.Collections.Generic.IList items, + global::Baseten.SandboxApiPaginationV1 pagination) + { + this.Items = items ?? throw new global::System.ArgumentNullException(nameof(items)); + this.Pagination = pagination ?? throw new global::System.ArgumentNullException(nameof(pagination)); + } + + /// + /// Initializes a new instance of the class. + /// + public ListSandboxesResponseV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.PushImageRequestV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.PushImageRequestV1.Json.g.cs new file mode 100644 index 0000000..69d1199 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.PushImageRequestV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class PushImageRequestV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.PushImageRequestV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.PushImageRequestV1), + jsonSerializerContext) as global::Baseten.PushImageRequestV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.PushImageRequestV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.PushImageRequestV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.PushImageRequestV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.PushImageRequestV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.PushImageRequestV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.PushImageRequestV1.g.cs new file mode 100644 index 0000000..549987e --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.PushImageRequestV1.g.cs @@ -0,0 +1,81 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Push a sandbox image from a source archive or an existing registry image.
+ /// Example: {"name":"base-image","image":"docker.io/b10/base-image:latest","docker_config":"{\u0022auths\u0022:{\u0022https://index.docker.io/v1/\u0022:{\u0022auth\u0022:\u0022YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu\u0022}}}"} + ///
+ public sealed partial class PushImageRequestV1 + { + /// + /// Target image repository name. Reusing a name pushes a new version to the existing repository.
+ /// Example: base-image + ///
+ /// base-image + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// Optional source registry image reference including a registry hostname. When omitted, the response provides an archive upload URL.
+ /// Example: docker.io/b10/base-image:latest + ///
+ /// docker.io/b10/base-image:latest + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + public string? Image { get; set; } + + /// + /// Optional serialized registry authentication configuration for importing a private image. Used only when image is supplied; never returned.
+ /// Included only in requests
+ /// Example: {"auths":{"https://index.docker.io/v1/":{"auth":"YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu"}}} + ///
+ /// {"auths":{"https://index.docker.io/v1/":{"auth":"YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu"}}} + [global::System.Text.Json.Serialization.JsonPropertyName("docker_config")] + public string? DockerConfig { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Target image repository name. Reusing a name pushes a new version to the existing repository.
+ /// Example: base-image + /// + /// + /// Optional source registry image reference including a registry hostname. When omitted, the response provides an archive upload URL.
+ /// Example: docker.io/b10/base-image:latest + /// + /// + /// Optional serialized registry authentication configuration for importing a private image. Used only when image is supplied; never returned.
+ /// Included only in requests
+ /// Example: {"auths":{"https://index.docker.io/v1/":{"auth":"YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu"}}} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public PushImageRequestV1( + string name, + string? image, + string? dockerConfig) + { + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Image = image; + this.DockerConfig = dockerConfig; + } + + /// + /// Initializes a new instance of the class. + /// + public PushImageRequestV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.PushImageResponseV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.PushImageResponseV1.Json.g.cs new file mode 100644 index 0000000..80858e2 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.PushImageResponseV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class PushImageResponseV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.PushImageResponseV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.PushImageResponseV1), + jsonSerializerContext) as global::Baseten.PushImageResponseV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.PushImageResponseV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.PushImageResponseV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.PushImageResponseV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.PushImageResponseV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.PushImageResponseV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.PushImageResponseV1.g.cs new file mode 100644 index 0000000..cb0a357 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.PushImageResponseV1.g.cs @@ -0,0 +1,95 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Accepted image push. Acceptance does not imply readiness; poll GET /sandboxes/images/{image_name} until status is BUILT or FAILED.
+ /// Example: {"name":"base-image","status":"BUILDING","image":"b10/base-image:latest"} + ///
+ public sealed partial class PushImageResponseV1 + { + /// + /// Target image repository name.
+ /// Example: base-image + ///
+ /// base-image + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Name { get; set; } + + /// + /// Image processing status. Only BUILT images are ready to use.
+ /// Example: BUILDING + ///
+ /// BUILDING + [global::System.Text.Json.Serialization.JsonPropertyName("status")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.ImageStatusV1JsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Baseten.ImageStatusV1 Status { get; set; } + + /// + /// Temporary signed URL for uploading the source ZIP archive with HTTP PUT. Present only when no source image was supplied. Uploading starts asynchronous processing. This storage upload is separate from the API endpoints.
+ /// Example: https://uploads.b10.run/images/base-image/20260916212658/source.zip?expires=2026-09-16T22%3A26%3A58Z&signature=demo-not-a-valid-upload-signature + ///
+ /// https://uploads.b10.run/images/base-image/20260916212658/source.zip?expires=2026-09-16T22%3A26%3A58Z&signature=demo-not-a-valid-upload-signature + [global::System.Text.Json.Serialization.JsonPropertyName("upload_url")] + public string? UploadUrl { get; set; } + + /// + /// Registered image reference including its tag, when available. Tags are assigned by the service; GET /sandboxes/images/{image_name} returns the available tags once processing completes.
+ /// Example: b10/base-image:latest + ///
+ /// b10/base-image:latest + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + public string? Image { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Target image repository name.
+ /// Example: base-image + /// + /// + /// Image processing status. Only BUILT images are ready to use.
+ /// Example: BUILDING + /// + /// + /// Temporary signed URL for uploading the source ZIP archive with HTTP PUT. Present only when no source image was supplied. Uploading starts asynchronous processing. This storage upload is separate from the API endpoints.
+ /// Example: https://uploads.b10.run/images/base-image/20260916212658/source.zip?expires=2026-09-16T22%3A26%3A58Z&signature=demo-not-a-valid-upload-signature + /// + /// + /// Registered image reference including its tag, when available. Tags are assigned by the service; GET /sandboxes/images/{image_name} returns the available tags once processing completes.
+ /// Example: b10/base-image:latest + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public PushImageResponseV1( + string name, + global::Baseten.ImageStatusV1 status, + string? uploadUrl, + string? image) + { + this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name)); + this.Status = status; + this.UploadUrl = uploadUrl; + this.Image = image; + } + + /// + /// Initializes a new instance of the class. + /// + public PushImageResponseV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxApiPaginationV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxApiPaginationV1.Json.g.cs new file mode 100644 index 0000000..5ebfeec --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxApiPaginationV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxApiPaginationV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxApiPaginationV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxApiPaginationV1), + jsonSerializerContext) as global::Baseten.SandboxApiPaginationV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxApiPaginationV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxApiPaginationV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxApiPaginationV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxApiPaginationV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxApiPaginationV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxApiPaginationV1.g.cs new file mode 100644 index 0000000..2a8941b --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxApiPaginationV1.g.cs @@ -0,0 +1,65 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Cursor pagination information. The cursor is present only when another page is available.
+ /// Example: {"has_more":true,"cursor":"eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ"} + ///
+ public sealed partial class SandboxApiPaginationV1 + { + /// + /// Whether another page is available.
+ /// Example: true + ///
+ /// true + [global::System.Text.Json.Serialization.JsonPropertyName("has_more")] + [global::System.Text.Json.Serialization.JsonRequired] + public required bool HasMore { get; set; } + + /// + /// Opaque cursor to pass to the next list request. Keep the same filters.
+ /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + ///
+ /// eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + [global::System.Text.Json.Serialization.JsonPropertyName("cursor")] + public string? Cursor { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Whether another page is available.
+ /// Example: true + /// + /// + /// Opaque cursor to pass to the next list request. Keep the same filters.
+ /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxApiPaginationV1( + bool hasMore, + string? cursor) + { + this.HasMore = hasMore; + this.Cursor = cursor; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxApiPaginationV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxConfigurationV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxConfigurationV1.Json.g.cs new file mode 100644 index 0000000..a652380 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxConfigurationV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxConfigurationV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxConfigurationV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxConfigurationV1), + jsonSerializerContext) as global::Baseten.SandboxConfigurationV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxConfigurationV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxConfigurationV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxConfigurationV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxConfigurationV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxConfigurationV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxConfigurationV1.g.cs new file mode 100644 index 0000000..36f14d2 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxConfigurationV1.g.cs @@ -0,0 +1,192 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Writable sandbox configuration. Fields are serialized at the root of the request or resource.
+ /// Example: {"enabled":true,"lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"network":{"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","memory":4096,"ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering"}} + ///
+ public sealed partial class SandboxConfigurationV1 + { + /// + /// When false, the sandbox is disabled and will not accept connections
+ /// Default Value: true
+ /// Example: true + ///
+ /// true + [global::System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + ///
+ /// {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + [global::System.Text.Json.Serialization.JsonPropertyName("lifecycle")] + public global::Baseten.SandboxLifecycleV1? Lifecycle { get; set; } + + /// + /// Network configuration for a sandbox including subnet, domain filtering, and proxy settings
+ /// Example: {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + ///
+ /// {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + [global::System.Text.Json.Serialization.JsonPropertyName("network")] + public global::Baseten.SandboxNetworkV1? Network { get; set; } + + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + ///
+ /// us-pdx-1 + [global::System.Text.Json.Serialization.JsonPropertyName("region")] + public string? Region { get; set; } + + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + ///
+ /// [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + [global::System.Text.Json.Serialization.JsonPropertyName("envs")] + public global::System.Collections.Generic.IList? Envs { get; set; } + + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + ///
+ /// blaxel/base-image:latest + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + public string? Image { get; set; } + + /// + /// Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
+ /// Example: 4096 + ///
+ /// 4096 + [global::System.Text.Json.Serialization.JsonPropertyName("memory")] + public long? Memory { get; set; } + + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + ///
+ /// [{"name":"http","protocol":"HTTP","target":3000}] + [global::System.Text.Json.Serialization.JsonPropertyName("ports")] + public global::System.Collections.Generic.IList? Ports { get; set; } + + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review + ///
+ /// Baseten API review + [global::System.Text.Json.Serialization.JsonPropertyName("display_name")] + public string? DisplayName { get; set; } + + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + ///
+ /// api-review-20260916-001 + [global::System.Text.Json.Serialization.JsonPropertyName("external_id")] + public string? ExternalId { get; set; } + + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering"} + ///
+ /// {"env":"development","project":"api-review","team":"engineering"} + [global::System.Text.Json.Serialization.JsonPropertyName("labels")] + public global::System.Collections.Generic.Dictionary? Labels { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// When false, the sandbox is disabled and will not accept connections
+ /// Default Value: true
+ /// Example: true + /// + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + /// + /// + /// Network configuration for a sandbox including subnet, domain filtering, and proxy settings
+ /// Example: {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + /// + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + /// + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + /// + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + /// + /// + /// Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
+ /// Example: 4096 + /// + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + /// + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review + /// + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + /// + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering"} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxConfigurationV1( + bool? enabled, + global::Baseten.SandboxLifecycleV1? lifecycle, + global::Baseten.SandboxNetworkV1? network, + string? region, + global::System.Collections.Generic.IList? envs, + string? image, + long? memory, + global::System.Collections.Generic.IList? ports, + string? displayName, + string? externalId, + global::System.Collections.Generic.Dictionary? labels) + { + this.Enabled = enabled; + this.Lifecycle = lifecycle; + this.Network = network; + this.Region = region; + this.Envs = envs; + this.Image = image; + this.Memory = memory; + this.Ports = ports; + this.DisplayName = displayName; + this.ExternalId = externalId; + this.Labels = labels; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxConfigurationV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1.Json.g.cs new file mode 100644 index 0000000..822e8ec --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxDateExpirationPolicyV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxDateExpirationPolicyV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxDateExpirationPolicyV1), + jsonSerializerContext) as global::Baseten.SandboxDateExpirationPolicyV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxDateExpirationPolicyV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxDateExpirationPolicyV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxDateExpirationPolicyV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxDateExpirationPolicyV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1.g.cs new file mode 100644 index 0000000..b4dc7de --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1.g.cs @@ -0,0 +1,68 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Delete at the specified absolute timestamp. + /// + public sealed partial class SandboxDateExpirationPolicyV1 + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("action")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1ActionJsonConverter))] + public global::Baseten.SandboxDateExpirationPolicyV1Action Action { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1TypeJsonConverter))] + public global::Baseten.SandboxDateExpirationPolicyV1Type Type { get; set; } + + /// + /// Example: 2026-09-23T21:26:58Z + /// + /// 2026-09-23T21:26:58Z + [global::System.Text.Json.Serialization.JsonPropertyName("value")] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::System.DateTime Value { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Example: 2026-09-23T21:26:58Z + /// + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxDateExpirationPolicyV1( + global::System.DateTime value, + global::Baseten.SandboxDateExpirationPolicyV1Action action, + global::Baseten.SandboxDateExpirationPolicyV1Type type) + { + this.Action = action; + this.Type = type; + this.Value = value; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxDateExpirationPolicyV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1Action.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1Action.g.cs new file mode 100644 index 0000000..8256312 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1Action.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + public enum SandboxDateExpirationPolicyV1Action + { + /// + /// + /// + Delete, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxDateExpirationPolicyV1ActionExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxDateExpirationPolicyV1Action value) + { + return value switch + { + SandboxDateExpirationPolicyV1Action.Delete => "DELETE", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxDateExpirationPolicyV1Action? ToEnum(string value) + { + return value switch + { + "DELETE" => SandboxDateExpirationPolicyV1Action.Delete, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1Type.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1Type.g.cs new file mode 100644 index 0000000..cf1409b --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxDateExpirationPolicyV1Type.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + public enum SandboxDateExpirationPolicyV1Type + { + /// + /// + /// + Date, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxDateExpirationPolicyV1TypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxDateExpirationPolicyV1Type value) + { + return value switch + { + SandboxDateExpirationPolicyV1Type.Date => "DATE", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxDateExpirationPolicyV1Type? ToEnum(string value) + { + return value switch + { + "DATE" => SandboxDateExpirationPolicyV1Type.Date, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxEnvV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxEnvV1.Json.g.cs new file mode 100644 index 0000000..7cdc97f --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxEnvV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxEnvV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxEnvV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxEnvV1), + jsonSerializerContext) as global::Baseten.SandboxEnvV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxEnvV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxEnvV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxEnvV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxEnvV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxEnvV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxEnvV1.g.cs new file mode 100644 index 0000000..451539d --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxEnvV1.g.cs @@ -0,0 +1,78 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Environment variable with name and value
+ /// Example: {"name":"NODE_ENV","secret":false,"value":"production"} + ///
+ public sealed partial class SandboxEnvV1 + { + /// + /// Name of the environment variable
+ /// Example: NODE_ENV + ///
+ /// NODE_ENV + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// Whether the value is a secret
+ /// Example: false + ///
+ /// false + [global::System.Text.Json.Serialization.JsonPropertyName("secret")] + public bool? Secret { get; set; } + + /// + /// Value of the environment variable
+ /// Example: production + ///
+ /// production + [global::System.Text.Json.Serialization.JsonPropertyName("value")] + public string? Value { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Name of the environment variable
+ /// Example: NODE_ENV + /// + /// + /// Whether the value is a secret
+ /// Example: false + /// + /// + /// Value of the environment variable
+ /// Example: production + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxEnvV1( + string? name, + bool? secret, + string? value) + { + this.Name = name; + this.Secret = secret; + this.Value = value; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxEnvV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1.Json.g.cs new file mode 100644 index 0000000..e060117 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public readonly partial struct SandboxExpirationPolicyV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxExpirationPolicyV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxExpirationPolicyV1), + jsonSerializerContext) as global::Baseten.SandboxExpirationPolicyV1?; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxExpirationPolicyV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxExpirationPolicyV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxExpirationPolicyV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxExpirationPolicyV1?; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1.g.cs new file mode 100644 index 0000000..121bc44 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1.g.cs @@ -0,0 +1,386 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Baseten +{ + /// + /// Expiration policy. The type determines whether value is a duration or an absolute timestamp. + /// + public readonly partial struct SandboxExpirationPolicyV1 : global::System.IEquatable + { + /// + /// + /// + public global::Baseten.SandboxExpirationPolicyV1DiscriminatorType? Type { get; } + + /// + /// Delete after the specified period of inactivity. + /// +#if NET6_0_OR_GREATER + public global::Baseten.SandboxTTLIdleExpirationPolicyV1? TtlIdle { get; init; } +#else + public global::Baseten.SandboxTTLIdleExpirationPolicyV1? TtlIdle { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(TtlIdle))] +#endif + public bool IsTtlIdle => TtlIdle != null; + + /// + /// + /// + public bool TryPickTtlIdle( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Baseten.SandboxTTLIdleExpirationPolicyV1? value) + { + value = TtlIdle; + return IsTtlIdle; + } + + /// + /// + /// + public global::Baseten.SandboxTTLIdleExpirationPolicyV1 PickTtlIdle() => TtlIdle is { } value + ? value + : throw new global::System.InvalidOperationException($"Expected union variant 'TtlIdle' but the value was {ToString()}."); + + /// + /// Delete after the specified total lifetime. + /// +#if NET6_0_OR_GREATER + public global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? TtlMaxAge { get; init; } +#else + public global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? TtlMaxAge { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(TtlMaxAge))] +#endif + public bool IsTtlMaxAge => TtlMaxAge != null; + + /// + /// + /// + public bool TryPickTtlMaxAge( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? value) + { + value = TtlMaxAge; + return IsTtlMaxAge; + } + + /// + /// + /// + public global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1 PickTtlMaxAge() => TtlMaxAge is { } value + ? value + : throw new global::System.InvalidOperationException($"Expected union variant 'TtlMaxAge' but the value was {ToString()}."); + + /// + /// Delete at the specified absolute timestamp. + /// +#if NET6_0_OR_GREATER + public global::Baseten.SandboxDateExpirationPolicyV1? Date { get; init; } +#else + public global::Baseten.SandboxDateExpirationPolicyV1? Date { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Date))] +#endif + public bool IsDate => Date != null; + + /// + /// + /// + public bool TryPickDate( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Baseten.SandboxDateExpirationPolicyV1? value) + { + value = Date; + return IsDate; + } + + /// + /// + /// + public global::Baseten.SandboxDateExpirationPolicyV1 PickDate() => Date is { } value + ? value + : throw new global::System.InvalidOperationException($"Expected union variant 'Date' but the value was {ToString()}."); + /// + /// + /// + public static implicit operator SandboxExpirationPolicyV1(global::Baseten.SandboxTTLIdleExpirationPolicyV1 value) => new SandboxExpirationPolicyV1((global::Baseten.SandboxTTLIdleExpirationPolicyV1?)value); + + /// + /// + /// + public static implicit operator global::Baseten.SandboxTTLIdleExpirationPolicyV1?(SandboxExpirationPolicyV1 @this) => @this.TtlIdle; + + /// + /// + /// + public SandboxExpirationPolicyV1(global::Baseten.SandboxTTLIdleExpirationPolicyV1? value) + { + TtlIdle = value; + } + + /// + /// + /// + public static SandboxExpirationPolicyV1 FromTtlIdle(global::Baseten.SandboxTTLIdleExpirationPolicyV1? value) => new SandboxExpirationPolicyV1(value); + + /// + /// + /// + public static implicit operator SandboxExpirationPolicyV1(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1 value) => new SandboxExpirationPolicyV1((global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1?)value); + + /// + /// + /// + public static implicit operator global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1?(SandboxExpirationPolicyV1 @this) => @this.TtlMaxAge; + + /// + /// + /// + public SandboxExpirationPolicyV1(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? value) + { + TtlMaxAge = value; + } + + /// + /// + /// + public static SandboxExpirationPolicyV1 FromTtlMaxAge(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? value) => new SandboxExpirationPolicyV1(value); + + /// + /// + /// + public static implicit operator SandboxExpirationPolicyV1(global::Baseten.SandboxDateExpirationPolicyV1 value) => new SandboxExpirationPolicyV1((global::Baseten.SandboxDateExpirationPolicyV1?)value); + + /// + /// + /// + public static implicit operator global::Baseten.SandboxDateExpirationPolicyV1?(SandboxExpirationPolicyV1 @this) => @this.Date; + + /// + /// + /// + public SandboxExpirationPolicyV1(global::Baseten.SandboxDateExpirationPolicyV1? value) + { + Date = value; + } + + /// + /// + /// + public static SandboxExpirationPolicyV1 FromDate(global::Baseten.SandboxDateExpirationPolicyV1? value) => new SandboxExpirationPolicyV1(value); + + /// + /// + /// + public SandboxExpirationPolicyV1( + global::Baseten.SandboxExpirationPolicyV1DiscriminatorType? type, + global::Baseten.SandboxTTLIdleExpirationPolicyV1? ttlIdle, + global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? ttlMaxAge, + global::Baseten.SandboxDateExpirationPolicyV1? date + ) + { + Type = type; + + TtlIdle = ttlIdle; + TtlMaxAge = ttlMaxAge; + Date = date; + } + + /// + /// + /// + public object? Object => + Date as object ?? + TtlMaxAge as object ?? + TtlIdle as object + ; + + /// + /// + /// + public override string? ToString() => + TtlIdle?.ToString() ?? + TtlMaxAge?.ToString() ?? + Date?.ToString() + ; + + /// + /// + /// + public bool Validate() + { + return IsTtlIdle && !IsTtlMaxAge && !IsDate || !IsTtlIdle && IsTtlMaxAge && !IsDate || !IsTtlIdle && !IsTtlMaxAge && IsDate; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? ttlIdle = null, + global::System.Func? ttlMaxAge = null, + global::System.Func? date = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (TtlIdle is { } __value0 && ttlIdle != null) + { + return ttlIdle(__value0); + } + else if (TtlMaxAge is { } __value1 && ttlMaxAge != null) + { + return ttlMaxAge(__value1); + } + else if (Date is { } __value2 && date != null) + { + return date(__value2); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? ttlIdle = null, + + global::System.Action? ttlMaxAge = null, + + global::System.Action? date = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (TtlIdle is { } __value0) + { + ttlIdle?.Invoke(__value0); + } + else if (TtlMaxAge is { } __value1) + { + ttlMaxAge?.Invoke(__value1); + } + else if (Date is { } __value2) + { + date?.Invoke(__value2); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? ttlIdle = null, + global::System.Action? ttlMaxAge = null, + global::System.Action? date = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (TtlIdle is { } __value0) + { + ttlIdle?.Invoke(__value0); + } + else if (TtlMaxAge is { } __value1) + { + ttlMaxAge?.Invoke(__value1); + } + else if (Date is { } __value2) + { + date?.Invoke(__value2); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + TtlIdle, + typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1), + TtlMaxAge, + typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1), + Date, + typeof(global::Baseten.SandboxDateExpirationPolicyV1), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(SandboxExpirationPolicyV1 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(TtlIdle, other.TtlIdle) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(TtlMaxAge, other.TtlMaxAge) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(Date, other.Date) + ; + } + + /// + /// + /// + public static bool operator ==(SandboxExpirationPolicyV1 obj1, SandboxExpirationPolicyV1 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(SandboxExpirationPolicyV1 obj1, SandboxExpirationPolicyV1 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is SandboxExpirationPolicyV1 o && Equals(o); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1Discriminator.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1Discriminator.Json.g.cs new file mode 100644 index 0000000..03a2379 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1Discriminator.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxExpirationPolicyV1Discriminator + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxExpirationPolicyV1Discriminator? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxExpirationPolicyV1Discriminator), + jsonSerializerContext) as global::Baseten.SandboxExpirationPolicyV1Discriminator; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxExpirationPolicyV1Discriminator? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxExpirationPolicyV1Discriminator? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxExpirationPolicyV1Discriminator), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxExpirationPolicyV1Discriminator; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1Discriminator.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1Discriminator.g.cs new file mode 100644 index 0000000..c8e2a72 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1Discriminator.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + public sealed partial class SandboxExpirationPolicyV1Discriminator + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorTypeJsonConverter))] + public global::Baseten.SandboxExpirationPolicyV1DiscriminatorType? Type { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxExpirationPolicyV1Discriminator( + global::Baseten.SandboxExpirationPolicyV1DiscriminatorType? type) + { + this.Type = type; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxExpirationPolicyV1Discriminator() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1DiscriminatorType.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1DiscriminatorType.g.cs new file mode 100644 index 0000000..b82583a --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxExpirationPolicyV1DiscriminatorType.g.cs @@ -0,0 +1,57 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + public enum SandboxExpirationPolicyV1DiscriminatorType + { + /// + /// + /// + Date, + /// + /// + /// + TtlIdle, + /// + /// + /// + TtlMaxAge, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxExpirationPolicyV1DiscriminatorTypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxExpirationPolicyV1DiscriminatorType value) + { + return value switch + { + SandboxExpirationPolicyV1DiscriminatorType.Date => "DATE", + SandboxExpirationPolicyV1DiscriminatorType.TtlIdle => "TTL_IDLE", + SandboxExpirationPolicyV1DiscriminatorType.TtlMaxAge => "TTL_MAX_AGE", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxExpirationPolicyV1DiscriminatorType? ToEnum(string value) + { + return value switch + { + "DATE" => SandboxExpirationPolicyV1DiscriminatorType.Date, + "TTL_IDLE" => SandboxExpirationPolicyV1DiscriminatorType.TtlIdle, + "TTL_MAX_AGE" => SandboxExpirationPolicyV1DiscriminatorType.TtlMaxAge, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxLifecycleV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxLifecycleV1.Json.g.cs new file mode 100644 index 0000000..dd5c896 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxLifecycleV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxLifecycleV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxLifecycleV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxLifecycleV1), + jsonSerializerContext) as global::Baseten.SandboxLifecycleV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxLifecycleV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxLifecycleV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxLifecycleV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxLifecycleV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxLifecycleV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxLifecycleV1.g.cs new file mode 100644 index 0000000..cdf108f --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxLifecycleV1.g.cs @@ -0,0 +1,64 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + ///
+ public sealed partial class SandboxLifecycleV1 + { + /// + /// List of expiration policies. Multiple policies can be combined; whichever condition is met first triggers the action.
+ /// Example: [{"action":"DELETE","type":"TTL_IDLE","value":"24h"}, {"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"}, {"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}] + ///
+ /// [{"action":"DELETE","type":"TTL_IDLE","value":"24h"}, {"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"}, {"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}] + [global::System.Text.Json.Serialization.JsonPropertyName("expiration_policies")] + public global::System.Collections.Generic.IList? ExpirationPolicies { get; set; } + + /// + /// Duration to keep the sandbox record after termination for log access (e.g., '1h', '24h', '7d'). Defaults to 5m. Subject to maximum quota limits.
+ /// Example: 24h + ///
+ /// 24h + [global::System.Text.Json.Serialization.JsonPropertyName("terminated_retention")] + public string? TerminatedRetention { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// List of expiration policies. Multiple policies can be combined; whichever condition is met first triggers the action.
+ /// Example: [{"action":"DELETE","type":"TTL_IDLE","value":"24h"}, {"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"}, {"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}] + /// + /// + /// Duration to keep the sandbox record after termination for log access (e.g., '1h', '24h', '7d'). Defaults to 5m. Subject to maximum quota limits.
+ /// Example: 24h + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxLifecycleV1( + global::System.Collections.Generic.IList? expirationPolicies, + string? terminatedRetention) + { + this.ExpirationPolicies = expirationPolicies; + this.TerminatedRetention = terminatedRetention; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxLifecycleV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxMetadataLabelsV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxMetadataLabelsV1.Json.g.cs new file mode 100644 index 0000000..d8e973b --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxMetadataLabelsV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxMetadataLabelsV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxMetadataLabelsV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxMetadataLabelsV1), + jsonSerializerContext) as global::Baseten.SandboxMetadataLabelsV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxMetadataLabelsV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxMetadataLabelsV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxMetadataLabelsV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxMetadataLabelsV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxMetadataLabelsV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxMetadataLabelsV1.g.cs new file mode 100644 index 0000000..1e94752 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxMetadataLabelsV1.g.cs @@ -0,0 +1,20 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering"} + ///
+ public sealed partial class SandboxMetadataLabelsV1 + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxNetworkV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxNetworkV1.Json.g.cs new file mode 100644 index 0000000..4a06c49 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxNetworkV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxNetworkV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxNetworkV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxNetworkV1), + jsonSerializerContext) as global::Baseten.SandboxNetworkV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxNetworkV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxNetworkV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxNetworkV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxNetworkV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxNetworkV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxNetworkV1.g.cs new file mode 100644 index 0000000..9205377 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxNetworkV1.g.cs @@ -0,0 +1,64 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Network configuration for a sandbox including subnet, domain filtering, and proxy settings
+ /// Example: {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + ///
+ public sealed partial class SandboxNetworkV1 + { + /// + /// Proxy configuration for routing sandbox HTTP traffic through the platform proxy with MITM inspection and per-destination header/body injection
+ /// Example: {"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]} + ///
+ /// {"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]} + [global::System.Text.Json.Serialization.JsonPropertyName("proxy")] + public global::Baseten.SandboxProxyConfigV1? Proxy { get; set; } + + /// + /// Subnet name for the sandbox. Defaults to "default" at creation.
+ /// Example: default + ///
+ /// default + [global::System.Text.Json.Serialization.JsonPropertyName("subnet")] + public string? Subnet { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Proxy configuration for routing sandbox HTTP traffic through the platform proxy with MITM inspection and per-destination header/body injection
+ /// Example: {"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]} + /// + /// + /// Subnet name for the sandbox. Defaults to "default" at creation.
+ /// Example: default + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxNetworkV1( + global::Baseten.SandboxProxyConfigV1? proxy, + string? subnet) + { + this.Proxy = proxy; + this.Subnet = subnet; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxNetworkV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1.Json.g.cs new file mode 100644 index 0000000..dfa24e7 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxPortV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxPortV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxPortV1), + jsonSerializerContext) as global::Baseten.SandboxPortV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxPortV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxPortV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxPortV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxPortV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1.g.cs new file mode 100644 index 0000000..460fe12 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1.g.cs @@ -0,0 +1,80 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// A port for a resource
+ /// Example: {"name":"http","protocol":"HTTP","target":3000} + ///
+ public sealed partial class SandboxPortV1 + { + /// + /// The name of the port
+ /// Example: http + ///
+ /// http + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string? Name { get; set; } + + /// + /// The protocol of the port
+ /// Example: HTTP + ///
+ /// HTTP + [global::System.Text.Json.Serialization.JsonPropertyName("protocol")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxPortV1ProtocolJsonConverter))] + public global::Baseten.SandboxPortV1Protocol? Protocol { get; set; } + + /// + /// The target port of the port
+ /// Example: 3000 + ///
+ /// 3000 + [global::System.Text.Json.Serialization.JsonPropertyName("target")] + [global::System.Text.Json.Serialization.JsonRequired] + public required int Target { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// The target port of the port
+ /// Example: 3000 + /// + /// + /// The name of the port
+ /// Example: http + /// + /// + /// The protocol of the port
+ /// Example: HTTP + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxPortV1( + int target, + string? name, + global::Baseten.SandboxPortV1Protocol? protocol) + { + this.Name = name; + this.Protocol = protocol; + this.Target = target; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxPortV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1Protocol.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1Protocol.g.cs new file mode 100644 index 0000000..33058e9 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxPortV1Protocol.g.cs @@ -0,0 +1,64 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// The protocol of the port
+ /// Example: HTTP + ///
+ public enum SandboxPortV1Protocol + { + /// + /// + /// + Http, + /// + /// + /// + Tcp, + /// + /// + /// + Tls, + /// + /// + /// + Udp, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxPortV1ProtocolExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxPortV1Protocol value) + { + return value switch + { + SandboxPortV1Protocol.Http => "HTTP", + SandboxPortV1Protocol.Tcp => "TCP", + SandboxPortV1Protocol.Tls => "TLS", + SandboxPortV1Protocol.Udp => "UDP", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxPortV1Protocol? ToEnum(string value) + { + return value switch + { + "HTTP" => SandboxPortV1Protocol.Http, + "TCP" => SandboxPortV1Protocol.Tcp, + "TLS" => SandboxPortV1Protocol.Tls, + "UDP" => SandboxPortV1Protocol.Udp, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyConfigV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyConfigV1.Json.g.cs new file mode 100644 index 0000000..d96c17c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyConfigV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxProxyConfigV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyConfigV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxProxyConfigV1), + jsonSerializerContext) as global::Baseten.SandboxProxyConfigV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyConfigV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxProxyConfigV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxProxyConfigV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxProxyConfigV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyConfigV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyConfigV1.g.cs new file mode 100644 index 0000000..79f5cfc --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyConfigV1.g.cs @@ -0,0 +1,92 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Proxy configuration for routing sandbox HTTP traffic through the platform proxy with MITM inspection and per-destination header/body injection
+ /// Example: {"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]} + ///
+ public sealed partial class SandboxProxyConfigV1 + { + /// + /// List of allowed external domains (allowlist). When set, only these domains are reachable. Supports wildcards (e.g. *.storage.example.com).
+ /// Example: [api.openai.com, pypi.org, files.pythonhosted.org, registry.npmjs.org] + ///
+ /// [api.openai.com, pypi.org, files.pythonhosted.org, registry.npmjs.org] + [global::System.Text.Json.Serialization.JsonPropertyName("allowed_domains")] + public global::System.Collections.Generic.IList? AllowedDomains { get; set; } + + /// + /// Domains that bypass the proxy entirely via the NO_PROXY directive. Traffic to these destinations goes direct, not through the CONNECT tunnel. Supports wildcards. Note that localhost, private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), 169.254.169.254, .local and .internal are always bypassed by default.
+ /// Example: [registry.npmjs.org] + ///
+ /// [registry.npmjs.org] + [global::System.Text.Json.Serialization.JsonPropertyName("bypass")] + public global::System.Collections.Generic.IList? Bypass { get; set; } + + /// + /// List of forbidden external domains (denylist). When set, all domains except these are reachable. Supports wildcards (e.g. *.malware.com). If both allowed_domains and forbidden_domains are set, allowed_domains takes precedence.
+ /// Example: [facebook.com, *.facebook.com] + ///
+ /// [facebook.com, *.facebook.com] + [global::System.Text.Json.Serialization.JsonPropertyName("forbidden_domains")] + public global::System.Collections.Generic.IList? ForbiddenDomains { get; set; } + + /// + /// Per-destination routing rules with header/body injection and secrets. Use destinations ["*"] for global rules that apply to all destinations.
+ /// Example: [{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}] + ///
+ /// [{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}] + [global::System.Text.Json.Serialization.JsonPropertyName("routing")] + public global::System.Collections.Generic.IList? Routing { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// List of allowed external domains (allowlist). When set, only these domains are reachable. Supports wildcards (e.g. *.storage.example.com).
+ /// Example: [api.openai.com, pypi.org, files.pythonhosted.org, registry.npmjs.org] + /// + /// + /// Domains that bypass the proxy entirely via the NO_PROXY directive. Traffic to these destinations goes direct, not through the CONNECT tunnel. Supports wildcards. Note that localhost, private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), 169.254.169.254, .local and .internal are always bypassed by default.
+ /// Example: [registry.npmjs.org] + /// + /// + /// List of forbidden external domains (denylist). When set, all domains except these are reachable. Supports wildcards (e.g. *.malware.com). If both allowed_domains and forbidden_domains are set, allowed_domains takes precedence.
+ /// Example: [facebook.com, *.facebook.com] + /// + /// + /// Per-destination routing rules with header/body injection and secrets. Use destinations ["*"] for global rules that apply to all destinations.
+ /// Example: [{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}] + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxProxyConfigV1( + global::System.Collections.Generic.IList? allowedDomains, + global::System.Collections.Generic.IList? bypass, + global::System.Collections.Generic.IList? forbiddenDomains, + global::System.Collections.Generic.IList? routing) + { + this.AllowedDomains = allowedDomains; + this.Bypass = bypass; + this.ForbiddenDomains = forbiddenDomains; + this.Routing = routing; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxProxyConfigV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1.Json.g.cs new file mode 100644 index 0000000..fb9f640 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxProxyTargetV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyTargetV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxProxyTargetV1), + jsonSerializerContext) as global::Baseten.SandboxProxyTargetV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyTargetV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxProxyTargetV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxProxyTargetV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxProxyTargetV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1.g.cs new file mode 100644 index 0000000..5af1359 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1.g.cs @@ -0,0 +1,94 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Routing rule that injects headers and body fields into requests matching the given destinations. Use destinations ["*"] for a global rule that applies to all proxied traffic.
+ /// Example: {"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}} + ///
+ public sealed partial class SandboxProxyTargetV1 + { + /// + /// Body fields to inject into matching requests. Values may contain {{SECRET:name}} references resolved from this rule's secrets.
+ /// Example: {"user":"baseten-api-review-0916"} + ///
+ /// {"user":"baseten-api-review-0916"} + [global::System.Text.Json.Serialization.JsonPropertyName("body")] + public global::System.Collections.Generic.Dictionary? Body { get; set; } + + /// + /// Destination domains this rule applies to. Use ["*"] for a global rule that matches all destinations.
+ /// Example: [api.openai.com] + ///
+ /// [api.openai.com] + [global::System.Text.Json.Serialization.JsonPropertyName("destinations")] + public global::System.Collections.Generic.IList? Destinations { get; set; } + + /// + /// Headers to inject into matching requests. Values may contain {{SECRET:name}} references resolved from this rule's secrets.
+ /// Example: {"Authorization":"Bearer {{SECRET:openai-key}}"} + ///
+ /// {"Authorization":"Bearer {{SECRET:openai-key}}"} + [global::System.Text.Json.Serialization.JsonPropertyName("headers")] + public global::System.Collections.Generic.Dictionary? Headers { get; set; } + + /// + /// Named secret values for this routing rule, referenced in headers/body via {{SECRET:name}}. Stored encrypted at rest. Write-only: never returned in API responses.
+ /// Included only in requests
+ /// Example: {"openai-key":"sk-proj-demo-not-a-valid-api-key"} + ///
+ /// {"openai-key":"sk-proj-demo-not-a-valid-api-key"} + [global::System.Text.Json.Serialization.JsonPropertyName("secrets")] + public global::System.Collections.Generic.Dictionary? Secrets { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Body fields to inject into matching requests. Values may contain {{SECRET:name}} references resolved from this rule's secrets.
+ /// Example: {"user":"baseten-api-review-0916"} + /// + /// + /// Destination domains this rule applies to. Use ["*"] for a global rule that matches all destinations.
+ /// Example: [api.openai.com] + /// + /// + /// Headers to inject into matching requests. Values may contain {{SECRET:name}} references resolved from this rule's secrets.
+ /// Example: {"Authorization":"Bearer {{SECRET:openai-key}}"} + /// + /// + /// Named secret values for this routing rule, referenced in headers/body via {{SECRET:name}}. Stored encrypted at rest. Write-only: never returned in API responses.
+ /// Included only in requests
+ /// Example: {"openai-key":"sk-proj-demo-not-a-valid-api-key"} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxProxyTargetV1( + global::System.Collections.Generic.Dictionary? body, + global::System.Collections.Generic.IList? destinations, + global::System.Collections.Generic.Dictionary? headers, + global::System.Collections.Generic.Dictionary? secrets) + { + this.Body = body; + this.Destinations = destinations; + this.Headers = headers; + this.Secrets = secrets; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxProxyTargetV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Body.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Body.Json.g.cs new file mode 100644 index 0000000..20a09b8 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Body.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxProxyTargetV1Body + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyTargetV1Body? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxProxyTargetV1Body), + jsonSerializerContext) as global::Baseten.SandboxProxyTargetV1Body; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyTargetV1Body? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxProxyTargetV1Body? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxProxyTargetV1Body), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxProxyTargetV1Body; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Body.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Body.g.cs new file mode 100644 index 0000000..1deccd1 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Body.g.cs @@ -0,0 +1,20 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Body fields to inject into matching requests. Values may contain {{SECRET:name}} references resolved from this rule's secrets.
+ /// Example: {"user":"baseten-api-review-0916"} + ///
+ public sealed partial class SandboxProxyTargetV1Body + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Headers.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Headers.Json.g.cs new file mode 100644 index 0000000..2b58f8e --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Headers.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxProxyTargetV1Headers + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyTargetV1Headers? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxProxyTargetV1Headers), + jsonSerializerContext) as global::Baseten.SandboxProxyTargetV1Headers; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyTargetV1Headers? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxProxyTargetV1Headers? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxProxyTargetV1Headers), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxProxyTargetV1Headers; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Headers.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Headers.g.cs new file mode 100644 index 0000000..e4f460c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Headers.g.cs @@ -0,0 +1,20 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Headers to inject into matching requests. Values may contain {{SECRET:name}} references resolved from this rule's secrets.
+ /// Example: {"Authorization":"Bearer {{SECRET:openai-key}}"} + ///
+ public sealed partial class SandboxProxyTargetV1Headers + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Secrets.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Secrets.Json.g.cs new file mode 100644 index 0000000..e2aefe7 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Secrets.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxProxyTargetV1Secrets + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyTargetV1Secrets? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxProxyTargetV1Secrets), + jsonSerializerContext) as global::Baseten.SandboxProxyTargetV1Secrets; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxProxyTargetV1Secrets? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxProxyTargetV1Secrets? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxProxyTargetV1Secrets), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxProxyTargetV1Secrets; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Secrets.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Secrets.g.cs new file mode 100644 index 0000000..f1e27b1 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxProxyTargetV1Secrets.g.cs @@ -0,0 +1,21 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Named secret values for this routing rule, referenced in headers/body via {{SECRET:name}}. Stored encrypted at rest. Write-only: never returned in API responses.
+ /// Included only in requests
+ /// Example: {"openai-key":"sk-proj-demo-not-a-valid-api-key"} + ///
+ public sealed partial class SandboxProxyTargetV1Secrets + { + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxStatusV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxStatusV1.g.cs new file mode 100644 index 0000000..198bb4c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxStatusV1.g.cs @@ -0,0 +1,113 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Sandbox deployment status.
+ /// Included only in responses
+ /// Example: DEPLOYED + ///
+ public enum SandboxStatusV1 + { + /// + /// + /// + Archived, + /// + /// + /// + Archiving, + /// + /// + /// + Building, + /// + /// + /// + Deactivated, + /// + /// + /// + Deactivating, + /// + /// + /// + Deleting, + /// + /// + /// + Deployed, + /// + /// + /// + Deploying, + /// + /// + /// + Failed, + /// + /// + /// + Terminated, + /// + /// + /// + Unarchiving, + /// + /// + /// + Uploading, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxStatusV1Extensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxStatusV1 value) + { + return value switch + { + SandboxStatusV1.Archived => "ARCHIVED", + SandboxStatusV1.Archiving => "ARCHIVING", + SandboxStatusV1.Building => "BUILDING", + SandboxStatusV1.Deactivated => "DEACTIVATED", + SandboxStatusV1.Deactivating => "DEACTIVATING", + SandboxStatusV1.Deleting => "DELETING", + SandboxStatusV1.Deployed => "DEPLOYED", + SandboxStatusV1.Deploying => "DEPLOYING", + SandboxStatusV1.Failed => "FAILED", + SandboxStatusV1.Terminated => "TERMINATED", + SandboxStatusV1.Unarchiving => "UNARCHIVING", + SandboxStatusV1.Uploading => "UPLOADING", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxStatusV1? ToEnum(string value) + { + return value switch + { + "ARCHIVED" => SandboxStatusV1.Archived, + "ARCHIVING" => SandboxStatusV1.Archiving, + "BUILDING" => SandboxStatusV1.Building, + "DEACTIVATED" => SandboxStatusV1.Deactivated, + "DEACTIVATING" => SandboxStatusV1.Deactivating, + "DELETING" => SandboxStatusV1.Deleting, + "DEPLOYED" => SandboxStatusV1.Deployed, + "DEPLOYING" => SandboxStatusV1.Deploying, + "FAILED" => SandboxStatusV1.Failed, + "TERMINATED" => SandboxStatusV1.Terminated, + "UNARCHIVING" => SandboxStatusV1.Unarchiving, + "UPLOADING" => SandboxStatusV1.Uploading, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1.Json.g.cs new file mode 100644 index 0000000..aee88a1 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxTTLIdleExpirationPolicyV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxTTLIdleExpirationPolicyV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1), + jsonSerializerContext) as global::Baseten.SandboxTTLIdleExpirationPolicyV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxTTLIdleExpirationPolicyV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxTTLIdleExpirationPolicyV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxTTLIdleExpirationPolicyV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1.g.cs new file mode 100644 index 0000000..76177e7 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1.g.cs @@ -0,0 +1,70 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Delete after the specified period of inactivity. + /// + public sealed partial class SandboxTTLIdleExpirationPolicyV1 + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("action")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1ActionJsonConverter))] + public global::Baseten.SandboxTTLIdleExpirationPolicyV1Action Action { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1TypeJsonConverter))] + public global::Baseten.SandboxTTLIdleExpirationPolicyV1Type Type { get; set; } + + /// + /// Duration using seconds, minutes, hours, or composite durations such as 1h30m. Whole days and weeks are also supported, for example 7d or 2w.
+ /// Example: 24h + ///
+ /// 24h + [global::System.Text.Json.Serialization.JsonPropertyName("value")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Value { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Duration using seconds, minutes, hours, or composite durations such as 1h30m. Whole days and weeks are also supported, for example 7d or 2w.
+ /// Example: 24h + /// + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxTTLIdleExpirationPolicyV1( + string value, + global::Baseten.SandboxTTLIdleExpirationPolicyV1Action action, + global::Baseten.SandboxTTLIdleExpirationPolicyV1Type type) + { + this.Action = action; + this.Type = type; + this.Value = value ?? throw new global::System.ArgumentNullException(nameof(value)); + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxTTLIdleExpirationPolicyV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1Action.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1Action.g.cs new file mode 100644 index 0000000..bc85d13 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1Action.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + public enum SandboxTTLIdleExpirationPolicyV1Action + { + /// + /// + /// + Delete, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxTTLIdleExpirationPolicyV1ActionExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxTTLIdleExpirationPolicyV1Action value) + { + return value switch + { + SandboxTTLIdleExpirationPolicyV1Action.Delete => "DELETE", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxTTLIdleExpirationPolicyV1Action? ToEnum(string value) + { + return value switch + { + "DELETE" => SandboxTTLIdleExpirationPolicyV1Action.Delete, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1Type.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1Type.g.cs new file mode 100644 index 0000000..b738b36 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLIdleExpirationPolicyV1Type.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + public enum SandboxTTLIdleExpirationPolicyV1Type + { + /// + /// + /// + TtlIdle, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxTTLIdleExpirationPolicyV1TypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxTTLIdleExpirationPolicyV1Type value) + { + return value switch + { + SandboxTTLIdleExpirationPolicyV1Type.TtlIdle => "TTL_IDLE", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxTTLIdleExpirationPolicyV1Type? ToEnum(string value) + { + return value switch + { + "TTL_IDLE" => SandboxTTLIdleExpirationPolicyV1Type.TtlIdle, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1.Json.g.cs new file mode 100644 index 0000000..9058f23 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxTTLMaxAgeExpirationPolicyV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1), + jsonSerializerContext) as global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1.g.cs new file mode 100644 index 0000000..130a17c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1.g.cs @@ -0,0 +1,70 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Delete after the specified total lifetime. + /// + public sealed partial class SandboxTTLMaxAgeExpirationPolicyV1 + { + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("action")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1ActionJsonConverter))] + public global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action Action { get; set; } + + /// + /// + /// + [global::System.Text.Json.Serialization.JsonPropertyName("type")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1TypeJsonConverter))] + public global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type Type { get; set; } + + /// + /// Duration using seconds, minutes, hours, or composite durations such as 1h30m. Whole days and weeks are also supported, for example 7d or 2w.
+ /// Example: 24h + ///
+ /// 24h + [global::System.Text.Json.Serialization.JsonPropertyName("value")] + [global::System.Text.Json.Serialization.JsonRequired] + public required string Value { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Duration using seconds, minutes, hours, or composite durations such as 1h30m. Whole days and weeks are also supported, for example 7d or 2w.
+ /// Example: 24h + /// + /// + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxTTLMaxAgeExpirationPolicyV1( + string value, + global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action action, + global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type type) + { + this.Action = action; + this.Type = type; + this.Value = value ?? throw new global::System.ArgumentNullException(nameof(value)); + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxTTLMaxAgeExpirationPolicyV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1Action.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1Action.g.cs new file mode 100644 index 0000000..2c8aae3 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1Action.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + public enum SandboxTTLMaxAgeExpirationPolicyV1Action + { + /// + /// + /// + Delete, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxTTLMaxAgeExpirationPolicyV1ActionExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxTTLMaxAgeExpirationPolicyV1Action value) + { + return value switch + { + SandboxTTLMaxAgeExpirationPolicyV1Action.Delete => "DELETE", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxTTLMaxAgeExpirationPolicyV1Action? ToEnum(string value) + { + return value switch + { + "DELETE" => SandboxTTLMaxAgeExpirationPolicyV1Action.Delete, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1Type.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1Type.g.cs new file mode 100644 index 0000000..244f78f --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxTTLMaxAgeExpirationPolicyV1Type.g.cs @@ -0,0 +1,45 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + public enum SandboxTTLMaxAgeExpirationPolicyV1Type + { + /// + /// + /// + TtlMaxAge, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxTTLMaxAgeExpirationPolicyV1TypeExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxTTLMaxAgeExpirationPolicyV1Type value) + { + return value switch + { + SandboxTTLMaxAgeExpirationPolicyV1Type.TtlMaxAge => "TTL_MAX_AGE", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxTTLMaxAgeExpirationPolicyV1Type? ToEnum(string value) + { + return value switch + { + "TTL_MAX_AGE" => SandboxTTLMaxAgeExpirationPolicyV1Type.TtlMaxAge, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1.Json.g.cs new file mode 100644 index 0000000..d2875b3 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public readonly partial struct SandboxV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxV1), + jsonSerializerContext) as global::Baseten.SandboxV1?; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxV1?; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1.g.cs new file mode 100644 index 0000000..472345f --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1.g.cs @@ -0,0 +1,298 @@ +#pragma warning disable CS0618 // Type or member is obsolete + +#nullable enable + +namespace Baseten +{ + /// + /// Sandbox resource with configuration and server-managed fields at the root. No metadata, spec, or runtime wrapper.
+ /// Example: {"enabled":true,"lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"network":{"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"}}]},"subnet":"default"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","memory":4096,"ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering"},"name":"baseten-api-review-0916","url":"https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run","status":"DEPLOYED","state":"RUNNING","created_at":"2026-09-16T21:26:58.545765901Z","updated_at":"2026-09-16T21:31:13Z","created_by":"sandbox-automation","updated_by":"sandbox-automation","last_used_at":"2026-09-16T21:31:13Z","expires_in":86400} + ///
+ public readonly partial struct SandboxV1 : global::System.IEquatable + { + /// + /// Writable sandbox configuration. Fields are serialized at the root of the request or resource.
+ /// Example: {"enabled":true,"lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"network":{"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","memory":4096,"ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering"}} + ///
+#if NET6_0_OR_GREATER + public global::Baseten.SandboxConfigurationV1? Configuration { get; init; } +#else + public global::Baseten.SandboxConfigurationV1? Configuration { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(Configuration))] +#endif + public bool IsConfiguration => Configuration != null; + + /// + /// + /// + public bool TryPickConfiguration( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Baseten.SandboxConfigurationV1? value) + { + value = Configuration; + return IsConfiguration; + } + + /// + /// + /// + public global::Baseten.SandboxConfigurationV1 PickConfiguration() => Configuration is { } value + ? value + : throw new global::System.InvalidOperationException($"Expected union variant 'Configuration' but the value was {ToString()}."); + + /// + /// Server-managed sandbox fields.
+ /// Example: {"name":"baseten-api-review-0916","url":"https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run","status":"DEPLOYED","state":"RUNNING","created_at":"2026-09-16T21:26:58.545765901Z","updated_at":"2026-09-16T21:31:13Z","created_by":"sandbox-automation","updated_by":"sandbox-automation","last_used_at":"2026-09-16T21:31:13Z","expires_in":86400} + ///
+#if NET6_0_OR_GREATER + public global::Baseten.SandboxV1Variant2? SandboxV1Variant2 { get; init; } +#else + public global::Baseten.SandboxV1Variant2? SandboxV1Variant2 { get; } +#endif + + /// + /// + /// +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.MemberNotNullWhen(true, nameof(SandboxV1Variant2))] +#endif + public bool IsSandboxV1Variant2 => SandboxV1Variant2 != null; + + /// + /// + /// + public bool TryPickSandboxV1Variant2( +#if NET6_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.NotNullWhen(true)] +#endif + out global::Baseten.SandboxV1Variant2? value) + { + value = SandboxV1Variant2; + return IsSandboxV1Variant2; + } + + /// + /// + /// + public global::Baseten.SandboxV1Variant2 PickSandboxV1Variant2() => SandboxV1Variant2 is { } value + ? value + : throw new global::System.InvalidOperationException($"Expected union variant 'SandboxV1Variant2' but the value was {ToString()}."); + /// + /// + /// + public static implicit operator SandboxV1(global::Baseten.SandboxConfigurationV1 value) => new SandboxV1((global::Baseten.SandboxConfigurationV1?)value); + + /// + /// + /// + public static implicit operator global::Baseten.SandboxConfigurationV1?(SandboxV1 @this) => @this.Configuration; + + /// + /// + /// + public SandboxV1(global::Baseten.SandboxConfigurationV1? value) + { + Configuration = value; + } + + /// + /// + /// + public static SandboxV1 FromConfiguration(global::Baseten.SandboxConfigurationV1? value) => new SandboxV1(value); + + /// + /// + /// + public static implicit operator SandboxV1(global::Baseten.SandboxV1Variant2 value) => new SandboxV1((global::Baseten.SandboxV1Variant2?)value); + + /// + /// + /// + public static implicit operator global::Baseten.SandboxV1Variant2?(SandboxV1 @this) => @this.SandboxV1Variant2; + + /// + /// + /// + public SandboxV1(global::Baseten.SandboxV1Variant2? value) + { + SandboxV1Variant2 = value; + } + + /// + /// + /// + public static SandboxV1 FromSandboxV1Variant2(global::Baseten.SandboxV1Variant2? value) => new SandboxV1(value); + + /// + /// + /// + public SandboxV1( + global::Baseten.SandboxConfigurationV1? configuration, + global::Baseten.SandboxV1Variant2? sandboxV1Variant2 + ) + { + Configuration = configuration; + SandboxV1Variant2 = sandboxV1Variant2; + } + + /// + /// + /// + public object? Object => + SandboxV1Variant2 as object ?? + Configuration as object + ; + + /// + /// + /// + public override string? ToString() => + Configuration?.ToString() ?? + SandboxV1Variant2?.ToString() + ; + + /// + /// + /// + public bool Validate() + { + return IsConfiguration && IsSandboxV1Variant2; + } + + /// + /// + /// + public TResult? Match( + global::System.Func? configuration = null, + global::System.Func? sandboxV1Variant2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (Configuration is { } __value0 && configuration != null) + { + return configuration(__value0); + } + else if (SandboxV1Variant2 is { } __value1 && sandboxV1Variant2 != null) + { + return sandboxV1Variant2(__value1); + } + + return default(TResult); + } + + /// + /// + /// + public void Match( + global::System.Action? configuration = null, + + global::System.Action? sandboxV1Variant2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (Configuration is { } __value0) + { + configuration?.Invoke(__value0); + } + else if (SandboxV1Variant2 is { } __value1) + { + sandboxV1Variant2?.Invoke(__value1); + } + } + + /// + /// + /// + public void Switch( + global::System.Action? configuration = null, + global::System.Action? sandboxV1Variant2 = null, + bool validate = true) + { + if (validate) + { + Validate(); + } + + if (Configuration is { } __value0) + { + configuration?.Invoke(__value0); + } + else if (SandboxV1Variant2 is { } __value1) + { + sandboxV1Variant2?.Invoke(__value1); + } + } + + /// + /// + /// + public override int GetHashCode() + { + var fields = new object?[] + { + Configuration, + typeof(global::Baseten.SandboxConfigurationV1), + SandboxV1Variant2, + typeof(global::Baseten.SandboxV1Variant2), + }; + const int offset = unchecked((int)2166136261); + const int prime = 16777619; + static int HashCodeAggregator(int hashCode, object? value) => value == null + ? (hashCode ^ 0) * prime + : (hashCode ^ value.GetHashCode()) * prime; + + return global::System.Linq.Enumerable.Aggregate(fields, offset, HashCodeAggregator); + } + + /// + /// + /// + public bool Equals(SandboxV1 other) + { + return + global::System.Collections.Generic.EqualityComparer.Default.Equals(Configuration, other.Configuration) && + global::System.Collections.Generic.EqualityComparer.Default.Equals(SandboxV1Variant2, other.SandboxV1Variant2) + ; + } + + /// + /// + /// + public static bool operator ==(SandboxV1 obj1, SandboxV1 obj2) + { + return global::System.Collections.Generic.EqualityComparer.Default.Equals(obj1, obj2); + } + + /// + /// + /// + public static bool operator !=(SandboxV1 obj1, SandboxV1 obj2) + { + return !(obj1 == obj2); + } + + /// + /// + /// + public override bool Equals(object? obj) + { + return obj is SandboxV1 o && Equals(o); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2.Json.g.cs new file mode 100644 index 0000000..51e4652 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxV1Variant2 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.SandboxV1Variant2? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.SandboxV1Variant2), + jsonSerializerContext) as global::Baseten.SandboxV1Variant2; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.SandboxV1Variant2? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.SandboxV1Variant2? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.SandboxV1Variant2), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.SandboxV1Variant2; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2.g.cs new file mode 100644 index 0000000..7d4289a --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2.g.cs @@ -0,0 +1,211 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Server-managed sandbox fields.
+ /// Example: {"name":"baseten-api-review-0916","url":"https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run","status":"DEPLOYED","state":"RUNNING","created_at":"2026-09-16T21:26:58.545765901Z","updated_at":"2026-09-16T21:31:13Z","created_by":"sandbox-automation","updated_by":"sandbox-automation","last_used_at":"2026-09-16T21:31:13Z","expires_in":86400} + ///
+ public sealed partial class SandboxV1Variant2 + { + /// + /// Immutable sandbox name, provided by the client or generated by the server, used in sandbox_name path parameters.
+ /// Included only in responses
+ /// Example: baseten-api-review-0916 + ///
+ /// default! + /// baseten-api-review-0916 + [global::System.Text.Json.Serialization.JsonPropertyName("name")] + public string Name { get; set; } = default!; + + /// + /// Base URL of this sandbox's execution API. Use this exact returned URL; do not reconstruct its hostname. Authenticate requests with the same Authorization: Bearer <api_key> header used to create the sandbox. No additional routing headers are required. Fetch GET {url}/swagger/doc.json with that header for the API reference served by this sandbox. For example, POST {url}/process with Content-Type: application/json and {"command":"echo hello","waitForCompletion":true} executes a command and waits for its result. Execution API fields use camelCase, independently of this API's snake_case fields.
+ /// Included only in responses
+ /// Example: https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run + ///
+ /// https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run + [global::System.Text.Json.Serialization.JsonPropertyName("url")] + public string? Url { get; set; } + + /// + /// Sandbox deployment status.
+ /// Example: DEPLOYED + ///
+ /// DEPLOYED + [global::System.Text.Json.Serialization.JsonPropertyName("status")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxStatusV1JsonConverter))] + [global::System.Text.Json.Serialization.JsonRequired] + public required global::Baseten.SandboxStatusV1 Status { get; set; } + + /// + /// Current execution state when available.
+ /// Included only in responses
+ /// Example: RUNNING + ///
+ /// RUNNING + [global::System.Text.Json.Serialization.JsonPropertyName("state")] + [global::System.Text.Json.Serialization.JsonConverter(typeof(global::Baseten.JsonConverters.SandboxV1Variant2StateJsonConverter))] + public global::Baseten.SandboxV1Variant2State? State { get; set; } + + /// + /// Time the sandbox was created.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:26:58.545765901Z + ///
+ /// default! + /// 2026-09-16T21:26:58.545765901Z + [global::System.Text.Json.Serialization.JsonPropertyName("created_at")] + public global::System.DateTime CreatedAt { get; set; } = default!; + + /// + /// Time the sandbox was last updated.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:31:13Z + ///
+ /// 2026-09-16T21:31:13Z + [global::System.Text.Json.Serialization.JsonPropertyName("updated_at")] + public global::System.DateTime? UpdatedAt { get; set; } + + /// + /// User or service account that created the sandbox.
+ /// Included only in responses
+ /// Example: sandbox-automation + ///
+ /// sandbox-automation + [global::System.Text.Json.Serialization.JsonPropertyName("created_by")] + public string? CreatedBy { get; set; } + + /// + /// User or service account that last updated the sandbox.
+ /// Included only in responses
+ /// Example: sandbox-automation + ///
+ /// sandbox-automation + [global::System.Text.Json.Serialization.JsonPropertyName("updated_by")] + public string? UpdatedBy { get; set; } + + /// + /// Time the sandbox was last used.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:31:13Z + ///
+ /// 2026-09-16T21:31:13Z + [global::System.Text.Json.Serialization.JsonPropertyName("last_used_at")] + public global::System.DateTime? LastUsedAt { get; set; } + + /// + /// Seconds remaining before automatic deletion, when expiration is configured.
+ /// Included only in responses
+ /// Example: 86400 + ///
+ /// 86400 + [global::System.Text.Json.Serialization.JsonPropertyName("expires_in")] + public int? ExpiresIn { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Sandbox deployment status.
+ /// Example: DEPLOYED + /// + /// + /// Base URL of this sandbox's execution API. Use this exact returned URL; do not reconstruct its hostname. Authenticate requests with the same Authorization: Bearer <api_key> header used to create the sandbox. No additional routing headers are required. Fetch GET {url}/swagger/doc.json with that header for the API reference served by this sandbox. For example, POST {url}/process with Content-Type: application/json and {"command":"echo hello","waitForCompletion":true} executes a command and waits for its result. Execution API fields use camelCase, independently of this API's snake_case fields.
+ /// Included only in responses
+ /// Example: https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run + /// + /// + /// Current execution state when available.
+ /// Included only in responses
+ /// Example: RUNNING + /// + /// + /// Time the sandbox was last updated.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:31:13Z + /// + /// + /// User or service account that created the sandbox.
+ /// Included only in responses
+ /// Example: sandbox-automation + /// + /// + /// User or service account that last updated the sandbox.
+ /// Included only in responses
+ /// Example: sandbox-automation + /// + /// + /// Time the sandbox was last used.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:31:13Z + /// + /// + /// Seconds remaining before automatic deletion, when expiration is configured.
+ /// Included only in responses
+ /// Example: 86400 + /// + /// + /// Immutable sandbox name, provided by the client or generated by the server, used in sandbox_name path parameters.
+ /// Included only in responses
+ /// Example: baseten-api-review-0916 + /// + /// + /// Time the sandbox was created.
+ /// Included only in responses
+ /// Example: 2026-09-16T21:26:58.545765901Z + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public SandboxV1Variant2( + global::Baseten.SandboxStatusV1 status, + string? url, + global::Baseten.SandboxV1Variant2State? state, + global::System.DateTime? updatedAt, + string? createdBy, + string? updatedBy, + global::System.DateTime? lastUsedAt, + int? expiresIn, + string name = default!, + global::System.DateTime createdAt = default!) + { + this.Name = name; + this.Url = url; + this.Status = status; + this.State = state; + this.CreatedAt = createdAt; + this.UpdatedAt = updatedAt; + this.CreatedBy = createdBy; + this.UpdatedBy = updatedBy; + this.LastUsedAt = lastUsedAt; + this.ExpiresIn = expiresIn; + } + + /// + /// Initializes a new instance of the class. + /// + public SandboxV1Variant2() + { + } + + /// + /// Creates a new from its single non-const required field, + /// hardcoding any const discriminator fields. + /// + public static SandboxV1Variant2 FromStatus(global::Baseten.SandboxStatusV1 status) + { + return new SandboxV1Variant2 + { + Status = status, + }; + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2State.g.cs b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2State.g.cs new file mode 100644 index 0000000..d4854c9 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.SandboxV1Variant2State.g.cs @@ -0,0 +1,53 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Current execution state when available.
+ /// Included only in responses
+ /// Example: RUNNING + ///
+ public enum SandboxV1Variant2State + { + /// + /// + /// + Running, + /// + /// + /// + Standby, + } + + /// + /// Enum extensions to do fast conversions without the reflection. + /// + public static class SandboxV1Variant2StateExtensions + { + /// + /// Converts an enum to a string. + /// + public static string ToValueString(this SandboxV1Variant2State value) + { + return value switch + { + SandboxV1Variant2State.Running => "RUNNING", + SandboxV1Variant2State.Standby => "STANDBY", + _ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null), + }; + } + /// + /// Converts an string to a enum. + /// + public static SandboxV1Variant2State? ToEnum(string value) + { + return value switch + { + "RUNNING" => SandboxV1Variant2State.Running, + "STANDBY" => SandboxV1Variant2State.Standby, + _ => null, + }; + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Models.UpdateSandboxRequestV1.Json.g.cs b/src/libs/Baseten/Generated/Baseten.Models.UpdateSandboxRequestV1.Json.g.cs new file mode 100644 index 0000000..76313d3 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.UpdateSandboxRequestV1.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Baseten +{ + public sealed partial class UpdateSandboxRequestV1 + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Baseten.UpdateSandboxRequestV1? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Baseten.UpdateSandboxRequestV1), + jsonSerializerContext) as global::Baseten.UpdateSandboxRequestV1; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Baseten.UpdateSandboxRequestV1? FromJson( + string json) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Baseten.UpdateSandboxRequestV1? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Baseten.UpdateSandboxRequestV1), + jsonSerializerContext).ConfigureAwait(false)) as global::Baseten.UpdateSandboxRequestV1; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Baseten.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Baseten/Generated/Baseten.Models.UpdateSandboxRequestV1.g.cs b/src/libs/Baseten/Generated/Baseten.Models.UpdateSandboxRequestV1.g.cs new file mode 100644 index 0000000..44fdc36 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Models.UpdateSandboxRequestV1.g.cs @@ -0,0 +1,162 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// Partial sandbox update. Omitted fields remain unchanged. Supplied arrays and maps (including labels) replace their previous values; supplied structured objects update only their supplied fields. Null is not accepted. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values.
+ /// Example: {"enabled":true,"lifecycle":{"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"},"region":"us-pdx-1","envs":[{"name":"NODE_ENV","secret":false,"value":"production"},{"name":"PORT","secret":false,"value":"3000"}],"image":"blaxel/base-image:latest","ports":[{"name":"http","protocol":"HTTP","target":3000}],"display_name":"Baseten API review - revised","external_id":"api-review-20260916-001","labels":{"env":"development","project":"api-review","team":"engineering","revision":"2"}} + ///
+ public sealed partial class UpdateSandboxRequestV1 + { + /// + /// When false, the sandbox is disabled and will not accept connections
+ /// Example: true + ///
+ /// true + [global::System.Text.Json.Serialization.JsonPropertyName("enabled")] + public bool? Enabled { get; set; } + + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + ///
+ /// {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + [global::System.Text.Json.Serialization.JsonPropertyName("lifecycle")] + public global::Baseten.SandboxLifecycleV1? Lifecycle { get; set; } + + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + ///
+ /// us-pdx-1 + [global::System.Text.Json.Serialization.JsonPropertyName("region")] + public string? Region { get; set; } + + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + ///
+ /// [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + [global::System.Text.Json.Serialization.JsonPropertyName("envs")] + public global::System.Collections.Generic.IList? Envs { get; set; } + + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + ///
+ /// blaxel/base-image:latest + [global::System.Text.Json.Serialization.JsonPropertyName("image")] + public string? Image { get; set; } + + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + ///
+ /// [{"name":"http","protocol":"HTTP","target":3000}] + [global::System.Text.Json.Serialization.JsonPropertyName("ports")] + public global::System.Collections.Generic.IList? Ports { get; set; } + + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review - revised + ///
+ /// Baseten API review - revised + [global::System.Text.Json.Serialization.JsonPropertyName("display_name")] + public string? DisplayName { get; set; } + + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + ///
+ /// api-review-20260916-001 + [global::System.Text.Json.Serialization.JsonPropertyName("external_id")] + public string? ExternalId { get; set; } + + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering","revision":"2"} + ///
+ /// {"env":"development","project":"api-review","team":"engineering","revision":"2"} + [global::System.Text.Json.Serialization.JsonPropertyName("labels")] + public global::System.Collections.Generic.Dictionary? Labels { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// When false, the sandbox is disabled and will not accept connections
+ /// Example: true + /// + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + /// + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + /// + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + /// + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + /// + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + /// + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review - revised + /// + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + /// + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering","revision":"2"} + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public UpdateSandboxRequestV1( + bool? enabled, + global::Baseten.SandboxLifecycleV1? lifecycle, + string? region, + global::System.Collections.Generic.IList? envs, + string? image, + global::System.Collections.Generic.IList? ports, + string? displayName, + string? externalId, + global::System.Collections.Generic.Dictionary? labels) + { + this.Enabled = enabled; + this.Lifecycle = lifecycle; + this.Region = region; + this.Envs = envs; + this.Image = image; + this.Ports = ports; + this.DisplayName = displayName; + this.ExternalId = externalId; + this.Labels = labels; + } + + /// + /// Initializes a new instance of the class. + /// + public UpdateSandboxRequestV1() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.Sandboxes.JsonSerializerContext.g.cs b/src/libs/Baseten/Generated/Baseten.Sandboxes.JsonSerializerContext.g.cs new file mode 100644 index 0000000..42fe504 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.Sandboxes.JsonSerializerContext.g.cs @@ -0,0 +1,361 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// + /// + [global::System.Text.Json.Serialization.JsonSourceGenerationOptions( + DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull + )] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.Dictionary))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.Dictionary))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List), TypeInfoPropertyName = "SystemCollectionsGeneric_ObjectList")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Text.Json.JsonElement?))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(bool))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(string))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.DateTime))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(int))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(long))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxLifecycleV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1), TypeInfoPropertyName = "SandboxExpirationPolicyV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1Discriminator))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType), TypeInfoPropertyName = "SandboxExpirationPolicyV1DiscriminatorType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action), TypeInfoPropertyName = "SandboxTTLIdleExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type), TypeInfoPropertyName = "SandboxTTLIdleExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action), TypeInfoPropertyName = "SandboxTTLMaxAgeExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type), TypeInfoPropertyName = "SandboxTTLMaxAgeExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1Action), TypeInfoPropertyName = "SandboxDateExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1Type), TypeInfoPropertyName = "SandboxDateExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxNetworkV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxProxyConfigV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxProxyTargetV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxEnvV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxPortV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxPortV1Protocol), TypeInfoPropertyName = "SandboxPortV1Protocol2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxConfigurationV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.CreateSandboxRequestV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.UpdateSandboxRequestV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1), TypeInfoPropertyName = "SandboxV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1Variant2))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxStatusV1), TypeInfoPropertyName = "SandboxStatusV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1Variant2State), TypeInfoPropertyName = "SandboxV1Variant2State2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxApiPaginationV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.ListSandboxesResponseV1))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(bool?))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(int?))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(long?))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1?), TypeInfoPropertyName = "NullableSandboxExpirationPolicyV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType?), TypeInfoPropertyName = "NullableSandboxExpirationPolicyV1DiscriminatorType2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action?), TypeInfoPropertyName = "NullableSandboxTTLIdleExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type?), TypeInfoPropertyName = "NullableSandboxTTLIdleExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action?), TypeInfoPropertyName = "NullableSandboxTTLMaxAgeExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type?), TypeInfoPropertyName = "NullableSandboxTTLMaxAgeExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1Action?), TypeInfoPropertyName = "NullableSandboxDateExpirationPolicyV1Action2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxDateExpirationPolicyV1Type?), TypeInfoPropertyName = "NullableSandboxDateExpirationPolicyV1Type2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxPortV1Protocol?), TypeInfoPropertyName = "NullableSandboxPortV1Protocol2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1?), TypeInfoPropertyName = "NullableSandboxV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxStatusV1?), TypeInfoPropertyName = "NullableSandboxStatusV12")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Baseten.SandboxV1Variant2State?), TypeInfoPropertyName = "NullableSandboxV1Variant2State2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List))] + internal sealed partial class SandboxesSourceGenerationContextChunk0 : global::System.Text.Json.Serialization.JsonSerializerContext + { + } + /// + /// + /// + public sealed partial class SandboxesSourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext + { + private static readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver Resolver = new LazyChunkResolver(); + + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + internal static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver TypeInfoResolver => Resolver; + + + private static readonly global::System.Text.Json.JsonSerializerOptions DefaultOptions = CreateDefaultOptions(); + + /// + /// + /// + public static SandboxesSourceGenerationContext Default { get; } = new(DefaultOptions); + + private SandboxesSourceGenerationContext(global::System.Text.Json.JsonSerializerOptions options) + : base(options) + { + } + + /// + protected override global::System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions => DefaultOptions; + + /// + public override global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(global::System.Type type) + { + return Resolver.GetTypeInfo(type, Options); + } + + /// + /// Adds this package's converters to . + /// + /// + /// A converter has to be on the options a chained resolver builds its JsonTypeInfo against, + /// and a context resolves types from every package below it. Each package contributes only + /// what it owns and calls down the chain for the rest, so the family's converter table is + /// written once rather than copied into all of them. + /// + [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)] + public static void AddConverters(global::System.Text.Json.JsonSerializerOptions options) + { + options.Converters.Add(new global::Baseten.JsonConverters.SandboxExpirationPolicyV1JsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.SandboxV1JsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.AnyOfJsonConverter()); + options.Converters.Add(new global::Baseten.JsonConverters.UnixTimestampJsonConverter()); + options.Converters.Add(new LazyEnumJsonConverterFactory()); + } + + private static global::System.Text.Json.JsonSerializerOptions CreateDefaultOptions() + { + var options = new global::System.Text.Json.JsonSerializerOptions + { + DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull, + TypeInfoResolver = Resolver, + }; + AddConverters(options); + + return options; + } + + + private sealed class LazyEnumJsonConverterFactory : global::System.Text.Json.Serialization.JsonConverterFactory + { + public override bool CanConvert(global::System.Type typeToConvert) + { + return + typeToConvert == typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType) + + || typeToConvert == typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType?) + + || typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action) + + || typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action?) + + || typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type) + + || typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type?) + + || typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action) + + || typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action?) + + || typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type) + + || typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type?) + + || typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Action) + + || typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Action?) + + || typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Type) + + || typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Type?) + + || typeToConvert == typeof(global::Baseten.SandboxPortV1Protocol) + + || typeToConvert == typeof(global::Baseten.SandboxPortV1Protocol?) + + || typeToConvert == typeof(global::Baseten.SandboxV1Variant2State) + + || typeToConvert == typeof(global::Baseten.SandboxV1Variant2State?) + + || typeToConvert == typeof(global::Baseten.SandboxStatusV1) + + || typeToConvert == typeof(global::Baseten.SandboxStatusV1?); + } + + public override global::System.Text.Json.Serialization.JsonConverter CreateConverter( + global::System.Type typeToConvert, + global::System.Text.Json.JsonSerializerOptions options) + { + if (typeToConvert == typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType)) + { + return new global::Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorTypeJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxExpirationPolicyV1DiscriminatorType?)) + { + return new global::Baseten.JsonConverters.SandboxExpirationPolicyV1DiscriminatorTypeNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action)) + { + return new global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1ActionJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Action?)) + { + return new global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1ActionNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type)) + { + return new global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1TypeJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLIdleExpirationPolicyV1Type?)) + { + return new global::Baseten.JsonConverters.SandboxTTLIdleExpirationPolicyV1TypeNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action)) + { + return new global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1ActionJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Action?)) + { + return new global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1ActionNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type)) + { + return new global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1TypeJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxTTLMaxAgeExpirationPolicyV1Type?)) + { + return new global::Baseten.JsonConverters.SandboxTTLMaxAgeExpirationPolicyV1TypeNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Action)) + { + return new global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1ActionJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Action?)) + { + return new global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1ActionNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Type)) + { + return new global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1TypeJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxDateExpirationPolicyV1Type?)) + { + return new global::Baseten.JsonConverters.SandboxDateExpirationPolicyV1TypeNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxPortV1Protocol)) + { + return new global::Baseten.JsonConverters.SandboxPortV1ProtocolJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxPortV1Protocol?)) + { + return new global::Baseten.JsonConverters.SandboxPortV1ProtocolNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxV1Variant2State)) + { + return new global::Baseten.JsonConverters.SandboxV1Variant2StateJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxV1Variant2State?)) + { + return new global::Baseten.JsonConverters.SandboxV1Variant2StateNullableJsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxStatusV1)) + { + return new global::Baseten.JsonConverters.SandboxStatusV1JsonConverter(); + } + + if (typeToConvert == typeof(global::Baseten.SandboxStatusV1?)) + { + return new global::Baseten.JsonConverters.SandboxStatusV1NullableJsonConverter(); + } + throw new global::System.NotSupportedException($"No generated enum converter is registered for '{typeToConvert}'."); + } + } + + private sealed class LazyChunkResolver : global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver + { + private readonly object _gate = new(); + private readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[] _resolvers = new global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[1]; + + public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo( + global::System.Type type, + global::System.Text.Json.JsonSerializerOptions options) + { + for (var index = 0; index < _resolvers.Length; index++) + { + var typeInfo = GetResolver(index).GetTypeInfo(type, options); + if (typeInfo is not null) + { + return typeInfo; + } + } + + return null; + } + + private global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver GetResolver(int index) + { + var resolver = global::System.Threading.Volatile.Read(ref _resolvers[index]); + if (resolver is not null) + { + return resolver; + } + + lock (_gate) + { + return _resolvers[index] ??= CreateResolver(index); + } + } + + private static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver CreateResolver(int index) + { + return index switch + { + 0 => new SandboxesSourceGenerationContextChunk0(new global::System.Text.Json.JsonSerializerOptions()), + _ => throw new global::System.ArgumentOutOfRangeException(nameof(index)), + }; + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.SandboxesClient.Authorizations.Bearer.g.cs b/src/libs/Baseten/Generated/Baseten.SandboxesClient.Authorizations.Bearer.g.cs new file mode 100644 index 0000000..9f82631 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.SandboxesClient.Authorizations.Bearer.g.cs @@ -0,0 +1,35 @@ + +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxesClient + { + + /// + public void AuthorizeUsingBearer( + string apiKey) + { + apiKey = apiKey ?? throw new global::System.ArgumentNullException(nameof(apiKey)); + + for (var i = Authorizations.Count - 1; i >= 0; i--) + { + var __authorization = Authorizations[i]; + if (__authorization.Type == "Http" && + __authorization.Name == "Bearer") + { + Authorizations.RemoveAt(i); + } + } + + Authorizations.Add(new global::Baseten.EndPointAuthorization + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + Value = apiKey, + }); + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.SandboxesClient.Constructors.Bearer.g.cs b/src/libs/Baseten/Generated/Baseten.SandboxesClient.Constructors.Bearer.g.cs new file mode 100644 index 0000000..1775140 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.SandboxesClient.Constructors.Bearer.g.cs @@ -0,0 +1,31 @@ + +#nullable enable + +namespace Baseten +{ + public sealed partial class SandboxesClient + { + /// + + public SandboxesClient( + string apiKey, + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this(httpClient, baseUri, authorizations, disposeHttpClient) + { + Authorizing(HttpClient, ref apiKey); + + AuthorizeUsingBearer(apiKey); + + Authorized(HttpClient); + } + + partial void Authorizing( + global::System.Net.Http.HttpClient client, + ref string apiKey); + partial void Authorized( + global::System.Net.Http.HttpClient client); + + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.SandboxesClient.CreateSandbox.g.cs b/src/libs/Baseten/Generated/Baseten.SandboxesClient.CreateSandbox.g.cs new file mode 100644 index 0000000..8673f60 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.SandboxesClient.CreateSandbox.g.cs @@ -0,0 +1,748 @@ + +#nullable enable + +namespace Baseten +{ + public partial class SandboxesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_CreateSandboxSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_CreateSandboxSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_CreateSandboxSecurityRequirement0, + }; + partial void PrepareCreateSandboxArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + global::Baseten.CreateSandboxRequestV1 request); + partial void PrepareCreateSandboxRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + global::Baseten.CreateSandboxRequestV1 request); + partial void ProcessCreateSandboxResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessCreateSandboxResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Create a sandbox
+ /// Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateSandboxAsync( + + global::Baseten.CreateSandboxRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await CreateSandboxAsResponseAsync( + + request: request, + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Create a sandbox
+ /// Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> CreateSandboxAsResponseAsync( + + global::Baseten.CreateSandboxRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareCreateSandboxArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + request: request); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_CreateSandboxSecurityRequirements, + operationName: "CreateSandboxAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: "/v1/sandboxes/instances", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Post, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareCreateSandboxRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateSandbox", + methodName: "CreateSandboxAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateSandbox", + methodName: "CreateSandboxAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateSandbox", + methodName: "CreateSandboxAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessCreateSandboxResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateSandbox", + methodName: "CreateSandboxAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "CreateSandbox", + methodName: "CreateSandboxAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "POST", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Invalid request. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // An active sandbox with the requested name already exists. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 409) + { + string? __content_409 = null; + global::System.Exception? __exception_409 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_409 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_409 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_409, + responseBody: __content_409, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessCreateSandboxResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.SandboxV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.SandboxV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Create a sandbox
+ /// Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key. + ///
+ /// + /// + /// + /// Optional unique sandbox name. Generated by the server when omitted; immutable after creation.
+ /// Example: baseten-api-review-0916 + /// + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + /// + /// + /// Network configuration for a sandbox including subnet, domain filtering, and proxy settings
+ /// Example: {"proxy":{"allowed_domains":["api.openai.com","pypi.org","files.pythonhosted.org","registry.npmjs.org"],"bypass":["registry.npmjs.org"],"forbidden_domains":["facebook.com","*.facebook.com"],"routing":[{"destinations":["api.openai.com"],"headers":{"Authorization":"Bearer {{SECRET:openai-key}}"},"body":{"user":"baseten-api-review-0916"},"secrets":{"openai-key":"sk-proj-demo-not-a-valid-api-key"}}]},"subnet":"default"} + /// + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + /// + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + /// + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + /// + /// + /// Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).
+ /// Example: 4096 + /// + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + /// + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review + /// + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + /// + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering"} + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task CreateSandboxAsync( + string? teamId = default, + string? xTeamId = default, + string? name = default, + global::Baseten.SandboxLifecycleV1? lifecycle = default, + global::Baseten.SandboxNetworkV1? network = default, + string? region = default, + global::System.Collections.Generic.IList? envs = default, + string? image = default, + long? memory = default, + global::System.Collections.Generic.IList? ports = default, + string? displayName = default, + string? externalId = default, + global::System.Collections.Generic.Dictionary? labels = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Baseten.CreateSandboxRequestV1 + { + Name = name, + Lifecycle = lifecycle, + Network = network, + Region = region, + Envs = envs, + Image = image, + Memory = memory, + Ports = ports, + DisplayName = displayName, + ExternalId = externalId, + Labels = labels, + }; + + return await CreateSandboxAsync( + teamId: teamId, + xTeamId: xTeamId, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.SandboxesClient.DeleteSandbox.g.cs b/src/libs/Baseten/Generated/Baseten.SandboxesClient.DeleteSandbox.g.cs new file mode 100644 index 0000000..026dac8 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.SandboxesClient.DeleteSandbox.g.cs @@ -0,0 +1,645 @@ + +#nullable enable + +namespace Baseten +{ + public partial class SandboxesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_DeleteSandboxSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_DeleteSandboxSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_DeleteSandboxSecurityRequirement0, + }; + partial void PrepareDeleteSandboxArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string sandboxName); + partial void PrepareDeleteSandboxRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string sandboxName); + partial void ProcessDeleteSandboxResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessDeleteSandboxResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Delete a sandbox
+ /// Permanently delete the sandbox and its local data asynchronously. The returned resource has status DELETING. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task DeleteSandboxAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await DeleteSandboxAsResponseAsync( + sandboxName: sandboxName, + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Delete a sandbox
+ /// Permanently delete the sandbox and its local data asynchronously. The returned resource has status DELETING. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> DeleteSandboxAsResponseAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareDeleteSandboxArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + sandboxName: ref sandboxName); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_DeleteSandboxSecurityRequirements, + operationName: "DeleteSandboxAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: $"/v1/sandboxes/instances/{sandboxName}", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Delete, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareDeleteSandboxRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + sandboxName: sandboxName); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteSandbox", + methodName: "DeleteSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteSandbox", + methodName: "DeleteSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteSandbox", + methodName: "DeleteSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessDeleteSandboxResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteSandbox", + methodName: "DeleteSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "DeleteSandbox", + methodName: "DeleteSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "DELETE", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource not found. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 409) + { + string? __content_409 = null; + global::System.Exception? __exception_409 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_409 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_409 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_409, + responseBody: __content_409, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessDeleteSandboxResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.SandboxV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.SandboxV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.SandboxesClient.GetSandbox.g.cs b/src/libs/Baseten/Generated/Baseten.SandboxesClient.GetSandbox.g.cs new file mode 100644 index 0000000..5fb22d2 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.SandboxesClient.GetSandbox.g.cs @@ -0,0 +1,613 @@ + +#nullable enable + +namespace Baseten +{ + public partial class SandboxesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_GetSandboxSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_GetSandboxSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_GetSandboxSecurityRequirement0, + }; + partial void PrepareGetSandboxArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string sandboxName); + partial void PrepareGetSandboxRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string sandboxName); + partial void ProcessGetSandboxResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessGetSandboxResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Get a sandbox
+ /// Return the sandbox configuration and current state. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task GetSandboxAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await GetSandboxAsResponseAsync( + sandboxName: sandboxName, + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Get a sandbox
+ /// Return the sandbox configuration and current state. + ///
+ /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> GetSandboxAsResponseAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareGetSandboxArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + sandboxName: ref sandboxName); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_GetSandboxSecurityRequirements, + operationName: "GetSandboxAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: $"/v1/sandboxes/instances/{sandboxName}", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareGetSandboxRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + sandboxName: sandboxName); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSandbox", + methodName: "GetSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSandbox", + methodName: "GetSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSandbox", + methodName: "GetSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessGetSandboxResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSandbox", + methodName: "GetSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "GetSandbox", + methodName: "GetSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource not found. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessGetSandboxResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.SandboxV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.SandboxV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.SandboxesClient.ListSandboxes.g.cs b/src/libs/Baseten/Generated/Baseten.SandboxesClient.ListSandboxes.g.cs new file mode 100644 index 0000000..44edc0c --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.SandboxesClient.ListSandboxes.g.cs @@ -0,0 +1,676 @@ + +#nullable enable + +namespace Baseten +{ + public partial class SandboxesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_ListSandboxesSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_ListSandboxesSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_ListSandboxesSecurityRequirement0, + }; + partial void PrepareListSandboxesArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string? cursor, + ref int? limit, + ref string? q, + global::System.Collections.Generic.IList? status, + ref string? externalId); + partial void PrepareListSandboxesRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string? cursor, + int? limit, + string? q, + global::System.Collections.Generic.IList? status, + string? externalId); + partial void ProcessListSandboxesResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessListSandboxesResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// List sandboxes
+ /// Return a cursor-paginated page of sandboxes. Terminated sandboxes are hidden by default. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Example: api-review + /// + /// + /// Example: [DEPLOYED, FAILED] + /// + /// + /// Example: api-review-20260916-001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task ListSandboxesAsync( + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? q = default, + global::System.Collections.Generic.IList? status = default, + string? externalId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await ListSandboxesAsResponseAsync( + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + q: q, + status: status, + externalId: externalId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// List sandboxes
+ /// Return a cursor-paginated page of sandboxes. Terminated sandboxes are hidden by default. + ///
+ /// + /// + /// + /// Example: eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ + /// + /// + /// Default Value: 20
+ /// Example: 20 + /// + /// + /// Example: api-review + /// + /// + /// Example: [DEPLOYED, FAILED] + /// + /// + /// Example: api-review-20260916-001 + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> ListSandboxesAsResponseAsync( + string? teamId = default, + string? xTeamId = default, + string? cursor = default, + int? limit = default, + string? q = default, + global::System.Collections.Generic.IList? status = default, + string? externalId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareListSandboxesArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + cursor: ref cursor, + limit: ref limit, + q: ref q, + status: status, + externalId: ref externalId); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_ListSandboxesSecurityRequirements, + operationName: "ListSandboxesAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: "/v1/sandboxes/instances", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + .AddOptionalParameter("cursor", cursor) + .AddOptionalParameter("limit", limit?.ToString()) + .AddOptionalParameter("q", q) + .AddOptionalParameter("status", status, delimiter: ",", explode: true) + .AddOptionalParameter("external_id", externalId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareListSandboxesRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + cursor: cursor, + limit: limit, + q: q, + status: status, + externalId: externalId); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListSandboxes", + methodName: "ListSandboxesAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListSandboxes", + methodName: "ListSandboxesAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListSandboxes", + methodName: "ListSandboxesAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessListSandboxesResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListSandboxes", + methodName: "ListSandboxesAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "ListSandboxes", + methodName: "ListSandboxesAsync", + pathTemplate: "\"/v1/sandboxes/instances\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Invalid request. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessListSandboxesResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.ListSandboxesResponseV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.ListSandboxesResponseV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.SandboxesClient.UpdateSandbox.g.cs b/src/libs/Baseten/Generated/Baseten.SandboxesClient.UpdateSandbox.g.cs new file mode 100644 index 0000000..326b5da --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.SandboxesClient.UpdateSandbox.g.cs @@ -0,0 +1,780 @@ + +#nullable enable + +namespace Baseten +{ + public partial class SandboxesClient + { + + + private static readonly global::Baseten.EndPointSecurityRequirement s_UpdateSandboxSecurityRequirement0 = + new global::Baseten.EndPointSecurityRequirement + { + Authorizations = new global::Baseten.EndPointAuthorizationRequirement[] + { new global::Baseten.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Baseten.EndPointSecurityRequirement[] s_UpdateSandboxSecurityRequirements = + new global::Baseten.EndPointSecurityRequirement[] + { s_UpdateSandboxSecurityRequirement0, + }; + partial void PrepareUpdateSandboxArguments( + global::System.Net.Http.HttpClient httpClient, + ref string? teamId, + ref string? xTeamId, + ref string sandboxName, + global::Baseten.UpdateSandboxRequestV1 request); + partial void PrepareUpdateSandboxRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + string? teamId, + string? xTeamId, + string sandboxName, + global::Baseten.UpdateSandboxRequestV1 request); + partial void ProcessUpdateSandboxResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessUpdateSandboxResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Update a sandbox
+ /// Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UpdateSandboxAsync( + string sandboxName, + + global::Baseten.UpdateSandboxRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await UpdateSandboxAsResponseAsync( + sandboxName: sandboxName, + + request: request, + teamId: teamId, + xTeamId: xTeamId, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Update a sandbox
+ /// Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values. + ///
+ /// + /// + /// + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> UpdateSandboxAsResponseAsync( + string sandboxName, + + global::Baseten.UpdateSandboxRequestV1 request, + string? teamId = default, + string? xTeamId = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + request = request ?? throw new global::System.ArgumentNullException(nameof(request)); + + PrepareArguments( + client: HttpClient); + PrepareUpdateSandboxArguments( + httpClient: HttpClient, + teamId: ref teamId, + xTeamId: ref xTeamId, + sandboxName: ref sandboxName, + request: request); + + + var __authorizations = global::Baseten.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_UpdateSandboxSecurityRequirements, + operationName: "UpdateSandboxAsync"); + + using var __timeoutCancellationTokenSource = global::Baseten.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Baseten.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Baseten.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Baseten.PathBuilder( + path: $"/v1/sandboxes/instances/{sandboxName}", + baseUri: HttpClient.BaseAddress); + __pathBuilder + .AddOptionalParameter("team_id", teamId) + ; + var __path = __pathBuilder.ToString(); + __path = global::Baseten.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: new global::System.Net.Http.HttpMethod("PATCH"), + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + + if (xTeamId != default) + { + __httpRequest.Headers.TryAddWithoutValidation("X-Team-Id", xTeamId.ToString()); + } + + var __httpRequestContentBody = request.ToJson(JsonSerializerContext); + var __httpRequestContent = new global::System.Net.Http.StringContent( + content: __httpRequestContentBody, + encoding: global::System.Text.Encoding.UTF8, + mediaType: "application/json"); + __httpRequest.Content = __httpRequestContent; + global::Baseten.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareUpdateSandboxRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + teamId: teamId, + xTeamId: xTeamId, + sandboxName: sandboxName, + request: request); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Baseten.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSandbox", + methodName: "UpdateSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSandbox", + methodName: "UpdateSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Baseten.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Baseten.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSandbox", + methodName: "UpdateSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Baseten.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessUpdateSandboxResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSandbox", + methodName: "UpdateSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Baseten.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Baseten.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "UpdateSandbox", + methodName: "UpdateSandboxAsync", + pathTemplate: "$\"/v1/sandboxes/instances/{sandboxName}\"", + httpMethod: "PATCH", + baseUri: BaseUri, + request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."), + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + // Invalid request, including attempts to change memory or network configuration. + if ((int)__response.StatusCode == 400) + { + string? __content_400 = null; + global::System.Exception? __exception_400 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_400 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_400 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_400, + responseBody: __content_400, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Missing or invalid authentication. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 401) + { + string? __content_401 = null; + global::System.Exception? __exception_401 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_401 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_401 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_401, + responseBody: __content_401, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Insufficient permissions. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 403) + { + string? __content_403 = null; + global::System.Exception? __exception_403 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_403 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_403 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_403, + responseBody: __content_403, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource not found. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 404) + { + string? __content_404 = null; + global::System.Exception? __exception_404 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_404 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_404 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_404, + responseBody: __content_404, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 409) + { + string? __content_409 = null; + global::System.Exception? __exception_409 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_409 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_409 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_409, + responseBody: __content_409, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Request limit exceeded. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 429) + { + string? __content_429 = null; + global::System.Exception? __exception_429 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_429 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_429 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_429, + responseBody: __content_429, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + // Internal server error. Returns a JSON error with code, message, and optional details. + if ((int)__response.StatusCode == 500) + { + string? __content_500 = null; + global::System.Exception? __exception_500 = null; + try + { + if (__effectiveReadResponseAsString) + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + else + { + __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false); + } + } + catch (global::System.Exception __ex) + { + __exception_500 = __ex; + } + + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content_500 ?? __response.ReasonPhrase ?? string.Empty, + innerException: __exception_500, + responseBody: __content_500, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessUpdateSandboxResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Baseten.SandboxV1.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Baseten.SandboxV1.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Baseten.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Baseten.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Baseten.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + /// + /// Update a sandbox
+ /// Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values. + ///
+ /// + /// + /// + /// + /// When false, the sandbox is disabled and will not accept connections
+ /// Example: true + /// + /// + /// Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates
+ /// Example: {"expiration_policies":[{"action":"DELETE","type":"TTL_IDLE","value":"24h"},{"action":"DELETE","type":"TTL_MAX_AGE","value":"7d"},{"action":"DELETE","type":"DATE","value":"2026-09-23T21:26:58Z"}],"terminated_retention":"24h"} + /// + /// + /// Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.
+ /// Example: us-pdx-1 + /// + /// + /// Environment variables injected into the sandbox.
+ /// Example: [{"name":"NODE_ENV","secret":false,"value":"production"}, {"name":"PORT","secret":false,"value":"3000"}] + /// + /// + /// Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.
+ /// Example: blaxel/base-image:latest + /// + /// + /// Set of ports for a resource
+ /// Example: [{"name":"http","protocol":"HTTP","target":3000}] + /// + /// + /// Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.
+ /// Example: Baseten API review - revised + /// + /// + /// Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.
+ /// Example: api-review-20260916-001 + /// + /// + /// Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.
+ /// Example: {"env":"development","project":"api-review","team":"engineering","revision":"2"} + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task UpdateSandboxAsync( + string sandboxName, + string? teamId = default, + string? xTeamId = default, + bool? enabled = default, + global::Baseten.SandboxLifecycleV1? lifecycle = default, + string? region = default, + global::System.Collections.Generic.IList? envs = default, + string? image = default, + global::System.Collections.Generic.IList? ports = default, + string? displayName = default, + string? externalId = default, + global::System.Collections.Generic.Dictionary? labels = default, + global::Baseten.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __request = new global::Baseten.UpdateSandboxRequestV1 + { + Enabled = enabled, + Lifecycle = lifecycle, + Region = region, + Envs = envs, + Image = image, + Ports = ports, + DisplayName = displayName, + ExternalId = externalId, + Labels = labels, + }; + + return await UpdateSandboxAsync( + teamId: teamId, + xTeamId: xTeamId, + sandboxName: sandboxName, + request: __request, + requestOptions: requestOptions, + cancellationToken: cancellationToken).ConfigureAwait(false); + } + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/Baseten.SandboxesClient.g.cs b/src/libs/Baseten/Generated/Baseten.SandboxesClient.g.cs new file mode 100644 index 0000000..5de49a7 --- /dev/null +++ b/src/libs/Baseten/Generated/Baseten.SandboxesClient.g.cs @@ -0,0 +1,143 @@ + +#nullable enable + +namespace Baseten +{ + /// + /// If no httpClient is provided, a new one will be created.
+ /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + ///
+ public sealed partial class SandboxesClient : global::Baseten.ISandboxesClient, global::System.IDisposable + { + /// + /// + /// + public const string DefaultBaseUrl = "https://api.baseten.co/"; + + private bool _disposeHttpClient = true; + + /// + public global::System.Net.Http.HttpClient HttpClient { get; } + + /// + public System.Uri? BaseUri => HttpClient.BaseAddress; + + /// + public global::System.Collections.Generic.List Authorizations { get; } + + /// + public bool ReadResponseAsString { get; set; } +#if DEBUG + = true; +#endif + + /// + public global::Baseten.AutoSDKClientOptions Options { get; } + + internal global::System.Lazy JsonSerializerContextProvider { get; set; } = new(() => global::Baseten.SandboxesSourceGenerationContext.Default); + + /// + /// + /// + public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext + { + get => JsonSerializerContextProvider.Value; + set => JsonSerializerContextProvider = new(() => value); + } + + + /// + /// Creates a new instance of the SandboxesClient. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SandboxesClient( + global::System.Net.Http.HttpClient? httpClient = null, + global::System.Uri? baseUri = null, + global::System.Collections.Generic.List? authorizations = null, + bool disposeHttpClient = true) : this( + httpClient, + baseUri, + authorizations, + options: null, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the SandboxesClient with explicit options but no base URL override. + /// Skips passing baseUri so the default base URL from the OpenAPI spec applies. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SandboxesClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Collections.Generic.List? authorizations, + global::Baseten.AutoSDKClientOptions? options, + bool disposeHttpClient = true) : this( + httpClient, + baseUri: null, + authorizations, + options, + disposeHttpClient: disposeHttpClient) + { + } + + /// + /// Creates a new instance of the SandboxesClient. + /// If no httpClient is provided, a new one will be created. + /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used. + /// + /// The HttpClient instance. If not provided, a new one will be created. + /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used. + /// The authorizations to use for the requests. + /// Client-wide request defaults such as headers, query parameters, retries, and timeout. + /// Dispose the HttpClient when the instance is disposed. True by default. + public SandboxesClient( + global::System.Net.Http.HttpClient? httpClient, + global::System.Uri? baseUri, + global::System.Collections.Generic.List? authorizations, + global::Baseten.AutoSDKClientOptions? options, + bool disposeHttpClient = true) + { + + HttpClient = httpClient ?? new global::System.Net.Http.HttpClient(); + HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl); + Authorizations = authorizations ?? new global::System.Collections.Generic.List(); + Options = options ?? new global::Baseten.AutoSDKClientOptions(); + _disposeHttpClient = disposeHttpClient; + + Initialized(HttpClient); + } + + /// + public void Dispose() + { + if (_disposeHttpClient) + { + HttpClient.Dispose(); + } + } + + partial void Initialized( + global::System.Net.Http.HttpClient client); + partial void PrepareArguments( + global::System.Net.Http.HttpClient client); + partial void PrepareRequest( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpRequestMessage request); + partial void ProcessResponse( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response); + partial void ProcessResponseContent( + global::System.Net.Http.HttpClient client, + global::System.Net.Http.HttpResponseMessage response, + ref string content); + } +} \ No newline at end of file diff --git a/src/libs/Baseten/Generated/autosdk.generated-examples.json b/src/libs/Baseten/Generated/autosdk.generated-examples.json new file mode 100644 index 0000000..d53a286 --- /dev/null +++ b/src/libs/Baseten/Generated/autosdk.generated-examples.json @@ -0,0 +1,136 @@ +{ + "Examples": [ + { + "Order": 1, + "Title": "Clean up unused images", + "Slug": "cleanupimages", + "Description": "Remove unused sandbox image versions. Versions referenced by active deployments are preserved.", + "Language": "csharp", + "Code": "using var client = new BasetenClient(apiKey);\nvar response = await client.Images.CleanupImagesAsync();\n\n// Example response:\n// {\n// \u0022deleted\u0022: 3,\n// \u0022message\u0022: \u0022Removed 3 unused image versions. Image versions used by active sandboxes were retained.\u0022\n// }", + "Format": "sdk", + "OperationId": "CleanupImages", + "Setup": "This example assumes \u0060using Baseten;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + }, + { + "Order": 2, + "Title": "Delete a sandbox image", + "Slug": "deleteimage", + "Description": "Delete the image repository and all its tags. Reject deletion if any version is referenced by an active deployment. Return the deleted image.", + "Language": "http", + "Code": "### Delete a sandbox image\n# @name DeleteImage\nDELETE {{host}}/v1/sandboxes/images/{{image_name}}?team_id={{team_id}}\nAuthorization: Bearer {{token}}\nX-Team-Id: {{X-Team-Id}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: Successful operation.\n# Content-Type: application/json\n# 401\n# Description: Missing or invalid authentication. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 403\n# Description: Insufficient permissions. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 404\n# Description: Resource not found. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 409\n# Description: Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 429\n# Description: Request limit exceeded. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 500\n# Description: Internal server error. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json", + "Format": "http", + "OperationId": "DeleteImage", + "Setup": null + }, + { + "Order": 3, + "Title": "Delete an image tag", + "Slug": "deleteimagetag", + "Description": "Delete a specific image version. Reject deletion if the version is referenced by an active deployment. Return the updated image with its remaining tags, possibly empty.", + "Language": "http", + "Code": "### Delete an image tag\n# @name DeleteImageTag\nDELETE {{host}}/v1/sandboxes/images/{{image_name}}/tags/{{tag_name}}?team_id={{team_id}}\nAuthorization: Bearer {{token}}\nX-Team-Id: {{X-Team-Id}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: Successful operation.\n# Content-Type: application/json\n# 401\n# Description: Missing or invalid authentication. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 403\n# Description: Insufficient permissions. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 404\n# Description: Resource not found. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 409\n# Description: Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 429\n# Description: Request limit exceeded. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 500\n# Description: Internal server error. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json", + "Format": "http", + "OperationId": "DeleteImageTag", + "Setup": null + }, + { + "Order": 4, + "Title": "Get a sandbox image", + "Slug": "getimage", + "Description": "Return the repository summary and processing status. Use the tag listing endpoint for image versions.", + "Language": "http", + "Code": "### Get a sandbox image\n# @name GetImage\nGET {{host}}/v1/sandboxes/images/{{image_name}}?team_id={{team_id}}\nAuthorization: Bearer {{token}}\nX-Team-Id: {{X-Team-Id}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: Successful operation.\n# Content-Type: application/json\n# 401\n# Description: Missing or invalid authentication. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 403\n# Description: Insufficient permissions. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 404\n# Description: Resource not found. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 429\n# Description: Request limit exceeded. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 500\n# Description: Internal server error. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json", + "Format": "http", + "OperationId": "GetImage", + "Setup": null + }, + { + "Order": 5, + "Title": "List image tags", + "Slug": "listimagetags", + "Description": "Return one cursor-paginated page of image versions.", + "Language": "http", + "Code": "### List image tags\n# @name ListImageTags\nGET {{host}}/v1/sandboxes/images/{{image_name}}/tags?team_id={{team_id}}\u0026cursor={{cursor}}\u0026limit=20\u0026sort=name:asc\u0026q={{q}}\u0026name={{name}}\nAuthorization: Bearer {{token}}\nX-Team-Id: {{X-Team-Id}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: Successful operation.\n# Content-Type: application/json\n# 400\n# Description: Invalid request. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 401\n# Description: Missing or invalid authentication. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 403\n# Description: Insufficient permissions. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 404\n# Description: Resource not found. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 429\n# Description: Request limit exceeded. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 500\n# Description: Internal server error. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json", + "Format": "http", + "OperationId": "ListImageTags", + "Setup": null + }, + { + "Order": 6, + "Title": "List sandbox images", + "Slug": "listimages", + "Description": "Return one cursor-paginated page of image repository summaries. Tags are listed separately. Pages can be empty when non-sandbox repositories are excluded; follow pagination.cursor while pagination.has_more is true. Prefix search forces ascending name order.", + "Language": "csharp", + "Code": "using var client = new BasetenClient(apiKey);\nvar response = await client.Images.ListImagesAsync();\n\n// Example response:\n// {\n// \u0022items\u0022: [\n// {\n// \u0022name\u0022: \u0022base-image\u0022,\n// \u0022display_name\u0022: \u0022b10/base-image\u0022,\n// \u0022status\u0022: \u0022BUILT\u0022,\n// \u0022created_at\u0022: \u00222026-09-15T21:20:00Z\u0022,\n// \u0022updated_at\u0022: \u00222026-09-16T21:25:00Z\u0022,\n// \u0022last_deployed_at\u0022: \u00222026-09-16T21:26:58.545765901Z\u0022,\n// \u0022size\u0022: 260046848,\n// \u0022tag_count\u0022: 2,\n// \u0022tags\u0022: []\n// }\n// ],\n// \u0022pagination\u0022: {\n// \u0022has_more\u0022: false\n// }\n// }", + "Format": "sdk", + "OperationId": "ListImages", + "Setup": "This example assumes \u0060using Baseten;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + }, + { + "Order": 7, + "Title": "Push a sandbox image", + "Slug": "pushimage", + "Description": "With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED.", + "Language": "csharp", + "Code": "using var client = new BasetenClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Baseten.PushImageRequestV1\u003E(\n @\u0022{\n \u0022\u0022name\u0022\u0022: \u0022\u0022base-image\u0022\u0022\n}\u0022)!;\n\nvar response = await client.Images.PushImageAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022name\u0022: \u0022base-image\u0022,\n// \u0022status\u0022: \u0022UPLOADING\u0022,\n// \u0022upload_url\u0022: \u0022https://uploads.b10.run/images/base-image/20260916212658/source.zip?expires=2026-09-16T22%3A26%3A58Z\\u0026signature=demo-not-a-valid-upload-signature\u0022\n// }", + "Format": "sdk", + "OperationId": "PushImage", + "Setup": "This example assumes \u0060using Baseten;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + }, + { + "Order": 8, + "Title": "Create a sandbox", + "Slug": "createsandbox", + "Description": "Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key.", + "Language": "csharp", + "Code": "using var client = new BasetenClient(apiKey);\n\nvar request = global::System.Text.Json.JsonSerializer.Deserialize\u003Cglobal::Baseten.CreateSandboxRequestV1\u003E(\n @\u0022{\n \u0022\u0022name\u0022\u0022: \u0022\u0022baseten-api-review-0916\u0022\u0022,\n \u0022\u0022lifecycle\u0022\u0022: {\n \u0022\u0022expiration_policies\u0022\u0022: [\n {\n \u0022\u0022action\u0022\u0022: \u0022\u0022DELETE\u0022\u0022,\n \u0022\u0022type\u0022\u0022: \u0022\u0022TTL_IDLE\u0022\u0022,\n \u0022\u0022value\u0022\u0022: \u0022\u002224h\u0022\u0022\n },\n {\n \u0022\u0022action\u0022\u0022: \u0022\u0022DELETE\u0022\u0022,\n \u0022\u0022type\u0022\u0022: \u0022\u0022TTL_MAX_AGE\u0022\u0022,\n \u0022\u0022value\u0022\u0022: \u0022\u00227d\u0022\u0022\n },\n {\n \u0022\u0022action\u0022\u0022: \u0022\u0022DELETE\u0022\u0022,\n \u0022\u0022type\u0022\u0022: \u0022\u0022DATE\u0022\u0022,\n \u0022\u0022value\u0022\u0022: \u0022\u00222026-09-23T21:26:58Z\u0022\u0022\n }\n ],\n \u0022\u0022terminated_retention\u0022\u0022: \u0022\u002224h\u0022\u0022\n },\n \u0022\u0022network\u0022\u0022: {\n \u0022\u0022proxy\u0022\u0022: {\n \u0022\u0022allowed_domains\u0022\u0022: [\n \u0022\u0022api.openai.com\u0022\u0022,\n \u0022\u0022pypi.org\u0022\u0022,\n \u0022\u0022files.pythonhosted.org\u0022\u0022,\n \u0022\u0022registry.npmjs.org\u0022\u0022\n ],\n \u0022\u0022bypass\u0022\u0022: [\n \u0022\u0022registry.npmjs.org\u0022\u0022\n ],\n \u0022\u0022forbidden_domains\u0022\u0022: [\n \u0022\u0022facebook.com\u0022\u0022,\n \u0022\u0022*.facebook.com\u0022\u0022\n ],\n \u0022\u0022routing\u0022\u0022: [\n {\n \u0022\u0022destinations\u0022\u0022: [\n \u0022\u0022api.openai.com\u0022\u0022\n ],\n \u0022\u0022headers\u0022\u0022: {\n \u0022\u0022Authorization\u0022\u0022: \u0022\u0022Bearer {{SECRET:openai-key}}\u0022\u0022\n },\n \u0022\u0022body\u0022\u0022: {\n \u0022\u0022user\u0022\u0022: \u0022\u0022baseten-api-review-0916\u0022\u0022\n },\n \u0022\u0022secrets\u0022\u0022: {\n \u0022\u0022openai-key\u0022\u0022: \u0022\u0022sk-proj-demo-not-a-valid-api-key\u0022\u0022\n }\n }\n ]\n },\n \u0022\u0022subnet\u0022\u0022: \u0022\u0022default\u0022\u0022\n },\n \u0022\u0022region\u0022\u0022: \u0022\u0022us-pdx-1\u0022\u0022,\n \u0022\u0022envs\u0022\u0022: [\n {\n \u0022\u0022name\u0022\u0022: \u0022\u0022NODE_ENV\u0022\u0022,\n \u0022\u0022secret\u0022\u0022: false,\n \u0022\u0022value\u0022\u0022: \u0022\u0022production\u0022\u0022\n },\n {\n \u0022\u0022name\u0022\u0022: \u0022\u0022PORT\u0022\u0022,\n \u0022\u0022secret\u0022\u0022: false,\n \u0022\u0022value\u0022\u0022: \u0022\u00223000\u0022\u0022\n }\n ],\n \u0022\u0022image\u0022\u0022: \u0022\u0022blaxel/base-image:latest\u0022\u0022,\n \u0022\u0022memory\u0022\u0022: 4096,\n \u0022\u0022ports\u0022\u0022: [\n {\n \u0022\u0022name\u0022\u0022: \u0022\u0022http\u0022\u0022,\n \u0022\u0022protocol\u0022\u0022: \u0022\u0022HTTP\u0022\u0022,\n \u0022\u0022target\u0022\u0022: 3000\n }\n ],\n \u0022\u0022display_name\u0022\u0022: \u0022\u0022Baseten API review\u0022\u0022,\n \u0022\u0022external_id\u0022\u0022: \u0022\u0022api-review-20260916-001\u0022\u0022,\n \u0022\u0022labels\u0022\u0022: {\n \u0022\u0022env\u0022\u0022: \u0022\u0022development\u0022\u0022,\n \u0022\u0022project\u0022\u0022: \u0022\u0022api-review\u0022\u0022,\n \u0022\u0022team\u0022\u0022: \u0022\u0022engineering\u0022\u0022\n }\n}\u0022)!;\n\nvar response = await client.Sandboxes.CreateSandboxAsync(\n request: request\n);\n\n// Example response:\n// {\n// \u0022enabled\u0022: true,\n// \u0022lifecycle\u0022: {\n// \u0022expiration_policies\u0022: [\n// {\n// \u0022action\u0022: \u0022DELETE\u0022,\n// \u0022type\u0022: \u0022TTL_IDLE\u0022,\n// \u0022value\u0022: \u002224h\u0022\n// },\n// {\n// \u0022action\u0022: \u0022DELETE\u0022,\n// \u0022type\u0022: \u0022TTL_MAX_AGE\u0022,\n// \u0022value\u0022: \u00227d\u0022\n// },\n// {\n// \u0022action\u0022: \u0022DELETE\u0022,\n// \u0022type\u0022: \u0022DATE\u0022,\n// \u0022value\u0022: \u00222026-09-23T21:26:58Z\u0022\n// }\n// ],\n// \u0022terminated_retention\u0022: \u002224h\u0022\n// },\n// \u0022network\u0022: {\n// \u0022proxy\u0022: {\n// \u0022allowed_domains\u0022: [\n// \u0022api.openai.com\u0022,\n// \u0022pypi.org\u0022,\n// \u0022files.pythonhosted.org\u0022,\n// \u0022registry.npmjs.org\u0022\n// ],\n// \u0022bypass\u0022: [\n// \u0022registry.npmjs.org\u0022\n// ],\n// \u0022forbidden_domains\u0022: [\n// \u0022facebook.com\u0022,\n// \u0022*.facebook.com\u0022\n// ],\n// \u0022routing\u0022: [\n// {\n// \u0022destinations\u0022: [\n// \u0022api.openai.com\u0022\n// ],\n// \u0022headers\u0022: {\n// \u0022Authorization\u0022: \u0022Bearer {{SECRET:openai-key}}\u0022\n// },\n// \u0022body\u0022: {\n// \u0022user\u0022: \u0022baseten-api-review-0916\u0022\n// }\n// }\n// ]\n// },\n// \u0022subnet\u0022: \u0022default\u0022\n// },\n// \u0022region\u0022: \u0022us-pdx-1\u0022,\n// \u0022envs\u0022: [\n// {\n// \u0022name\u0022: \u0022NODE_ENV\u0022,\n// \u0022secret\u0022: false,\n// \u0022value\u0022: \u0022production\u0022\n// },\n// {\n// \u0022name\u0022: \u0022PORT\u0022,\n// \u0022secret\u0022: false,\n// \u0022value\u0022: \u00223000\u0022\n// }\n// ],\n// \u0022image\u0022: \u0022blaxel/base-image:latest\u0022,\n// \u0022memory\u0022: 4096,\n// \u0022ports\u0022: [\n// {\n// \u0022name\u0022: \u0022http\u0022,\n// \u0022protocol\u0022: \u0022HTTP\u0022,\n// \u0022target\u0022: 3000\n// }\n// ],\n// \u0022display_name\u0022: \u0022Baseten API review\u0022,\n// \u0022external_id\u0022: \u0022api-review-20260916-001\u0022,\n// \u0022labels\u0022: {\n// \u0022env\u0022: \u0022development\u0022,\n// \u0022project\u0022: \u0022api-review\u0022,\n// \u0022team\u0022: \u0022engineering\u0022\n// },\n// \u0022name\u0022: \u0022baseten-api-review-0916\u0022,\n// \u0022url\u0022: \u0022https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run\u0022,\n// \u0022status\u0022: \u0022DEPLOYED\u0022,\n// \u0022state\u0022: \u0022RUNNING\u0022,\n// \u0022created_at\u0022: \u00222026-09-16T21:26:58.545765901Z\u0022,\n// \u0022updated_at\u0022: \u00222026-09-16T21:31:13Z\u0022,\n// \u0022created_by\u0022: \u0022sandbox-automation\u0022,\n// \u0022updated_by\u0022: \u0022sandbox-automation\u0022,\n// \u0022last_used_at\u0022: \u00222026-09-16T21:31:13Z\u0022,\n// \u0022expires_in\u0022: 86400\n// }", + "Format": "sdk", + "OperationId": "CreateSandbox", + "Setup": "This example assumes \u0060using Baseten;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + }, + { + "Order": 9, + "Title": "Delete a sandbox", + "Slug": "deletesandbox", + "Description": "Permanently delete the sandbox and its local data asynchronously. The returned resource has status DELETING.", + "Language": "http", + "Code": "### Delete a sandbox\n# @name DeleteSandbox\nDELETE {{host}}/v1/sandboxes/instances/{{sandbox_name}}?team_id={{team_id}}\nAuthorization: Bearer {{token}}\nX-Team-Id: {{X-Team-Id}}\nAccept: application/json\n\n## Responses\n# 202\n# Description: Request accepted.\n# Content-Type: application/json\n# 401\n# Description: Missing or invalid authentication. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 403\n# Description: Insufficient permissions. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 404\n# Description: Resource not found. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 409\n# Description: Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 429\n# Description: Request limit exceeded. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 500\n# Description: Internal server error. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json", + "Format": "http", + "OperationId": "DeleteSandbox", + "Setup": null + }, + { + "Order": 10, + "Title": "Get a sandbox", + "Slug": "getsandbox", + "Description": "Return the sandbox configuration and current state.", + "Language": "http", + "Code": "### Get a sandbox\n# @name GetSandbox\nGET {{host}}/v1/sandboxes/instances/{{sandbox_name}}?team_id={{team_id}}\nAuthorization: Bearer {{token}}\nX-Team-Id: {{X-Team-Id}}\nAccept: application/json\n\n## Responses\n# 200\n# Description: Successful operation.\n# Content-Type: application/json\n# 401\n# Description: Missing or invalid authentication. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 403\n# Description: Insufficient permissions. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 404\n# Description: Resource not found. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 429\n# Description: Request limit exceeded. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 500\n# Description: Internal server error. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json", + "Format": "http", + "OperationId": "GetSandbox", + "Setup": null + }, + { + "Order": 11, + "Title": "List sandboxes", + "Slug": "listsandboxes", + "Description": "Return a cursor-paginated page of sandboxes. Terminated sandboxes are hidden by default.", + "Language": "csharp", + "Code": "using var client = new BasetenClient(apiKey);\nvar response = await client.Sandboxes.ListSandboxesAsync();\n\n// Example response:\n// {\n// \u0022items\u0022: [\n// {\n// \u0022enabled\u0022: true,\n// \u0022lifecycle\u0022: {\n// \u0022expiration_policies\u0022: [\n// {\n// \u0022action\u0022: \u0022DELETE\u0022,\n// \u0022type\u0022: \u0022TTL_IDLE\u0022,\n// \u0022value\u0022: \u002224h\u0022\n// },\n// {\n// \u0022action\u0022: \u0022DELETE\u0022,\n// \u0022type\u0022: \u0022TTL_MAX_AGE\u0022,\n// \u0022value\u0022: \u00227d\u0022\n// },\n// {\n// \u0022action\u0022: \u0022DELETE\u0022,\n// \u0022type\u0022: \u0022DATE\u0022,\n// \u0022value\u0022: \u00222026-09-23T21:26:58Z\u0022\n// }\n// ],\n// \u0022terminated_retention\u0022: \u002224h\u0022\n// },\n// \u0022network\u0022: {\n// \u0022proxy\u0022: {\n// \u0022allowed_domains\u0022: [\n// \u0022api.openai.com\u0022,\n// \u0022pypi.org\u0022,\n// \u0022files.pythonhosted.org\u0022,\n// \u0022registry.npmjs.org\u0022\n// ],\n// \u0022bypass\u0022: [\n// \u0022registry.npmjs.org\u0022\n// ],\n// \u0022forbidden_domains\u0022: [\n// \u0022facebook.com\u0022,\n// \u0022*.facebook.com\u0022\n// ],\n// \u0022routing\u0022: [\n// {\n// \u0022destinations\u0022: [\n// \u0022api.openai.com\u0022\n// ],\n// \u0022headers\u0022: {\n// \u0022Authorization\u0022: \u0022Bearer {{SECRET:openai-key}}\u0022\n// },\n// \u0022body\u0022: {\n// \u0022user\u0022: \u0022baseten-api-review-0916\u0022\n// }\n// }\n// ]\n// },\n// \u0022subnet\u0022: \u0022default\u0022\n// },\n// \u0022region\u0022: \u0022us-pdx-1\u0022,\n// \u0022envs\u0022: [\n// {\n// \u0022name\u0022: \u0022NODE_ENV\u0022,\n// \u0022secret\u0022: false,\n// \u0022value\u0022: \u0022production\u0022\n// },\n// {\n// \u0022name\u0022: \u0022PORT\u0022,\n// \u0022secret\u0022: false,\n// \u0022value\u0022: \u00223000\u0022\n// }\n// ],\n// \u0022image\u0022: \u0022blaxel/base-image:latest\u0022,\n// \u0022memory\u0022: 4096,\n// \u0022ports\u0022: [\n// {\n// \u0022name\u0022: \u0022http\u0022,\n// \u0022protocol\u0022: \u0022HTTP\u0022,\n// \u0022target\u0022: 3000\n// }\n// ],\n// \u0022display_name\u0022: \u0022Baseten API review\u0022,\n// \u0022external_id\u0022: \u0022api-review-20260916-001\u0022,\n// \u0022labels\u0022: {\n// \u0022env\u0022: \u0022development\u0022,\n// \u0022project\u0022: \u0022api-review\u0022,\n// \u0022team\u0022: \u0022engineering\u0022\n// },\n// \u0022name\u0022: \u0022baseten-api-review-0916\u0022,\n// \u0022url\u0022: \u0022https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run\u0022,\n// \u0022status\u0022: \u0022DEPLOYED\u0022,\n// \u0022state\u0022: \u0022RUNNING\u0022,\n// \u0022created_at\u0022: \u00222026-09-16T21:26:58.545765901Z\u0022,\n// \u0022updated_at\u0022: \u00222026-09-16T21:31:13Z\u0022,\n// \u0022created_by\u0022: \u0022sandbox-automation\u0022,\n// \u0022updated_by\u0022: \u0022sandbox-automation\u0022,\n// \u0022last_used_at\u0022: \u00222026-09-16T21:31:13Z\u0022,\n// \u0022expires_in\u0022: 86400\n// }\n// ],\n// \u0022pagination\u0022: {\n// \u0022has_more\u0022: false\n// }\n// }", + "Format": "sdk", + "OperationId": "ListSandboxes", + "Setup": "This example assumes \u0060using Baseten;\u0060 is in scope and \u0060apiKey\u0060 contains the required credential." + }, + { + "Order": 12, + "Title": "Update a sandbox", + "Slug": "updatesandbox", + "Description": "Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values.", + "Language": "http", + "Code": "### Update a sandbox\n# @name UpdateSandbox\nPATCH {{host}}/v1/sandboxes/instances/{{sandbox_name}}?team_id={{team_id}}\nAuthorization: Bearer {{token}}\nX-Team-Id: {{X-Team-Id}}\nContent-Type: application/json\nAccept: application/json\n\n{\n \u0022enabled\u0022: true,\n \u0022lifecycle\u0022: {\n \u0022expiration_policies\u0022: [\n {\n \u0022action\u0022: \u0022DELETE\u0022,\n \u0022type\u0022: \u0022TTL_IDLE\u0022,\n \u0022value\u0022: \u002224h\u0022\n },\n {\n \u0022action\u0022: \u0022DELETE\u0022,\n \u0022type\u0022: \u0022TTL_MAX_AGE\u0022,\n \u0022value\u0022: \u00227d\u0022\n },\n {\n \u0022action\u0022: \u0022DELETE\u0022,\n \u0022type\u0022: \u0022DATE\u0022,\n \u0022value\u0022: \u00222026-09-23T21:26:58Z\u0022\n }\n ],\n \u0022terminated_retention\u0022: \u002224h\u0022\n },\n \u0022region\u0022: \u0022us-pdx-1\u0022,\n \u0022envs\u0022: [\n {\n \u0022name\u0022: \u0022NODE_ENV\u0022,\n \u0022secret\u0022: false,\n \u0022value\u0022: \u0022production\u0022\n },\n {\n \u0022name\u0022: \u0022PORT\u0022,\n \u0022secret\u0022: false,\n \u0022value\u0022: \u00223000\u0022\n }\n ],\n \u0022image\u0022: \u0022blaxel/base-image:latest\u0022,\n \u0022ports\u0022: [\n {\n \u0022name\u0022: \u0022http\u0022,\n \u0022protocol\u0022: \u0022HTTP\u0022,\n \u0022target\u0022: 3000\n }\n ],\n \u0022display_name\u0022: \u0022Baseten API review - revised\u0022,\n \u0022external_id\u0022: \u0022api-review-20260916-001\u0022,\n \u0022labels\u0022: {\n \u0022env\u0022: \u0022development\u0022,\n \u0022project\u0022: \u0022api-review\u0022,\n \u0022team\u0022: \u0022engineering\u0022,\n \u0022revision\u0022: \u00222\u0022\n }\n}\n\n## Responses\n# 200\n# Description: Successful operation.\n# Content-Type: application/json\n# 400\n# Description: Invalid request, including attempts to change memory or network configuration.\n# Content-Type: application/json\n# 401\n# Description: Missing or invalid authentication. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 403\n# Description: Insufficient permissions. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 404\n# Description: Resource not found. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 409\n# Description: Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 429\n# Description: Request limit exceeded. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json\n# 500\n# Description: Internal server error. Returns a JSON error with code, message, and optional details.\n# Content-Type: application/json", + "Format": "http", + "OperationId": "UpdateSandbox", + "Setup": null + } + ] +} \ No newline at end of file diff --git a/src/libs/Baseten/openapi.yaml b/src/libs/Baseten/openapi.yaml index 8876f19..8b0c6aa 100644 --- a/src/libs/Baseten/openapi.yaml +++ b/src/libs/Baseten/openapi.yaml @@ -10614,6 +10614,823 @@ "$ref": "#/components/parameters/api_key_prefix" } ] + }, + "/v1/sandboxes/instances": { + "get": { + "operationId": "ListSandboxes", + "summary": "List sandboxes", + "description": "Return a cursor-paginated page of sandboxes. Terminated sandboxes are hidden by default.", + "tags": [ + "Sandboxes" + ], + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + }, + { + "$ref": "#/components/parameters/Cursor" + }, + { + "$ref": "#/components/parameters/Limit" + }, + { + "name": "q", + "in": "query", + "description": "Search indexed sandbox names and labels. Search is applied before pagination.", + "required": false, + "schema": { + "type": "string", + "example": "api-review" + } + }, + { + "name": "status", + "in": "query", + "description": "Deployment statuses. Repeat the query parameter for each status, for example status=DEPLOYED&status=FAILED. Unknown values are rejected. Cannot be combined with external_id.", + "required": false, + "style": "form", + "explode": true, + "schema": { + "type": "array", + "minItems": 1, + "items": { + "type": "string", + "minLength": 1 + }, + "example": [ + "DEPLOYED", + "FAILED" + ] + } + }, + { + "name": "external_id", + "in": "query", + "description": "Filter by a caller-owned external identifier. Cannot be combined with status.", + "required": false, + "schema": { + "type": "string", + "example": "api-review-20260916-001" + } + } + ], + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListSandboxesResponseV1" + }, + "examples": { + "page": { + "$ref": "#/components/examples/SandboxesPage" + }, + "last_page": { + "$ref": "#/components/examples/SandboxesLastPage" + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/SandboxError400" + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + }, + "post": { + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "operationId": "CreateSandbox", + "summary": "Create a sandbox", + "description": "Create a sandbox with an optional client-provided name, generated by the server when omitted. The request waits briefly for deployment, then returns the created resource. Deployment may continue after the response; inspect status to determine readiness. Names belonging to failed or terminated sandboxes can be reused; an active sandbox reserves its name. To get started, set image to blaxel/base-image:latest, the built-in image with the sandbox execution API ready to use. It is available directly; no image build, push, or GET /v1/sandboxes/images is needed. Use the returned url to execute commands with the same Bearer API key.", + "tags": [ + "Sandboxes" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateSandboxRequestV1" + }, + "examples": { + "quickstart": { + "$ref": "#/components/examples/CreateSandboxQuickstart" + }, + "complete": { + "$ref": "#/components/examples/CreateSandbox" + } + } + } + } + }, + "responses": { + "201": { + "description": "Sandbox created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SandboxV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/SandboxReady" + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/SandboxError400" + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "409": { + "description": "An active sandbox with the requested name already exists. Returns a JSON error with code, message, and optional details.", + "content": { + "application/json": { + "example": { + "code": "ALREADY_EXISTS", + "message": "A sandbox with this name already exists.", + "details": { + "name": "baseten-api-review-0916" + } + } + } + } + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + } + }, + "/v1/sandboxes/instances/{sandbox_name}": { + "parameters": [ + { + "$ref": "#/components/parameters/SandboxName" + } + ], + "get": { + "operationId": "GetSandbox", + "summary": "Get a sandbox", + "description": "Return the sandbox configuration and current state.", + "tags": [ + "Sandboxes" + ], + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SandboxV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/SandboxReady" + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "404": { + "$ref": "#/components/responses/SandboxError404" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + }, + "patch": { + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "operationId": "UpdateSandbox", + "summary": "Update a sandbox", + "description": "Partially update configuration. Omitted fields remain unchanged; supplied arrays and maps replace their previous values. Structured objects update only supplied fields. Changes to image may reset running state. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values.", + "tags": [ + "Sandboxes" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UpdateSandboxRequestV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/UpdateSandbox" + } + } + } + } + }, + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SandboxV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/SandboxUpdated" + } + } + } + } + }, + "400": { + "description": "Invalid request, including attempts to change memory or network configuration.", + "content": { + "application/json": { + "example": { + "code": "INVALID_REQUEST", + "message": "Memory and network configuration cannot be changed after creation." + } + } + } + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "404": { + "$ref": "#/components/responses/SandboxError404" + }, + "409": { + "$ref": "#/components/responses/SandboxError409" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + }, + "delete": { + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "operationId": "DeleteSandbox", + "summary": "Delete a sandbox", + "description": "Permanently delete the sandbox and its local data asynchronously. The returned resource has status DELETING.", + "tags": [ + "Sandboxes" + ], + "responses": { + "202": { + "description": "Request accepted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SandboxV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/SandboxDeleting" + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "404": { + "$ref": "#/components/responses/SandboxError404" + }, + "409": { + "$ref": "#/components/responses/SandboxError409" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + } + }, + "/v1/sandboxes/images": { + "get": { + "operationId": "ListImages", + "summary": "List sandbox images", + "description": "Return one cursor-paginated page of image repository summaries. Tags are listed separately. Pages can be empty when non-sandbox repositories are excluded; follow pagination.cursor while pagination.has_more is true. Prefix search forces ascending name order.", + "tags": [ + "Images" + ], + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + }, + { + "$ref": "#/components/parameters/Cursor" + }, + { + "$ref": "#/components/parameters/Limit" + }, + { + "name": "sort", + "in": "query", + "description": "Sort by repository name or creation time: name:asc, name:desc, createdAt:asc, or createdAt:desc. Keep the same sort when following a cursor.", + "schema": { + "type": "string", + "default": "createdAt:desc" + } + }, + { + "name": "q", + "in": "query", + "description": "Case-sensitive repository name prefix. Search is applied before pagination.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListImagesResponseV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/ImagesList" + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/SandboxError400" + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + }, + "post": { + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "operationId": "PushImage", + "summary": "Push a sandbox image", + "description": "With image supplied, import the registry image asynchronously. Otherwise return an upload URL for a ZIP source archive containing its Dockerfile and build context. Processing starts after upload. No sandbox is created. Poll the image until BUILT or FAILED.", + "tags": [ + "Images" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PushImageRequestV1" + }, + "examples": { + "archive": { + "$ref": "#/components/examples/PushArchive" + }, + "registry": { + "$ref": "#/components/examples/PushRegistry" + } + } + } + } + }, + "responses": { + "202": { + "description": "Request accepted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PushImageResponseV1" + }, + "examples": { + "archive": { + "$ref": "#/components/examples/PushArchiveAccepted" + }, + "registry": { + "$ref": "#/components/examples/PushRegistryAccepted" + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/SandboxError400" + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + } + }, + "/v1/sandboxes/cleanup_images": { + "post": { + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "operationId": "CleanupImages", + "summary": "Clean up unused images", + "description": "Remove unused sandbox image versions. Versions referenced by active deployments are preserved.", + "tags": [ + "Images" + ], + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CleanupImagesResponseV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/CleanupImages" + } + } + } + } + }, + "400": { + "$ref": "#/components/responses/SandboxError400" + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + } + }, + "/v1/sandboxes/images/{image_name}": { + "parameters": [ + { + "$ref": "#/components/parameters/ImageName" + } + ], + "get": { + "operationId": "GetImage", + "summary": "Get a sandbox image", + "description": "Return the repository summary and processing status. Use the tag listing endpoint for image versions.", + "tags": [ + "Images" + ], + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/ImageSummary" + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "404": { + "$ref": "#/components/responses/SandboxError404" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + }, + "delete": { + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "operationId": "DeleteImage", + "summary": "Delete a sandbox image", + "description": "Delete the image repository and all its tags. Reject deletion if any version is referenced by an active deployment. Return the deleted image.", + "tags": [ + "Images" + ], + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/ImageReady" + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "404": { + "$ref": "#/components/responses/SandboxError404" + }, + "409": { + "$ref": "#/components/responses/SandboxError409" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + } + }, + "/v1/sandboxes/images/{image_name}/tags": { + "parameters": [ + { + "$ref": "#/components/parameters/ImageName" + } + ], + "get": { + "operationId": "ListImageTags", + "summary": "List image tags", + "description": "Return one cursor-paginated page of image versions.", + "tags": [ + "Images" + ], + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + }, + { + "$ref": "#/components/parameters/Cursor" + }, + { + "$ref": "#/components/parameters/Limit" + }, + { + "name": "sort", + "in": "query", + "description": "Sort by tag name: name:asc or name:desc. Keep the same sort when following a cursor.", + "schema": { + "type": "string", + "default": "name:asc" + } + }, + { + "name": "q", + "in": "query", + "description": "Case-sensitive tag name prefix. Cannot be combined with name. Forces ascending name order.", + "schema": { + "type": "string" + } + }, + { + "name": "name", + "in": "query", + "description": "Exact tag name. Cannot be combined with q. Forces ascending name order.", + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ListImageTagsResponseV1" + } + } + } + }, + "400": { + "$ref": "#/components/responses/SandboxError400" + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "404": { + "$ref": "#/components/responses/SandboxError404" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + } + }, + "/v1/sandboxes/images/{image_name}/tags/{tag_name}": { + "parameters": [ + { + "$ref": "#/components/parameters/ImageName" + }, + { + "$ref": "#/components/parameters/TagName" + } + ], + "delete": { + "parameters": [ + { + "$ref": "#/components/parameters/TeamId" + }, + { + "$ref": "#/components/parameters/TeamIdHeader" + } + ], + "operationId": "DeleteImageTag", + "summary": "Delete an image tag", + "description": "Delete a specific image version. Reject deletion if the version is referenced by an active deployment. Return the updated image with its remaining tags, possibly empty.", + "tags": [ + "Images" + ], + "responses": { + "200": { + "description": "Successful operation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ImageV1" + }, + "examples": { + "complete": { + "$ref": "#/components/examples/ImageAfterTagDeletion" + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/SandboxError401" + }, + "403": { + "$ref": "#/components/responses/SandboxError403" + }, + "404": { + "$ref": "#/components/responses/SandboxError404" + }, + "409": { + "$ref": "#/components/responses/SandboxError409" + }, + "429": { + "$ref": "#/components/responses/SandboxError429" + }, + "500": { + "$ref": "#/components/responses/SandboxError500" + } + }, + "x-stability": "unstable" + } } }, "openapi": "3.1.0", @@ -30247,321 +31064,680 @@ "input": { "anyOf": [ { - "type": "number" + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "USD per 1M input tokens, when available.", + "title": "Input" + }, + "output": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "USD per 1M output tokens, when available.", + "title": "Output" + }, + "cache_read": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "USD per 1M input tokens read from cache, when available.", + "title": "Cache Read" + }, + "cache_write": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "USD per 1M input tokens written to cache, when available.", + "title": "Cache Write" + }, + "long_context": { + "anyOf": [ + { + "$ref": "#/components/schemas/ExploreCostValuesV1" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Prices for long-context requests, when the provider tiers by context length." + } + }, + "title": "ExploreCostV1", + "type": "object" + }, + "ExploreCostValuesV1": { + "properties": { + "input": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "USD per 1M input tokens, when available.", + "title": "Input" + }, + "output": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "USD per 1M output tokens, when available.", + "title": "Output" + }, + "cache_read": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "USD per 1M input tokens read from cache, when available.", + "title": "Cache Read" + }, + "cache_write": { + "anyOf": [ + { + "type": "number" + }, + { + "type": "null" + } + ], + "default": null, + "description": "USD per 1M input tokens written to cache, when available.", + "title": "Cache Write" + } + }, + "title": "ExploreCostValuesV1", + "type": "object" + }, + "ExploreMetadataAPIFormatsV1": { + "properties": { + "messages": { + "default": false, + "description": "Anthropic Messages API support.", + "title": "Messages", + "type": "boolean" + }, + "responses": { + "default": false, + "description": "OpenAI Responses API support.", + "title": "Responses", + "type": "boolean" + }, + "chat_completions": { + "default": false, + "description": "OpenAI Chat Completions API support.", + "title": "Chat Completions", + "type": "boolean" + } + }, + "title": "ExploreMetadataAPIFormatsV1", + "type": "object" + }, + "ExploreMetadataV1": { + "properties": { + "slug": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Metadata slug, e.g. 'anthropic/claude-opus-4'; null for rows without one.", + "title": "Slug" + }, + "display_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Model display name, when available.", + "title": "Display Name" + }, + "release_date": { + "anyOf": [ + { + "format": "date", + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Model release date. Month-only source dates use the first day of that month.", + "title": "Release Date" + }, + "provider": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Provider key derived from the slug prefix, e.g. 'anthropic'; null for unprefixed slugs.", + "title": "Provider" + }, + "context_window": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Total context window in tokens.", + "title": "Context Window" + }, + "max_output_tokens": { + "anyOf": [ + { + "type": "integer" + }, + { + "type": "null" + } + ], + "description": "Maximum output tokens per response.", + "title": "Max Output Tokens" + }, + "input_modalities": { + "description": "Accepted input modalities.", + "items": { + "type": "string" + }, + "title": "Input Modalities", + "type": "array" + }, + "tools": { + "anyOf": [ + { + "type": "boolean" }, { "type": "null" } ], - "default": null, - "description": "USD per 1M input tokens, when available.", - "title": "Input" + "description": "Whether the model supports tool calling.", + "title": "Tools" }, - "output": { + "reasoning_effort_levels": { "anyOf": [ { - "type": "number" + "items": { + "type": "string" + }, + "type": "array" }, { "type": "null" } ], - "default": null, - "description": "USD per 1M output tokens, when available.", - "title": "Output" + "description": "Reasoning effort levels the model supports.", + "title": "Reasoning Effort Levels" }, - "cache_read": { + "parallel_tool_calls": { "anyOf": [ { - "type": "number" + "type": "boolean" }, { "type": "null" } ], - "default": null, - "description": "USD per 1M input tokens read from cache, when available.", - "title": "Cache Read" + "description": "Whether the model supports parallel tool calls.", + "title": "Parallel Tool Calls" }, - "cache_write": { + "supported_api_formats": { "anyOf": [ { - "type": "number" + "$ref": "#/components/schemas/ExploreMetadataAPIFormatsV1" }, { "type": "null" } ], - "default": null, - "description": "USD per 1M input tokens written to cache, when available.", - "title": "Cache Write" + "description": "API formats the model supports." }, - "long_context": { + "cost": { "anyOf": [ { - "$ref": "#/components/schemas/ExploreCostValuesV1" + "$ref": "#/components/schemas/ExploreCostV1" }, { "type": "null" } ], - "default": null, - "description": "Prices for long-context requests, when the provider tiers by context length." + "description": "Provider list prices in USD per 1M tokens, when available." } }, - "title": "ExploreCostV1", + "required": [ + "slug", + "display_name", + "release_date", + "provider", + "context_window", + "max_output_tokens", + "input_modalities", + "tools", + "reasoning_effort_levels", + "parallel_tool_calls", + "supported_api_formats", + "cost" + ], + "title": "ExploreMetadataV1", "type": "object" }, - "ExploreCostValuesV1": { + "ExploreMetadataResponseV1": { "properties": { - "input": { + "items": { + "description": "Items in this page.", + "items": { + "$ref": "#/components/schemas/ExploreMetadataV1" + }, + "title": "Items", + "type": "array" + }, + "pagination": { + "$ref": "#/components/schemas/PaginationResponseV1", + "description": "Pagination metadata for the page." + } + }, + "required": [ + "items", + "pagination" + ], + "title": "ExploreMetadataResponseV1", + "type": "object" + }, + "ExploreMetadataRequestV1": { + "properties": { + "cursor": { "anyOf": [ { - "type": "number" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "USD per 1M input tokens, when available.", - "title": "Input" + "description": "Opaque cursor returned by a previous page. Omit to fetch the first page.", + "title": "Cursor" }, - "output": { + "limit": { + "default": 100, + "description": "Maximum number of items to return.", + "maximum": 1000, + "minimum": 1, + "title": "Limit", + "type": "integer" + }, + "provider": { "anyOf": [ { - "type": "number" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "USD per 1M output tokens, when available.", - "title": "Output" + "description": "Filter to a provider by slug prefix, e.g. 'anthropic'. Preserved by the cursor; if repeated, must match the original filter.", + "title": "Provider" }, - "cache_read": { + "q": { "anyOf": [ { - "type": "number" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "USD per 1M input tokens read from cache, when available.", - "title": "Cache Read" + "description": "Case-insensitive substring search over metadata slugs. Preserved by the cursor; if repeated, must match the original filter.", + "title": "Q" + } + }, + "title": "ExploreMetadataRequestV1", + "type": "object" + }, + "RouteRefV1": { + "properties": { + "id": { + "description": "Stable route identifier.", + "title": "Id", + "type": "string" + }, + "slug": { + "description": "Name of the route to send in the inference request's model field.", + "title": "Slug", + "type": "string" + } + }, + "required": [ + "id", + "slug" + ], + "title": "RouteRefV1", + "type": "object" + }, + "RouteTargetAnthropicV1": { + "properties": { + "type": { + "const": "ANTHROPIC", + "description": "Target kind for Anthropic.", + "title": "Type", + "type": "string" + }, + "model": { + "description": "Model name sent to the provider.", + "minLength": 1, + "title": "Model", + "type": "string" + }, + "secret_name": { + "description": "Name of a credential secret owned by the route's team.", + "minLength": 1, + "title": "Secret Name", + "type": "string" + } + }, + "required": [ + "type", + "model", + "secret_name" + ], + "title": "RouteTargetAnthropicV1", + "type": "object" + }, + "RouteTargetBasetenModelAPIV1": { + "properties": { + "type": { + "const": "BASETEN_MODEL_API", + "description": "Target kind for a Baseten Model API.", + "title": "Type", + "type": "string" + }, + "model": { + "description": "Name of the target Model API.", + "minLength": 1, + "title": "Model", + "type": "string" + } + }, + "required": [ + "type", + "model" + ], + "title": "RouteTargetBasetenModelAPIV1", + "type": "object" + }, + "RouteTargetClassifierModelBasedV1": { + "properties": { + "type": { + "const": "CLASSIFIER_MODEL_BASED", + "description": "Target kind for a classifier-model-based route.", + "title": "Type", + "type": "string" + }, + "classifier_model_id": { + "description": "ID of the Baseten model that picks a route for each request.", + "examples": [ + "abcd123" + ], + "title": "Classifier Model Id", + "type": "string" + }, + "classifier_environment_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Environment of the classifier model. Null for production.", + "examples": [ + "production" + ], + "title": "Classifier Environment Name" + }, + "default_route": { + "$ref": "#/components/schemas/RouteRefV1", + "description": "Route used when the classifier picks none." + }, + "allowed_routes": { + "description": "Routes the classifier may pick, in creation order.", + "items": { + "$ref": "#/components/schemas/RouteRefV1" + }, + "title": "Allowed Routes", + "type": "array" + } + }, + "required": [ + "type", + "classifier_model_id", + "classifier_environment_name", + "default_route", + "allowed_routes" + ], + "title": "RouteTargetClassifierModelBasedV1", + "type": "object" + }, + "RouteTargetOpenAIV1": { + "properties": { + "type": { + "const": "OPENAI", + "description": "Target kind for OpenAI.", + "title": "Type", + "type": "string" }, - "cache_write": { - "anyOf": [ - { - "type": "number" - }, - { - "type": "null" - } - ], - "default": null, - "description": "USD per 1M input tokens written to cache, when available.", - "title": "Cache Write" + "model": { + "description": "Model name sent to the provider.", + "minLength": 1, + "title": "Model", + "type": "string" + }, + "secret_name": { + "description": "Name of a credential secret owned by the route's team.", + "minLength": 1, + "title": "Secret Name", + "type": "string" } }, - "title": "ExploreCostValuesV1", + "required": [ + "type", + "model", + "secret_name" + ], + "title": "RouteTargetOpenAIV1", "type": "object" }, - "ExploreMetadataAPIFormatsV1": { + "RouteTargetXAIV1": { "properties": { - "messages": { - "default": false, - "description": "Anthropic Messages API support.", - "title": "Messages", - "type": "boolean" + "type": { + "const": "XAI", + "description": "Target kind for xAI.", + "title": "Type", + "type": "string" }, - "responses": { - "default": false, - "description": "OpenAI Responses API support.", - "title": "Responses", - "type": "boolean" + "model": { + "description": "Model name sent to the provider.", + "minLength": 1, + "title": "Model", + "type": "string" }, - "chat_completions": { - "default": false, - "description": "OpenAI Chat Completions API support.", - "title": "Chat Completions", - "type": "boolean" + "secret_name": { + "description": "Name of a credential secret owned by the route's team.", + "minLength": 1, + "title": "Secret Name", + "type": "string" } }, - "title": "ExploreMetadataAPIFormatsV1", + "required": [ + "type", + "model", + "secret_name" + ], + "title": "RouteTargetXAIV1", "type": "object" }, - "ExploreMetadataV1": { + "RouteV1": { "properties": { - "slug": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Metadata slug, e.g. 'anthropic/claude-opus-4'; null for rows without one.", - "title": "Slug" + "id": { + "description": "Stable route identifier.", + "title": "Id", + "type": "string" }, - "display_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Model display name, when available.", - "title": "Display Name" + "name": { + "description": "Name to send in the inference request's model field.", + "title": "Name", + "type": "string" }, - "release_date": { - "anyOf": [ - { - "format": "date", - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Model release date. Month-only source dates use the first day of that month.", - "title": "Release Date" + "team_id": { + "description": "Identifier of the owning team.", + "title": "Team Id", + "type": "string" }, - "provider": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "description": "Provider key derived from the slug prefix, e.g. 'anthropic'; null for unprefixed slugs.", - "title": "Provider" + "team_name": { + "description": "Name of the owning team.", + "title": "Team Name", + "type": "string" }, - "context_window": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "description": "Total context window in tokens.", - "title": "Context Window" + "display_name": { + "description": "Display label, defaulting to the route name.", + "title": "Display Name", + "type": "string" }, - "max_output_tokens": { - "anyOf": [ - { - "type": "integer" - }, - { - "type": "null" - } - ], - "description": "Maximum output tokens per response.", - "title": "Max Output Tokens" + "description": { + "description": "Short description of the route, empty when unset.", + "title": "Description", + "type": "string" }, - "input_modalities": { - "description": "Accepted input modalities.", - "items": { - "type": "string" + "target": { + "description": "Configured upstream target.", + "discriminator": { + "mapping": { + "ANTHROPIC": "#/components/schemas/RouteTargetAnthropicV1", + "BASETEN_MODEL_API": "#/components/schemas/RouteTargetBasetenModelAPIV1", + "CLASSIFIER_MODEL_BASED": "#/components/schemas/RouteTargetClassifierModelBasedV1", + "OPENAI": "#/components/schemas/RouteTargetOpenAIV1", + "XAI": "#/components/schemas/RouteTargetXAIV1" + }, + "propertyName": "type" }, - "title": "Input Modalities", - "type": "array" - }, - "tools": { - "anyOf": [ + "oneOf": [ { - "type": "boolean" + "$ref": "#/components/schemas/RouteTargetBasetenModelAPIV1" }, { - "type": "null" - } - ], - "description": "Whether the model supports tool calling.", - "title": "Tools" - }, - "reasoning_effort_levels": { - "anyOf": [ - { - "items": { - "type": "string" - }, - "type": "array" + "$ref": "#/components/schemas/RouteTargetAnthropicV1" }, { - "type": "null" - } - ], - "description": "Reasoning effort levels the model supports.", - "title": "Reasoning Effort Levels" - }, - "parallel_tool_calls": { - "anyOf": [ - { - "type": "boolean" + "$ref": "#/components/schemas/RouteTargetOpenAIV1" }, { - "type": "null" - } - ], - "description": "Whether the model supports parallel tool calls.", - "title": "Parallel Tool Calls" - }, - "supported_api_formats": { - "anyOf": [ - { - "$ref": "#/components/schemas/ExploreMetadataAPIFormatsV1" + "$ref": "#/components/schemas/RouteTargetXAIV1" }, { - "type": "null" + "$ref": "#/components/schemas/RouteTargetClassifierModelBasedV1" } ], - "description": "API formats the model supports." + "title": "Target" }, - "cost": { + "metadata": { "anyOf": [ { - "$ref": "#/components/schemas/ExploreCostV1" + "$ref": "#/components/schemas/ExploreMetadataV1" }, { "type": "null" } ], - "description": "Provider list prices in USD per 1M tokens, when available." + "description": "Resolved model metadata; for a router, the envelope of its allowed routes' metadata. Null when nothing is linked." + }, + "invoke_url": { + "description": "Base URL for inference requests using this route.", + "title": "Invoke Url", + "type": "string" + }, + "created_at": { + "description": "Creation time, ISO 8601.", + "format": "date-time", + "title": "Created At", + "type": "string" } }, - "required": [ - "slug", - "display_name", - "release_date", - "provider", - "context_window", - "max_output_tokens", - "input_modalities", - "tools", - "reasoning_effort_levels", - "parallel_tool_calls", - "supported_api_formats", - "cost" + "required": [ + "id", + "name", + "team_id", + "team_name", + "display_name", + "description", + "target", + "metadata", + "invoke_url", + "created_at" ], - "title": "ExploreMetadataV1", + "title": "RouteV1", "type": "object" }, - "ExploreMetadataResponseV1": { + "RoutesResponseV1": { "properties": { "items": { "description": "Items in this page.", "items": { - "$ref": "#/components/schemas/ExploreMetadataV1" + "$ref": "#/components/schemas/RouteV1" }, "title": "Items", "type": "array" @@ -30575,10 +31751,10 @@ "items", "pagination" ], - "title": "ExploreMetadataResponseV1", + "title": "RoutesResponseV1", "type": "object" }, - "ExploreMetadataRequestV1": { + "RoutesRequestV1": { "properties": { "cursor": { "anyOf": [ @@ -30601,7 +31777,7 @@ "title": "Limit", "type": "integer" }, - "provider": { + "team_id": { "anyOf": [ { "type": "string" @@ -30611,10 +31787,10 @@ } ], "default": null, - "description": "Filter to a provider by slug prefix, e.g. 'anthropic'. Preserved by the cursor; if repeated, must match the original filter.", - "title": "Provider" + "description": "Identifier of the team whose routes to list.", + "title": "Team Id" }, - "q": { + "name": { "anyOf": [ { "type": "string" @@ -30624,34 +31800,15 @@ } ], "default": null, - "description": "Case-insensitive substring search over metadata slugs. Preserved by the cursor; if repeated, must match the original filter.", - "title": "Q" - } - }, - "title": "ExploreMetadataRequestV1", - "type": "object" - }, - "RouteRefV1": { - "properties": { - "id": { - "description": "Stable route identifier.", - "title": "Id", - "type": "string" - }, - "slug": { - "description": "Name of the route to send in the inference request's model field.", - "title": "Slug", - "type": "string" + "description": "Filter by exact route name. Preserved by the cursor; if repeated, must match the original filter.", + "title": "Name" } }, - "required": [ - "id", - "slug" - ], - "title": "RouteRefV1", + "title": "RoutesRequestV1", "type": "object" }, - "RouteTargetAnthropicV1": { + "RouteTargetConfigAnthropicV1": { + "additionalProperties": false, "properties": { "type": { "const": "ANTHROPIC", @@ -30677,10 +31834,11 @@ "model", "secret_name" ], - "title": "RouteTargetAnthropicV1", + "title": "RouteTargetConfigAnthropicV1", "type": "object" }, - "RouteTargetBasetenModelAPIV1": { + "RouteTargetConfigBasetenModelAPIV1": { + "additionalProperties": false, "properties": { "type": { "const": "BASETEN_MODEL_API", @@ -30699,64 +31857,78 @@ "type", "model" ], - "title": "RouteTargetBasetenModelAPIV1", + "title": "RouteTargetConfigBasetenModelAPIV1", "type": "object" }, - "RouteTargetClassifierModelBasedV1": { + "RouteTargetConfigClassifierModelBasedV1": { + "additionalProperties": false, "properties": { "type": { "const": "CLASSIFIER_MODEL_BASED", - "description": "Target kind for a classifier-model-based route.", + "description": "Target kind for a classifier-model-based route. Not intended for general use: classifiers are deployed by Baseten's post-training team.", "title": "Type", "type": "string" }, "classifier_model_id": { - "description": "ID of the Baseten model that picks a route for each request.", + "description": "ID of the Baseten model that picks a route for each request. Only classifiers deployed by Baseten's post-training team are supported.", "examples": [ "abcd123" ], + "minLength": 1, "title": "Classifier Model Id", "type": "string" }, "classifier_environment_name": { "anyOf": [ { + "minLength": 1, "type": "string" }, { "type": "null" } ], - "description": "Environment of the classifier model. Null for production.", + "default": null, + "description": "Environment of the classifier model. Omit for production, which is returned as null.", "examples": [ "production" ], "title": "Classifier Environment Name" }, - "default_route": { - "$ref": "#/components/schemas/RouteRefV1", - "description": "Route used when the classifier picks none." - }, - "allowed_routes": { - "description": "Routes the classifier may pick, in creation order.", + "allowed_route_ids": { + "description": "IDs of the routes the classifier may pick. All must belong to the route's team and must not be routers themselves.", + "examples": [ + [ + "abc1234", + "def5678" + ] + ], "items": { - "$ref": "#/components/schemas/RouteRefV1" + "type": "string" }, - "title": "Allowed Routes", + "title": "Allowed Route Ids", "type": "array" + }, + "default_route_id": { + "description": "ID of the allowed route used when the classifier picks none.", + "examples": [ + "abc1234" + ], + "title": "Default Route Id", + "type": "string" } }, "required": [ "type", "classifier_model_id", - "classifier_environment_name", - "default_route", - "allowed_routes" + "allowed_route_ids", + "default_route_id" ], - "title": "RouteTargetClassifierModelBasedV1", + "title": "RouteTargetConfigClassifierModelBasedV1", "type": "object" }, - "RouteTargetOpenAIV1": { + "RouteTargetConfigOpenAIV1": { + "additionalProperties": false, "properties": { "type": { "const": "OPENAI", @@ -30782,10 +31954,11 @@ "model", "secret_name" ], - "title": "RouteTargetOpenAIV1", + "title": "RouteTargetConfigOpenAIV1", "type": "object" }, - "RouteTargetXAIV1": { + "RouteTargetConfigXAIV1": { + "additionalProperties": false, "properties": { "type": { "const": "XAI", @@ -30811,116 +31984,230 @@ "model", "secret_name" ], - "title": "RouteTargetXAIV1", + "title": "RouteTargetConfigXAIV1", "type": "object" }, - "RouteV1": { + "CreateRouteRequestV1": { + "additionalProperties": false, "properties": { - "id": { - "description": "Stable route identifier.", - "title": "Id", - "type": "string" - }, - "name": { - "description": "Name to send in the inference request's model field.", - "title": "Name", - "type": "string" - }, "team_id": { - "description": "Identifier of the owning team.", - "title": "Team Id", - "type": "string" - }, - "team_name": { - "description": "Name of the owning team.", - "title": "Team Name", - "type": "string" + "anyOf": [ + { + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Identifier of the team that owns the route.", + "examples": [ + "abc1234" + ], + "title": "Team Id" }, "display_name": { - "description": "Display label, defaulting to the route name.", - "title": "Display Name", - "type": "string" + "anyOf": [ + { + "maxLength": 255, + "minLength": 1, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Display label. Omit to use the route name; null is not accepted.", + "examples": [ + "Assistant" + ], + "title": "Display Name" + }, + "target": { + "description": "Upstream target for the route.", + "discriminator": { + "mapping": { + "ANTHROPIC": "#/components/schemas/RouteTargetConfigAnthropicV1", + "BASETEN_MODEL_API": "#/components/schemas/RouteTargetConfigBasetenModelAPIV1", + "CLASSIFIER_MODEL_BASED": "#/components/schemas/RouteTargetConfigClassifierModelBasedV1", + "OPENAI": "#/components/schemas/RouteTargetConfigOpenAIV1", + "XAI": "#/components/schemas/RouteTargetConfigXAIV1" + }, + "propertyName": "type" + }, + "examples": [ + { + "model": "zai-org/GLM-5.3", + "type": "BASETEN_MODEL_API" + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/RouteTargetConfigBasetenModelAPIV1" + }, + { + "$ref": "#/components/schemas/RouteTargetConfigAnthropicV1" + }, + { + "$ref": "#/components/schemas/RouteTargetConfigOpenAIV1" + }, + { + "$ref": "#/components/schemas/RouteTargetConfigXAIV1" + }, + { + "$ref": "#/components/schemas/RouteTargetConfigClassifierModelBasedV1" + } + ], + "title": "Target" }, "description": { - "description": "Short description of the route, empty when unset.", - "title": "Description", + "anyOf": [ + { + "maxLength": 1000, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Short description of the route. Omit for no description; null is not accepted.", + "examples": [ + "Assistant for code review and debugging." + ], + "title": "Description" + } + }, + "required": [ + "target" + ], + "title": "CreateRouteRequestV1", + "type": "object" + }, + "RouteProviderV1": { + "description": "Upstream provider of a route target, named like the route target types.", + "enum": [ + "BASETEN_MODEL_API", + "OPENAI", + "ANTHROPIC", + "XAI", + "VERTEX", + "OPENAI_COMPATIBLE" + ], + "title": "RouteProviderV1", + "type": "string" + }, + "RoutesUsageBucketV1": { + "properties": { + "date": { + "description": "UTC calendar date for this bucket, from midnight inclusive to the next midnight exclusive.", + "format": "date", + "title": "Date", "type": "string" }, - "target": { - "description": "Configured upstream target.", - "discriminator": { - "mapping": { - "ANTHROPIC": "#/components/schemas/RouteTargetAnthropicV1", - "BASETEN_MODEL_API": "#/components/schemas/RouteTargetBasetenModelAPIV1", - "CLASSIFIER_MODEL_BASED": "#/components/schemas/RouteTargetClassifierModelBasedV1", - "OPENAI": "#/components/schemas/RouteTargetOpenAIV1", - "XAI": "#/components/schemas/RouteTargetXAIV1" - }, - "propertyName": "type" + "results": { + "description": "Usage broken down by the requested dimensions. Empty when there is no usage.", + "items": { + "$ref": "#/components/schemas/RoutesUsageResultV1" }, - "oneOf": [ - { - "$ref": "#/components/schemas/RouteTargetBasetenModelAPIV1" - }, + "title": "Results", + "type": "array" + } + }, + "required": [ + "date", + "results" + ], + "title": "RoutesUsageBucketV1", + "type": "object" + }, + "RoutesUsageResultV1": { + "properties": { + "user_id": { + "anyOf": [ { - "$ref": "#/components/schemas/RouteTargetAnthropicV1" + "type": "string" }, { - "$ref": "#/components/schemas/RouteTargetOpenAIV1" - }, + "type": "null" + } + ], + "default": null, + "description": "ID of the user who created the Routes key. Null when not grouping by USER.", + "title": "User Id" + }, + "model": { + "anyOf": [ { - "$ref": "#/components/schemas/RouteTargetXAIV1" + "type": "string" }, { - "$ref": "#/components/schemas/RouteTargetClassifierModelBasedV1" + "type": "null" } ], - "title": "Target" + "default": null, + "description": "Model name. For external providers, the model name sent to the provider. Null when not grouping by MODEL.", + "title": "Model" }, - "metadata": { + "provider": { "anyOf": [ { - "$ref": "#/components/schemas/ExploreMetadataV1" + "$ref": "#/components/schemas/RouteProviderV1" }, { "type": "null" } ], - "description": "Resolved model metadata; for a router, the envelope of its allowed routes' metadata. Null when nothing is linked." + "default": null, + "description": "Provider that served the requests. Null when not grouping by PROVIDER." }, - "invoke_url": { - "description": "Base URL for inference requests using this route.", - "title": "Invoke Url", + "cost_usd": { + "description": "Estimated cost in USD, returned as an exact decimal string. Costs for OpenAI, Anthropic, and xAI estimate what you pay those providers; they are not Baseten charges.", + "examples": [ + "0.00035625" + ], + "title": "Cost Usd", "type": "string" }, - "created_at": { - "description": "Creation time, ISO 8601.", - "format": "date-time", - "title": "Created At", - "type": "string" + "input_tokens": { + "description": "Input tokens, including cached input tokens.", + "title": "Input Tokens", + "type": "integer" + }, + "cached_input_tokens": { + "description": "Input tokens read from the prompt cache.", + "title": "Cached Input Tokens", + "type": "integer" + }, + "uncached_input_tokens": { + "description": "Input tokens not read from the prompt cache, including tokens written to the cache.", + "title": "Uncached Input Tokens", + "type": "integer" + }, + "output_tokens": { + "description": "Output tokens.", + "title": "Output Tokens", + "type": "integer" } }, "required": [ - "id", - "name", - "team_id", - "team_name", - "display_name", - "description", - "target", - "metadata", - "invoke_url", - "created_at" + "cost_usd", + "input_tokens", + "cached_input_tokens", + "uncached_input_tokens", + "output_tokens" ], - "title": "RouteV1", + "title": "RoutesUsageResultV1", "type": "object" }, - "RoutesResponseV1": { + "RoutesUsageResponseV1": { "properties": { "items": { "description": "Items in this page.", "items": { - "$ref": "#/components/schemas/RouteV1" + "$ref": "#/components/schemas/RoutesUsageBucketV1" }, "title": "Items", "type": "array" @@ -30934,10 +32221,19 @@ "items", "pagination" ], - "title": "RoutesResponseV1", + "title": "RoutesUsageResponseV1", "type": "object" }, - "RoutesRequestV1": { + "RouteUsageDimensionV1": { + "enum": [ + "USER", + "MODEL", + "PROVIDER" + ], + "title": "RouteUsageDimensionV1", + "type": "string" + }, + "RoutesUsageRequestV1": { "properties": { "cursor": { "anyOf": [ @@ -30953,16 +32249,17 @@ "title": "Cursor" }, "limit": { - "default": 100, - "description": "Maximum number of items to return.", - "maximum": 1000, + "default": 7, + "description": "Number of daily buckets to return. Defaults to 7; maximum 31.", + "maximum": 31, "minimum": 1, "title": "Limit", "type": "integer" }, - "team_id": { + "start_date": { "anyOf": [ { + "format": "date", "type": "string" }, { @@ -30970,12 +32267,13 @@ } ], "default": null, - "description": "Identifier of the team whose routes to list.", - "title": "Team Id" + "description": "Inclusive UTC calendar day at the start of the query range. Defaults to the previous UTC date, and is ignored when you pass a cursor.", + "title": "Start Date" }, - "name": { + "end_date": { "anyOf": [ { + "format": "date", "type": "string" }, { @@ -30983,200 +32281,201 @@ } ], "default": null, - "description": "Filter by exact route name. Preserved by the cursor; if repeated, must match the original filter.", - "title": "Name" + "description": "Exclusive UTC calendar day at the end of the query range. Defaults to the day after the current UTC date so current-day usage is included.", + "title": "End Date" + }, + "group_by": { + "description": "Dimensions to break usage down by, repeated once per dimension: USER, MODEL, or PROVIDER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. Defaults to MODEL.", + "items": { + "$ref": "#/components/schemas/RouteUsageDimensionV1" + }, + "title": "Group By", + "type": "array" + }, + "user_ids": { + "description": "Return only usage from Routes keys created by these user IDs, repeated once per ID.", + "items": { + "type": "string" + }, + "title": "User Ids", + "type": "array" + }, + "models": { + "description": "Return only usage for these exact model names, repeated once per model.", + "items": { + "type": "string" + }, + "title": "Models", + "type": "array" + }, + "providers": { + "description": "Return only usage for these providers, repeated once per provider.", + "items": { + "$ref": "#/components/schemas/RouteProviderV1" + }, + "title": "Providers", + "type": "array" } }, - "title": "RoutesRequestV1", + "title": "RoutesUsageRequestV1", "type": "object" }, - "RouteTargetConfigAnthropicV1": { - "additionalProperties": false, + "RouteEffectiveSpendLimitV1": { "properties": { - "type": { - "const": "ANTHROPIC", - "description": "Target kind for Anthropic.", - "title": "Type", - "type": "string" - }, - "model": { - "description": "Model name sent to the provider.", - "minLength": 1, - "title": "Model", - "type": "string" + "monthly_limit_usd": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Spend limit in USD enforced for the current UTC calendar month: the user's own limit, else the team default. Null when no limit applies.", + "examples": [ + "200" + ], + "title": "Monthly Limit Usd" }, - "secret_name": { - "description": "Name of a credential secret owned by the route's team.", - "minLength": 1, - "title": "Secret Name", - "type": "string" + "source": { + "anyOf": [ + { + "$ref": "#/components/schemas/RouteSettingSourceV1" + }, + { + "type": "null" + } + ], + "description": "Where the limit comes from: `user` when it is set on the user, `team` when it is the team default. Null when no limit applies." } }, "required": [ - "type", - "model", - "secret_name" + "monthly_limit_usd", + "source" ], - "title": "RouteTargetConfigAnthropicV1", + "title": "RouteEffectiveSpendLimitV1", "type": "object" }, - "RouteTargetConfigBasetenModelAPIV1": { - "additionalProperties": false, - "properties": { - "type": { - "const": "BASETEN_MODEL_API", - "description": "Target kind for a Baseten Model API.", - "title": "Type", - "type": "string" - }, - "model": { - "description": "Name of the target Model API.", - "minLength": 1, - "title": "Model", - "type": "string" - } - }, - "required": [ - "type", - "model" + "RouteSettingSourceV1": { + "enum": [ + "user", + "team" ], - "title": "RouteTargetConfigBasetenModelAPIV1", - "type": "object" + "title": "RouteSettingSourceV1", + "type": "string" }, - "RouteTargetConfigClassifierModelBasedV1": { - "additionalProperties": false, + "RouteSpendLimitSettingV1": { "properties": { - "type": { - "const": "CLASSIFIER_MODEL_BASED", - "description": "Target kind for a classifier-model-based route. Not intended for general use: classifiers are deployed by Baseten's post-training team.", - "title": "Type", - "type": "string" - }, - "classifier_model_id": { - "description": "ID of the Baseten model that picks a route for each request. Only classifiers deployed by Baseten's post-training team are supported.", - "examples": [ - "abcd123" - ], - "minLength": 1, - "title": "Classifier Model Id", - "type": "string" - }, - "classifier_environment_name": { + "user_monthly_limit_usd": { "anyOf": [ { - "minLength": 1, "type": "string" }, { "type": "null" } ], - "default": null, - "description": "Environment of the classifier model. Omit for production, which is returned as null.", + "description": "Standing spend limit in USD for each UTC calendar month set on the user. Null when the user has no limit of their own.", "examples": [ - "production" + "200" ], - "title": "Classifier Environment Name" + "title": "User Monthly Limit Usd" }, - "allowed_route_ids": { - "description": "IDs of the routes the classifier may pick. All must belong to the route's team and must not be routers themselves.", - "examples": [ - [ - "abc1234", - "def5678" - ] + "team_default": { + "anyOf": [ + { + "$ref": "#/components/schemas/RouteSpendLimitTeamDefaultV1" + }, + { + "type": "null" + } ], - "items": { - "type": "string" - }, - "title": "Allowed Route Ids", - "type": "array" + "description": "Per-member limit of the team the user's active Code key belongs to. This limit applies when the user has no limit of their own. Null when there is none." }, - "default_route_id": { - "description": "ID of the allowed route used when the classifier picks none.", - "examples": [ - "abc1234" - ], - "title": "Default Route Id", - "type": "string" + "effective": { + "$ref": "#/components/schemas/RouteEffectiveSpendLimitV1", + "description": "The effective limit enforced for the current month." } }, "required": [ - "type", - "classifier_model_id", - "allowed_route_ids", - "default_route_id" + "user_monthly_limit_usd", + "team_default", + "effective" ], - "title": "RouteTargetConfigClassifierModelBasedV1", + "title": "RouteSpendLimitSettingV1", "type": "object" }, - "RouteTargetConfigOpenAIV1": { - "additionalProperties": false, + "RouteSpendLimitTeamDefaultV1": { "properties": { - "type": { - "const": "OPENAI", - "description": "Target kind for OpenAI.", - "title": "Type", - "type": "string" - }, - "model": { - "description": "Model name sent to the provider.", - "minLength": 1, - "title": "Model", + "team_id": { + "description": "ID of the team the user's active Code key belongs to.", + "examples": [ + "abc1234" + ], + "title": "Team Id", "type": "string" }, - "secret_name": { - "description": "Name of a credential secret owned by the route's team.", - "minLength": 1, - "title": "Secret Name", + "per_member_monthly_limit_usd": { + "description": "The team's per-member spend limit in USD for each UTC calendar month.", + "examples": [ + "100" + ], + "title": "Per Member Monthly Limit Usd", "type": "string" } }, "required": [ - "type", - "model", - "secret_name" + "team_id", + "per_member_monthly_limit_usd" ], - "title": "RouteTargetConfigOpenAIV1", + "title": "RouteSpendLimitTeamDefaultV1", "type": "object" }, - "RouteTargetConfigXAIV1": { - "additionalProperties": false, + "RouteUserSettingsV1": { "properties": { - "type": { - "const": "XAI", - "description": "Target kind for xAI.", - "title": "Type", + "user_id": { + "description": "ID of the user.", + "examples": [ + "abc1234" + ], + "title": "User Id", "type": "string" }, - "model": { - "description": "Model name sent to the provider.", - "minLength": 1, - "title": "Model", - "type": "string" + "email": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "description": "Email address of the user.", + "examples": [ + "dev@example.com" + ], + "title": "Email" }, - "secret_name": { - "description": "Name of a credential secret owned by the route's team.", - "minLength": 1, - "title": "Secret Name", - "type": "string" + "spend_limit": { + "$ref": "#/components/schemas/RouteSpendLimitSettingV1", + "description": "Spend limit for Baseten Code. Applies to requests with Routes keys the user created; personal API keys are not limited." } }, "required": [ - "type", - "model", - "secret_name" + "user_id", + "email", + "spend_limit" ], - "title": "RouteTargetConfigXAIV1", + "title": "RouteUserSettingsV1", "type": "object" }, - "CreateRouteRequestV1": { + "UpdateRouteSpendLimitSettingV1": { "additionalProperties": false, + "minProperties": 1, "properties": { - "team_id": { + "user_monthly_limit_usd": { "anyOf": [ { - "minLength": 1, "type": "string" }, { @@ -31184,133 +32483,195 @@ } ], "default": null, - "description": "Identifier of the team that owns the route.", + "description": "Standing spend limit in USD for each UTC calendar month. Send null to remove the limit; omit to leave it unchanged.", "examples": [ - "abc1234" + "200" ], - "title": "Team Id" - }, - "display_name": { + "title": "User Monthly Limit Usd", + "x-null-distinct": true + } + }, + "title": "UpdateRouteSpendLimitSettingV1", + "type": "object" + }, + "UpdateRouteUserSettingsRequestV1": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "spend_limit": { "anyOf": [ { - "maxLength": 255, - "minLength": 1, - "type": "string" + "$ref": "#/components/schemas/UpdateRouteSpendLimitSettingV1" }, { "type": "null" } ], "default": null, - "description": "Display label. Omit to use the route name; null is not accepted.", - "examples": [ - "Assistant" - ], - "title": "Display Name" - }, - "target": { - "description": "Upstream target for the route.", - "discriminator": { - "mapping": { - "ANTHROPIC": "#/components/schemas/RouteTargetConfigAnthropicV1", - "BASETEN_MODEL_API": "#/components/schemas/RouteTargetConfigBasetenModelAPIV1", - "CLASSIFIER_MODEL_BASED": "#/components/schemas/RouteTargetConfigClassifierModelBasedV1", - "OPENAI": "#/components/schemas/RouteTargetConfigOpenAIV1", - "XAI": "#/components/schemas/RouteTargetConfigXAIV1" + "description": "Spend limit fields to change. Pass null to remove the user's limit; omit to leave it unchanged.", + "x-null-distinct": true + } + }, + "title": "UpdateRouteUserSettingsRequestV1", + "type": "object" + }, + "BackgroundHarnessDefaultsV1": { + "properties": { + "primary": { + "anyOf": [ + { + "$ref": "#/components/schemas/RouteHarnessModelV1" }, - "propertyName": "type" - }, - "examples": [ { - "model": "zai-org/GLM-5.3", - "type": "BASETEN_MODEL_API" + "type": "null" } ], - "oneOf": [ - { - "$ref": "#/components/schemas/RouteTargetConfigBasetenModelAPIV1" - }, + "description": "Route for the primary model, which new sessions use. Null when the team has no route to use." + }, + "background": { + "anyOf": [ { - "$ref": "#/components/schemas/RouteTargetConfigAnthropicV1" + "$ref": "#/components/schemas/RouteHarnessModelV1" }, { - "$ref": "#/components/schemas/RouteTargetConfigOpenAIV1" - }, + "type": "null" + } + ], + "description": "Route for background tasks, such as session titles. Null when the team has no route to use." + } + }, + "required": [ + "primary", + "background" + ], + "title": "BackgroundHarnessDefaultsV1", + "type": "object" + }, + "PrimaryHarnessDefaultsV1": { + "properties": { + "primary": { + "anyOf": [ { - "$ref": "#/components/schemas/RouteTargetConfigXAIV1" + "$ref": "#/components/schemas/RouteHarnessModelV1" }, { - "$ref": "#/components/schemas/RouteTargetConfigClassifierModelBasedV1" + "type": "null" } ], - "title": "Target" + "description": "Route for the primary model, which new sessions use. Null when the team has no route to use." + } + }, + "required": [ + "primary" + ], + "title": "PrimaryHarnessDefaultsV1", + "type": "object" + }, + "RouteHarnessDefaultsV1": { + "properties": { + "claude_code": { + "$ref": "#/components/schemas/BackgroundHarnessDefaultsV1", + "description": "Default models for Claude Code." }, - "description": { + "opencode": { + "$ref": "#/components/schemas/BackgroundHarnessDefaultsV1", + "description": "Default models for OpenCode." + }, + "codex": { + "$ref": "#/components/schemas/PrimaryHarnessDefaultsV1", + "description": "Default models for Codex." + }, + "pi": { + "$ref": "#/components/schemas/PrimaryHarnessDefaultsV1", + "description": "Default models for Pi." + } + }, + "required": [ + "claude_code", + "opencode", + "codex", + "pi" + ], + "title": "RouteHarnessDefaultsV1", + "type": "object" + }, + "RouteHarnessModelV1": { + "properties": { + "source": { + "$ref": "#/components/schemas/RouteSettingSourceV1", + "description": "Where this role's route comes from. `team` covers both a route a team admin set and the default chosen from the team's Model API routes." + }, + "route": { + "$ref": "#/components/schemas/RouteV1", + "description": "Route to use for this role." + } + }, + "required": [ + "source", + "route" + ], + "title": "RouteHarnessModelV1", + "type": "object" + }, + "RouteTeamSpendLimitSettingV1": { + "properties": { + "per_member_monthly_limit_usd": { "anyOf": [ { - "maxLength": 1000, "type": "string" }, { "type": "null" } ], - "default": null, - "description": "Short description of the route. Omit for no description; null is not accepted.", + "description": "Spend limit in USD for each UTC calendar month that applies to each member whose active Code key belongs to this team, unless the member has a limit of their own. Returned as an exact decimal string. Null when the team has no per-member limit.", "examples": [ - "Assistant for code review and debugging." + "200" ], - "title": "Description" + "title": "Per Member Monthly Limit Usd" } }, "required": [ - "target" + "per_member_monthly_limit_usd" ], - "title": "CreateRouteRequestV1", + "title": "RouteTeamSpendLimitSettingV1", "type": "object" }, - "RouteProviderV1": { - "description": "Upstream provider of a route target, named like the route target types.", - "enum": [ - "BASETEN_MODEL_API", - "OPENAI", - "ANTHROPIC", - "XAI", - "VERTEX", - "OPENAI_COMPATIBLE" - ], - "title": "RouteProviderV1", - "type": "string" - }, - "RoutesUsageBucketV1": { + "RouteTeamSettingsV1": { "properties": { - "date": { - "description": "UTC calendar date for this bucket, from midnight inclusive to the next midnight exclusive.", - "format": "date", - "title": "Date", + "team_id": { + "description": "ID of the team.", + "examples": [ + "abc1234" + ], + "title": "Team Id", "type": "string" }, - "results": { - "description": "Usage broken down by the requested dimensions. Empty when there is no usage.", - "items": { - "$ref": "#/components/schemas/RoutesUsageResultV1" - }, - "title": "Results", - "type": "array" + "harness_defaults": { + "$ref": "#/components/schemas/RouteHarnessDefaultsV1", + "description": "Route for each model role of each coding harness. A role with no route set by a team admin uses the default chosen from the team's Model API routes: the recommended model for `primary` and the lowest-priced model for `background`. These defaults never use external-provider routes." + }, + "spend_limit": { + "$ref": "#/components/schemas/RouteTeamSpendLimitSettingV1", + "description": "Spend limits for Baseten Code for members whose active Code key belongs to this team." } }, "required": [ - "date", - "results" + "team_id", + "harness_defaults", + "spend_limit" ], - "title": "RoutesUsageBucketV1", + "title": "RouteTeamSettingsV1", "type": "object" }, - "RoutesUsageResultV1": { + "UpdateBackgroundHarnessModelsV1": { + "additionalProperties": false, + "minProperties": 1, "properties": { - "user_id": { + "primary": { "anyOf": [ { + "minLength": 1, "type": "string" }, { @@ -31318,12 +32679,17 @@ } ], "default": null, - "description": "ID of the user who created the Routes key. Null when not grouping by USER.", - "title": "User Id" + "description": "Route ID for the primary model, which new sessions use. Omit to keep the current route, or pass null to use the team's default.", + "examples": [ + "abc1234" + ], + "title": "Primary", + "x-null-distinct": true }, - "model": { + "background": { "anyOf": [ { + "minLength": 1, "type": "string" }, { @@ -31331,181 +32697,108 @@ } ], "default": null, - "description": "Model name. For external providers, the model name sent to the provider. Null when not grouping by MODEL.", - "title": "Model" - }, - "provider": { + "description": "Route ID for background tasks, such as session titles. Omit to keep the current route, or pass null to use the team's default.", + "examples": [ + "def5678" + ], + "title": "Background", + "x-null-distinct": true + } + }, + "title": "UpdateBackgroundHarnessModelsV1", + "type": "object" + }, + "UpdatePrimaryHarnessModelsV1": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "primary": { "anyOf": [ { - "$ref": "#/components/schemas/RouteProviderV1" + "minLength": 1, + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Provider that served the requests. Null when not grouping by PROVIDER." - }, - "cost_usd": { - "description": "Estimated cost in USD, returned as an exact decimal string. Costs for OpenAI, Anthropic, and xAI estimate what you pay those providers; they are not Baseten charges.", + "description": "Route ID for the primary model, which new sessions use. Omit to keep the current route, or pass null to use the team's default.", "examples": [ - "0.00035625" + "abc1234" ], - "title": "Cost Usd", - "type": "string" - }, - "input_tokens": { - "description": "Input tokens, including cached input tokens.", - "title": "Input Tokens", - "type": "integer" - }, - "cached_input_tokens": { - "description": "Input tokens read from the prompt cache.", - "title": "Cached Input Tokens", - "type": "integer" - }, - "uncached_input_tokens": { - "description": "Input tokens not read from the prompt cache, including tokens written to the cache.", - "title": "Uncached Input Tokens", - "type": "integer" - }, - "output_tokens": { - "description": "Output tokens.", - "title": "Output Tokens", - "type": "integer" - } - }, - "required": [ - "cost_usd", - "input_tokens", - "cached_input_tokens", - "uncached_input_tokens", - "output_tokens" - ], - "title": "RoutesUsageResultV1", - "type": "object" - }, - "RoutesUsageResponseV1": { - "properties": { - "items": { - "description": "Items in this page.", - "items": { - "$ref": "#/components/schemas/RoutesUsageBucketV1" - }, - "title": "Items", - "type": "array" - }, - "pagination": { - "$ref": "#/components/schemas/PaginationResponseV1", - "description": "Pagination metadata for the page." + "title": "Primary", + "x-null-distinct": true } }, - "required": [ - "items", - "pagination" - ], - "title": "RoutesUsageResponseV1", + "title": "UpdatePrimaryHarnessModelsV1", "type": "object" }, - "RouteUsageDimensionV1": { - "enum": [ - "USER", - "MODEL", - "PROVIDER" - ], - "title": "RouteUsageDimensionV1", - "type": "string" - }, - "RoutesUsageRequestV1": { + "UpdateRouteHarnessDefaultsV1": { + "additionalProperties": false, + "minProperties": 1, "properties": { - "cursor": { + "claude_code": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/UpdateBackgroundHarnessModelsV1" }, { "type": "null" } ], "default": null, - "description": "Opaque cursor returned by a previous page. Omit to fetch the first page.", - "title": "Cursor" + "description": "Route IDs for the model roles to change; roles left out are unchanged. Every route must belong to the team. Pass null to clear every role, or omit to leave the harness unchanged.", + "x-null-distinct": true }, - "limit": { - "default": 7, - "description": "Number of daily buckets to return. Defaults to 7; maximum 31.", - "maximum": 31, - "minimum": 1, - "title": "Limit", - "type": "integer" + "opencode": { + "anyOf": [ + { + "$ref": "#/components/schemas/UpdateBackgroundHarnessModelsV1" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Route IDs for the model roles to change; roles left out are unchanged. Every route must belong to the team. Pass null to clear every role, or omit to leave the harness unchanged.", + "x-null-distinct": true }, - "start_date": { + "codex": { "anyOf": [ { - "format": "date", - "type": "string" + "$ref": "#/components/schemas/UpdatePrimaryHarnessModelsV1" }, { "type": "null" } ], "default": null, - "description": "Inclusive UTC calendar day at the start of the query range. Defaults to the previous UTC date, and is ignored when you pass a cursor.", - "title": "Start Date" + "description": "Route IDs for the model roles to change; roles left out are unchanged. Every route must belong to the team. Pass null to clear every role, or omit to leave the harness unchanged.", + "x-null-distinct": true }, - "end_date": { + "pi": { "anyOf": [ { - "format": "date", - "type": "string" + "$ref": "#/components/schemas/UpdatePrimaryHarnessModelsV1" }, { "type": "null" } ], "default": null, - "description": "Exclusive UTC calendar day at the end of the query range. Defaults to the day after the current UTC date so current-day usage is included.", - "title": "End Date" - }, - "group_by": { - "description": "Dimensions to break usage down by, repeated once per dimension: USER, MODEL, or PROVIDER. Each result represents one observed combination of the requested dimensions within that day, and results are sorted by those values. Combinations without usage are omitted, so result counts can differ between days. Defaults to MODEL.", - "items": { - "$ref": "#/components/schemas/RouteUsageDimensionV1" - }, - "title": "Group By", - "type": "array" - }, - "user_ids": { - "description": "Return only usage from Routes keys created by these user IDs, repeated once per ID.", - "items": { - "type": "string" - }, - "title": "User Ids", - "type": "array" - }, - "models": { - "description": "Return only usage for these exact model names, repeated once per model.", - "items": { - "type": "string" - }, - "title": "Models", - "type": "array" - }, - "providers": { - "description": "Return only usage for these providers, repeated once per provider.", - "items": { - "$ref": "#/components/schemas/RouteProviderV1" - }, - "title": "Providers", - "type": "array" + "description": "Route IDs for the model roles to change; roles left out are unchanged. Every route must belong to the team. Pass null to clear every role, or omit to leave the harness unchanged.", + "x-null-distinct": true } }, - "title": "RoutesUsageRequestV1", + "title": "UpdateRouteHarnessDefaultsV1", "type": "object" }, - "RouteEffectiveSpendLimitV1": { + "UpdateRouteTeamSpendLimitSettingV1": { + "additionalProperties": false, + "minProperties": 1, "properties": { - "monthly_limit_usd": { + "per_member_monthly_limit_usd": { "anyOf": [ { "type": "string" @@ -31514,344 +32807,402 @@ "type": "null" } ], - "description": "Spend limit in USD enforced for the current UTC calendar month: the user's own limit, else the team default. Null when no limit applies.", + "default": null, + "description": "Spend limit in USD for each UTC calendar month that applies to each member whose active Code key belongs to this team, unless the member has a limit of their own. Send null to remove it; omit to leave it unchanged.", "examples": [ "200" ], - "title": "Monthly Limit Usd" - }, - "source": { - "anyOf": [ - { - "$ref": "#/components/schemas/RouteSettingSourceV1" - }, - { - "type": "null" - } - ], - "description": "Where the limit comes from: `user` when it is set on the user, `team` when it is the team default. Null when no limit applies." + "title": "Per Member Monthly Limit Usd", + "x-null-distinct": true } }, - "required": [ - "monthly_limit_usd", - "source" - ], - "title": "RouteEffectiveSpendLimitV1", + "title": "UpdateRouteTeamSpendLimitSettingV1", "type": "object" }, - "RouteSettingSourceV1": { - "enum": [ - "user", - "team" - ], - "title": "RouteSettingSourceV1", - "type": "string" - }, - "RouteSpendLimitSettingV1": { + "UpdateRouteTeamSettingsRequestV1": { + "additionalProperties": false, + "minProperties": 1, "properties": { - "user_monthly_limit_usd": { + "harness_defaults": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/UpdateRouteHarnessDefaultsV1" }, { "type": "null" } ], - "description": "Standing spend limit in USD for each UTC calendar month set on the user. Null when the user has no limit of their own.", - "examples": [ - "200" - ], - "title": "User Monthly Limit Usd" + "default": null, + "description": "Harnesses to change; harnesses left out are unchanged. Pass null to clear every harness, so each role uses the team's default.", + "x-null-distinct": true }, - "team_default": { + "spend_limit": { "anyOf": [ { - "$ref": "#/components/schemas/RouteSpendLimitTeamDefaultV1" + "$ref": "#/components/schemas/UpdateRouteTeamSpendLimitSettingV1" }, { "type": "null" } ], - "description": "Per-member limit of the team the user's active Code key belongs to. This limit applies when the user has no limit of their own. Null when there is none." + "default": null, + "description": "Spend limit fields to change. Pass null to remove the team's per-member limit; omit to leave it unchanged.", + "x-null-distinct": true + } + }, + "title": "UpdateRouteTeamSettingsRequestV1", + "type": "object" + }, + "RouteConnectionAnthropicV1": { + "properties": { + "provider": { + "const": "ANTHROPIC", + "description": "Provider kind for Anthropic.", + "title": "Provider", + "type": "string" }, - "effective": { - "$ref": "#/components/schemas/RouteEffectiveSpendLimitV1", - "description": "The effective limit enforced for the current month." + "secret_id": { + "description": "Identifier of the team secret holding the provider API key.", + "title": "Secret Id", + "type": "string" + }, + "secret_name": { + "description": "Name of the team secret holding the provider API key.", + "title": "Secret Name", + "type": "string" } }, "required": [ - "user_monthly_limit_usd", - "team_default", - "effective" + "provider", + "secret_id", + "secret_name" ], - "title": "RouteSpendLimitSettingV1", + "title": "RouteConnectionAnthropicV1", "type": "object" }, - "RouteSpendLimitTeamDefaultV1": { + "RouteConnectionOpenAIV1": { "properties": { - "team_id": { - "description": "ID of the team the user's active Code key belongs to.", - "examples": [ - "abc1234" - ], - "title": "Team Id", + "provider": { + "const": "OPENAI", + "description": "Provider kind for OpenAI.", + "title": "Provider", "type": "string" }, - "per_member_monthly_limit_usd": { - "description": "The team's per-member spend limit in USD for each UTC calendar month.", - "examples": [ - "100" - ], - "title": "Per Member Monthly Limit Usd", + "secret_id": { + "description": "Identifier of the team secret holding the provider API key.", + "title": "Secret Id", + "type": "string" + }, + "secret_name": { + "description": "Name of the team secret holding the provider API key.", + "title": "Secret Name", "type": "string" } }, "required": [ - "team_id", - "per_member_monthly_limit_usd" + "provider", + "secret_id", + "secret_name" ], - "title": "RouteSpendLimitTeamDefaultV1", + "title": "RouteConnectionOpenAIV1", "type": "object" }, - "RouteUserSettingsV1": { + "RouteConnectionV1": { "properties": { - "user_id": { - "description": "ID of the user.", - "examples": [ - "abc1234" - ], - "title": "User Id", + "id": { + "description": "Stable connection identifier.", + "title": "Id", "type": "string" }, - "email": { - "anyOf": [ + "team_id": { + "description": "Identifier of the team that owns the connection.", + "title": "Team Id", + "type": "string" + }, + "config": { + "description": "Provider the connection authenticates with, and the team secret holding its API key.", + "discriminator": { + "mapping": { + "ANTHROPIC": "#/components/schemas/RouteConnectionAnthropicV1", + "OPENAI": "#/components/schemas/RouteConnectionOpenAIV1", + "XAI": "#/components/schemas/RouteConnectionXAIV1" + }, + "propertyName": "provider" + }, + "oneOf": [ { - "type": "string" + "$ref": "#/components/schemas/RouteConnectionAnthropicV1" }, { - "type": "null" + "$ref": "#/components/schemas/RouteConnectionOpenAIV1" + }, + { + "$ref": "#/components/schemas/RouteConnectionXAIV1" } ], - "description": "Email address of the user.", - "examples": [ - "dev@example.com" - ], - "title": "Email" + "title": "Config" + }, + "created_at": { + "description": "Creation time, ISO 8601.", + "format": "date-time", + "title": "Created At", + "type": "string" + }, + "updated_at": { + "description": "Last update time, ISO 8601.", + "format": "date-time", + "title": "Updated At", + "type": "string" + } + }, + "required": [ + "id", + "team_id", + "config", + "created_at", + "updated_at" + ], + "title": "RouteConnectionV1", + "type": "object" + }, + "RouteConnectionXAIV1": { + "properties": { + "provider": { + "const": "XAI", + "description": "Provider kind for xAI.", + "title": "Provider", + "type": "string" + }, + "secret_id": { + "description": "Identifier of the team secret holding the provider API key.", + "title": "Secret Id", + "type": "string" }, - "spend_limit": { - "$ref": "#/components/schemas/RouteSpendLimitSettingV1", - "description": "Spend limit for Baseten Code. Applies to requests with Routes keys the user created; personal API keys are not limited." + "secret_name": { + "description": "Name of the team secret holding the provider API key.", + "title": "Secret Name", + "type": "string" } }, "required": [ - "user_id", - "email", - "spend_limit" + "provider", + "secret_id", + "secret_name" ], - "title": "RouteUserSettingsV1", + "title": "RouteConnectionXAIV1", "type": "object" }, - "UpdateRouteSpendLimitSettingV1": { - "additionalProperties": false, - "minProperties": 1, + "RouteConnectionsResponseV1": { "properties": { - "user_monthly_limit_usd": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Standing spend limit in USD for each UTC calendar month. Send null to remove the limit; omit to leave it unchanged.", - "examples": [ - "200" - ], - "title": "User Monthly Limit Usd", - "x-null-distinct": true + "items": { + "description": "Items in this page.", + "items": { + "$ref": "#/components/schemas/RouteConnectionV1" + }, + "title": "Items", + "type": "array" + }, + "pagination": { + "$ref": "#/components/schemas/PaginationResponseV1", + "description": "Pagination metadata for the page." } }, - "title": "UpdateRouteSpendLimitSettingV1", + "required": [ + "items", + "pagination" + ], + "title": "RouteConnectionsResponseV1", "type": "object" }, - "UpdateRouteUserSettingsRequestV1": { - "additionalProperties": false, - "minProperties": 1, + "RouteConnectionsRequestV1": { "properties": { - "spend_limit": { + "cursor": { "anyOf": [ { - "$ref": "#/components/schemas/UpdateRouteSpendLimitSettingV1" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Spend limit fields to change. Pass null to remove the user's limit; omit to leave it unchanged.", - "x-null-distinct": true - } - }, - "title": "UpdateRouteUserSettingsRequestV1", - "type": "object" - }, - "BackgroundHarnessDefaultsV1": { - "properties": { - "primary": { - "anyOf": [ - { - "$ref": "#/components/schemas/RouteHarnessModelV1" - }, - { - "type": "null" - } - ], - "description": "Route for the primary model, which new sessions use. Null when the team has no route to use." + "description": "Opaque cursor returned by a previous page. Omit to fetch the first page.", + "title": "Cursor" }, - "background": { + "limit": { + "default": 100, + "description": "Maximum number of items to return.", + "maximum": 1000, + "minimum": 1, + "title": "Limit", + "type": "integer" + }, + "team_id": { "anyOf": [ { - "$ref": "#/components/schemas/RouteHarnessModelV1" + "type": "string" }, { "type": "null" } ], - "description": "Route for background tasks, such as session titles. Null when the team has no route to use." + "default": null, + "description": "Identifier of the team whose connections to list.", + "title": "Team Id" } }, - "required": [ - "primary", - "background" - ], - "title": "BackgroundHarnessDefaultsV1", + "title": "RouteConnectionsRequestV1", "type": "object" }, - "PrimaryHarnessDefaultsV1": { + "RouteConnectionConfigAnthropicV1": { + "additionalProperties": false, "properties": { - "primary": { - "anyOf": [ - { - "$ref": "#/components/schemas/RouteHarnessModelV1" - }, - { - "type": "null" - } - ], - "description": "Route for the primary model, which new sessions use. Null when the team has no route to use." + "provider": { + "const": "ANTHROPIC", + "description": "Provider kind for Anthropic.", + "title": "Provider", + "type": "string" + }, + "secret_id": { + "description": "Identifier of an existing secret, owned by the same team, that holds the provider API key.", + "minLength": 1, + "title": "Secret Id", + "type": "string" } }, "required": [ - "primary" + "provider", + "secret_id" ], - "title": "PrimaryHarnessDefaultsV1", + "title": "RouteConnectionConfigAnthropicV1", "type": "object" }, - "RouteHarnessDefaultsV1": { + "RouteConnectionConfigOpenAIV1": { + "additionalProperties": false, "properties": { - "claude_code": { - "$ref": "#/components/schemas/BackgroundHarnessDefaultsV1", - "description": "Default models for Claude Code." - }, - "opencode": { - "$ref": "#/components/schemas/BackgroundHarnessDefaultsV1", - "description": "Default models for OpenCode." - }, - "codex": { - "$ref": "#/components/schemas/PrimaryHarnessDefaultsV1", - "description": "Default models for Codex." + "provider": { + "const": "OPENAI", + "description": "Provider kind for OpenAI.", + "title": "Provider", + "type": "string" }, - "pi": { - "$ref": "#/components/schemas/PrimaryHarnessDefaultsV1", - "description": "Default models for Pi." + "secret_id": { + "description": "Identifier of an existing secret, owned by the same team, that holds the provider API key.", + "minLength": 1, + "title": "Secret Id", + "type": "string" } }, "required": [ - "claude_code", - "opencode", - "codex", - "pi" + "provider", + "secret_id" ], - "title": "RouteHarnessDefaultsV1", + "title": "RouteConnectionConfigOpenAIV1", "type": "object" }, - "RouteHarnessModelV1": { + "RouteConnectionConfigXAIV1": { + "additionalProperties": false, "properties": { - "source": { - "$ref": "#/components/schemas/RouteSettingSourceV1", - "description": "Where this role's route comes from. `team` covers both a route a team admin set and the default chosen from the team's Model API routes." + "provider": { + "const": "XAI", + "description": "Provider kind for xAI.", + "title": "Provider", + "type": "string" }, - "route": { - "$ref": "#/components/schemas/RouteV1", - "description": "Route to use for this role." + "secret_id": { + "description": "Identifier of an existing secret, owned by the same team, that holds the provider API key.", + "minLength": 1, + "title": "Secret Id", + "type": "string" } }, "required": [ - "source", - "route" + "provider", + "secret_id" ], - "title": "RouteHarnessModelV1", + "title": "RouteConnectionConfigXAIV1", "type": "object" }, - "RouteTeamSpendLimitSettingV1": { + "CreateRouteConnectionRequestV1": { + "additionalProperties": false, "properties": { - "per_member_monthly_limit_usd": { + "team_id": { "anyOf": [ { + "minLength": 1, "type": "string" }, { "type": "null" } ], - "description": "Spend limit in USD for each UTC calendar month that applies to each member whose active Code key belongs to this team, unless the member has a limit of their own. Returned as an exact decimal string. Null when the team has no per-member limit.", + "default": null, + "description": "Identifier of the team that owns the connection.", "examples": [ - "200" + "abc1234" ], - "title": "Per Member Monthly Limit Usd" + "title": "Team Id" + }, + "config": { + "description": "Provider the connection authenticates with, and the team secret holding its API key.", + "discriminator": { + "mapping": { + "ANTHROPIC": "#/components/schemas/RouteConnectionConfigAnthropicV1", + "OPENAI": "#/components/schemas/RouteConnectionConfigOpenAIV1", + "XAI": "#/components/schemas/RouteConnectionConfigXAIV1" + }, + "propertyName": "provider" + }, + "examples": [ + { + "provider": "ANTHROPIC", + "secret_id": "abc1234" + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/RouteConnectionConfigAnthropicV1" + }, + { + "$ref": "#/components/schemas/RouteConnectionConfigOpenAIV1" + }, + { + "$ref": "#/components/schemas/RouteConnectionConfigXAIV1" + } + ], + "title": "Config" } }, "required": [ - "per_member_monthly_limit_usd" + "config" ], - "title": "RouteTeamSpendLimitSettingV1", + "title": "CreateRouteConnectionRequestV1", "type": "object" }, - "RouteTeamSettingsV1": { - "properties": { - "team_id": { - "description": "ID of the team.", - "examples": [ - "abc1234" - ], - "title": "Team Id", - "type": "string" - }, - "harness_defaults": { - "$ref": "#/components/schemas/RouteHarnessDefaultsV1", - "description": "Route for each model role of each coding harness. A role with no route set by a team admin uses the default chosen from the team's Model API routes: the recommended model for `primary` and the lowest-priced model for `background`. These defaults never use external-provider routes." - }, - "spend_limit": { - "$ref": "#/components/schemas/RouteTeamSpendLimitSettingV1", - "description": "Spend limits for Baseten Code for members whose active Code key belongs to this team." + "RouteConnectionTombstoneV1": { + "properties": { + "id": { + "description": "Stable identifier of the deleted connection.", + "title": "Id", + "type": "string" } }, "required": [ - "team_id", - "harness_defaults", - "spend_limit" + "id" ], - "title": "RouteTeamSettingsV1", + "title": "RouteConnectionTombstoneV1", "type": "object" }, - "UpdateBackgroundHarnessModelsV1": { + "UpdateRouteConnectionConfigAnthropicV1": { "additionalProperties": false, - "minProperties": 1, "properties": { - "primary": { + "provider": { + "const": "ANTHROPIC", + "description": "Provider kind for Anthropic.", + "title": "Provider", + "type": "string" + }, + "secret_id": { "anyOf": [ { "minLength": 1, @@ -31862,14 +33213,27 @@ } ], "default": null, - "description": "Route ID for the primary model, which new sessions use. Omit to keep the current route, or pass null to use the team's default.", - "examples": [ - "abc1234" - ], - "title": "Primary", + "description": "Identifier of the new secret, owned by the connection's team, that holds the provider API key. Omit to keep the current secret.", + "title": "Secret Id", "x-null-distinct": true + } + }, + "required": [ + "provider" + ], + "title": "UpdateRouteConnectionConfigAnthropicV1", + "type": "object" + }, + "UpdateRouteConnectionConfigOpenAIV1": { + "additionalProperties": false, + "properties": { + "provider": { + "const": "OPENAI", + "description": "Provider kind for OpenAI.", + "title": "Provider", + "type": "string" }, - "background": { + "secret_id": { "anyOf": [ { "minLength": 1, @@ -31880,22 +33244,27 @@ } ], "default": null, - "description": "Route ID for background tasks, such as session titles. Omit to keep the current route, or pass null to use the team's default.", - "examples": [ - "def5678" - ], - "title": "Background", + "description": "Identifier of the new secret, owned by the connection's team, that holds the provider API key. Omit to keep the current secret.", + "title": "Secret Id", "x-null-distinct": true } }, - "title": "UpdateBackgroundHarnessModelsV1", + "required": [ + "provider" + ], + "title": "UpdateRouteConnectionConfigOpenAIV1", "type": "object" }, - "UpdatePrimaryHarnessModelsV1": { + "UpdateRouteConnectionConfigXAIV1": { "additionalProperties": false, - "minProperties": 1, "properties": { - "primary": { + "provider": { + "const": "XAI", + "description": "Provider kind for xAI.", + "title": "Provider", + "type": "string" + }, + "secret_id": { "anyOf": [ { "minLength": 1, @@ -31906,82 +33275,166 @@ } ], "default": null, - "description": "Route ID for the primary model, which new sessions use. Omit to keep the current route, or pass null to use the team's default.", - "examples": [ - "abc1234" - ], - "title": "Primary", + "description": "Identifier of the new secret, owned by the connection's team, that holds the provider API key. Omit to keep the current secret.", + "title": "Secret Id", "x-null-distinct": true } }, - "title": "UpdatePrimaryHarnessModelsV1", + "required": [ + "provider" + ], + "title": "UpdateRouteConnectionConfigXAIV1", "type": "object" }, - "UpdateRouteHarnessDefaultsV1": { + "UpdateRouteConnectionRequestV1": { "additionalProperties": false, - "minProperties": 1, "properties": { - "claude_code": { - "anyOf": [ + "config": { + "description": "Connection fields to change. The provider must match the connection and is immutable.", + "discriminator": { + "mapping": { + "ANTHROPIC": "#/components/schemas/UpdateRouteConnectionConfigAnthropicV1", + "OPENAI": "#/components/schemas/UpdateRouteConnectionConfigOpenAIV1", + "XAI": "#/components/schemas/UpdateRouteConnectionConfigXAIV1" + }, + "propertyName": "provider" + }, + "examples": [ { - "$ref": "#/components/schemas/UpdateBackgroundHarnessModelsV1" + "provider": "ANTHROPIC", + "secret_id": "abc1234" + } + ], + "oneOf": [ + { + "$ref": "#/components/schemas/UpdateRouteConnectionConfigAnthropicV1" }, { - "type": "null" + "$ref": "#/components/schemas/UpdateRouteConnectionConfigOpenAIV1" + }, + { + "$ref": "#/components/schemas/UpdateRouteConnectionConfigXAIV1" } ], - "default": null, - "description": "Route IDs for the model roles to change; roles left out are unchanged. Every route must belong to the team. Pass null to clear every role, or omit to leave the harness unchanged.", - "x-null-distinct": true + "title": "Config" + } + }, + "required": [ + "config" + ], + "title": "UpdateRouteConnectionRequestV1", + "type": "object" + }, + "RouteTombstoneV1": { + "properties": { + "id": { + "description": "Stable identifier of the deleted route.", + "title": "Id", + "type": "string" }, - "opencode": { + "name": { + "description": "Name of the deleted route.", + "title": "Name", + "type": "string" + } + }, + "required": [ + "id", + "name" + ], + "title": "RouteTombstoneV1", + "type": "object" + }, + "UpdateRouteRequestV1": { + "additionalProperties": false, + "minProperties": 1, + "properties": { + "description": { "anyOf": [ { - "$ref": "#/components/schemas/UpdateBackgroundHarnessModelsV1" + "maxLength": 1000, + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Route IDs for the model roles to change; roles left out are unchanged. Every route must belong to the team. Pass null to clear every role, or omit to leave the harness unchanged.", - "x-null-distinct": true + "description": "New description. Omit to keep the current description; use an empty string to clear it. Null is not accepted.", + "examples": [ + "Assistant for code review and debugging." + ], + "title": "Description" }, - "codex": { + "display_name": { "anyOf": [ { - "$ref": "#/components/schemas/UpdatePrimaryHarnessModelsV1" + "maxLength": 255, + "minLength": 1, + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Route IDs for the model roles to change; roles left out are unchanged. Every route must belong to the team. Pass null to clear every role, or omit to leave the harness unchanged.", - "x-null-distinct": true + "description": "New display label. Omit to keep the current label; null is not accepted.", + "examples": [ + "Assistant" + ], + "title": "Display Name" }, - "pi": { + "target": { "anyOf": [ { - "$ref": "#/components/schemas/UpdatePrimaryHarnessModelsV1" + "discriminator": { + "mapping": { + "ANTHROPIC": "#/components/schemas/RouteTargetConfigAnthropicV1", + "BASETEN_MODEL_API": "#/components/schemas/RouteTargetConfigBasetenModelAPIV1", + "CLASSIFIER_MODEL_BASED": "#/components/schemas/RouteTargetConfigClassifierModelBasedV1", + "OPENAI": "#/components/schemas/RouteTargetConfigOpenAIV1", + "XAI": "#/components/schemas/RouteTargetConfigXAIV1" + }, + "propertyName": "type" + }, + "oneOf": [ + { + "$ref": "#/components/schemas/RouteTargetConfigBasetenModelAPIV1" + }, + { + "$ref": "#/components/schemas/RouteTargetConfigAnthropicV1" + }, + { + "$ref": "#/components/schemas/RouteTargetConfigOpenAIV1" + }, + { + "$ref": "#/components/schemas/RouteTargetConfigXAIV1" + }, + { + "$ref": "#/components/schemas/RouteTargetConfigClassifierModelBasedV1" + } + ] }, { "type": "null" } ], - "default": null, - "description": "Route IDs for the model roles to change; roles left out are unchanged. Every route must belong to the team. Pass null to clear every role, or omit to leave the harness unchanged.", + "description": "Complete new target configuration. Omit to keep the current configuration; null is not accepted. Only the CLASSIFIER_MODEL_BASED configuration of a router route is mutable.", + "title": "Target", "x-null-distinct": true } }, - "title": "UpdateRouteHarnessDefaultsV1", + "title": "UpdateRouteRequestV1", "type": "object" }, - "UpdateRouteTeamSpendLimitSettingV1": { - "additionalProperties": false, - "minProperties": 1, + "EndpointTargetV1": { + "description": "One configured upstream target of an endpoint.", "properties": { - "per_member_monthly_limit_usd": { + "provider": { + "$ref": "#/components/schemas/GatewayProvider", + "description": "Upstream provider." + }, + "secret_id": { "anyOf": [ { "type": "string" @@ -31991,139 +33444,99 @@ } ], "default": null, - "description": "Spend limit in USD for each UTC calendar month that applies to each member whose active Code key belongs to this team, unless the member has a limit of their own. Send null to remove it; omit to leave it unchanged.", - "examples": [ - "200" + "description": "Referenced secret, if any.", + "title": "Secret Id" + }, + "target_model": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } ], - "title": "Per Member Monthly Limit Usd", - "x-null-distinct": true - } - }, - "title": "UpdateRouteTeamSpendLimitSettingV1", - "type": "object" - }, - "UpdateRouteTeamSettingsRequestV1": { - "additionalProperties": false, - "minProperties": 1, - "properties": { - "harness_defaults": { + "default": null, + "description": "Upstream model name, if any.", + "title": "Target Model" + }, + "base_url": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Custom OpenAI-compatible base URL, if any.", + "title": "Base Url" + }, + "model_id": { "anyOf": [ { - "$ref": "#/components/schemas/UpdateRouteHarnessDefaultsV1" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Harnesses to change; harnesses left out are unchanged. Pass null to clear every harness, so each role uses the team's default.", - "x-null-distinct": true + "description": "Baseten model, if any.", + "title": "Model Id" }, - "spend_limit": { + "environment_name": { "anyOf": [ { - "$ref": "#/components/schemas/UpdateRouteTeamSpendLimitSettingV1" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Spend limit fields to change. Pass null to remove the team's per-member limit; omit to leave it unchanged.", - "x-null-distinct": true - } - }, - "title": "UpdateRouteTeamSettingsRequestV1", - "type": "object" - }, - "RouteConnectionAnthropicV1": { - "properties": { - "provider": { - "const": "ANTHROPIC", - "description": "Provider kind for Anthropic.", - "title": "Provider", - "type": "string" - }, - "secret_id": { - "description": "Identifier of the team secret holding the provider API key.", - "title": "Secret Id", - "type": "string" - }, - "secret_name": { - "description": "Name of the team secret holding the provider API key.", - "title": "Secret Name", - "type": "string" - } - }, - "required": [ - "provider", - "secret_id", - "secret_name" - ], - "title": "RouteConnectionAnthropicV1", - "type": "object" - }, - "RouteConnectionOpenAIV1": { - "properties": { - "provider": { - "const": "OPENAI", - "description": "Provider kind for OpenAI.", - "title": "Provider", - "type": "string" - }, - "secret_id": { - "description": "Identifier of the team secret holding the provider API key.", - "title": "Secret Id", - "type": "string" + "description": "Baseten model environment, if non-production.", + "title": "Environment Name" }, - "secret_name": { - "description": "Name of the team secret holding the provider API key.", - "title": "Secret Name", - "type": "string" + "vertex_config": { + "anyOf": [ + { + "$ref": "#/components/schemas/VertexTargetConfigV1" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Google Vertex configuration, if any." } }, "required": [ - "provider", - "secret_id", - "secret_name" + "provider" ], - "title": "RouteConnectionOpenAIV1", + "title": "EndpointTargetV1", "type": "object" }, - "RouteConnectionV1": { + "EndpointV1": { + "description": "A Gateway endpoint: a slug and its priority-ordered targets (index 0 tried first).", "properties": { "id": { - "description": "Stable connection identifier.", + "description": "Stable identifier for the endpoint.", "title": "Id", "type": "string" }, - "team_id": { - "description": "Identifier of the team that owns the connection.", - "title": "Team Id", + "slug": { + "description": "Globally-unique routing slug.", + "examples": [ + "baseten/mymodel-4" + ], + "title": "Slug", "type": "string" }, - "config": { - "description": "Provider the connection authenticates with, and the team secret holding its API key.", - "discriminator": { - "mapping": { - "ANTHROPIC": "#/components/schemas/RouteConnectionAnthropicV1", - "OPENAI": "#/components/schemas/RouteConnectionOpenAIV1", - "XAI": "#/components/schemas/RouteConnectionXAIV1" - }, - "propertyName": "provider" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/RouteConnectionAnthropicV1" - }, - { - "$ref": "#/components/schemas/RouteConnectionOpenAIV1" - }, - { - "$ref": "#/components/schemas/RouteConnectionXAIV1" - } - ], - "title": "Config" + "region": { + "$ref": "#/components/schemas/SharedEndpointRegionV1", + "description": "Region this endpoint's routing serves." }, "created_at": { "description": "Creation time, ISO 8601.", @@ -32136,183 +33549,113 @@ "format": "date-time", "title": "Updated At", "type": "string" - } - }, - "required": [ - "id", - "team_id", - "config", - "created_at", - "updated_at" - ], - "title": "RouteConnectionV1", - "type": "object" - }, - "RouteConnectionXAIV1": { - "properties": { - "provider": { - "const": "XAI", - "description": "Provider kind for xAI.", - "title": "Provider", - "type": "string" - }, - "secret_id": { - "description": "Identifier of the team secret holding the provider API key.", - "title": "Secret Id", - "type": "string" }, - "secret_name": { - "description": "Name of the team secret holding the provider API key.", - "title": "Secret Name", - "type": "string" - } - }, - "required": [ - "provider", - "secret_id", - "secret_name" - ], - "title": "RouteConnectionXAIV1", - "type": "object" - }, - "RouteConnectionsResponseV1": { - "properties": { - "items": { - "description": "Items in this page.", + "targets": { + "description": "The endpoint's upstream targets. Exactly one target is supported at this time.", "items": { - "$ref": "#/components/schemas/RouteConnectionV1" + "$ref": "#/components/schemas/EndpointTargetV1" }, - "title": "Items", + "title": "Targets", "type": "array" - }, - "pagination": { - "$ref": "#/components/schemas/PaginationResponseV1", - "description": "Pagination metadata for the page." } }, "required": [ - "items", - "pagination" + "id", + "slug", + "region", + "created_at", + "updated_at", + "targets" ], - "title": "RouteConnectionsResponseV1", + "title": "EndpointV1", "type": "object" }, - "RouteConnectionsRequestV1": { - "properties": { - "cursor": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Opaque cursor returned by a previous page. Omit to fetch the first page.", - "title": "Cursor" - }, - "limit": { - "default": 100, - "description": "Maximum number of items to return.", - "maximum": 1000, - "minimum": 1, - "title": "Limit", - "type": "integer" - }, - "team_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Identifier of the team whose connections to list.", - "title": "Team Id" - } - }, - "title": "RouteConnectionsRequestV1", - "type": "object" + "GatewayProvider": { + "enum": [ + "ANTHROPIC", + "OPENAI", + "XAI", + "BASETEN", + "BASETEN_MODEL_API", + "VERTEX", + "OPENAI_COMPATIBLE" + ], + "title": "GatewayProvider", + "type": "string" }, - "RouteConnectionConfigAnthropicV1": { - "additionalProperties": false, - "properties": { - "provider": { - "const": "ANTHROPIC", - "description": "Provider kind for Anthropic.", - "title": "Provider", - "type": "string" - }, - "secret_id": { - "description": "Identifier of an existing secret, owned by the same team, that holds the provider API key.", - "minLength": 1, - "title": "Secret Id", - "type": "string" - } - }, - "required": [ - "provider", - "secret_id" + "SharedEndpointRegionV1": { + "enum": [ + "UNRESTRICTED", + "EU" ], - "title": "RouteConnectionConfigAnthropicV1", - "type": "object" + "title": "SharedEndpointRegionV1", + "type": "string" }, - "RouteConnectionConfigOpenAIV1": { - "additionalProperties": false, + "VertexTargetConfigV1": { "properties": { - "provider": { - "const": "OPENAI", - "description": "Provider kind for OpenAI.", - "title": "Provider", + "project_id": { + "description": "Google Cloud project ID or project number.", + "examples": [ + "my-gcp-project", + "464036093014" + ], + "title": "Project Id", "type": "string" }, - "secret_id": { - "description": "Identifier of an existing secret, owned by the same team, that holds the provider API key.", - "minLength": 1, - "title": "Secret Id", + "location": { + "description": "Google Cloud location.", + "examples": [ + "global" + ], + "title": "Location", "type": "string" } }, "required": [ - "provider", - "secret_id" + "project_id", + "location" ], - "title": "RouteConnectionConfigOpenAIV1", + "title": "VertexTargetConfigV1", "type": "object" }, - "RouteConnectionConfigXAIV1": { - "additionalProperties": false, + "EndpointsResponseV1": { "properties": { - "provider": { - "const": "XAI", - "description": "Provider kind for xAI.", - "title": "Provider", - "type": "string" + "items": { + "description": "Items in this page.", + "items": { + "$ref": "#/components/schemas/EndpointV1" + }, + "title": "Items", + "type": "array" }, - "secret_id": { - "description": "Identifier of an existing secret, owned by the same team, that holds the provider API key.", - "minLength": 1, - "title": "Secret Id", - "type": "string" + "pagination": { + "$ref": "#/components/schemas/PaginationResponseV1", + "description": "Pagination metadata for the page." } }, "required": [ - "provider", - "secret_id" + "items", + "pagination" ], - "title": "RouteConnectionConfigXAIV1", + "title": "EndpointsResponseV1", "type": "object" }, - "CreateRouteConnectionRequestV1": { - "additionalProperties": false, + "EndpointTargetRequestV1": { + "description": "One desired upstream target. The customer picks a provider; Baseten owns the\nupstream host and protocol adapter.", "properties": { - "team_id": { + "provider": { + "$ref": "#/components/schemas/GatewayProvider", + "description": "Upstream provider for this target.", + "examples": [ + "ANTHROPIC", + "OPENAI", + "OPENAI_COMPATIBLE", + "BASETEN" + ] + }, + "secret_id": { "anyOf": [ { - "minLength": 1, "type": "string" }, { @@ -32320,75 +33663,63 @@ } ], "default": null, - "description": "Identifier of the team that owns the connection.", + "description": "Secret holding the provider credential. Required for external providers.", "examples": [ - "abc1234" + "3kZ9xqd" ], - "title": "Team Id" + "title": "Secret Id" }, - "config": { - "description": "Provider the connection authenticates with, and the team secret holding its API key.", - "discriminator": { - "mapping": { - "ANTHROPIC": "#/components/schemas/RouteConnectionConfigAnthropicV1", - "OPENAI": "#/components/schemas/RouteConnectionConfigOpenAIV1", - "XAI": "#/components/schemas/RouteConnectionConfigXAIV1" + "target_model": { + "anyOf": [ + { + "type": "string" }, - "propertyName": "provider" - }, - "examples": [ { - "provider": "ANTHROPIC", - "secret_id": "abc1234" + "type": "null" } ], - "oneOf": [ + "default": null, + "description": "Model name to send upstream. Required for external providers and optional for BASETEN targets.", + "examples": [ + "gpt-4o" + ], + "title": "Target Model" + }, + "base_url": { + "anyOf": [ { - "$ref": "#/components/schemas/RouteConnectionConfigAnthropicV1" + "type": "string" }, { - "$ref": "#/components/schemas/RouteConnectionConfigOpenAIV1" + "type": "null" + } + ], + "default": null, + "description": "HTTPS base URL of the upstream OpenAI-compatible server. Must not include a port. Required for and only valid with OPENAI_COMPATIBLE.", + "examples": [ + "https://my-vllm.example.com" + ], + "title": "Base Url" + }, + "model_id": { + "anyOf": [ + { + "type": "string" }, { - "$ref": "#/components/schemas/RouteConnectionConfigXAIV1" + "type": "null" } ], - "title": "Config" - } - }, - "required": [ - "config" - ], - "title": "CreateRouteConnectionRequestV1", - "type": "object" - }, - "RouteConnectionTombstoneV1": { - "properties": { - "id": { - "description": "Stable identifier of the deleted connection.", - "title": "Id", - "type": "string" - } - }, - "required": [ - "id" - ], - "title": "RouteConnectionTombstoneV1", - "type": "object" - }, - "UpdateRouteConnectionConfigAnthropicV1": { - "additionalProperties": false, - "properties": { - "provider": { - "const": "ANTHROPIC", - "description": "Provider kind for Anthropic.", - "title": "Provider", - "type": "string" + "default": null, + "description": "Baseten model to route to. Required for and only valid with BASETEN.", + "examples": [ + "3kZ9xqd" + ], + "title": "Model Id" }, - "secret_id": { + "environment_name": { "anyOf": [ { - "minLength": 1, "type": "string" }, { @@ -32396,241 +33727,287 @@ } ], "default": null, - "description": "Identifier of the new secret, owned by the connection's team, that holds the provider API key. Omit to keep the current secret.", - "title": "Secret Id", - "x-null-distinct": true + "description": "Baseten model environment to route to. Only valid with BASETEN. Omit or pass `production` to target production.", + "examples": [ + "staging" + ], + "title": "Environment Name" + }, + "vertex_config": { + "anyOf": [ + { + "$ref": "#/components/schemas/VertexTargetConfigV1" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Google Vertex configuration. Required for and only valid with VERTEX." } }, "required": [ "provider" ], - "title": "UpdateRouteConnectionConfigAnthropicV1", + "title": "EndpointTargetRequestV1", "type": "object" }, - "UpdateRouteConnectionConfigOpenAIV1": { - "additionalProperties": false, + "CreateEndpointRequestV1": { "properties": { - "provider": { - "const": "OPENAI", - "description": "Provider kind for OpenAI.", - "title": "Provider", + "slug": { + "description": "Globally-unique slug of the form '{org_prefix}/{name}'.", + "examples": [ + "baseten/mymodel-4" + ], + "title": "Slug", "type": "string" }, - "secret_id": { - "anyOf": [ - { - "minLength": 1, - "type": "string" - }, - { - "type": "null" - } + "region": { + "$ref": "#/components/schemas/SharedEndpointRegionV1", + "default": "UNRESTRICTED", + "description": "Region the new routing serves." + }, + "targets": { + "description": "The endpoint's upstream targets. Exactly one target is supported at this time.", + "examples": [ + [ + { + "environment_name": "staging", + "model_id": "3kZ9xqd", + "provider": "BASETEN", + "target_model": "custom/model-name" + } + ], + [ + { + "provider": "OPENAI", + "secret_id": "3kZ9xqd", + "target_model": "gpt-4o" + } + ], + [ + { + "base_url": "https://my-vllm.example.com", + "provider": "OPENAI_COMPATIBLE", + "secret_id": "3kZ9xqd", + "target_model": "my-model" + } + ] ], - "default": null, - "description": "Identifier of the new secret, owned by the connection's team, that holds the provider API key. Omit to keep the current secret.", - "title": "Secret Id", - "x-null-distinct": true + "items": { + "$ref": "#/components/schemas/EndpointTargetRequestV1" + }, + "maxItems": 1, + "minItems": 1, + "title": "Targets", + "type": "array" } }, "required": [ - "provider" + "slug", + "targets" ], - "title": "UpdateRouteConnectionConfigOpenAIV1", + "title": "CreateEndpointRequestV1", "type": "object" }, - "UpdateRouteConnectionConfigXAIV1": { - "additionalProperties": false, + "EndpointTombstoneV1": { "properties": { - "provider": { - "const": "XAI", - "description": "Provider kind for xAI.", - "title": "Provider", + "id": { + "description": "Identifier of the deleted endpoint.", + "title": "Id", "type": "string" }, - "secret_id": { - "anyOf": [ - { - "minLength": 1, - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Identifier of the new secret, owned by the connection's team, that holds the provider API key. Omit to keep the current secret.", - "title": "Secret Id", - "x-null-distinct": true + "slug": { + "description": "Slug of the deleted endpoint.", + "title": "Slug", + "type": "string" } }, "required": [ - "provider" + "id", + "slug" ], - "title": "UpdateRouteConnectionConfigXAIV1", + "title": "EndpointTombstoneV1", "type": "object" }, - "UpdateRouteConnectionRequestV1": { - "additionalProperties": false, + "UpdateEndpointRequestV1": { + "description": "PATCH body. Replaces the endpoint's full target list. The slug is immutable\nafter creation; to change it, create a new endpoint and delete this one.", "properties": { - "config": { - "description": "Connection fields to change. The provider must match the connection and is immutable.", - "discriminator": { - "mapping": { - "ANTHROPIC": "#/components/schemas/UpdateRouteConnectionConfigAnthropicV1", - "OPENAI": "#/components/schemas/UpdateRouteConnectionConfigOpenAIV1", - "XAI": "#/components/schemas/UpdateRouteConnectionConfigXAIV1" - }, - "propertyName": "provider" - }, - "examples": [ - { - "provider": "ANTHROPIC", - "secret_id": "abc1234" - } - ], - "oneOf": [ - { - "$ref": "#/components/schemas/UpdateRouteConnectionConfigAnthropicV1" - }, + "targets": { + "anyOf": [ { - "$ref": "#/components/schemas/UpdateRouteConnectionConfigOpenAIV1" + "items": { + "$ref": "#/components/schemas/EndpointTargetRequestV1" + }, + "maxItems": 1, + "minItems": 1, + "type": "array" }, { - "$ref": "#/components/schemas/UpdateRouteConnectionConfigXAIV1" + "type": "null" } ], - "title": "Config" + "default": null, + "description": "The endpoint's upstream targets. Exactly one target is supported at this time.", + "examples": [ + [ + { + "environment_name": "staging", + "model_id": "3kZ9xqd", + "provider": "BASETEN", + "target_model": "custom/model-name" + } + ], + [ + { + "provider": "OPENAI", + "secret_id": "3kZ9xqd", + "target_model": "gpt-4o" + } + ], + [ + { + "base_url": "https://my-vllm.example.com", + "provider": "OPENAI_COMPATIBLE", + "secret_id": "3kZ9xqd", + "target_model": "my-model" + } + ] + ], + "title": "Targets" } }, - "required": [ - "config" - ], - "title": "UpdateRouteConnectionRequestV1", + "title": "UpdateEndpointRequestV1", "type": "object" }, - "RouteTombstoneV1": { + "EffectiveModelConfigV1": { "properties": { - "id": { - "description": "Stable identifier of the deleted route.", - "title": "Id", + "slug": { + "description": "Shared endpoint slug.", + "title": "Slug", "type": "string" }, - "name": { - "description": "Name of the deleted route.", - "title": "Name", - "type": "string" + "rate_limits": { + "items": { + "$ref": "#/components/schemas/EffectiveRateLimitV1" + }, + "title": "Rate Limits", + "type": "array" + }, + "usage_limits": { + "items": { + "$ref": "#/components/schemas/EffectiveUsageLimitV1" + }, + "title": "Usage Limits", + "type": "array" } }, "required": [ - "id", - "name" + "slug" ], - "title": "RouteTombstoneV1", + "title": "EffectiveModelConfigV1", "type": "object" }, - "UpdateRouteRequestV1": { - "additionalProperties": false, - "minProperties": 1, + "EffectiveRateLimitV1": { "properties": { - "description": { - "anyOf": [ - { - "maxLength": 1000, - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "New description. Omit to keep the current description; use an empty string to clear it. Null is not accepted.", + "type": { + "$ref": "#/components/schemas/LimitTypeV1", + "description": "The type of the rate limit", "examples": [ - "Assistant for code review and debugging." - ], - "title": "Description" + "TOKEN", + "REQUEST" + ] }, - "display_name": { - "anyOf": [ - { - "maxLength": 255, - "minLength": 1, - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "New display label. Omit to keep the current label; null is not accepted.", + "unit": { + "$ref": "#/components/schemas/RateLimitUnitV1", + "description": "The unit of the rate limit", "examples": [ - "Assistant" + "SECOND", + "MINUTE" + ] + }, + "threshold": { + "description": "The threshold for the rate limit", + "examples": [ + 1000, + 50000 ], - "title": "Display Name" + "minimum": 0, + "title": "Threshold", + "type": "integer" }, - "target": { - "anyOf": [ - { - "discriminator": { - "mapping": { - "ANTHROPIC": "#/components/schemas/RouteTargetConfigAnthropicV1", - "BASETEN_MODEL_API": "#/components/schemas/RouteTargetConfigBasetenModelAPIV1", - "CLASSIFIER_MODEL_BASED": "#/components/schemas/RouteTargetConfigClassifierModelBasedV1", - "OPENAI": "#/components/schemas/RouteTargetConfigOpenAIV1", - "XAI": "#/components/schemas/RouteTargetConfigXAIV1" - }, - "propertyName": "type" - }, - "oneOf": [ - { - "$ref": "#/components/schemas/RouteTargetConfigBasetenModelAPIV1" - }, - { - "$ref": "#/components/schemas/RouteTargetConfigAnthropicV1" - }, - { - "$ref": "#/components/schemas/RouteTargetConfigOpenAIV1" - }, - { - "$ref": "#/components/schemas/RouteTargetConfigXAIV1" - }, - { - "$ref": "#/components/schemas/RouteTargetConfigClassifierModelBasedV1" - } - ] - }, - { - "type": "null" - } + "source_group": { + "description": "ID of the group in the hierarchy this limit is anchored to.", + "examples": [ + "abc123" + ], + "title": "Source Group", + "type": "string" + } + }, + "required": [ + "type", + "unit", + "threshold", + "source_group" + ], + "title": "EffectiveRateLimitV1", + "type": "object" + }, + "EffectiveUsageLimitV1": { + "properties": { + "type": { + "$ref": "#/components/schemas/LimitTypeV1", + "description": "The type of the usage limit", + "examples": [ + "REQUEST", + "TOKEN" + ] + }, + "unit": { + "$ref": "#/components/schemas/UsageLimitUnitV1", + "description": "The unit of the usage limit", + "examples": [ + "DAY" + ] + }, + "threshold": { + "description": "The threshold for the usage limit", + "examples": [ + 10000000 ], - "description": "Complete new target configuration. Omit to keep the current configuration; null is not accepted. Only the CLASSIFIER_MODEL_BASED configuration of a router route is mutable.", - "title": "Target", - "x-null-distinct": true + "minimum": 0, + "title": "Threshold", + "type": "integer" + }, + "source_group": { + "description": "ID of the group in the hierarchy this limit is anchored to.", + "examples": [ + "abc123" + ], + "title": "Source Group", + "type": "string" } }, - "title": "UpdateRouteRequestV1", + "required": [ + "type", + "unit", + "threshold", + "source_group" + ], + "title": "EffectiveUsageLimitV1", "type": "object" }, - "EndpointTargetV1": { - "description": "One configured upstream target of an endpoint.", + "GroupHierarchyV1": { "properties": { - "provider": { - "$ref": "#/components/schemas/GatewayProvider", - "description": "Upstream provider." - }, - "secret_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Referenced secret, if any.", - "title": "Secret Id" + "limit_enforcement": { + "$ref": "#/components/schemas/LimitEnforcementV1", + "examples": [ + "CASCADING", + "INDEPENDENT" + ] }, - "target_model": { + "parent_group_id": { "anyOf": [ { "type": "string" @@ -32640,25 +34017,24 @@ } ], "default": null, - "description": "Upstream model name, if any.", - "title": "Target Model" - }, - "base_url": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "examples": [ + "abc123" ], - "default": null, - "description": "Custom OpenAI-compatible base URL, if any.", - "title": "Base Url" - }, - "model_id": { + "title": "Parent Group Id" + } + }, + "required": [ + "limit_enforcement" + ], + "title": "GroupHierarchyV1", + "type": "object" + }, + "GroupMetadataV1": { + "properties": { + "name": { "anyOf": [ { + "maxLength": 255, "type": "string" }, { @@ -32666,147 +34042,158 @@ } ], "default": null, - "description": "Baseten model, if any.", - "title": "Model Id" - }, - "environment_name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } + "description": "Optional display name for the group.", + "examples": [ + "Acme prod" ], - "default": null, - "description": "Baseten model environment, if non-production.", - "title": "Environment Name" + "title": "Name" }, - "vertex_config": { - "anyOf": [ - { - "$ref": "#/components/schemas/VertexTargetConfigV1" - }, - { - "type": "null" - } + "external_entity_id": { + "description": "External-system identifier for this group. Unique within the caller's org.", + "examples": [ + "cust_42" ], - "default": null, - "description": "Google Vertex configuration, if any." + "maxLength": 255, + "minLength": 1, + "title": "External Entity Id", + "type": "string" } }, "required": [ - "provider" + "external_entity_id" ], - "title": "EndpointTargetV1", + "title": "GroupMetadataV1", "type": "object" }, - "EndpointV1": { - "description": "A Gateway endpoint: a slug and its priority-ordered targets (index 0 tried first).", + "GroupV1": { "properties": { "id": { - "description": "Stable identifier for the endpoint.", + "description": "Internal Baseten ID for the group.", "title": "Id", "type": "string" }, - "slug": { - "description": "Globally-unique routing slug.", - "examples": [ - "baseten/mymodel-4" - ], - "title": "Slug", - "type": "string" + "metadata": { + "$ref": "#/components/schemas/GroupMetadataV1", + "description": "Group identity + display metadata." }, - "region": { - "$ref": "#/components/schemas/SharedEndpointRegionV1", - "description": "Region this endpoint's routing serves." + "models": { + "items": { + "$ref": "#/components/schemas/ModelConfigV1" + }, + "title": "Models", + "type": "array" + }, + "effective_models": { + "items": { + "$ref": "#/components/schemas/EffectiveModelConfigV1" + }, + "title": "Effective Models", + "type": "array" + }, + "hierarchy": { + "$ref": "#/components/schemas/GroupHierarchyV1", + "description": "Parent linkage and limit enforcement mode. Parent is null for root groups." }, "created_at": { - "description": "Creation time, ISO 8601.", + "description": "When this group was created.", "format": "date-time", "title": "Created At", "type": "string" - }, - "updated_at": { - "description": "Last update time, ISO 8601.", - "format": "date-time", - "title": "Updated At", - "type": "string" - }, - "targets": { - "description": "The endpoint's upstream targets. Exactly one target is supported at this time.", - "items": { - "$ref": "#/components/schemas/EndpointTargetV1" - }, - "title": "Targets", - "type": "array" } }, "required": [ "id", - "slug", - "region", - "created_at", - "updated_at", - "targets" + "metadata", + "hierarchy", + "created_at" ], - "title": "EndpointV1", + "title": "GroupV1", "type": "object" }, - "GatewayProvider": { + "LimitEnforcementV1": { "enum": [ - "ANTHROPIC", - "OPENAI", - "XAI", - "BASETEN", - "BASETEN_MODEL_API", - "VERTEX", - "OPENAI_COMPATIBLE" + "CASCADING", + "INDEPENDENT" ], - "title": "GatewayProvider", + "title": "LimitEnforcementV1", "type": "string" }, - "SharedEndpointRegionV1": { + "ModelConfigV1": { + "properties": { + "slug": { + "description": "Shared endpoint slug.", + "title": "Slug", + "type": "string" + }, + "rate_limits": { + "items": { + "$ref": "#/components/schemas/RateLimitV1" + }, + "title": "Rate Limits", + "type": "array" + }, + "usage_limits": { + "items": { + "$ref": "#/components/schemas/UsageLimitV1" + }, + "title": "Usage Limits", + "type": "array" + } + }, + "required": [ + "slug" + ], + "title": "ModelConfigV1", + "type": "object" + }, + "UsageLimitUnitV1": { "enum": [ - "UNRESTRICTED", - "EU" + "DAY" ], - "title": "SharedEndpointRegionV1", + "title": "UsageLimitUnitV1", "type": "string" }, - "VertexTargetConfigV1": { + "UsageLimitV1": { "properties": { - "project_id": { - "description": "Google Cloud project ID or project number.", + "type": { + "$ref": "#/components/schemas/LimitTypeV1", + "description": "The type of the usage limit", + "examples": [ + "REQUEST", + "TOKEN" + ] + }, + "unit": { + "$ref": "#/components/schemas/UsageLimitUnitV1", + "description": "The unit of the usage limit", "examples": [ - "my-gcp-project", - "464036093014" - ], - "title": "Project Id", - "type": "string" + "DAY" + ] }, - "location": { - "description": "Google Cloud location.", + "threshold": { + "description": "The threshold for the usage limit", "examples": [ - "global" + 10000000 ], - "title": "Location", - "type": "string" + "minimum": 0, + "title": "Threshold", + "type": "integer" } }, "required": [ - "project_id", - "location" + "type", + "unit", + "threshold" ], - "title": "VertexTargetConfigV1", + "title": "UsageLimitV1", "type": "object" }, - "EndpointsResponseV1": { + "GroupsResponseV1": { "properties": { "items": { "description": "Items in this page.", "items": { - "$ref": "#/components/schemas/EndpointV1" + "$ref": "#/components/schemas/GroupV1" }, "title": "Items", "type": "array" @@ -32820,39 +34207,27 @@ "items", "pagination" ], - "title": "EndpointsResponseV1", + "title": "GroupsResponseV1", "type": "object" }, - "EndpointTargetRequestV1": { - "description": "One desired upstream target. The customer picks a provider; Baseten owns the\nupstream host and protocol adapter.", + "CreateGroupHierarchyV1": { "properties": { - "provider": { - "$ref": "#/components/schemas/GatewayProvider", - "description": "Upstream provider for this target.", - "examples": [ - "ANTHROPIC", - "OPENAI", - "OPENAI_COMPATIBLE", - "BASETEN" - ] - }, - "secret_id": { + "limit_enforcement": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/LimitEnforcementV1" }, { "type": "null" } ], "default": null, - "description": "Secret holding the provider credential. Required for external providers.", + "description": "Limit behavior. Child groups inherit their parent's behavior when omitted; root groups default to Independent for backwards compatibility.", "examples": [ - "3kZ9xqd" - ], - "title": "Secret Id" + "INDEPENDENT" + ] }, - "target_model": { + "parent_group_id": { "anyOf": [ { "type": "string" @@ -32862,15 +34237,56 @@ } ], "default": null, - "description": "Model name to send upstream. Required for external providers and optional for BASETEN targets.", "examples": [ - "gpt-4o" + "abc123" ], - "title": "Target Model" + "title": "Parent Group Id" + } + }, + "title": "CreateGroupHierarchyV1", + "type": "object" + }, + "CreateGroupRequestV1": { + "properties": { + "metadata": { + "$ref": "#/components/schemas/GroupMetadataV1", + "description": "Group identity + display metadata." }, - "base_url": { + "models": { + "description": "Per-model rate and usage limit configuration. Defines the group's complete model set. Must be non-empty.", + "examples": [ + [ + { + "slug": "my-org/claude" + } + ] + ], + "items": { + "$ref": "#/components/schemas/ModelConfigV1" + }, + "minItems": 1, + "title": "Models", + "type": "array" + }, + "hierarchy": { + "$ref": "#/components/schemas/CreateGroupHierarchyV1", + "description": "Parent linkage and limit enforcement mode. Immutable after creation." + } + }, + "required": [ + "metadata", + "models", + "hierarchy" + ], + "title": "CreateGroupRequestV1", + "type": "object" + }, + "UpdateGroupMetadataV1": { + "properties": { + "name": { "anyOf": [ { + "maxLength": 255, "type": "string" }, { @@ -32878,805 +34294,2117 @@ } ], "default": null, - "description": "HTTPS base URL of the upstream OpenAI-compatible server. Must not include a port. Required for and only valid with OPENAI_COMPATIBLE.", + "description": "Optional display name for the group.", "examples": [ - "https://my-vllm.example.com" + "Acme prod" ], - "title": "Base Url" - }, - "model_id": { + "title": "Name" + } + }, + "title": "UpdateGroupMetadataV1", + "type": "object" + }, + "UpdateGroupRequestV1": { + "properties": { + "metadata": { "anyOf": [ { - "type": "string" + "$ref": "#/components/schemas/UpdateGroupMetadataV1" }, { "type": "null" } ], "default": null, - "description": "Baseten model to route to. Required for and only valid with BASETEN.", + "description": "Mutable group metadata.", "examples": [ - "3kZ9xqd" - ], - "title": "Model Id" + { + "name": "Acme Prod" + } + ] }, - "environment_name": { + "models": { "anyOf": [ { - "type": "string" + "items": { + "$ref": "#/components/schemas/ModelConfigV1" + }, + "type": "array" }, { "type": "null" } ], "default": null, - "description": "Baseten model environment to route to. Only valid with BASETEN. Omit or pass `production` to target production.", - "examples": [ - "staging" - ], - "title": "Environment Name" + "description": "Per-model rate and usage limit configuration.", + "title": "Models" + } + }, + "title": "UpdateGroupRequestV1", + "type": "object" + }, + "GatewayKeyInfoV1": { + "properties": { + "prefix": { + "description": "The prefix of the Model API key.", + "title": "Prefix", + "type": "string" }, - "vertex_config": { + "name": { "anyOf": [ { - "$ref": "#/components/schemas/VertexTargetConfigV1" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "Google Vertex configuration. Required for and only valid with VERTEX." + "description": "Optional display name.", + "title": "Name" } }, "required": [ - "provider" + "prefix" ], - "title": "EndpointTargetRequestV1", + "title": "GatewayKeyInfoV1", "type": "object" }, - "CreateEndpointRequestV1": { + "KeysForGroupResponseV1": { "properties": { - "slug": { - "description": "Globally-unique slug of the form '{org_prefix}/{name}'.", - "examples": [ - "baseten/mymodel-4" - ], - "title": "Slug", - "type": "string" - }, - "region": { - "$ref": "#/components/schemas/SharedEndpointRegionV1", - "default": "UNRESTRICTED", - "description": "Region the new routing serves." - }, - "targets": { - "description": "The endpoint's upstream targets. Exactly one target is supported at this time.", - "examples": [ - [ - { - "environment_name": "staging", - "model_id": "3kZ9xqd", - "provider": "BASETEN", - "target_model": "custom/model-name" - } - ], - [ - { - "provider": "OPENAI", - "secret_id": "3kZ9xqd", - "target_model": "gpt-4o" - } - ], - [ - { - "base_url": "https://my-vllm.example.com", - "provider": "OPENAI_COMPATIBLE", - "secret_id": "3kZ9xqd", - "target_model": "my-model" - } - ] - ], + "items": { + "description": "Items in this page.", "items": { - "$ref": "#/components/schemas/EndpointTargetRequestV1" + "$ref": "#/components/schemas/GatewayKeyInfoV1" }, - "maxItems": 1, - "minItems": 1, - "title": "Targets", + "title": "Items", "type": "array" + }, + "pagination": { + "$ref": "#/components/schemas/PaginationResponseV1", + "description": "Pagination metadata for the page." } }, "required": [ - "slug", - "targets" + "items", + "pagination" ], - "title": "CreateEndpointRequestV1", + "title": "KeysForGroupResponseV1", "type": "object" }, - "EndpointTombstoneV1": { + "CreateApiKeyForGroupRequestV1": { + "properties": { + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Optional display name for the new key.", + "examples": [ + "prod-key-1" + ], + "title": "Name" + } + }, + "title": "CreateApiKeyForGroupRequestV1", + "type": "object" + }, + "CreateApiKeyForGroupResponseV1": { "properties": { - "id": { - "description": "Identifier of the deleted endpoint.", - "title": "Id", + "api_key": { + "description": "Plaintext key string, returned exactly once.", + "title": "Api Key", "type": "string" }, - "slug": { - "description": "Slug of the deleted endpoint.", - "title": "Slug", + "prefix": { + "description": "Key prefix (the part before the dot).", + "title": "Prefix", "type": "string" + }, + "name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "description": "Display name of the key.", + "title": "Name" } }, "required": [ - "id", - "slug" + "api_key", + "prefix" ], - "title": "EndpointTombstoneV1", + "title": "CreateApiKeyForGroupResponseV1", "type": "object" }, - "UpdateEndpointRequestV1": { - "description": "PATCH body. Replaces the endpoint's full target list. The slug is immutable\nafter creation; to change it, create a new endpoint and delete this one.", + "RegisterAPIKeyRequestV1": { + "description": "Request to register a caller-supplied API key against an existing FederatedGroup.", "properties": { - "targets": { + "name": { "anyOf": [ { - "items": { - "$ref": "#/components/schemas/EndpointTargetRequestV1" - }, - "maxItems": 1, - "minItems": 1, - "type": "array" + "type": "string" }, { "type": "null" } ], "default": null, - "description": "The endpoint's upstream targets. Exactly one target is supported at this time.", + "description": "Optional name for the Model API key", "examples": [ - [ - { - "environment_name": "staging", - "model_id": "3kZ9xqd", - "provider": "BASETEN", - "target_model": "custom/model-name" - } - ], - [ - { - "provider": "OPENAI", - "secret_id": "3kZ9xqd", - "target_model": "gpt-4o" - } - ], - [ - { - "base_url": "https://my-vllm.example.com", - "provider": "OPENAI_COMPATIBLE", - "secret_id": "3kZ9xqd", - "target_model": "my-model" - } - ] + "my-model-api-key" ], - "title": "Targets" + "title": "Name" + }, + "key": { + "description": "Value of the API key to register", + "examples": [ + "my-secure-api-key-value" + ], + "title": "Key", + "type": "string" } }, - "title": "UpdateEndpointRequestV1", + "required": [ + "key" + ], + "title": "RegisterAPIKeyRequestV1", "type": "object" }, - "EffectiveModelConfigV1": { + "RegisterAPIKeyResponseV1": { "properties": { - "slug": { - "description": "Shared endpoint slug.", - "title": "Slug", - "type": "string" - }, - "rate_limits": { - "items": { - "$ref": "#/components/schemas/EffectiveRateLimitV1" - }, - "title": "Rate Limits", - "type": "array" - }, - "usage_limits": { - "items": { - "$ref": "#/components/schemas/EffectiveUsageLimitV1" - }, - "title": "Usage Limits", - "type": "array" + "ok": { + "description": "Whether the registration was successful", + "title": "Ok", + "type": "boolean" } }, "required": [ - "slug" + "ok" ], - "title": "EffectiveModelConfigV1", + "title": "RegisterAPIKeyResponseV1", "type": "object" }, - "EffectiveRateLimitV1": { + "SandboxLifecycleV1": { + "type": "object", + "description": "Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates", "properties": { - "type": { - "$ref": "#/components/schemas/LimitTypeV1", - "description": "The type of the rate limit", - "examples": [ - "TOKEN", - "REQUEST" + "expiration_policies": { + "type": "array", + "description": "List of expiration policies. Multiple policies can be combined; whichever condition is met first triggers the action.", + "items": { + "$ref": "#/components/schemas/SandboxExpirationPolicyV1" + }, + "example": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } ] }, - "unit": { - "$ref": "#/components/schemas/RateLimitUnitV1", - "description": "The unit of the rate limit", - "examples": [ - "SECOND", - "MINUTE" - ] + "terminated_retention": { + "type": "string", + "description": "Duration to keep the sandbox record after termination for log access (e.g., '1h', '24h', '7d'). Defaults to 5m. Subject to maximum quota limits.", + "example": "24h" + } + }, + "example": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + } + }, + "SandboxExpirationPolicyV1": { + "description": "Expiration policy. The type determines whether value is a duration or an absolute timestamp.", + "oneOf": [ + { + "$ref": "#/components/schemas/SandboxTTLIdleExpirationPolicyV1" }, - "threshold": { - "description": "The threshold for the rate limit", - "examples": [ - 1000, - 50000 - ], - "minimum": 0, - "title": "Threshold", - "type": "integer" + { + "$ref": "#/components/schemas/SandboxTTLMaxAgeExpirationPolicyV1" }, - "source_group": { - "description": "ID of the group in the hierarchy this limit is anchored to.", - "examples": [ - "abc123" - ], - "title": "Source Group", - "type": "string" + { + "$ref": "#/components/schemas/SandboxDateExpirationPolicyV1" } - }, + ], + "discriminator": { + "propertyName": "type", + "mapping": { + "TTL_IDLE": "#/components/schemas/SandboxTTLIdleExpirationPolicyV1", + "TTL_MAX_AGE": "#/components/schemas/SandboxTTLMaxAgeExpirationPolicyV1", + "DATE": "#/components/schemas/SandboxDateExpirationPolicyV1" + } + } + }, + "SandboxDurationV1": { + "type": "string", + "description": "Duration using seconds, minutes, hours, or composite durations such as 1h30m. Whole days and weeks are also supported, for example 7d or 2w.", + "pattern": "^[+-]?(0|[0-9]+[dw]|([0-9]+(\\.[0-9]*)?|\\.[0-9]+)(ns|us|\u00b5s|\u03bcs|ms|s|m|h)(([0-9]+(\\.[0-9]*)?|\\.[0-9]+)(ns|us|\u00b5s|\u03bcs|ms|s|m|h))*)$", + "example": "24h" + }, + "SandboxTTLIdleExpirationPolicyV1": { + "type": "object", + "description": "Delete after the specified period of inactivity.", "required": [ + "action", "type", - "unit", - "threshold", - "source_group" + "value" ], - "title": "EffectiveRateLimitV1", - "type": "object" - }, - "EffectiveUsageLimitV1": { "properties": { + "action": { + "type": "string", + "enum": [ + "DELETE" + ] + }, "type": { - "$ref": "#/components/schemas/LimitTypeV1", - "description": "The type of the usage limit", - "examples": [ - "REQUEST", - "TOKEN" + "type": "string", + "enum": [ + "TTL_IDLE" ] }, - "unit": { - "$ref": "#/components/schemas/UsageLimitUnitV1", - "description": "The unit of the usage limit", - "examples": [ - "DAY" + "value": { + "$ref": "#/components/schemas/SandboxDurationV1" + } + } + }, + "SandboxTTLMaxAgeExpirationPolicyV1": { + "type": "object", + "description": "Delete after the specified total lifetime.", + "required": [ + "action", + "type", + "value" + ], + "properties": { + "action": { + "type": "string", + "enum": [ + "DELETE" ] }, - "threshold": { - "description": "The threshold for the usage limit", - "examples": [ - 10000000 - ], - "minimum": 0, - "title": "Threshold", - "type": "integer" + "type": { + "type": "string", + "enum": [ + "TTL_MAX_AGE" + ] }, - "source_group": { - "description": "ID of the group in the hierarchy this limit is anchored to.", - "examples": [ - "abc123" - ], - "title": "Source Group", - "type": "string" + "value": { + "$ref": "#/components/schemas/SandboxDurationV1" } - }, + } + }, + "SandboxDateExpirationPolicyV1": { + "type": "object", + "description": "Delete at the specified absolute timestamp.", "required": [ + "action", "type", - "unit", - "threshold", - "source_group" + "value" ], - "title": "EffectiveUsageLimitV1", - "type": "object" - }, - "GroupHierarchyV1": { "properties": { - "limit_enforcement": { - "$ref": "#/components/schemas/LimitEnforcementV1", - "examples": [ - "CASCADING", - "INDEPENDENT" + "action": { + "type": "string", + "enum": [ + "DELETE" ] }, - "parent_group_id": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "examples": [ - "abc123" - ], - "title": "Parent Group Id" + "type": { + "type": "string", + "enum": [ + "DATE" + ] + }, + "value": { + "type": "string", + "format": "date-time", + "example": "2026-09-23T21:26:58Z" } - }, - "required": [ - "limit_enforcement" - ], - "title": "GroupHierarchyV1", - "type": "object" + } }, - "GroupMetadataV1": { + "SandboxNetworkV1": { + "type": "object", + "description": "Network configuration for a sandbox including subnet, domain filtering, and proxy settings", "properties": { - "name": { - "anyOf": [ - { - "maxLength": 255, - "type": "string" - }, + "proxy": { + "description": "Proxy configuration for routing sandbox HTTP traffic through the platform proxy with MITM inspection and per-destination header/body injection", + "allOf": [ { - "type": "null" + "$ref": "#/components/schemas/SandboxProxyConfigV1" } ], - "default": null, - "description": "Optional display name for the group.", - "examples": [ - "Acme prod" - ], - "title": "Name" + "example": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + ] + } }, - "external_entity_id": { - "description": "External-system identifier for this group. Unique within the caller's org.", - "examples": [ - "cust_42" - ], - "maxLength": 255, - "minLength": 1, - "title": "External Entity Id", - "type": "string" + "subnet": { + "type": "string", + "description": "Subnet name for the sandbox. Defaults to \"default\" at creation.", + "example": "default" } }, - "required": [ - "external_entity_id" - ], - "title": "GroupMetadataV1", - "type": "object" + "example": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + ] + }, + "subnet": "default" + } }, - "GroupV1": { + "SandboxProxyConfigV1": { + "type": "object", + "description": "Proxy configuration for routing sandbox HTTP traffic through the platform proxy with MITM inspection and per-destination header/body injection", "properties": { - "id": { - "description": "Internal Baseten ID for the group.", - "title": "Id", - "type": "string" - }, - "metadata": { - "$ref": "#/components/schemas/GroupMetadataV1", - "description": "Group identity + display metadata." - }, - "models": { + "allowed_domains": { + "type": "array", + "description": "List of allowed external domains (allowlist). When set, only these domains are reachable. Supports wildcards (e.g. *.storage.example.com).", "items": { - "$ref": "#/components/schemas/ModelConfigV1" + "type": "string", + "example": "api.openai.com" }, - "title": "Models", - "type": "array" + "example": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ] }, - "effective_models": { + "bypass": { + "type": "array", + "description": "Domains that bypass the proxy entirely via the NO_PROXY directive. Traffic to these destinations goes direct, not through the CONNECT tunnel. Supports wildcards. Note that localhost, private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), 169.254.169.254, .local and .internal are always bypassed by default.", "items": { - "$ref": "#/components/schemas/EffectiveModelConfigV1" + "type": "string", + "example": "registry.npmjs.org" }, - "title": "Effective Models", - "type": "array" + "example": [ + "registry.npmjs.org" + ] }, - "hierarchy": { - "$ref": "#/components/schemas/GroupHierarchyV1", - "description": "Parent linkage and limit enforcement mode. Parent is null for root groups." + "forbidden_domains": { + "type": "array", + "description": "List of forbidden external domains (denylist). When set, all domains except these are reachable. Supports wildcards (e.g. *.malware.com). If both allowed_domains and forbidden_domains are set, allowed_domains takes precedence.", + "items": { + "type": "string", + "example": "facebook.com" + }, + "example": [ + "facebook.com", + "*.facebook.com" + ] }, - "created_at": { - "description": "When this group was created.", - "format": "date-time", - "title": "Created At", - "type": "string" + "routing": { + "type": "array", + "description": "Per-destination routing rules with header/body injection and secrets. Use destinations [\"*\"] for global rules that apply to all destinations.", + "items": { + "$ref": "#/components/schemas/SandboxProxyTargetV1" + }, + "example": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + ] } }, - "required": [ - "id", - "metadata", - "hierarchy", - "created_at" - ], - "title": "GroupV1", - "type": "object" - }, - "LimitEnforcementV1": { - "enum": [ - "CASCADING", - "INDEPENDENT" - ], - "title": "LimitEnforcementV1", - "type": "string" + "example": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + ] + } }, - "ModelConfigV1": { + "SandboxProxyTargetV1": { + "type": "object", + "description": "Routing rule that injects headers and body fields into requests matching the given destinations. Use destinations [\"*\"] for a global rule that applies to all proxied traffic.", "properties": { - "slug": { - "description": "Shared endpoint slug.", - "title": "Slug", - "type": "string" + "body": { + "type": "object", + "description": "Body fields to inject into matching requests. Values may contain {{SECRET:name}} references resolved from this rule's secrets.", + "additionalProperties": { + "type": "string" + }, + "example": { + "user": "baseten-api-review-0916" + } }, - "rate_limits": { + "destinations": { + "type": "array", + "description": "Destination domains this rule applies to. Use [\"*\"] for a global rule that matches all destinations.", "items": { - "$ref": "#/components/schemas/RateLimitV1" + "type": "string", + "example": "api.openai.com" }, - "title": "Rate Limits", - "type": "array" + "example": [ + "api.openai.com" + ] }, - "usage_limits": { - "items": { - "$ref": "#/components/schemas/UsageLimitV1" + "headers": { + "type": "object", + "description": "Headers to inject into matching requests. Values may contain {{SECRET:name}} references resolved from this rule's secrets.", + "additionalProperties": { + "type": "string" }, - "title": "Usage Limits", - "type": "array" + "example": { + "Authorization": "Bearer {{SECRET:openai-key}}" + } + }, + "secrets": { + "type": "object", + "description": "Named secret values for this routing rule, referenced in headers/body via {{SECRET:name}}. Stored encrypted at rest. Write-only: never returned in API responses.", + "additionalProperties": { + "type": "string" + }, + "example": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + }, + "writeOnly": true + } + }, + "example": { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + }, + "SandboxEnvV1": { + "type": "object", + "description": "Environment variable with name and value", + "properties": { + "name": { + "type": "string", + "description": "Name of the environment variable", + "example": "NODE_ENV" + }, + "secret": { + "type": "boolean", + "description": "Whether the value is a secret", + "example": false + }, + "value": { + "type": "string", + "description": "Value of the environment variable", + "example": "production" + } + }, + "example": { + "name": "NODE_ENV", + "secret": false, + "value": "production" + } + }, + "SandboxPortsV1": { + "type": "array", + "description": "Set of ports for a resource", + "items": { + "$ref": "#/components/schemas/SandboxPortV1" + }, + "example": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ] + }, + "SandboxPortV1": { + "type": "object", + "description": "A port for a resource", + "properties": { + "name": { + "type": "string", + "description": "The name of the port", + "example": "http" + }, + "protocol": { + "type": "string", + "description": "The protocol of the port", + "enum": [ + "HTTP", + "TCP", + "UDP", + "TLS" + ], + "example": "HTTP" + }, + "target": { + "type": "integer", + "description": "The target port of the port", + "example": 3000, + "minimum": 1, + "maximum": 65535 } }, "required": [ - "slug" + "target" ], - "title": "ModelConfigV1", - "type": "object" + "example": { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } }, - "UsageLimitUnitV1": { - "enum": [ - "DAY" - ], - "title": "UsageLimitUnitV1", - "type": "string" + "SandboxMetadataLabelsV1": { + "type": "object", + "description": "Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.", + "additionalProperties": { + "type": "string" + }, + "example": { + "env": "development", + "project": "api-review", + "team": "engineering" + } }, - "UsageLimitV1": { + "SandboxConfigurationV1": { + "type": "object", + "description": "Writable sandbox configuration. Fields are serialized at the root of the request or resource.", "properties": { - "type": { - "$ref": "#/components/schemas/LimitTypeV1", - "description": "The type of the usage limit", - "examples": [ - "REQUEST", - "TOKEN" + "enabled": { + "type": "boolean", + "description": "When false, the sandbox is disabled and will not accept connections", + "example": true, + "default": true + }, + "lifecycle": { + "description": "Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxLifecycleV1" + } + ], + "example": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + } + }, + "network": { + "description": "Network configuration for a sandbox including subnet, domain filtering, and proxy settings", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxNetworkV1" + } + ], + "example": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + ] + }, + "subnet": "default" + } + }, + "region": { + "type": "string", + "description": "Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.", + "example": "us-pdx-1" + }, + "envs": { + "type": "array", + "description": "Environment variables injected into the sandbox.", + "items": { + "$ref": "#/components/schemas/SandboxEnvV1" + }, + "example": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } ] }, - "unit": { - "$ref": "#/components/schemas/UsageLimitUnitV1", - "description": "The unit of the usage limit", - "examples": [ - "DAY" + "image": { + "type": "string", + "description": "Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.", + "example": "blaxel/base-image:latest" + }, + "memory": { + "type": "integer", + "description": "Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).", + "example": 4096, + "minimum": 1 + }, + "ports": { + "description": "Set of ports for a resource", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxPortsV1" + } + ], + "example": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } ] }, - "threshold": { - "description": "The threshold for the usage limit", - "examples": [ - 10000000 + "display_name": { + "type": "string", + "description": "Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.", + "example": "Baseten API review", + "maxLength": 63 + }, + "external_id": { + "type": "string", + "description": "Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.", + "example": "api-review-20260916-001", + "maxLength": 64, + "pattern": "^[A-Za-z0-9-]+$" + }, + "labels": { + "description": "Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxMetadataLabelsV1" + } ], - "minimum": 0, - "title": "Threshold", - "type": "integer" + "example": { + "env": "development", + "project": "api-review", + "team": "engineering" + } } }, - "required": [ - "type", - "unit", - "threshold" - ], - "title": "UsageLimitV1", - "type": "object" - }, - "GroupsResponseV1": { - "properties": { - "items": { - "description": "Items in this page.", - "items": { - "$ref": "#/components/schemas/GroupV1" - }, - "title": "Items", - "type": "array" + "example": { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" }, - "pagination": { - "$ref": "#/components/schemas/PaginationResponseV1", - "description": "Pagination metadata for the page." + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" } - }, - "required": [ - "items", - "pagination" - ], - "title": "GroupsResponseV1", - "type": "object" + } }, - "CreateGroupHierarchyV1": { + "CreateSandboxRequestV1": { + "type": "object", + "description": "Configuration for a new sandbox. The client may provide a name; otherwise the server generates one. The name is immutable after creation.", "properties": { - "limit_enforcement": { - "anyOf": [ + "name": { + "type": "string", + "description": "Optional unique sandbox name. Generated by the server when omitted; immutable after creation.", + "minLength": 1, + "example": "baseten-api-review-0916" + }, + "lifecycle": { + "description": "Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates", + "allOf": [ { - "$ref": "#/components/schemas/LimitEnforcementV1" - }, + "$ref": "#/components/schemas/SandboxLifecycleV1" + } + ], + "example": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + } + }, + "network": { + "description": "Network configuration for a sandbox including subnet, domain filtering, and proxy settings", + "allOf": [ { - "type": "null" + "$ref": "#/components/schemas/SandboxNetworkV1" } ], - "default": null, - "description": "Limit behavior. Child groups inherit their parent's behavior when omitted; root groups default to Independent for backwards compatibility.", - "examples": [ - "INDEPENDENT" - ] + "example": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + ] + }, + "subnet": "default" + } }, - "parent_group_id": { - "anyOf": [ + "region": { + "type": "string", + "description": "Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.", + "example": "us-pdx-1" + }, + "envs": { + "type": "array", + "description": "Environment variables injected into the sandbox.", + "items": { + "$ref": "#/components/schemas/SandboxEnvV1" + }, + "example": [ { - "type": "string" + "name": "NODE_ENV", + "secret": false, + "value": "production" }, { - "type": "null" + "name": "PORT", + "secret": false, + "value": "3000" + } + ] + }, + "image": { + "type": "string", + "description": "Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.", + "example": "blaxel/base-image:latest" + }, + "memory": { + "type": "integer", + "description": "Memory allocation in megabytes. Also determines CPU allocation (CPU cores = memory in MB / 2048, e.g., 4096MB = 2 CPUs).", + "example": 4096, + "minimum": 1 + }, + "ports": { + "description": "Set of ports for a resource", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxPortsV1" } ], - "default": null, - "examples": [ - "abc123" + "example": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ] + }, + "display_name": { + "type": "string", + "description": "Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.", + "example": "Baseten API review", + "maxLength": 63 + }, + "external_id": { + "type": "string", + "description": "Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.", + "example": "api-review-20260916-001", + "maxLength": 64, + "pattern": "^[A-Za-z0-9-]+$" + }, + "labels": { + "description": "Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxMetadataLabelsV1" + } ], - "title": "Parent Group Id" + "example": { + "env": "development", + "project": "api-review", + "team": "engineering" + } } }, - "title": "CreateGroupHierarchyV1", - "type": "object" - }, - "CreateGroupRequestV1": { - "properties": { - "metadata": { - "$ref": "#/components/schemas/GroupMetadataV1", - "description": "Group identity + display metadata." + "example": { + "name": "baseten-api-review-0916", + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" }, - "models": { - "description": "Per-model rate and usage limit configuration. Defines the group's complete model set. Must be non-empty.", - "examples": [ - [ + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ { - "slug": "my-org/claude" + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } } ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + } + } + }, + "UpdateSandboxRequestV1": { + "type": "object", + "description": "Partial sandbox update. Omitted fields remain unchanged. Supplied arrays and maps (including labels) replace their previous values; supplied structured objects update only their supplied fields. Null is not accepted. The name, memory, and network configuration are immutable after creation. Supplying memory or network returns 400, including unchanged, empty, or null values.", + "properties": { + "enabled": { + "type": "boolean", + "description": "When false, the sandbox is disabled and will not accept connections", + "example": true + }, + "lifecycle": { + "description": "Lifecycle configuration controlling automatic sandbox deletion based on idle time, max age, or specific dates", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxLifecycleV1" + } ], + "example": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + } + }, + "region": { + "type": "string", + "description": "Region where the sandbox runs (for example us-pdx-1 or eu-lon-1). When omitted at creation, the closest region is selected.", + "example": "us-pdx-1" + }, + "envs": { + "type": "array", + "description": "Environment variables injected into the sandbox.", "items": { - "$ref": "#/components/schemas/ModelConfigV1" + "$ref": "#/components/schemas/SandboxEnvV1" }, - "minItems": 1, - "title": "Models", - "type": "array" + "example": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ] }, - "hierarchy": { - "$ref": "#/components/schemas/CreateGroupHierarchyV1", - "description": "Parent linkage and limit enforcement mode. Immutable after creation." + "image": { + "type": "string", + "description": "Image reference including its tag. Use blaxel/base-image:latest to get started with the built-in sandbox execution API. This image is available directly without building, pushing, or listing images through GET /v1/sandboxes/images.", + "example": "blaxel/base-image:latest" + }, + "ports": { + "description": "Set of ports for a resource", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxPortsV1" + } + ], + "example": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ] + }, + "display_name": { + "type": "string", + "description": "Human-readable name for display in the UI. Can contain spaces and special characters, max 63 characters.", + "example": "Baseten API review - revised", + "maxLength": 63 + }, + "external_id": { + "type": "string", + "description": "Caller-owned identifier for external lookups. Max 64 chars, alphanumeric + dash.", + "example": "api-review-20260916-001", + "maxLength": 64, + "pattern": "^[A-Za-z0-9-]+$" + }, + "labels": { + "description": "Key-value pairs for organizing and filtering resources. Labels can be used to categorize resources by environment, project, team, or any custom taxonomy.", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxMetadataLabelsV1" + } + ], + "example": { + "env": "development", + "project": "api-review", + "team": "engineering", + "revision": "2" + } } }, - "required": [ - "metadata", - "models", - "hierarchy" - ], - "title": "CreateGroupRequestV1", - "type": "object" + "minProperties": 1, + "example": { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review - revised", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering", + "revision": "2" + } + } }, - "UpdateGroupMetadataV1": { - "properties": { - "name": { - "anyOf": [ + "SandboxV1": { + "description": "Sandbox resource with configuration and server-managed fields at the root. No metadata, spec, or runtime wrapper.", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxConfigurationV1" + }, + { + "type": "object", + "description": "Server-managed sandbox fields.", + "properties": { + "name": { + "type": "string", + "description": "Immutable sandbox name, provided by the client or generated by the server, used in sandbox_name path parameters.", + "readOnly": true, + "example": "baseten-api-review-0916" + }, + "url": { + "type": "string", + "description": "Base URL of this sandbox's execution API. Use this exact returned URL; do not reconstruct its hostname. Authenticate requests with the same Authorization: Bearer header used to create the sandbox. No additional routing headers are required. Fetch GET {url}/swagger/doc.json with that header for the API reference served by this sandbox. For example, POST {url}/process with Content-Type: application/json and {\"command\":\"echo hello\",\"waitForCompletion\":true} executes a command and waits for its result. Execution API fields use camelCase, independently of this API's snake_case fields.", + "format": "uri", + "readOnly": true, + "example": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run" + }, + "status": { + "description": "Sandbox deployment status.", + "allOf": [ + { + "$ref": "#/components/schemas/SandboxStatusV1" + } + ], + "example": "DEPLOYED" + }, + "state": { + "type": "string", + "description": "Current execution state when available.", + "enum": [ + "RUNNING", + "STANDBY" + ], + "readOnly": true, + "example": "RUNNING" + }, + "created_at": { + "type": "string", + "description": "Time the sandbox was created.", + "format": "date-time", + "readOnly": true, + "example": "2026-09-16T21:26:58.545765901Z" + }, + "updated_at": { + "type": "string", + "description": "Time the sandbox was last updated.", + "format": "date-time", + "readOnly": true, + "example": "2026-09-16T21:31:13Z" + }, + "created_by": { + "type": "string", + "description": "User or service account that created the sandbox.", + "readOnly": true, + "example": "sandbox-automation" + }, + "updated_by": { + "type": "string", + "description": "User or service account that last updated the sandbox.", + "readOnly": true, + "example": "sandbox-automation" + }, + "last_used_at": { + "type": "string", + "description": "Time the sandbox was last used.", + "format": "date-time", + "readOnly": true, + "example": "2026-09-16T21:31:13Z" + }, + "expires_in": { + "type": "integer", + "description": "Seconds remaining before automatic deletion, when expiration is configured.", + "readOnly": true, + "minimum": 0, + "example": 86400 + } + }, + "required": [ + "name", + "status", + "created_at" + ], + "example": { + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DEPLOYED", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:31:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:31:13Z", + "expires_in": 86400 + } + } + ], + "example": { + "enabled": true, + "lifecycle": { + "expiration_policies": [ { - "maxLength": 255, - "type": "string" + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" }, { - "type": "null" + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" } ], - "default": null, - "description": "Optional display name for the group.", - "examples": [ - "Acme prod" - ], - "title": "Name" + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + }, + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DEPLOYED", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:31:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:31:13Z", + "expires_in": 86400 + } + }, + "SandboxStatusV1": { + "type": "string", + "description": "Sandbox deployment status.", + "enum": [ + "DEPLOYING", + "DEPLOYED", + "FAILED", + "DEACTIVATING", + "DEACTIVATED", + "DELETING", + "TERMINATED", + "ARCHIVING", + "ARCHIVED", + "UNARCHIVING", + "BUILDING", + "UPLOADING" + ], + "readOnly": true, + "example": "DEPLOYED" + }, + "SandboxApiPaginationV1": { + "type": "object", + "description": "Cursor pagination information. The cursor is present only when another page is available.", + "properties": { + "has_more": { + "type": "boolean", + "description": "Whether another page is available.", + "example": true + }, + "cursor": { + "type": "string", + "description": "Opaque cursor to pass to the next list request. Keep the same filters.", + "minLength": 1, + "example": "eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ" } }, - "title": "UpdateGroupMetadataV1", - "type": "object" + "required": [ + "has_more" + ], + "example": { + "has_more": true, + "cursor": "eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ" + } }, - "UpdateGroupRequestV1": { + "ListSandboxesResponseV1": { + "type": "object", + "description": "One page of sandboxes.", "properties": { - "metadata": { - "anyOf": [ - { - "$ref": "#/components/schemas/UpdateGroupMetadataV1" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Mutable group metadata.", - "examples": [ + "items": { + "type": "array", + "description": "Resources on this page.", + "items": { + "$ref": "#/components/schemas/SandboxV1" + }, + "example": [ { - "name": "Acme Prod" + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + }, + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DEPLOYED", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:31:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:31:13Z", + "expires_in": 86400 } ] }, - "models": { - "anyOf": [ - { - "items": { - "$ref": "#/components/schemas/ModelConfigV1" - }, - "type": "array" - }, + "pagination": { + "description": "Cursor pagination information. The cursor is present only when another page is available.", + "allOf": [ { - "type": "null" + "$ref": "#/components/schemas/SandboxApiPaginationV1" } ], - "default": null, - "description": "Per-model rate and usage limit configuration.", - "title": "Models" + "example": { + "has_more": true, + "cursor": "eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ" + } } }, - "title": "UpdateGroupRequestV1", - "type": "object" + "required": [ + "items", + "pagination" + ], + "example": { + "items": [ + { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + }, + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DEPLOYED", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:31:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:31:13Z", + "expires_in": 86400 + } + ], + "pagination": { + "has_more": true, + "cursor": "eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ" + } + } }, - "GatewayKeyInfoV1": { + "ListImagesResponseV1": { + "type": "object", + "description": "One page of image repository summaries. Fetch tags through the separate tag listing endpoint.", "properties": { - "prefix": { - "description": "The prefix of the Model API key.", - "title": "Prefix", - "type": "string" + "items": { + "type": "array", + "description": "Image repositories on this page.", + "items": { + "$ref": "#/components/schemas/ImageV1" + } }, - "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Optional display name.", - "title": "Name" + "pagination": { + "$ref": "#/components/schemas/SandboxApiPaginationV1" } }, "required": [ - "prefix" - ], - "title": "GatewayKeyInfoV1", - "type": "object" + "items", + "pagination" + ] }, - "KeysForGroupResponseV1": { + "ListImageTagsResponseV1": { + "type": "object", + "description": "One page of image tags.", "properties": { "items": { - "description": "Items in this page.", + "type": "array", "items": { - "$ref": "#/components/schemas/GatewayKeyInfoV1" - }, - "title": "Items", - "type": "array" + "$ref": "#/components/schemas/ImageTagV1" + } }, "pagination": { - "$ref": "#/components/schemas/PaginationResponseV1", - "description": "Pagination metadata for the page." + "$ref": "#/components/schemas/SandboxApiPaginationV1" } }, "required": [ "items", "pagination" + ] + }, + "ImageStatusV1": { + "type": "string", + "description": "Image processing status. Only BUILT images are ready to use.", + "enum": [ + "UPLOADING", + "BUILDING", + "BUILT", + "FAILED" ], - "title": "KeysForGroupResponseV1", - "type": "object" + "readOnly": true, + "example": "BUILT" }, - "CreateApiKeyForGroupRequestV1": { + "ImageTagV1": { + "type": "object", + "description": "A tag identifying a version of a sandbox image.", "properties": { "name": { - "anyOf": [ - { - "type": "string" - }, - { - "type": "null" - } - ], - "default": null, - "description": "Optional display name for the new key.", - "examples": [ - "prod-key-1" - ], - "title": "Name" + "type": "string", + "description": "Image tag name.", + "example": "latest" + }, + "created_at": { + "type": "string", + "description": "Time the tag was created.", + "format": "date-time", + "readOnly": true, + "example": "2026-09-16T21:20:00Z" + }, + "updated_at": { + "type": "string", + "description": "Time the tag was last updated.", + "format": "date-time", + "readOnly": true, + "example": "2026-09-16T21:25:00Z" + }, + "size": { + "type": "integer", + "description": "Image size in bytes.", + "format": "int64", + "minimum": 0, + "readOnly": true, + "example": 134217728 } }, - "title": "CreateApiKeyForGroupRequestV1", - "type": "object" + "required": [ + "name" + ], + "example": { + "name": "latest", + "created_at": "2026-09-16T21:20:00Z", + "updated_at": "2026-09-16T21:25:00Z", + "size": 134217728 + } }, - "CreateApiKeyForGroupResponseV1": { + "ImageV1": { + "type": "object", + "description": "Sandbox image repository. List and get operations return a summary without embedded tags.", "properties": { - "api_key": { - "description": "Plaintext key string, returned exactly once.", - "title": "Api Key", - "type": "string" + "name": { + "type": "string", + "description": "Stable repository name supplied when pushing the image.", + "example": "base-image" }, - "prefix": { - "description": "Key prefix (the part before the dot).", - "title": "Prefix", - "type": "string" + "display_name": { + "type": "string", + "description": "Human-readable image repository name.", + "example": "b10/base-image" }, - "name": { - "anyOf": [ + "status": { + "description": "Image processing status. Only BUILT images are ready to use.", + "allOf": [ { - "type": "string" + "$ref": "#/components/schemas/ImageStatusV1" + } + ], + "example": "BUILT" + }, + "created_at": { + "type": "string", + "description": "Time the image was created.", + "format": "date-time", + "readOnly": true, + "example": "2026-09-15T21:20:00Z" + }, + "updated_at": { + "type": "string", + "description": "Time the image was last updated.", + "format": "date-time", + "readOnly": true, + "example": "2026-09-16T21:25:00Z" + }, + "last_deployed_at": { + "type": "string", + "description": "Most recent deployment time across all tags, if deployed.", + "format": "date-time", + "readOnly": true, + "example": "2026-09-16T21:26:58.545765901Z" + }, + "size": { + "type": "integer", + "description": "Total repository size in bytes.", + "format": "int64", + "minimum": 0, + "readOnly": true, + "example": 260046848 + }, + "tag_count": { + "type": "integer", + "format": "int64", + "minimum": 0, + "readOnly": true, + "description": "Number of image versions in the repository.", + "example": 2 + }, + "tags": { + "type": "array", + "description": "Empty for list and get summary responses. Use GET /sandboxes/images/{image_name}/tags to retrieve paginated image versions.", + "items": { + "$ref": "#/components/schemas/ImageTagV1" + }, + "example": [ + { + "name": "latest", + "created_at": "2026-09-16T21:20:00Z", + "updated_at": "2026-09-16T21:25:00Z", + "size": 134217728 }, { - "type": "null" + "name": "20260915212000", + "created_at": "2026-09-15T21:20:00Z", + "updated_at": "2026-09-15T21:25:00Z", + "size": 125829120 } - ], - "default": null, - "description": "Display name of the key.", - "title": "Name" + ] } }, "required": [ - "api_key", - "prefix" - ], - "title": "CreateApiKeyForGroupResponseV1", - "type": "object" + "name", + "status", + "tags" + ], + "example": { + "name": "base-image", + "display_name": "b10/base-image", + "status": "BUILT", + "created_at": "2026-09-15T21:20:00Z", + "updated_at": "2026-09-16T21:25:00Z", + "last_deployed_at": "2026-09-16T21:26:58.545765901Z", + "size": 260046848, + "tags": [ + { + "name": "latest", + "created_at": "2026-09-16T21:20:00Z", + "updated_at": "2026-09-16T21:25:00Z", + "size": 134217728 + }, + { + "name": "20260915212000", + "created_at": "2026-09-15T21:20:00Z", + "updated_at": "2026-09-15T21:25:00Z", + "size": 125829120 + } + ] + } }, - "RegisterAPIKeyRequestV1": { - "description": "Request to register a caller-supplied API key against an existing FederatedGroup.", + "PushImageRequestV1": { + "type": "object", + "description": "Push a sandbox image from a source archive or an existing registry image.", "properties": { "name": { - "anyOf": [ - { - "type": "string" - }, + "type": "string", + "description": "Target image repository name. Reusing a name pushes a new version to the existing repository.", + "minLength": 1, + "example": "base-image" + }, + "image": { + "type": "string", + "description": "Optional source registry image reference including a registry hostname. When omitted, the response provides an archive upload URL.", + "example": "docker.io/b10/base-image:latest" + }, + "docker_config": { + "type": "string", + "description": "Optional serialized registry authentication configuration for importing a private image. Used only when image is supplied; never returned.", + "writeOnly": true, + "example": "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu\"}}}" + } + }, + "required": [ + "name" + ], + "example": { + "name": "base-image", + "image": "docker.io/b10/base-image:latest", + "docker_config": "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu\"}}}" + } + }, + "PushImageResponseV1": { + "type": "object", + "description": "Accepted image push. Acceptance does not imply readiness; poll GET /sandboxes/images/{image_name} until status is BUILT or FAILED.", + "properties": { + "name": { + "type": "string", + "description": "Target image repository name.", + "example": "base-image" + }, + "status": { + "description": "Image processing status. Only BUILT images are ready to use.", + "allOf": [ { - "type": "null" + "$ref": "#/components/schemas/ImageStatusV1" } ], - "default": null, - "description": "Optional name for the Model API key", - "examples": [ - "my-model-api-key" - ], - "title": "Name" + "example": "BUILDING" }, - "key": { - "description": "Value of the API key to register", - "examples": [ - "my-secure-api-key-value" - ], - "title": "Key", - "type": "string" + "upload_url": { + "type": "string", + "description": "Temporary signed URL for uploading the source ZIP archive with HTTP PUT. Present only when no source image was supplied. Uploading starts asynchronous processing. This storage upload is separate from the API endpoints.", + "format": "uri", + "example": "https://uploads.b10.run/images/base-image/20260916212658/source.zip?expires=2026-09-16T22%3A26%3A58Z&signature=demo-not-a-valid-upload-signature" + }, + "image": { + "type": "string", + "description": "Registered image reference including its tag, when available. Tags are assigned by the service; GET /sandboxes/images/{image_name} returns the available tags once processing completes.", + "example": "b10/base-image:latest" } }, "required": [ - "key" + "name", + "status" ], - "title": "RegisterAPIKeyRequestV1", - "type": "object" + "example": { + "name": "base-image", + "status": "BUILDING", + "image": "b10/base-image:latest" + } }, - "RegisterAPIKeyResponseV1": { + "CleanupImagesResponseV1": { + "type": "object", + "description": "Result of cleaning up unused sandbox images.", "properties": { - "ok": { - "description": "Whether the registration was successful", - "title": "Ok", - "type": "boolean" + "deleted": { + "type": "integer", + "description": "Number of image versions removed.", + "minimum": 0, + "example": 3 + }, + "message": { + "type": "string", + "description": "Human-readable cleanup result.", + "example": "Removed 3 unused image versions. Image versions used by active sandboxes were retained." } }, "required": [ - "ok" + "deleted", + "message" ], - "title": "RegisterAPIKeyResponseV1", - "type": "object" + "example": { + "deleted": 3, + "message": "Removed 3 unused image versions. Image versions used by active sandboxes were retained." + } } }, "parameters": { @@ -33903,6 +36631,82 @@ "name": "group_id", "in": "path", "required": true + }, + "TeamId": { + "name": "team_id", + "in": "query", + "required": false, + "description": "Optional team ID. Must match X-Team-Id when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + "schema": { + "type": "string", + "minLength": 1 + } + }, + "TeamIdHeader": { + "name": "X-Team-Id", + "in": "header", + "required": false, + "description": "Optional team ID. Must match the team_id query parameter when both are supplied. If neither selector is supplied, defaults to the caller's only accessible team. Callers with multiple accessible teams must select a team. Requests without access to any team are forbidden.", + "schema": { + "type": "string", + "minLength": 1 + } + }, + "SandboxName": { + "name": "sandbox_name", + "in": "path", + "required": true, + "description": "Immutable sandbox name returned by creation.", + "schema": { + "type": "string", + "minLength": 1, + "example": "baseten-api-review-0916" + } + }, + "ImageName": { + "name": "image_name", + "in": "path", + "required": true, + "description": "Image repository name.", + "schema": { + "type": "string", + "minLength": 1, + "example": "base-image" + } + }, + "TagName": { + "name": "tag_name", + "in": "path", + "required": true, + "description": "Image tag name.", + "schema": { + "type": "string", + "minLength": 1, + "example": "20260915212000" + } + }, + "Cursor": { + "name": "cursor", + "in": "query", + "required": false, + "description": "Opaque cursor from the previous page; omit for the first page.", + "schema": { + "type": "string", + "example": "eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ" + } + }, + "Limit": { + "name": "limit", + "in": "query", + "required": false, + "description": "Maximum number of items to return.", + "schema": { + "type": "integer", + "minimum": 1, + "maximum": 100, + "default": 20, + "example": 20 + } } }, "securitySchemes": { @@ -33911,6 +36715,881 @@ "scheme": "bearer", "description": "Send `Authorization: Bearer `. The legacy `Authorization: Api-Key ` scheme is also accepted." } + }, + "responses": { + "SandboxError400": { + "description": "Invalid request. Returns a JSON error with code, message, and optional details.", + "content": { + "application/json": { + "example": { + "code": "INVALID_REQUEST", + "message": "One or more request parameters are invalid.", + "details": { + "request_id": "a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043" + } + } + } + } + }, + "SandboxError401": { + "description": "Missing or invalid authentication. Returns a JSON error with code, message, and optional details.", + "content": { + "application/json": { + "example": { + "code": "UNAUTHORIZED", + "message": "Provide a valid API key in the Authorization header.", + "details": { + "header": "Authorization" + } + } + } + } + }, + "SandboxError403": { + "description": "Insufficient permissions. Returns a JSON error with code, message, and optional details.", + "content": { + "application/json": { + "example": { + "code": "FORBIDDEN", + "message": "This API key does not have permission to perform this operation.", + "details": { + "request_id": "a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043" + } + } + } + } + }, + "SandboxError404": { + "description": "Resource not found. Returns a JSON error with code, message, and optional details.", + "content": { + "application/json": { + "example": { + "code": "NOT_FOUND", + "message": "The requested resource was not found.", + "details": { + "request_id": "a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043" + } + } + } + } + }, + "SandboxError409": { + "description": "Resource is currently in use or conflicts with the requested operation. Returns a JSON error with code, message, and optional details.", + "content": { + "application/json": { + "example": { + "code": "RESOURCE_IN_USE", + "message": "The resource is currently in use or conflicts with the requested operation.", + "details": { + "request_id": "a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043" + } + } + } + } + }, + "SandboxError429": { + "description": "Request limit exceeded. Returns a JSON error with code, message, and optional details.", + "content": { + "application/json": { + "example": { + "code": "RATE_LIMITED", + "message": "Too many requests. Try again in 30 seconds.", + "details": { + "retry_after_seconds": 30 + } + } + } + } + }, + "SandboxError500": { + "description": "Internal server error. Returns a JSON error with code, message, and optional details.", + "content": { + "application/json": { + "example": { + "code": "INTERNAL_ERROR", + "message": "The request could not be completed. Try again later.", + "details": { + "request_id": "a3b7c4d2-91e6-4f08-9b5a-2c6d7e8f1043" + } + } + } + } + } + }, + "examples": { + "CreateSandboxQuickstart": { + "summary": "Run code with the built-in image", + "description": "Create directly with the built-in image; no image discovery, build, or push is needed. Use the returned url to call the sandbox execution API with the same Bearer API key.", + "value": { + "image": "blaxel/base-image:latest", + "memory": 2048 + } + }, + "CreateSandbox": { + "summary": "Create with every supported field", + "value": { + "name": "baseten-api-review-0916", + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + }, + "secrets": { + "openai-key": "sk-proj-demo-not-a-valid-api-key" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + } + }, + "description": "All supported request fields are shown. Credential values are nonfunctional demonstration values." + }, + "UpdateSandbox": { + "summary": "Update every mutable field", + "value": { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review - revised", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering", + "revision": "2" + } + }, + "description": "All mutable request fields are shown. Memory and network configuration are only accepted during creation." + }, + "SandboxReady": { + "summary": "Running sandbox with complete configuration", + "value": { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + }, + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DEPLOYED", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:31:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:31:13Z", + "expires_in": 86400 + }, + "description": "Example sandbox URL in the b10.run domain. Write-only proxy secrets are not returned. Other values illustrate a fully configured sandbox." + }, + "SandboxUpdated": { + "summary": "Updated sandbox with complete configuration", + "value": { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review - revised", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering", + "revision": "2" + }, + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DEPLOYED", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:36:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:36:13Z", + "expires_in": 86400 + } + }, + "SandboxDeleting": { + "summary": "Sandbox deletion accepted", + "value": { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + }, + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DELETING", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:41:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:31:13Z", + "expires_in": 85800 + } + }, + "SandboxesPage": { + "summary": "Sandbox page with another page available", + "value": { + "items": [ + { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + }, + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DEPLOYED", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:31:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:31:13Z", + "expires_in": 86400 + } + ], + "pagination": { + "has_more": true, + "cursor": "eyJ2IjoxLCJsYXN0X2tleSI6ImJhc2V0ZW4tYXBpLXJldmlldy0wOTE2Iiwic29ydCI6ImRlc2MifQ" + } + }, + "description": "The cursor illustrates an opaque pagination token; it is not a reusable live cursor." + }, + "SandboxesLastPage": { + "summary": "Last sandbox page", + "value": { + "items": [ + { + "enabled": true, + "lifecycle": { + "expiration_policies": [ + { + "action": "DELETE", + "type": "TTL_IDLE", + "value": "24h" + }, + { + "action": "DELETE", + "type": "TTL_MAX_AGE", + "value": "7d" + }, + { + "action": "DELETE", + "type": "DATE", + "value": "2026-09-23T21:26:58Z" + } + ], + "terminated_retention": "24h" + }, + "network": { + "proxy": { + "allowed_domains": [ + "api.openai.com", + "pypi.org", + "files.pythonhosted.org", + "registry.npmjs.org" + ], + "bypass": [ + "registry.npmjs.org" + ], + "forbidden_domains": [ + "facebook.com", + "*.facebook.com" + ], + "routing": [ + { + "destinations": [ + "api.openai.com" + ], + "headers": { + "Authorization": "Bearer {{SECRET:openai-key}}" + }, + "body": { + "user": "baseten-api-review-0916" + } + } + ] + }, + "subnet": "default" + }, + "region": "us-pdx-1", + "envs": [ + { + "name": "NODE_ENV", + "secret": false, + "value": "production" + }, + { + "name": "PORT", + "secret": false, + "value": "3000" + } + ], + "image": "blaxel/base-image:latest", + "memory": 4096, + "ports": [ + { + "name": "http", + "protocol": "HTTP", + "target": 3000 + } + ], + "display_name": "Baseten API review", + "external_id": "api-review-20260916-001", + "labels": { + "env": "development", + "project": "api-review", + "team": "engineering" + }, + "name": "baseten-api-review-0916", + "url": "https://sbx-baseten-api-review-0916-esb1qo.us-pdx-1.b10.run", + "status": "DEPLOYED", + "state": "RUNNING", + "created_at": "2026-09-16T21:26:58.545765901Z", + "updated_at": "2026-09-16T21:31:13Z", + "created_by": "sandbox-automation", + "updated_by": "sandbox-automation", + "last_used_at": "2026-09-16T21:31:13Z", + "expires_in": 86400 + } + ], + "pagination": { + "has_more": false + } + } + }, + "ImageReady": { + "summary": "Built image with all metadata and tags", + "value": { + "name": "base-image", + "display_name": "b10/base-image", + "status": "BUILT", + "created_at": "2026-09-15T21:20:00Z", + "updated_at": "2026-09-16T21:25:00Z", + "last_deployed_at": "2026-09-16T21:26:58.545765901Z", + "size": 260046848, + "tags": [ + { + "name": "latest", + "created_at": "2026-09-16T21:20:00Z", + "updated_at": "2026-09-16T21:25:00Z", + "size": 134217728 + }, + { + "name": "20260915212000", + "created_at": "2026-09-15T21:20:00Z", + "updated_at": "2026-09-15T21:25:00Z", + "size": 125829120 + } + ] + }, + "description": "Dates and byte sizes are representative example data. Image references use the b10 namespace." + }, + "ImageAfterTagDeletion": { + "summary": "Image after deleting its older tag", + "value": { + "name": "base-image", + "display_name": "b10/base-image", + "status": "BUILT", + "created_at": "2026-09-15T21:20:00Z", + "updated_at": "2026-09-16T21:41:13Z", + "last_deployed_at": "2026-09-16T21:26:58.545765901Z", + "size": 134217728, + "tags": [ + { + "name": "latest", + "created_at": "2026-09-16T21:20:00Z", + "updated_at": "2026-09-16T21:25:00Z", + "size": 134217728 + } + ] + } + }, + "ImageSummary": { + "summary": "Image repository summary", + "value": { + "name": "base-image", + "display_name": "b10/base-image", + "status": "BUILT", + "created_at": "2026-09-15T21:20:00Z", + "size": 260046848, + "tag_count": 2, + "tags": [] + } + }, + "ImagesList": { + "summary": "One page of image repositories", + "value": { + "items": [ + { + "name": "base-image", + "display_name": "b10/base-image", + "status": "BUILT", + "created_at": "2026-09-15T21:20:00Z", + "updated_at": "2026-09-16T21:25:00Z", + "last_deployed_at": "2026-09-16T21:26:58.545765901Z", + "size": 260046848, + "tag_count": 2, + "tags": [] + } + ], + "pagination": { + "has_more": false + } + } + }, + "PushArchive": { + "summary": "Build an image from an uploaded source archive", + "value": { + "name": "base-image" + }, + "description": "Omit image and docker_config to request an upload URL. Those fields do not apply to source-archive uploads." + }, + "PushRegistry": { + "summary": "Import an image with registry authentication", + "value": { + "name": "base-image", + "image": "docker.io/b10/base-image:latest", + "docker_config": "{\"auths\":{\"https://index.docker.io/v1/\":{\"auth\":\"YjEwLXJldmlldzpkZW1vLW5vdC1hLXZhbGlkLXJlZ2lzdHJ5LXRva2Vu\"}}}" + }, + "description": "Shows every request field. docker_config is serialized registry configuration with a deliberately invalid demonstration credential." + }, + "PushArchiveAccepted": { + "summary": "Source upload required", + "value": { + "name": "base-image", + "status": "UPLOADING", + "upload_url": "https://uploads.b10.run/images/base-image/20260916212658/source.zip?expires=2026-09-16T22%3A26%3A58Z&signature=demo-not-a-valid-upload-signature" + }, + "description": "The signed upload URL is illustrative, with a nonfunctional signature. image is unavailable until processing produces a registered image reference." + }, + "PushRegistryAccepted": { + "summary": "Image import accepted", + "value": { + "name": "base-image", + "status": "BUILDING", + "image": "b10/base-image:latest" + }, + "description": "No upload_url is returned for registry imports." + }, + "CleanupImages": { + "summary": "Unused image versions removed", + "value": { + "deleted": 3, + "message": "Removed 3 unused image versions. Image versions used by active sandboxes were retained." + } + } } } } \ No newline at end of file