diff --git a/api/openapi.ts b/api/openapi.ts index a6a8a5a..7bd7aa7 100644 --- a/api/openapi.ts +++ b/api/openapi.ts @@ -123,6 +123,35 @@ export interface paths { */ get: operations["containerRegistries-testConnection"]; }; + "/custom-templates": { + /** + * List templates + * @description Fetches a list of templates. + */ + get: operations["customTemplates-list"]; + /** + * Create template + * @description Create a template for a machine. + */ + post: operations["customTemplates-create"]; + }; + "/custom-templates/{id}": { + /** + * Get a template + * @description Fetches a single template by ID. + */ + get: operations["customTemplates-get"]; + /** + * Update a template + * @description Updates a single template by ID. + */ + put: operations["customTemplates-update"]; + /** + * Delete template + * @description Delete a template. + */ + delete: operations["customTemplates-delete"]; + }; "/datasets": { /** * List datasets @@ -378,6 +407,13 @@ export interface paths { */ get: operations["notebooks-get"]; }; + "/os-templates": { + /** + * List OS templates + * @description Fetches a list of OS templates. + */ + get: operations["osTemplates-list"]; + }; "/private-networks": { /** * List private networks @@ -779,35 +815,6 @@ export interface paths { */ delete: operations["teamMemberships-removeUser"]; }; - "/templates": { - /** - * List templates - * @description Fetches a list of templates. - */ - get: operations["templates-list"]; - /** - * Create template - * @description Create a template for a machine. - */ - post: operations["templates-create"]; - }; - "/templates/{id}": { - /** - * Get a template - * @description Fetches a single template by ID. - */ - get: operations["templates-get"]; - /** - * Update a template - * @description Updates a single template by ID. - */ - put: operations["templates-update"]; - /** - * Delete template - * @description Delete a template. - */ - delete: operations["templates-delete"]; - }; "/workflows": { /** List all workflows */ get: operations["workflows-list"]; @@ -859,9 +866,7 @@ export interface components { content: { readonly "application/json": { readonly code: string; - readonly issues?: readonly ({ - readonly message: string; - })[]; + readonly details?: Record; readonly message: string; }; }; @@ -4586,10 +4591,10 @@ export interface operations { }; }; /** - * List datasets - * @description List datasets + * List templates + * @description Fetches a list of templates. */ - "datasets-list": { + "customTemplates-list": { parameters: { readonly query: { /** @description Fetch the next page of results after this cursor. */ @@ -4597,11 +4602,11 @@ export interface operations { /** @description The number of items to fetch after this page. */ limit?: number; /** @description Order results by one of these fields. */ - orderBy?: "dtCreated"; + orderBy?: "dtCreated" | "name"; /** @description The order to sort the results by. */ order?: "asc" | "desc"; - teamId?: string; - privacy?: Record | ("PUBLIC" | "PRIVATE"); + name?: string; + machineId?: string; }; }; responses: { @@ -4613,28 +4618,34 @@ export interface operations { readonly hasMore: boolean; /** @description The items on this page. */ readonly items: readonly ({ - /** @description The description of the dataset */ - readonly description: string | null; + /** @description The type of agent installed on the template. */ + readonly agentType: string; + /** @description The machine types the template is available on. */ + readonly availableMachineTypes: readonly ({ + /** @description Whether the template is available on this machine type. */ + readonly isAvailable: boolean; + /** @description The label of the machine type. */ + readonly machineTypeLabel: string; + })[]; + /** @description The default size of the template in gigabytes. */ + readonly defaultSizeGb: number; /** * Format: date-time - * @description The date the dataset was created + * @description The date the template was created. */ readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the dataset was last modified - */ - readonly dtModified: Date; - /** @description The ID of the dataset */ + /** @description The date the shared drive was deleted. */ + readonly dtDeleted?: (Record | Date) | null; + /** @description The ID of the template. */ readonly id: string; - /** @description Whether the dataset is public */ - readonly isPublic: boolean; - /** @description The name of the dataset */ - readonly name: string | null; - /** @description The ID of the storage provider */ - readonly storageProviderId: string | null; - /** @description The ID of the team that owns the dataset */ - readonly teamId: string; + /** @description The name of the template. */ + readonly name: string; + /** @description The operating system installed on the template. */ + readonly operatingSystemLabel: string; + /** @description The ID of the parent machine. */ + readonly parentMachineId: string; + /** @description The region the template is in. */ + readonly region: string; })[]; /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ readonly nextPage?: string; @@ -4645,21 +4656,17 @@ export interface operations { }; }; /** - * Create a dataset - * @description Create a dataset + * Create template + * @description Create a template for a machine. */ - "datasets-create": { + "customTemplates-create": { readonly requestBody: { readonly content: { readonly "application/json": { - /** @description The description of the dataset */ - readonly description?: (Record | string) | null; - /** @description Whether the dataset is public */ - readonly isPublic: boolean; - /** @description The name of the dataset */ + /** @description The ID of the machine to create a template from. */ + readonly machineId: string; + /** @description The name of the template. */ readonly name: string; - /** @description The ID of the storage provider */ - readonly storageProviderId?: string; }; }; }; @@ -4668,28 +4675,93 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description The description of the dataset */ - readonly description: string | null; - /** - * Format: date-time - * @description The date the dataset was created - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the dataset was last modified - */ - readonly dtModified: Date; - /** @description The ID of the dataset */ - readonly id: string; - /** @description Whether the dataset is public */ - readonly isPublic: boolean; - /** @description The name of the dataset */ - readonly name: string | null; - /** @description The ID of the storage provider */ - readonly storageProviderId: string | null; - /** @description The ID of the team that owns the dataset */ - readonly teamId: string; + /** @description The template. */ + readonly data: { + /** @description The type of agent installed on the template. */ + readonly agentType: string; + /** @description The machine types the template is available on. */ + readonly availableMachineTypes: readonly ({ + /** @description Whether the template is available on this machine type. */ + readonly isAvailable: boolean; + /** @description The label of the machine type. */ + readonly machineTypeLabel: string; + })[]; + /** @description The default size of the template in gigabytes. */ + readonly defaultSizeGb: number; + /** + * Format: date-time + * @description The date the template was created. + */ + readonly dtCreated: Date; + /** @description The date the shared drive was deleted. */ + readonly dtDeleted?: (Record | Date) | null; + /** @description The ID of the template. */ + readonly id: string; + /** @description The name of the template. */ + readonly name: string; + /** @description The operating system installed on the template. */ + readonly operatingSystemLabel: string; + /** @description The ID of the parent machine. */ + readonly parentMachineId: string; + /** @description The region the template is in. */ + readonly region: string; + }; + /** @description The machine event to poll for the async operation. */ + readonly event: { + /** + * Format: date-time + * @description The date the event was created. + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the event was finished. + */ + readonly dtFinished: Date; + /** + * Format: date-time + * @description The date the event was started. + */ + readonly dtStarted: Date; + /** @description The error message of the event, if any. */ + readonly error: string | null; + /** @description The ID of the event. */ + readonly id: string; + /** @description The ID of the machine the event is for. */ + readonly machineId: string | null; + /** + * @description The name of the event, e.g. "create". + * @enum {string} + */ + readonly name: + | "bill-sessions" + | "bill-upgrade" + | "create" + | "deactivate" + | "restart" + | "snapshot-create" + | "snapshot-delete" + | "snapshot-restore" + | "start" + | "stop" + | "template-create" + | "template-delete" + | "template-distribute" + | "template-import" + | "vm-migrate" + | "vm-shutdown-force" + | "vm-upgrade"; + /** + * @description The state of the event, e.g. "done". + * @enum {string} + */ + readonly state: + | "new" + | "in progress" + | "done" + | "error" + | "cancelled"; + }; }; }; }; @@ -4697,25 +4769,14 @@ export interface operations { }; }; /** - * List dataset versions - * @description List dataset versions + * Get a template + * @description Fetches a single template by ID. */ - "datasetVersions-list": { + "customTemplates-get": { parameters: { - readonly query: { - /** @description Fetch the next page of results after this cursor. */ - after?: string; - /** @description The number of items to fetch after this page. */ - limit?: number; - /** @description Order results by one of these fields. */ - orderBy?: "dtCreated"; - /** @description The order to sort the results by. */ - order?: "asc" | "desc"; - tags?: string; - }; readonly path: { - /** @description The ID of the dataset */ - datasetId: string; + /** @description The ID of the template to fetch. */ + id: string; }; }; responses: { @@ -4723,21 +4784,301 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description Whether there are more pages of results available. */ - readonly hasMore: boolean; - /** @description The items on this page. */ - readonly items: readonly ({ - /** @description The ID of the dataset */ - readonly datasetId: string; - /** - * Format: date-time - * @description The date the version was created - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the version was last modified - */ + /** @description The type of agent installed on the template. */ + readonly agentType: string; + /** @description The machine types the template is available on. */ + readonly availableMachineTypes: readonly ({ + /** @description Whether the template is available on this machine type. */ + readonly isAvailable: boolean; + /** @description The label of the machine type. */ + readonly machineTypeLabel: string; + })[]; + /** @description The default size of the template in gigabytes. */ + readonly defaultSizeGb: number; + /** + * Format: date-time + * @description The date the template was created. + */ + readonly dtCreated: Date; + /** @description The date the shared drive was deleted. */ + readonly dtDeleted?: (Record | Date) | null; + /** @description The ID of the template. */ + readonly id: string; + /** @description The name of the template. */ + readonly name: string; + /** @description The operating system installed on the template. */ + readonly operatingSystemLabel: string; + /** @description The ID of the parent machine. */ + readonly parentMachineId: string; + /** @description The region the template is in. */ + readonly region: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; + /** + * Update a template + * @description Updates a single template by ID. + */ + "customTemplates-update": { + parameters: { + readonly path: { + /** @description The ID of the template to update. */ + id: string; + }; + }; + readonly requestBody: { + readonly content: { + readonly "application/json": { + /** @description The name of the template. */ + readonly name: string; + }; + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** @description The type of agent installed on the template. */ + readonly agentType: string; + /** @description The machine types the template is available on. */ + readonly availableMachineTypes: readonly ({ + /** @description Whether the template is available on this machine type. */ + readonly isAvailable: boolean; + /** @description The label of the machine type. */ + readonly machineTypeLabel: string; + })[]; + /** @description The default size of the template in gigabytes. */ + readonly defaultSizeGb: number; + /** + * Format: date-time + * @description The date the template was created. + */ + readonly dtCreated: Date; + /** @description The date the shared drive was deleted. */ + readonly dtDeleted?: (Record | Date) | null; + /** @description The ID of the template. */ + readonly id: string; + /** @description The name of the template. */ + readonly name: string; + /** @description The operating system installed on the template. */ + readonly operatingSystemLabel: string; + /** @description The ID of the parent machine. */ + readonly parentMachineId: string; + /** @description The region the template is in. */ + readonly region: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; + /** + * Delete template + * @description Delete a template. + */ + "customTemplates-delete": { + parameters: { + readonly path: { + /** @description The ID of the template to delete. */ + id: string; + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** @description The type of agent installed on the template. */ + readonly agentType: string; + /** @description The machine types the template is available on. */ + readonly availableMachineTypes: readonly ({ + /** @description Whether the template is available on this machine type. */ + readonly isAvailable: boolean; + /** @description The label of the machine type. */ + readonly machineTypeLabel: string; + })[]; + /** @description The default size of the template in gigabytes. */ + readonly defaultSizeGb: number; + /** + * Format: date-time + * @description The date the template was created. + */ + readonly dtCreated: Date; + /** @description The date the shared drive was deleted. */ + readonly dtDeleted?: (Record | Date) | null; + /** @description The ID of the template. */ + readonly id: string; + /** @description The name of the template. */ + readonly name: string; + /** @description The operating system installed on the template. */ + readonly operatingSystemLabel: string; + /** @description The ID of the parent machine. */ + readonly parentMachineId: string; + /** @description The region the template is in. */ + readonly region: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; + /** + * List datasets + * @description List datasets + */ + "datasets-list": { + parameters: { + readonly query: { + /** @description Fetch the next page of results after this cursor. */ + after?: string; + /** @description The number of items to fetch after this page. */ + limit?: number; + /** @description Order results by one of these fields. */ + orderBy?: "dtCreated"; + /** @description The order to sort the results by. */ + order?: "asc" | "desc"; + teamId?: string; + privacy?: Record | ("PUBLIC" | "PRIVATE"); + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** @description Whether there are more pages of results available. */ + readonly hasMore: boolean; + /** @description The items on this page. */ + readonly items: readonly ({ + /** @description The description of the dataset */ + readonly description: string | null; + /** + * Format: date-time + * @description The date the dataset was created + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the dataset was last modified + */ + readonly dtModified: Date; + /** @description The ID of the dataset */ + readonly id: string; + /** @description Whether the dataset is public */ + readonly isPublic: boolean; + /** @description The name of the dataset */ + readonly name: string | null; + /** @description The ID of the storage provider */ + readonly storageProviderId: string | null; + /** @description The ID of the team that owns the dataset */ + readonly teamId: string; + })[]; + /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ + readonly nextPage?: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; + /** + * Create a dataset + * @description Create a dataset + */ + "datasets-create": { + readonly requestBody: { + readonly content: { + readonly "application/json": { + /** @description The description of the dataset */ + readonly description?: (Record | string) | null; + /** @description Whether the dataset is public */ + readonly isPublic: boolean; + /** @description The name of the dataset */ + readonly name: string; + /** @description The ID of the storage provider */ + readonly storageProviderId?: string; + }; + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** @description The description of the dataset */ + readonly description: string | null; + /** + * Format: date-time + * @description The date the dataset was created + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the dataset was last modified + */ + readonly dtModified: Date; + /** @description The ID of the dataset */ + readonly id: string; + /** @description Whether the dataset is public */ + readonly isPublic: boolean; + /** @description The name of the dataset */ + readonly name: string | null; + /** @description The ID of the storage provider */ + readonly storageProviderId: string | null; + /** @description The ID of the team that owns the dataset */ + readonly teamId: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; + /** + * List dataset versions + * @description List dataset versions + */ + "datasetVersions-list": { + parameters: { + readonly query: { + /** @description Fetch the next page of results after this cursor. */ + after?: string; + /** @description The number of items to fetch after this page. */ + limit?: number; + /** @description Order results by one of these fields. */ + orderBy?: "dtCreated"; + /** @description The order to sort the results by. */ + order?: "asc" | "desc"; + tags?: string; + }; + readonly path: { + /** @description The ID of the dataset */ + datasetId: string; + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** @description Whether there are more pages of results available. */ + readonly hasMore: boolean; + /** @description The items on this page. */ + readonly items: readonly ({ + /** @description The ID of the dataset */ + readonly datasetId: string; + /** + * Format: date-time + * @description The date the version was created + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the version was last modified + */ readonly dtModified: Date; /** @description Whether the version is committed */ readonly isCommitted: boolean; @@ -8271,7 +8612,10 @@ export interface operations { readonly autoSnapshotSaveCount?: number; /** @description The disk size in gigabytes. */ readonly diskSize: number; - /** @description Whether to email the password. */ + /** + * @description Whether to email the password. + * @default true + */ readonly emailPassword?: boolean; /** @description Whether to enable NVLink. */ readonly enableNvlink?: boolean; @@ -10315,7 +10659,7 @@ export interface operations { readonly requestBody: { readonly content: { readonly "application/json": { - readonly clusterId: string; + readonly clusterId?: string; readonly command?: string; readonly container?: string; readonly isPublic: boolean; @@ -10517,6 +10861,64 @@ export interface operations { default: components["responses"]["error"]; }; }; + /** + * List OS templates + * @description Fetches a list of OS templates. + */ + "osTemplates-list": { + parameters: { + readonly query: { + /** @description Fetch the next page of results after this cursor. */ + after?: string; + /** @description The number of items to fetch after this page. */ + limit?: number; + /** @description Order results by one of these fields. */ + orderBy?: "name"; + /** @description The order to sort the results by. */ + order?: "asc" | "desc"; + name?: string; + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** @description Whether there are more pages of results available. */ + readonly hasMore: boolean; + /** @description The items on this page. */ + readonly items: readonly ({ + /** @description The type of agent installed on the template. */ + readonly agentType: string; + /** @description The machine types the template is available on. */ + readonly availableMachineTypes: readonly ({ + /** @description Whether the template is available on this machine type. */ + readonly isAvailable: boolean; + /** @description The label of the machine type. */ + readonly machineTypeLabel: string; + })[]; + /** @description The default size of the template in gigabytes. */ + readonly defaultSizeGb: number | null; + /** + * Format: date-time + * @description The date the template was created. + */ + readonly dtCreated: Date; + /** @description The ID of the template. */ + readonly id: string; + /** @description The name of the template. */ + readonly name: string; + /** @description The operating system installed on the template. */ + readonly operatingSystemLabel: string; + })[]; + /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ + readonly nextPage?: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; /** * List private networks * @description Fetches a list of private networks. @@ -14198,216 +14600,61 @@ export interface operations { }; }; }; - default: components["responses"]["error"]; - }; - }; - /** - * List startup scripts - * @description Fetches a list of startup scripts. - */ - "startupScripts-list": { - parameters: { - readonly query: { - /** @description Fetch the next page of results after this cursor. */ - after?: string; - /** @description The number of items to fetch after this page. */ - limit?: number; - /** @description Order results by one of these fields. */ - orderBy?: "dtCreated" | "name"; - /** @description The order to sort the results by. */ - order?: "asc" | "desc"; - name?: string; - }; - }; - responses: { - /** @description Successful response */ - 200: { - content: { - readonly "application/json": { - /** @description Whether there are more pages of results available. */ - readonly hasMore: boolean; - /** @description The items on this page. */ - readonly items: readonly ({ - /** @description The IDs of the machines the startup script is assigned to. */ - readonly assignedMachineIds: readonly (string)[]; - /** @description The description of the startup script. */ - readonly description: string | null; - /** - * Format: date-time - * @description The date the startup script was created. - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the startup script was deleted. - */ - readonly dtDeleted: Date; - /** @description The ID of the startup script. */ - readonly id: string; - /** @description Whether the startup script is enabled. */ - readonly isEnabled: boolean; - /** @description Whether the startup script is run once on first boot or on every boot. */ - readonly isRunOnce: boolean; - /** @description The name of the startup script. */ - readonly name: string; - })[]; - /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ - readonly nextPage?: string; - }; - }; - }; - default: components["responses"]["error"]; - }; - }; - /** - * Create startup script - * @description Create a startup script. - */ - "startupScripts-create": { - readonly requestBody: { - readonly content: { - readonly "application/json": { - /** - * @description Whether the script should only run once on first boot or on every boot. - * @default false - */ - readonly isRunOnce?: boolean; - /** @description The name of the startup script. */ - readonly name: string; - /** @description The script to run on startup. */ - readonly script: string; - }; - }; - }; - responses: { - /** @description Successful response */ - 200: { - content: { - readonly "application/json": { - /** @description The IDs of the machines the startup script is assigned to. */ - readonly assignedMachineIds: readonly (string)[]; - /** @description The description of the startup script. */ - readonly description: string | null; - /** - * Format: date-time - * @description The date the startup script was created. - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the startup script was deleted. - */ - readonly dtDeleted: Date; - /** @description The ID of the startup script. */ - readonly id: string; - /** @description Whether the startup script is enabled. */ - readonly isEnabled: boolean; - /** @description Whether the startup script is run once on first boot or on every boot. */ - readonly isRunOnce: boolean; - /** @description The name of the startup script. */ - readonly name: string; - }; - }; - }; - default: components["responses"]["error"]; - }; - }; - /** - * Get a startup script - * @description Fetches a single startup script by ID. - */ - "startupScripts-get": { - parameters: { - readonly path: { - /** @description The ID of the startup script to fetch. */ - id: string; - }; - }; - responses: { - /** @description Successful response */ - 200: { - content: { - readonly "application/json": { - /** @description The IDs of the machines the startup script is assigned to. */ - readonly assignedMachineIds: readonly (string)[]; - /** @description The description of the startup script. */ - readonly description: string | null; - /** - * Format: date-time - * @description The date the startup script was created. - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the startup script was deleted. - */ - readonly dtDeleted: Date; - /** @description The ID of the startup script. */ - readonly id: string; - /** @description Whether the startup script is enabled. */ - readonly isEnabled: boolean; - /** @description Whether the startup script is run once on first boot or on every boot. */ - readonly isRunOnce: boolean; - /** @description The name of the startup script. */ - readonly name: string; - }; - }; - }; - default: components["responses"]["error"]; - }; - }; - /** - * Update startup script - * @description Update a startup script. - */ - "startupScripts-update": { - parameters: { - readonly path: { - /** @description The id of the startup script. */ - id: string; - }; - }; - readonly requestBody: { - readonly content: { - readonly "application/json": { - /** @description Whether the startup script is enabled. */ - readonly isEnabled?: boolean; - /** @description Whether the script should only run once on first boot or on every boot. */ - readonly isRunOnce?: boolean; - /** @description The name of the startup script. */ - readonly name?: string; - /** @description The script to run on startup. */ - readonly script?: string; - }; - }; + default: components["responses"]["error"]; + }; + }; + /** + * List startup scripts + * @description Fetches a list of startup scripts. + */ + "startupScripts-list": { + parameters: { + readonly query: { + /** @description Fetch the next page of results after this cursor. */ + after?: string; + /** @description The number of items to fetch after this page. */ + limit?: number; + /** @description Order results by one of these fields. */ + orderBy?: "dtCreated" | "name"; + /** @description The order to sort the results by. */ + order?: "asc" | "desc"; + name?: string; + }; }; responses: { /** @description Successful response */ 200: { content: { readonly "application/json": { - /** @description The IDs of the machines the startup script is assigned to. */ - readonly assignedMachineIds: readonly (string)[]; - /** @description The description of the startup script. */ - readonly description: string | null; - /** - * Format: date-time - * @description The date the startup script was created. - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the startup script was deleted. - */ - readonly dtDeleted: Date; - /** @description The ID of the startup script. */ - readonly id: string; - /** @description Whether the startup script is enabled. */ - readonly isEnabled: boolean; - /** @description Whether the startup script is run once on first boot or on every boot. */ - readonly isRunOnce: boolean; - /** @description The name of the startup script. */ - readonly name: string; + /** @description Whether there are more pages of results available. */ + readonly hasMore: boolean; + /** @description The items on this page. */ + readonly items: readonly ({ + /** @description The IDs of the machines the startup script is assigned to. */ + readonly assignedMachineIds: readonly (string)[]; + /** @description The description of the startup script. */ + readonly description: string | null; + /** + * Format: date-time + * @description The date the startup script was created. + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the startup script was deleted. + */ + readonly dtDeleted: Date; + /** @description The ID of the startup script. */ + readonly id: string; + /** @description Whether the startup script is enabled. */ + readonly isEnabled: boolean; + /** @description Whether the startup script is run once on first boot or on every boot. */ + readonly isRunOnce: boolean; + /** @description The name of the startup script. */ + readonly name: string; + })[]; + /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ + readonly nextPage?: string; }; }; }; @@ -14415,14 +14662,23 @@ export interface operations { }; }; /** - * Delete startup script - * @description Delete a startup script. + * Create startup script + * @description Create a startup script. */ - "startupScripts-delete": { - parameters: { - readonly path: { - /** @description The id of the startup script. */ - id: string; + "startupScripts-create": { + readonly requestBody: { + readonly content: { + readonly "application/json": { + /** + * @description Whether the script should only run once on first boot or on every boot. + * @default false + */ + readonly isRunOnce?: boolean; + /** @description The name of the startup script. */ + readonly name: string; + /** @description The script to run on startup. */ + readonly script: string; + }; }; }; responses: { @@ -14459,24 +14715,16 @@ export interface operations { }; }; /** - * Assign startup script to machine - * @description Assign a startup script to a machine. + * Get a startup script + * @description Fetches a single startup script by ID. */ - "startupScripts-assign": { + "startupScripts-get": { parameters: { readonly path: { - /** @description The id of the startup script. */ + /** @description The ID of the startup script to fetch. */ id: string; }; }; - readonly requestBody: { - readonly content: { - readonly "application/json": { - /** @description The id of the machine to assign the startup script to. */ - readonly machineId: string; - }; - }; - }; responses: { /** @description Successful response */ 200: { @@ -14511,10 +14759,10 @@ export interface operations { }; }; /** - * Unassign startup script from machine - * @description Unassign a startup script from a machine. + * Update startup script + * @description Update a startup script. */ - "startupScripts-unassign": { + "startupScripts-update": { parameters: { readonly path: { /** @description The id of the startup script. */ @@ -14524,8 +14772,14 @@ export interface operations { readonly requestBody: { readonly content: { readonly "application/json": { - /** @description The id of the machine to unassign the startup script from. */ - readonly machineId: string; + /** @description Whether the startup script is enabled. */ + readonly isEnabled?: boolean; + /** @description Whether the script should only run once on first boot or on every boot. */ + readonly isRunOnce?: boolean; + /** @description The name of the startup script. */ + readonly name?: string; + /** @description The script to run on startup. */ + readonly script?: string; }; }; }; @@ -14563,140 +14817,13 @@ export interface operations { }; }; /** - * List storage providers - * @description List storage providers - */ - "storageProviders-list": { - parameters: { - readonly query: { - /** @description Fetch the next page of results after this cursor. */ - after?: string; - /** @description The number of items to fetch after this page. */ - limit?: number; - /** @description Order results by one of these fields. */ - orderBy?: "dtCreated"; - /** @description The order to sort the results by. */ - order?: "asc" | "desc"; - }; - }; - responses: { - /** @description Successful response */ - 200: { - content: { - readonly "application/json": { - /** @description Whether there are more pages of results available. */ - readonly hasMore: boolean; - /** @description The items on this page. */ - readonly items: readonly ({ - /** @description The ID of the storage provider */ - readonly id: string; - /** @description Whether the storage provider is managed by Paperspace */ - readonly isManaged: boolean; - /** @description Whether the storage provider is the team's default provider */ - readonly isTeamDefault: boolean | null; - /** @description The name of the storage provider */ - readonly name: string; - /** @description The storage provider configuration */ - readonly s3Config: { - readonly accessKey: string; - readonly bucket: string; - /** - * Format: uri - * @default null - */ - readonly endpoint?: string | null; - readonly region?: string | null; - /** @default false */ - readonly retainData?: boolean | null; - readonly secretAccessKey: string; - readonly signatureVersion?: string | null; - }; - })[]; - /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ - readonly nextPage?: string; - }; - }; - }; - default: components["responses"]["error"]; - }; - }; - /** - * Create a storage provider - * @description Create a storage provider - */ - "storageProviders-create": { - readonly requestBody: { - readonly content: { - readonly "application/json": { - /** @description Is team default */ - readonly isTeamDefault?: boolean; - /** @description The name of the storage provider */ - readonly name: string; - /** @description The storage provider configuration */ - readonly s3Config: { - readonly accessKey: string; - readonly bucket: string; - /** - * Format: uri - * @default null - */ - readonly endpoint?: string | null; - readonly region?: string | null; - /** @default false */ - readonly retainData?: boolean | null; - readonly secretAccessKey: string; - readonly signatureVersion?: string | null; - }; - /** - * @description The type of storage provider - * @enum {string} - */ - readonly storageProviderType: "s3"; - }; - }; - }; - responses: { - /** @description Successful response */ - 200: { - content: { - readonly "application/json": { - /** @description The ID of the storage provider */ - readonly id: string; - /** @description Whether the storage provider is managed by Paperspace */ - readonly isManaged: boolean; - /** @description Whether the storage provider is the team's default provider */ - readonly isTeamDefault: boolean | null; - /** @description The name of the storage provider */ - readonly name: string; - /** @description The storage provider configuration */ - readonly s3Config: { - readonly accessKey: string; - readonly bucket: string; - /** - * Format: uri - * @default null - */ - readonly endpoint?: string | null; - readonly region?: string | null; - /** @default false */ - readonly retainData?: boolean | null; - readonly secretAccessKey: string; - readonly signatureVersion?: string | null; - }; - }; - }; - }; - default: components["responses"]["error"]; - }; - }; - /** - * Get a storage provider - * @description Get a storage provider + * Delete startup script + * @description Delete a startup script. */ - "storageProviders-get": { + "startupScripts-delete": { parameters: { readonly path: { - /** @description The ID of the storage provider */ + /** @description The id of the startup script. */ id: string; }; }; @@ -14705,29 +14832,28 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description The ID of the storage provider */ + /** @description The IDs of the machines the startup script is assigned to. */ + readonly assignedMachineIds: readonly (string)[]; + /** @description The description of the startup script. */ + readonly description: string | null; + /** + * Format: date-time + * @description The date the startup script was created. + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the startup script was deleted. + */ + readonly dtDeleted: Date; + /** @description The ID of the startup script. */ readonly id: string; - /** @description Whether the storage provider is managed by Paperspace */ - readonly isManaged: boolean; - /** @description Whether the storage provider is the team's default provider */ - readonly isTeamDefault: boolean | null; - /** @description The name of the storage provider */ + /** @description Whether the startup script is enabled. */ + readonly isEnabled: boolean; + /** @description Whether the startup script is run once on first boot or on every boot. */ + readonly isRunOnce: boolean; + /** @description The name of the startup script. */ readonly name: string; - /** @description The storage provider configuration */ - readonly s3Config: { - readonly accessKey: string; - readonly bucket: string; - /** - * Format: uri - * @default null - */ - readonly endpoint?: string | null; - readonly region?: string | null; - /** @default false */ - readonly retainData?: boolean | null; - readonly secretAccessKey: string; - readonly signatureVersion?: string | null; - }; }; }; }; @@ -14735,38 +14861,21 @@ export interface operations { }; }; /** - * Update a storage provider - * @description Update a storage provider + * Assign startup script to machine + * @description Assign a startup script to a machine. */ - "storageProviders-update": { + "startupScripts-assign": { parameters: { readonly path: { - /** @description The ID of the storage provider */ + /** @description The id of the startup script. */ id: string; }; }; readonly requestBody: { readonly content: { readonly "application/json": { - /** @description Is team default */ - readonly isTeamDefault: boolean; - /** @description The name of the storage provider */ - readonly name: string; - /** @description The storage provider configuration */ - readonly s3Config: { - readonly accessKey: string; - readonly bucket: string; - /** - * Format: uri - * @default null - */ - readonly endpoint?: string | null; - readonly region?: string | null; - /** @default false */ - readonly retainData?: boolean | null; - readonly secretAccessKey: string; - readonly signatureVersion?: string | null; - }; + /** @description The id of the machine to assign the startup script to. */ + readonly machineId: string; }; }; }; @@ -14775,29 +14884,28 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description The ID of the storage provider */ + /** @description The IDs of the machines the startup script is assigned to. */ + readonly assignedMachineIds: readonly (string)[]; + /** @description The description of the startup script. */ + readonly description: string | null; + /** + * Format: date-time + * @description The date the startup script was created. + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the startup script was deleted. + */ + readonly dtDeleted: Date; + /** @description The ID of the startup script. */ readonly id: string; - /** @description Whether the storage provider is managed by Paperspace */ - readonly isManaged: boolean; - /** @description Whether the storage provider is the team's default provider */ - readonly isTeamDefault: boolean | null; - /** @description The name of the storage provider */ + /** @description Whether the startup script is enabled. */ + readonly isEnabled: boolean; + /** @description Whether the startup script is run once on first boot or on every boot. */ + readonly isRunOnce: boolean; + /** @description The name of the startup script. */ readonly name: string; - /** @description The storage provider configuration */ - readonly s3Config: { - readonly accessKey: string; - readonly bucket: string; - /** - * Format: uri - * @default null - */ - readonly endpoint?: string | null; - readonly region?: string | null; - /** @default false */ - readonly retainData?: boolean | null; - readonly secretAccessKey: string; - readonly signatureVersion?: string | null; - }; }; }; }; @@ -14805,53 +14913,51 @@ export interface operations { }; }; /** - * Delete a storage provider - * @description Delete a storage provider + * Unassign startup script from machine + * @description Unassign a startup script from a machine. */ - "storageProviders-delete": { + "startupScripts-unassign": { parameters: { readonly path: { - /** @description The ID of the storage provider */ + /** @description The id of the startup script. */ id: string; }; }; - responses: { - /** @description Successful response */ - 200: { - content: { - readonly "application/json": { - /** @description The ID of the storage provider */ - readonly id: string; - }; + readonly requestBody: { + readonly content: { + readonly "application/json": { + /** @description The id of the machine to unassign the startup script from. */ + readonly machineId: string; }; }; - default: components["responses"]["error"]; }; - }; - /** - * Get storage utilization - * @description Get a breakdown of how storage is being used by your team - */ - "storageUtilization-getPublic": { responses: { /** @description Successful response */ 200: { content: { readonly "application/json": { - /** @description Storage used by datasets in bytes */ - readonly datasetUsage: string; - /** @description Storage used by models in bytes */ - readonly modelUsage: string; - /** @description Storage used by notebooks files in bytes */ - readonly notebookWorkspaceUsage: string; - /** @description The amount of free storage left before you reach your plan's limit in bytes */ - readonly remainingFreeStorage: string; - /** @description Persistent storage used by the notebook shared storage directory in bytes */ - readonly sharedStorageUsage: string; - /** @description The amount of free storage that comes with your current plan in bytes */ - readonly totalFreeStorage: string; - /** @description Total storage used by your team in bytes */ - readonly totalUsage: string; + /** @description The IDs of the machines the startup script is assigned to. */ + readonly assignedMachineIds: readonly (string)[]; + /** @description The description of the startup script. */ + readonly description: string | null; + /** + * Format: date-time + * @description The date the startup script was created. + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the startup script was deleted. + */ + readonly dtDeleted: Date; + /** @description The ID of the startup script. */ + readonly id: string; + /** @description Whether the startup script is enabled. */ + readonly isEnabled: boolean; + /** @description Whether the startup script is run once on first boot or on every boot. */ + readonly isRunOnce: boolean; + /** @description The name of the startup script. */ + readonly name: string; }; }; }; @@ -14859,10 +14965,10 @@ export interface operations { }; }; /** - * List a team's secrets - * @description Fetches a list of secrets for a team. + * List storage providers + * @description List storage providers */ - "teamSecrets-list": { + "storageProviders-list": { parameters: { readonly query: { /** @description Fetch the next page of results after this cursor. */ @@ -14874,10 +14980,6 @@ export interface operations { /** @description The order to sort the results by. */ order?: "asc" | "desc"; }; - readonly path: { - /** @description The ID of the team where the secret is stored. */ - id: string; - }; }; responses: { /** @description Successful response */ @@ -14888,19 +14990,29 @@ export interface operations { readonly hasMore: boolean; /** @description The items on this page. */ readonly items: readonly ({ - /** - * Format: date-time - * @description The date the secret was created. - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the secret was last modified. - */ - readonly dtModified: Date; - readonly hasDeploymentAttached: boolean; - /** @description The name of the secret, e.g. "DB_PASSWORD". */ + /** @description The ID of the storage provider */ + readonly id: string; + /** @description Whether the storage provider is managed by Paperspace */ + readonly isManaged: boolean; + /** @description Whether the storage provider is the team's default provider */ + readonly isTeamDefault: boolean | null; + /** @description The name of the storage provider */ readonly name: string; + /** @description The storage provider configuration */ + readonly s3Config: { + readonly accessKey: string; + readonly bucket: string; + /** + * Format: uri + * @default null + */ + readonly endpoint?: string | null; + readonly region?: string | null; + /** @default false */ + readonly retainData?: boolean | null; + readonly secretAccessKey: string; + readonly signatureVersion?: string | null; + }; })[]; /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ readonly nextPage?: string; @@ -14911,80 +15023,68 @@ export interface operations { }; }; /** - * Create a team secret - * @description Creates a new secret for a team. + * Create a storage provider + * @description Create a storage provider */ - "teamSecrets-create": { - parameters: { - readonly path: { - /** @description The ID of the team where the secret is stored. */ - id: string; - }; - }; + "storageProviders-create": { readonly requestBody: { readonly content: { readonly "application/json": { - /** @description The name of the secret, e.g. "DB_PASSWORD". */ + /** @description Is team default */ + readonly isTeamDefault?: boolean; + /** @description The name of the storage provider */ readonly name: string; - /** @description The value of the secret, e.g. "password". */ - readonly value: string; - }; - }; - }; - responses: { - /** @description Successful response */ - 200: { - content: { - readonly "application/json": { - /** - * Format: date-time - * @description The date the secret was created. - */ - readonly dtCreated: Date; + /** @description The storage provider configuration */ + readonly s3Config: { + readonly accessKey: string; + readonly bucket: string; /** - * Format: date-time - * @description The date the secret was last modified. + * Format: uri + * @default null */ - readonly dtModified: Date; - /** @description The name of the secret, e.g. "DB_PASSWORD". */ - readonly name: string; + readonly endpoint?: string | null; + readonly region?: string | null; + /** @default false */ + readonly retainData?: boolean | null; + readonly secretAccessKey: string; + readonly signatureVersion?: string | null; }; + /** + * @description The type of storage provider + * @enum {string} + */ + readonly storageProviderType: "s3"; }; }; - default: components["responses"]["error"]; - }; - }; - /** - * Get a team secret - * @description Fetches a secret for a team. - */ - "teamSecrets-get": { - parameters: { - readonly path: { - /** @description The ID of the team where the secret is stored. */ - id: string; - /** @description The name of the secret, e.g. "DB_PASSWORD". */ - name: string; - }; }; responses: { /** @description Successful response */ 200: { content: { readonly "application/json": { - /** - * Format: date-time - * @description The date the secret was created. - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the secret was last modified. - */ - readonly dtModified: Date; - readonly hasDeploymentAttached: boolean; - /** @description The name of the secret, e.g. "DB_PASSWORD". */ + /** @description The ID of the storage provider */ + readonly id: string; + /** @description Whether the storage provider is managed by Paperspace */ + readonly isManaged: boolean; + /** @description Whether the storage provider is the team's default provider */ + readonly isTeamDefault: boolean | null; + /** @description The name of the storage provider */ readonly name: string; + /** @description The storage provider configuration */ + readonly s3Config: { + readonly accessKey: string; + readonly bucket: string; + /** + * Format: uri + * @default null + */ + readonly endpoint?: string | null; + readonly region?: string | null; + /** @default false */ + readonly retainData?: boolean | null; + readonly secretAccessKey: string; + readonly signatureVersion?: string | null; + }; }; }; }; @@ -14992,16 +15092,14 @@ export interface operations { }; }; /** - * Delete a team secret - * @description Deletes a secret for a team. + * Get a storage provider + * @description Get a storage provider */ - "teamSecrets-delete": { + "storageProviders-get": { parameters: { readonly path: { - /** @description The ID of the team where the secret is stored. */ + /** @description The ID of the storage provider */ id: string; - /** @description The name of the secret, e.g. "DB_PASSWORD". */ - name: string; }; }; responses: { @@ -15009,8 +15107,29 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description The name of the secret, e.g. "DB_PASSWORD". */ + /** @description The ID of the storage provider */ + readonly id: string; + /** @description Whether the storage provider is managed by Paperspace */ + readonly isManaged: boolean; + /** @description Whether the storage provider is the team's default provider */ + readonly isTeamDefault: boolean | null; + /** @description The name of the storage provider */ readonly name: string; + /** @description The storage provider configuration */ + readonly s3Config: { + readonly accessKey: string; + readonly bucket: string; + /** + * Format: uri + * @default null + */ + readonly endpoint?: string | null; + readonly region?: string | null; + /** @default false */ + readonly retainData?: boolean | null; + readonly secretAccessKey: string; + readonly signatureVersion?: string | null; + }; }; }; }; @@ -15018,146 +15137,84 @@ export interface operations { }; }; /** - * Update a team secret - * @description Update the value of a secret for a team. + * Update a storage provider + * @description Update a storage provider */ - "teamSecrets-update": { + "storageProviders-update": { parameters: { readonly path: { - /** @description The ID of the team where the secret is stored. */ + /** @description The ID of the storage provider */ id: string; - /** @description The name of the secret, e.g. "DB_PASSWORD". */ - name: string; }; }; readonly requestBody: { readonly content: { readonly "application/json": { - /** @description The value of the secret, e.g. "password". */ - readonly value: string; - }; - }; - }; - responses: { - /** @description Successful response */ - 200: { - content: { - readonly "application/json": { - /** - * Format: date-time - * @description The date the secret was created. - */ - readonly dtCreated: Date; + /** @description Is team default */ + readonly isTeamDefault: boolean; + /** @description The name of the storage provider */ + readonly name: string; + /** @description The storage provider configuration */ + readonly s3Config: { + readonly accessKey: string; + readonly bucket: string; /** - * Format: date-time - * @description The date the secret was last modified. + * Format: uri + * @default null */ - readonly dtModified: Date; - /** @description The name of the secret, e.g. "DB_PASSWORD". */ - readonly name: string; + readonly endpoint?: string | null; + readonly region?: string | null; + /** @default false */ + readonly retainData?: boolean | null; + readonly secretAccessKey: string; + readonly signatureVersion?: string | null; }; }; }; - default: components["responses"]["error"]; - }; - }; - /** - * List team members - * @description List team members - */ - "teamMemberships-listByTeamId": { - parameters: { - readonly query: { - /** @description Fetch the next page of results after this cursor. */ - after?: string; - /** @description The number of items to fetch after this page. */ - limit?: number; - /** @description Order results by one of these fields. */ - orderBy?: "dtConfirmed"; - /** @description The order to sort the results by. */ - order?: "asc" | "desc"; - /** @description Filter team members by their role on the team. */ - role?: "member" | "admin" | "owner"; - }; - readonly path: { - /** @description The team's ID */ - teamId: string; - }; }; responses: { /** @description Successful response */ 200: { content: { readonly "application/json": { - /** @description Whether there are more pages of results available. */ - readonly hasMore: boolean; - /** @description The items on this page. */ - readonly items: readonly ({ + /** @description The ID of the storage provider */ + readonly id: string; + /** @description Whether the storage provider is managed by Paperspace */ + readonly isManaged: boolean; + /** @description Whether the storage provider is the team's default provider */ + readonly isTeamDefault: boolean | null; + /** @description The name of the storage provider */ + readonly name: string; + /** @description The storage provider configuration */ + readonly s3Config: { + readonly accessKey: string; + readonly bucket: string; /** - * Format: date-time - * @description The date the user confirmed their membership + * Format: uri * @default null */ - readonly dtConfirmed?: Date; - /** @description Whether the user is an admin of the team */ - readonly isAdmin: boolean; - /** @description Whether the user is the owner of the team */ - readonly isOwner: boolean; - readonly user: { - /** @description The email address of the user */ - readonly email: string; - /** - * @description The first name of the user - * @default null - */ - readonly firstName?: string | null; - /** @description The ID of the user */ - readonly id: string; - /** - * Format: date-time - * @description The date the user was last active. - * @default null - */ - readonly lastActive?: Date; - /** - * @description The last name of the user - * @default null - */ - readonly lastName?: string | null; - /** - * @description The URL of the team's profile image. - * @default null - */ - readonly publicProfileImageUrl?: string | null; - }; - })[]; - /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ - readonly nextPage?: string; + readonly endpoint?: string | null; + readonly region?: string | null; + /** @default false */ + readonly retainData?: boolean | null; + readonly secretAccessKey: string; + readonly signatureVersion?: string | null; + }; }; }; }; default: components["responses"]["error"]; - }; - }; - /** - * Update a team membership - * @description Update a team membership - */ - "teamMemberships-update": { - parameters: { - readonly path: { - /** @description The team's ID */ - teamId: string; - /** @description The user's ID */ - userId: string; - }; - }; - readonly requestBody: { - readonly content: { - readonly "application/json": { - /** @description Whether the user will gain admin access or not */ - readonly isAdmin: boolean; - }; + }; + }; + /** + * Delete a storage provider + * @description Delete a storage provider + */ + "storageProviders-delete": { + parameters: { + readonly path: { + /** @description The ID of the storage provider */ + id: string; }; }; responses: { @@ -15165,22 +15222,8 @@ export interface operations { 200: { content: { readonly "application/json": { - /** - * Format: date-time - * @description The date the user confirmed their membership - * @default null - */ - readonly dtConfirmed?: Date; - /** - * Format: date-time - * @description The date the user was removed from the team - * @default null - */ - readonly dtDeleted?: Date; - /** @description Whether the user is an admin of the team */ - readonly isAdmin: boolean; - /** @description Whether the user is the owner of the team */ - readonly isOwner: boolean; + /** @description The ID of the storage provider */ + readonly id: string; }; }; }; @@ -15188,39 +15231,29 @@ export interface operations { }; }; /** - * Remove a user from a team - * @description Remove a user from a team + * Get storage utilization + * @description Get a breakdown of how storage is being used by your team */ - "teamMemberships-removeUser": { - parameters: { - readonly path: { - /** @description The team's ID */ - teamId: string; - /** @description The user's ID */ - userId: string; - }; - }; + "storageUtilization-getPublic": { responses: { /** @description Successful response */ 200: { content: { readonly "application/json": { - /** - * Format: date-time - * @description The date the user confirmed their membership - * @default null - */ - readonly dtConfirmed?: Date; - /** - * Format: date-time - * @description The date the user was removed from the team - * @default null - */ - readonly dtDeleted?: Date; - /** @description Whether the user is an admin of the team */ - readonly isAdmin: boolean; - /** @description Whether the user is the owner of the team */ - readonly isOwner: boolean; + /** @description Storage used by datasets in bytes */ + readonly datasetUsage: string; + /** @description Storage used by models in bytes */ + readonly modelUsage: string; + /** @description Storage used by notebooks files in bytes */ + readonly notebookWorkspaceUsage: string; + /** @description The amount of free storage left before you reach your plan's limit in bytes */ + readonly remainingFreeStorage: string; + /** @description Persistent storage used by the notebook shared storage directory in bytes */ + readonly sharedStorageUsage: string; + /** @description The amount of free storage that comes with your current plan in bytes */ + readonly totalFreeStorage: string; + /** @description Total storage used by your team in bytes */ + readonly totalUsage: string; }; }; }; @@ -15228,10 +15261,10 @@ export interface operations { }; }; /** - * List templates - * @description Fetches a list of templates. + * List a team's secrets + * @description Fetches a list of secrets for a team. */ - "templates-list": { + "teamSecrets-list": { parameters: { readonly query: { /** @description Fetch the next page of results after this cursor. */ @@ -15239,11 +15272,13 @@ export interface operations { /** @description The number of items to fetch after this page. */ limit?: number; /** @description Order results by one of these fields. */ - orderBy?: "dtCreated" | "name"; + orderBy?: "dtCreated"; /** @description The order to sort the results by. */ order?: "asc" | "desc"; - name?: string; - machineId?: string; + }; + readonly path: { + /** @description The ID of the team where the secret is stored. */ + id: string; }; }; responses: { @@ -15255,39 +15290,19 @@ export interface operations { readonly hasMore: boolean; /** @description The items on this page. */ readonly items: readonly ({ - /** @description The type of agent installed on the template. */ - readonly agentType: string; - /** @description The machine types the template is available on. */ - readonly availableMachineTypes: readonly ({ - /** @description Whether the template is available on this machine type. */ - readonly isAvailable: boolean; - /** @description The label of the machine type. */ - readonly machineTypeLabel: string; - })[]; - /** @description The default size of the template in gigabytes. */ - readonly defaultSizeGb: number; /** * Format: date-time - * @description The date the template was created. + * @description The date the secret was created. */ readonly dtCreated: Date; - /** @description The date the shared drive was deleted. */ - readonly dtDeleted?: (Record | Date) | null; - /** @description The ID of the template. */ - readonly id: string; /** - * @description Whether the template is public. - * @default false + * Format: date-time + * @description The date the secret was last modified. */ - readonly isPublic?: boolean; - /** @description The name of the template. */ + readonly dtModified: Date; + readonly hasDeploymentAttached: boolean; + /** @description The name of the secret, e.g. "DB_PASSWORD". */ readonly name: string; - /** @description The operating system installed on the template. */ - readonly operatingSystemLabel: string; - /** @description The ID of the parent machine. */ - readonly parentMachineId: string; - /** @description The region the template is in. Public templates are in all regions. */ - readonly region: string; })[]; /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ readonly nextPage?: string; @@ -15298,17 +15313,23 @@ export interface operations { }; }; /** - * Create template - * @description Create a template for a machine. + * Create a team secret + * @description Creates a new secret for a team. */ - "templates-create": { + "teamSecrets-create": { + parameters: { + readonly path: { + /** @description The ID of the team where the secret is stored. */ + id: string; + }; + }; readonly requestBody: { readonly content: { readonly "application/json": { - /** @description The ID of the machine to create a template from. */ - readonly machineId: string; - /** @description The name of the template. */ + /** @description The name of the secret, e.g. "DB_PASSWORD". */ readonly name: string; + /** @description The value of the secret, e.g. "password". */ + readonly value: string; }; }; }; @@ -15317,98 +15338,55 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description The template. */ - readonly data: { - /** @description The type of agent installed on the template. */ - readonly agentType: string; - /** @description The machine types the template is available on. */ - readonly availableMachineTypes: readonly ({ - /** @description Whether the template is available on this machine type. */ - readonly isAvailable: boolean; - /** @description The label of the machine type. */ - readonly machineTypeLabel: string; - })[]; - /** @description The default size of the template in gigabytes. */ - readonly defaultSizeGb: number; - /** - * Format: date-time - * @description The date the template was created. - */ - readonly dtCreated: Date; - /** @description The date the shared drive was deleted. */ - readonly dtDeleted?: (Record | Date) | null; - /** @description The ID of the template. */ - readonly id: string; - /** - * @description Whether the template is public. - * @default false - */ - readonly isPublic?: boolean; - /** @description The name of the template. */ - readonly name: string; - /** @description The operating system installed on the template. */ - readonly operatingSystemLabel: string; - /** @description The ID of the parent machine. */ - readonly parentMachineId: string; - /** @description The region the template is in. Public templates are in all regions. */ - readonly region: string; - }; - /** @description The machine event to poll for the async operation. */ - readonly event: { - /** - * Format: date-time - * @description The date the event was created. - */ - readonly dtCreated: Date; - /** - * Format: date-time - * @description The date the event was finished. - */ - readonly dtFinished: Date; - /** - * Format: date-time - * @description The date the event was started. - */ - readonly dtStarted: Date; - /** @description The error message of the event, if any. */ - readonly error: string | null; - /** @description The ID of the event. */ - readonly id: string; - /** @description The ID of the machine the event is for. */ - readonly machineId: string | null; - /** - * @description The name of the event, e.g. "create". - * @enum {string} - */ - readonly name: - | "bill-sessions" - | "bill-upgrade" - | "create" - | "deactivate" - | "restart" - | "snapshot-create" - | "snapshot-delete" - | "snapshot-restore" - | "start" - | "stop" - | "template-create" - | "template-delete" - | "template-distribute" - | "template-import" - | "vm-migrate" - | "vm-shutdown-force" - | "vm-upgrade"; - /** - * @description The state of the event, e.g. "done". - * @enum {string} - */ - readonly state: - | "new" - | "in progress" - | "done" - | "error" - | "cancelled"; - }; + /** + * Format: date-time + * @description The date the secret was created. + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the secret was last modified. + */ + readonly dtModified: Date; + /** @description The name of the secret, e.g. "DB_PASSWORD". */ + readonly name: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; + /** + * Get a team secret + * @description Fetches a secret for a team. + */ + "teamSecrets-get": { + parameters: { + readonly path: { + /** @description The ID of the team where the secret is stored. */ + id: string; + /** @description The name of the secret, e.g. "DB_PASSWORD". */ + name: string; + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** + * Format: date-time + * @description The date the secret was created. + */ + readonly dtCreated: Date; + /** + * Format: date-time + * @description The date the secret was last modified. + */ + readonly dtModified: Date; + readonly hasDeploymentAttached: boolean; + /** @description The name of the secret, e.g. "DB_PASSWORD". */ + readonly name: string; }; }; }; @@ -15416,14 +15394,50 @@ export interface operations { }; }; /** - * Get a template - * @description Fetches a single template by ID. + * Delete a team secret + * @description Deletes a secret for a team. */ - "templates-get": { + "teamSecrets-delete": { parameters: { readonly path: { - /** @description The ID of the template to fetch. */ + /** @description The ID of the team where the secret is stored. */ id: string; + /** @description The name of the secret, e.g. "DB_PASSWORD". */ + name: string; + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** @description The name of the secret, e.g. "DB_PASSWORD". */ + readonly name: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; + /** + * Update a team secret + * @description Update the value of a secret for a team. + */ + "teamSecrets-update": { + parameters: { + readonly path: { + /** @description The ID of the team where the secret is stored. */ + id: string; + /** @description The name of the secret, e.g. "DB_PASSWORD". */ + name: string; + }; + }; + readonly requestBody: { + readonly content: { + readonly "application/json": { + /** @description The value of the secret, e.g. "password". */ + readonly value: string; + }; }; }; responses: { @@ -15431,39 +15445,18 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description The type of agent installed on the template. */ - readonly agentType: string; - /** @description The machine types the template is available on. */ - readonly availableMachineTypes: readonly ({ - /** @description Whether the template is available on this machine type. */ - readonly isAvailable: boolean; - /** @description The label of the machine type. */ - readonly machineTypeLabel: string; - })[]; - /** @description The default size of the template in gigabytes. */ - readonly defaultSizeGb: number; /** * Format: date-time - * @description The date the template was created. + * @description The date the secret was created. */ readonly dtCreated: Date; - /** @description The date the shared drive was deleted. */ - readonly dtDeleted?: (Record | Date) | null; - /** @description The ID of the template. */ - readonly id: string; /** - * @description Whether the template is public. - * @default false + * Format: date-time + * @description The date the secret was last modified. */ - readonly isPublic?: boolean; - /** @description The name of the template. */ + readonly dtModified: Date; + /** @description The name of the secret, e.g. "DB_PASSWORD". */ readonly name: string; - /** @description The operating system installed on the template. */ - readonly operatingSystemLabel: string; - /** @description The ID of the parent machine. */ - readonly parentMachineId: string; - /** @description The region the template is in. Public templates are in all regions. */ - readonly region: string; }; }; }; @@ -15471,21 +15464,101 @@ export interface operations { }; }; /** - * Update a template - * @description Updates a single template by ID. + * List team members + * @description List team members */ - "templates-update": { + "teamMemberships-listByTeamId": { parameters: { + readonly query: { + /** @description Fetch the next page of results after this cursor. */ + after?: string; + /** @description The number of items to fetch after this page. */ + limit?: number; + /** @description Order results by one of these fields. */ + orderBy?: "dtConfirmed"; + /** @description The order to sort the results by. */ + order?: "asc" | "desc"; + /** @description Filter team members by their role on the team. */ + role?: "member" | "admin" | "owner"; + }; readonly path: { - /** @description The ID of the template to update. */ - id: string; + /** @description The team's ID */ + teamId: string; + }; + }; + responses: { + /** @description Successful response */ + 200: { + content: { + readonly "application/json": { + /** @description Whether there are more pages of results available. */ + readonly hasMore: boolean; + /** @description The items on this page. */ + readonly items: readonly ({ + /** + * Format: date-time + * @description The date the user confirmed their membership + * @default null + */ + readonly dtConfirmed?: Date; + /** @description Whether the user is an admin of the team */ + readonly isAdmin: boolean; + /** @description Whether the user is the owner of the team */ + readonly isOwner: boolean; + readonly user: { + /** @description The email address of the user */ + readonly email: string; + /** + * @description The first name of the user + * @default null + */ + readonly firstName?: string | null; + /** @description The ID of the user */ + readonly id: string; + /** + * Format: date-time + * @description The date the user was last active. + * @default null + */ + readonly lastActive?: Date; + /** + * @description The last name of the user + * @default null + */ + readonly lastName?: string | null; + /** + * @description The URL of the team's profile image. + * @default null + */ + readonly publicProfileImageUrl?: string | null; + }; + })[]; + /** @description The cursor required to fetch the next page of results. i.e. `?after=nextPage`. This is `null` when there is no next page. */ + readonly nextPage?: string; + }; + }; + }; + default: components["responses"]["error"]; + }; + }; + /** + * Update a team membership + * @description Update a team membership + */ + "teamMemberships-update": { + parameters: { + readonly path: { + /** @description The team's ID */ + teamId: string; + /** @description The user's ID */ + userId: string; }; }; readonly requestBody: { readonly content: { readonly "application/json": { - /** @description The name of the template. */ - readonly name: string; + /** @description Whether the user will gain admin access or not */ + readonly isAdmin: boolean; }; }; }; @@ -15494,39 +15567,22 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description The type of agent installed on the template. */ - readonly agentType: string; - /** @description The machine types the template is available on. */ - readonly availableMachineTypes: readonly ({ - /** @description Whether the template is available on this machine type. */ - readonly isAvailable: boolean; - /** @description The label of the machine type. */ - readonly machineTypeLabel: string; - })[]; - /** @description The default size of the template in gigabytes. */ - readonly defaultSizeGb: number; /** * Format: date-time - * @description The date the template was created. + * @description The date the user confirmed their membership + * @default null */ - readonly dtCreated: Date; - /** @description The date the shared drive was deleted. */ - readonly dtDeleted?: (Record | Date) | null; - /** @description The ID of the template. */ - readonly id: string; + readonly dtConfirmed?: Date; /** - * @description Whether the template is public. - * @default false + * Format: date-time + * @description The date the user was removed from the team + * @default null */ - readonly isPublic?: boolean; - /** @description The name of the template. */ - readonly name: string; - /** @description The operating system installed on the template. */ - readonly operatingSystemLabel: string; - /** @description The ID of the parent machine. */ - readonly parentMachineId: string; - /** @description The region the template is in. Public templates are in all regions. */ - readonly region: string; + readonly dtDeleted?: Date; + /** @description Whether the user is an admin of the team */ + readonly isAdmin: boolean; + /** @description Whether the user is the owner of the team */ + readonly isOwner: boolean; }; }; }; @@ -15534,14 +15590,16 @@ export interface operations { }; }; /** - * Delete template - * @description Delete a template. + * Remove a user from a team + * @description Remove a user from a team */ - "templates-delete": { + "teamMemberships-removeUser": { parameters: { readonly path: { - /** @description The ID of the template to delete. */ - id: string; + /** @description The team's ID */ + teamId: string; + /** @description The user's ID */ + userId: string; }; }; responses: { @@ -15549,39 +15607,22 @@ export interface operations { 200: { content: { readonly "application/json": { - /** @description The type of agent installed on the template. */ - readonly agentType: string; - /** @description The machine types the template is available on. */ - readonly availableMachineTypes: readonly ({ - /** @description Whether the template is available on this machine type. */ - readonly isAvailable: boolean; - /** @description The label of the machine type. */ - readonly machineTypeLabel: string; - })[]; - /** @description The default size of the template in gigabytes. */ - readonly defaultSizeGb: number; /** * Format: date-time - * @description The date the template was created. + * @description The date the user confirmed their membership + * @default null */ - readonly dtCreated: Date; - /** @description The date the shared drive was deleted. */ - readonly dtDeleted?: (Record | Date) | null; - /** @description The ID of the template. */ - readonly id: string; + readonly dtConfirmed?: Date; /** - * @description Whether the template is public. - * @default false + * Format: date-time + * @description The date the user was removed from the team + * @default null */ - readonly isPublic?: boolean; - /** @description The name of the template. */ - readonly name: string; - /** @description The operating system installed on the template. */ - readonly operatingSystemLabel: string; - /** @description The ID of the parent machine. */ - readonly parentMachineId: string; - /** @description The region the template is in. Public templates are in all regions. */ - readonly region: string; + readonly dtDeleted?: Date; + /** @description Whether the user is an admin of the team */ + readonly isAdmin: boolean; + /** @description Whether the user is the owner of the team */ + readonly isOwner: boolean; }; }; }; diff --git a/api/templates.ts b/api/templates.ts index 894ee81..8584497 100644 --- a/api/templates.ts +++ b/api/templates.ts @@ -1,8 +1,12 @@ import { client } from "./client.ts"; -export const templates = { - create: client("/templates").post, - get: client("/templates/{id}").get, - list: client("/templates").get, - delete: client("/templates/{id}").delete, +export const customTemplates = { + create: client("/custom-templates").post, + get: client("/custom-templates/{id}").get, + list: client("/custom-templates").get, + delete: client("/custom-templates/{id}").delete, +}; + +export const osTemplates = { + list: client("/os-templates").get, }; diff --git a/commands/template/create/mod.ts b/commands/custom-template/create/mod.ts similarity index 84% rename from commands/template/create/mod.ts rename to commands/custom-template/create/mod.ts index e403ca0..87d2ce3 100644 --- a/commands/template/create/mod.ts +++ b/commands/custom-template/create/mod.ts @@ -4,7 +4,7 @@ import { command, flag, flags } from "../../../zcli.ts"; import { dataTable } from "../../../lib/data-table.ts"; import { fields } from "../../../flags.ts"; import { pickJson } from "../../../lib/pick-json.ts"; -import { templates } from "../../../api/templates.ts"; +import { customTemplates } from "../../../api/templates.ts"; import { defaultFields } from "../mod.ts"; /** @@ -14,9 +14,9 @@ import { defaultFields } from "../mod.ts"; const subCommands: ReturnType[] = []; export const create = command("create", { - short: "Create a template", + short: "Create a custom template", long: ` - Create a template from a machine. + Create a custom template from a machine. `, commands: subCommands, flags: flags({ @@ -24,11 +24,11 @@ export const create = command("create", { }).merge(flags({ "name": flag({ aliases: ["n"], - short: "The name of the template", + short: "The name of the custom template", }).string(), "machine-id": flag({ aliases: ["m"], - short: "The ID of the machine to create a template from", + short: "The ID of the machine to create a custom template from", }).string(), })), // We use command metadata in the `persistentPreRun` function to check if a @@ -41,7 +41,7 @@ export const create = command("create", { }).run( async function* ({ flags }) { const response = await loading( - templates.create({ + customTemplates.create({ name: flags.name, machineId: flags["machine-id"], }), diff --git a/commands/template/delete/mod.ts b/commands/custom-template/delete/mod.ts similarity index 83% rename from commands/template/delete/mod.ts rename to commands/custom-template/delete/mod.ts index f4e190d..1099603 100644 --- a/commands/template/delete/mod.ts +++ b/commands/custom-template/delete/mod.ts @@ -5,7 +5,7 @@ import { args, command, flags, z } from "../../../zcli.ts"; import { dataTable } from "../../../lib/data-table.ts"; import { fields } from "../../../flags.ts"; import { pickJson } from "../../../lib/pick-json.ts"; -import { templates } from "../../../api/templates.ts"; +import { customTemplates } from "../../../api/templates.ts"; import { defaultFields } from "../mod.ts"; /** @@ -15,13 +15,13 @@ import { defaultFields } from "../mod.ts"; const subCommands: ReturnType[] = []; export const del = command("delete", { - short: "Delete a template", + short: "Delete a custom template", long: ` - Delete a template from a team. + Delete a custom template from a team. `, commands: subCommands, args: args().tuple([ - z.string().describe("The ID of the template to delete"), + z.string().describe("The ID of the custom template to delete"), ]).optional(), flags: flags({ fields, @@ -40,11 +40,11 @@ export const del = command("delete", { id = await input("ID:", { filter: (v) => !!v.sequence.match(/[a-zA-Z0-9_-]/), }); - asserts(id, "A template ID is required"); + asserts(id, "A custom template ID is required"); } const response = await loading( - templates.delete({ id }), + customTemplates.delete({ id }), ); asserts(response.ok, response); diff --git a/commands/template/get/mod.ts b/commands/custom-template/get/mod.ts similarity index 84% rename from commands/template/get/mod.ts rename to commands/custom-template/get/mod.ts index 1df7dfb..1317846 100644 --- a/commands/template/get/mod.ts +++ b/commands/custom-template/get/mod.ts @@ -5,7 +5,7 @@ import { args, command, flags, z } from "../../../zcli.ts"; import { dataTable } from "../../../lib/data-table.ts"; import { fields } from "../../../flags.ts"; import { pickJson } from "../../../lib/pick-json.ts"; -import { templates } from "../../../api/templates.ts"; +import { customTemplates } from "../../../api/templates.ts"; import { defaultFields } from "../mod.ts"; /** @@ -15,13 +15,13 @@ import { defaultFields } from "../mod.ts"; const subCommands: ReturnType[] = []; export const get = command("get", { - short: "Get a template", + short: "Get a custom template", long: ` - Get a template from a team. + Get a custom template from a team. `, commands: subCommands, args: args().tuple([ - z.string().describe("The ID of the template to get"), + z.string().describe("The ID of the custom template to get"), ]).optional(), flags: flags({ fields, @@ -40,11 +40,11 @@ export const get = command("get", { id = await input("ID:", { filter: (v) => !!v.sequence.match(/[a-zA-Z0-9_-]/), }); - asserts(id, "A template ID is required"); + asserts(id, "A custom template ID is required"); } const response = await loading( - templates.get({ id }), + customTemplates.get({ id }), ); asserts(response.ok, response); diff --git a/commands/template/list/mod.ts b/commands/custom-template/list/mod.ts similarity index 87% rename from commands/template/list/mod.ts rename to commands/custom-template/list/mod.ts index ea11562..957f434 100644 --- a/commands/template/list/mod.ts +++ b/commands/custom-template/list/mod.ts @@ -5,7 +5,7 @@ import { loading } from "../../../lib/loading.ts"; import * as psFlags from "../../../flags.ts"; import { pickJson } from "../../../lib/pick-json.ts"; import { config } from "../../../config.ts"; -import { templates } from "../../../api/templates.ts"; +import { customTemplates } from "../../../api/templates.ts"; import { defaultFields } from "../mod.ts"; /** @@ -15,13 +15,13 @@ import { defaultFields } from "../mod.ts"; const subCommands: ReturnType[] = []; export const list = command("list", { - short: "List templates.", + short: "List custom templates.", long: ({ root }) => ` - List templates in your team. + List custom templates in your team. Pick a subset of fields to display: \`\`\` - ${root.name} template list -F name -F dtModified + ${root.name} custom-template list -F name -F dtModified \`\`\` `, commands: subCommands, @@ -48,9 +48,9 @@ export const list = command("list", { }).run( async function* ({ flags }) { const team = await config.get("team"); - asserts(team, "You must be in a team to list templates."); + asserts(team, "You must be in a team to list custom templates."); const result = await loading( - templates.list({ + customTemplates.list({ limit: flags.limit, after: flags.after, orderBy: "dtCreated", diff --git a/commands/template/mod.ts b/commands/custom-template/mod.ts similarity index 68% rename from commands/template/mod.ts rename to commands/custom-template/mod.ts index efcb280..d353032 100644 --- a/commands/template/mod.ts +++ b/commands/custom-template/mod.ts @@ -24,12 +24,12 @@ const subCommands: ReturnType[] = [ del, ]; -export const template = command("template", { - short: "Manage your templates", +export const customTemplate = command("custom-template", { + short: "Manage your custom templates", long: ` - Manage your templates. Templates are a backup of your machine's disk. - They can be used to create additional machines. You can use them to - prepopulate a machine with your desired software stack. + Manage your custom templates. Custom templates are a backup of your + machine's disk. They can be used to create additional machines. You + can use them to prepopulate a machine with your desired software stack. For more information, see ${new URL( "/compute/custom-templates", @@ -38,7 +38,7 @@ export const template = command("template", { `, commands: subCommands, }).run(function* ({ ctx }) { - for (const line of template.help(ctx)) { + for (const line of customTemplate.help(ctx)) { yield line; } }); diff --git a/commands/mod.ts b/commands/mod.ts index cfdb963..4274728 100644 --- a/commands/mod.ts +++ b/commands/mod.ts @@ -29,9 +29,10 @@ import { signup } from "./signup/mod.ts"; import { snapshot } from "./snapshot/mod.ts"; import { startupScript } from "./startup-script/mod.ts"; import { storageProvider } from "./storage-provider/mod.ts"; -import { template } from "./template/mod.ts"; +import { customTemplate } from "./custom-template/mod.ts"; import { up } from "./up/mod.ts"; import { getLatestVersion, upgrade } from "./upgrade/mod.ts"; +import { osTemplate } from "./os-template/mod.ts"; /** * This variable is automatically generated by `zcli add`. Do not remove this @@ -41,6 +42,7 @@ export const commands = [ autoscalingGroup, config, console, + customTemplate, dataset, deployment, docs, @@ -49,6 +51,7 @@ export const commands = [ logout, machine, machineEvent, + osTemplate, privateNetwork, project, publicIp, @@ -58,7 +61,6 @@ export const commands = [ sharedDrive, startupScript, storageProvider, - template, up, upgrade, model, diff --git a/commands/os-template/list/mod.ts b/commands/os-template/list/mod.ts new file mode 100644 index 0000000..6642cb5 --- /dev/null +++ b/commands/os-template/list/mod.ts @@ -0,0 +1,67 @@ +import { command, flag, flags } from "../../../zcli.ts"; +import { asserts } from "../../../lib/asserts.ts"; +import { dataTable } from "../../../lib/data-table.ts"; +import { loading } from "../../../lib/loading.ts"; +import * as psFlags from "../../../flags.ts"; +import { pickJson } from "../../../lib/pick-json.ts"; +import { osTemplates } from "../../../api/templates.ts"; +import { defaultFields } from "../mod.ts"; + +/** + * This variable is automatically generated by `zcli add`. Do not remove this + * or change its name unless you're no longer using `zcli add`. + */ +const subCommands: ReturnType[] = []; + +export const list = command("list", { + short: "List OS templates.", + long: ({ root }) => ` + List OS templates. + + Pick a subset of fields to display: + \`\`\` + ${root.name} os-template list -F name + \`\`\` + `, + commands: subCommands, + flags: psFlags.paginator.merge(flags({ + "name": flag({ + aliases: ["n"], + short: "Filter by name.", + }).ostring(), + })), + // We use command metadata in the `persistentPreRun` function to check if a + // command requires an API key. If it does, we'll check to see if one is + // set. If not, we'll throw an error. + meta: { + requireApiKey: true, + }, +}).run( + async function* ({ flags }) { + const result = await loading( + osTemplates.list({ + limit: flags.limit, + after: flags.after, + orderBy: "name", + order: flags.asc ? "asc" : undefined, + name: flags.name, + }), + { enabled: !flags.json }, + ); + + asserts(result.ok, result); + + if (!flags.json) { + for await ( + const line of dataTable( + result.data.items, + flags.fields ?? defaultFields, + ) + ) { + yield line; + } + } else { + yield pickJson(result.data, flags.fields); + } + }, +); diff --git a/commands/os-template/mod.ts b/commands/os-template/mod.ts new file mode 100644 index 0000000..1e682af --- /dev/null +++ b/commands/os-template/mod.ts @@ -0,0 +1,36 @@ +import { command } from "../../zcli.ts"; +import { list } from "./list/mod.ts"; +import { env } from "../../env.ts"; + +export const defaultFields = [ + "id", + "name", + "operatingSystemLabel", + "defaultSizeGb", +]; + +/** + * This variable is automatically generated by `zcli add`. Do not remove this + * or change its name unless you're no longer using `zcli add`. + */ +const subCommands: ReturnType[] = [ + list, +]; + +export const osTemplate = command("os-template", { + short: "List OS templates", + long: ` + List OS templates. OS templates are pre-configured virtual machines that + you can use to create a new machine. + + For more information, see ${new URL( + "/compute/os-templates", + env.get("PAPERSPACE_DOCS_URL"), + )}. + `, + commands: subCommands, +}).run(function* ({ ctx }) { + for (const line of osTemplate.help(ctx)) { + yield line; + } +}); diff --git a/errors.ts b/errors.ts index 0332f66..2e7795e 100644 --- a/errors.ts +++ b/errors.ts @@ -71,13 +71,13 @@ export class DegitError extends AppError { export class ApiClientError extends AppError { readonly name = "ApiClientError"; readonly code: ApiClientErrorCode; - readonly issues: - components["responses"]["error"]["content"]["application/json"]["issues"]; + readonly details: + components["responses"]["error"]["content"]["application/json"]["details"]; constructor({ message, code, - issues, + details, }: & Omit< components["responses"]["error"]["content"]["application/json"], @@ -88,7 +88,7 @@ export class ApiClientError extends AppError { }) { super({ message, exitCode: 1 }); this.code = code; - this.issues = issues; + this.details = details; } }