-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #387 from rstudio/dotnomad/deployment-destinations
List Destinations on the Project page
- Loading branch information
Showing
8 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (C) 2023 by Posit Software, PBC. | ||
|
||
import { AxiosInstance } from 'axios'; | ||
|
||
import { Configuration, ConfigurationError } from 'src/api/types/configurations'; | ||
|
||
export class Configurations { | ||
private client: AxiosInstance; | ||
|
||
constructor(client: AxiosInstance) { | ||
this.client = client; | ||
} | ||
|
||
getAll() { | ||
return this.client.get<Array<Configuration | ConfigurationError>>( | ||
'/configurations', | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (C) 2023 by Posit Software, PBC. | ||
|
||
import { AxiosInstance, AxiosRequestConfig } from 'axios'; | ||
|
||
import { Deployment, DeploymentError } from 'src/api/types/deployments'; | ||
|
||
export class Deployments { | ||
private client: AxiosInstance; | ||
|
||
constructor(client: AxiosInstance) { | ||
this.client = client; | ||
} | ||
|
||
private createConfig(config?: AxiosRequestConfig): AxiosRequestConfig { | ||
return { | ||
ignoreCamelCase: ['files'], | ||
...config, | ||
}; | ||
} | ||
|
||
getAll() { | ||
return this.client.get<Array<Deployment | DeploymentError>>( | ||
'/deployments', | ||
this.createConfig() | ||
); | ||
} | ||
|
||
get(id: string) { | ||
return this.client.get<Deployment | DeploymentError>( | ||
`deployments/${id}`, | ||
this.createConfig() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
// Copyright (C) 2023 by Posit Software, PBC. | ||
|
||
import { ConnectConfig } from 'src/api/types/connect'; | ||
import { SchemaURL } from 'src/api/types/schema'; | ||
|
||
export type ConfigurationLocation = { | ||
configurationName: string; | ||
configurationPath: string; | ||
} | ||
|
||
export type ConfigurationError = { | ||
error: string; | ||
} & ConfigurationLocation | ||
|
||
export type Configuration = { | ||
configuration: ConfigurationDetails | ||
} & ConfigurationLocation | ||
|
||
export function isConfigurationError( | ||
c: Configuration | ConfigurationError | ||
): c is ConfigurationError { | ||
return (c as ConfigurationError).error !== undefined; | ||
} | ||
|
||
enum AppMode { | ||
UNKNOWN = '', | ||
SHINY = 'shiny', | ||
RMD_SHINY = 'rmd-shiny', | ||
RMD_STATIC = 'rmd-static', | ||
STATIC = 'static', | ||
PLUMBER_API = 'api', | ||
JUPYTER_STATIC = 'jupyter-static', | ||
JUPYTER_VOILA = 'jupyter-voila', | ||
PYTHON_API = 'python-api', | ||
PYTHON_DASH = 'python-dash', | ||
PYTHON_STREAMLIT = 'python-streamlit', | ||
PYTHON_BOKEH = 'python-bokeh', | ||
PYTHON_FASTAPI = 'python-fastapi', | ||
PYTHON_SHINY = 'python-shiny', | ||
QUARTO_SHINY = 'quarto-shiny', | ||
QUARTO_STATIC = 'quarto-static', | ||
} | ||
|
||
export type ConfigurationDetails = { | ||
$schema: SchemaURL, | ||
type: AppMode, | ||
entrypoint?: string, | ||
title?: string, | ||
description?: string, | ||
thumbnail?: string, | ||
tags?: string[], | ||
python?: PythonConfig, | ||
r?: RConfig, | ||
quarto?: QuartoConfig, | ||
environment?: EnvironmentConfig, | ||
secrets?: string[], | ||
schedules?: ScheduleConfig[], | ||
access?: AccessConfig, | ||
connect?: ConnectConfig, | ||
} | ||
|
||
export type PythonConfig = { | ||
version: string, | ||
packageFile: string, | ||
packageManager: string | ||
} | ||
|
||
export type RConfig = { | ||
version: string, | ||
packageFile: string, | ||
packageManager: string | ||
} | ||
|
||
export type QuartoConfig = { | ||
version: string, | ||
engines: string[] | ||
} | ||
|
||
export type EnvironmentConfig = Record<string, string> | ||
|
||
export type ScheduleConfig = { | ||
start: string, | ||
recurrence: string | ||
} | ||
|
||
export enum AccessType { | ||
ANONYMOUS = 'all', | ||
LOGGED_IN = 'logged-in', | ||
ACL = 'acl' | ||
} | ||
|
||
export type AccessConfig = { | ||
type: AccessType, | ||
users?: User[], | ||
groups?: Group[] | ||
} | ||
|
||
export type User = { | ||
id?: string, | ||
guid?: string, | ||
name?: string, | ||
permissions: string | ||
} | ||
|
||
export type Group = { | ||
id?: string, | ||
guid?: string, | ||
name?: string, | ||
permissions: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Copyright (C) 2023 by Posit Software, PBC. | ||
|
||
export type ConnectConfig = { | ||
access?: ConnectAccess, | ||
runtime?: ConnectRuntime, | ||
kubernetes?: ConnectKubernetes | ||
} | ||
|
||
export type ConnectAccess = { | ||
runAs?: string, | ||
runAsCurrentUser?: boolean, | ||
} | ||
|
||
export type ConnectRuntime = { | ||
connectTimeout?: number, | ||
readTimeout?: number, | ||
initTimeout?: number, | ||
idleTimeout?: number, | ||
maxProcesses?: number, | ||
minProcesses?: number, | ||
maxConnections?: number, | ||
loadFactor?: number, | ||
} | ||
|
||
export type ConnectKubernetes = { | ||
memoryRequest?: number, | ||
memoryLimit?: number, | ||
cpuRequest?: number, | ||
cpuLimit?: number, | ||
amdGpuLimit?: number, | ||
nvidiaGpuLimit?: number, | ||
serviceAccountName?: string, | ||
imageName?: string, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (C) 2023 by Posit Software, PBC. | ||
|
||
import { Configuration } from 'src/api/types/configurations'; | ||
import { SchemaURL } from 'src/api/types/schema'; | ||
|
||
export type DeploymentError = { | ||
error: string, | ||
} | ||
|
||
export enum ServerType { | ||
CONNECT = 'connect', | ||
SHINY_APPS = 'shinyapps', | ||
CLOUD = 'cloud', | ||
} | ||
|
||
export type Deployment = { | ||
$schema: SchemaURL, | ||
serverType: ServerType | ||
serverUrl: string, | ||
id: string, | ||
files: string[] | ||
configurationPath: string | ||
configurationName: string | ||
configuration: Configuration | ||
} | ||
|
||
export function isDeploymentError( | ||
d: Deployment | DeploymentError | ||
): d is DeploymentError { | ||
return (d as DeploymentError).error !== undefined; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright (C) 2023 by Posit Software, PBC. | ||
|
||
export type SchemaURL = string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters