forked from databricks/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
126 lines (98 loc) · 3.86 KB
/
Copy pathapp.py
File metadata and controls
126 lines (98 loc) · 3.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
from dataclasses import dataclass, field
from typing import TYPE_CHECKING, Any, TypedDict
from databricks.bundles.apps._models.app_permission import (
AppPermission,
AppPermissionParam,
)
from databricks.bundles.apps._models.app_resource import AppResource, AppResourceParam
from databricks.bundles.apps._models.lifecycle import Lifecycle, LifecycleParam
from databricks.bundles.core._resource import Resource
from databricks.bundles.core._transform import _transform
from databricks.bundles.core._transform_to_json import _transform_to_json_value
from databricks.bundles.core._variable import (
VariableOr,
VariableOrDict,
VariableOrList,
VariableOrOptional,
)
if TYPE_CHECKING:
from typing_extensions import Self
@dataclass(kw_only=True)
class App(Resource):
"""Databricks App resource"""
name: VariableOr[str]
"""
The name of the app. The name must be unique within the workspace.
"""
source_code_path: VariableOrOptional[str] = None
"""
Path to the app source code on local disk. This is used by DABs to deploy the app.
"""
description: VariableOrOptional[str] = None
"""
The description of the app.
"""
resources: VariableOrList[AppResource] = field(default_factory=list)
"""
A list of workspace resources associated with the app.
Each resource can be a job, secret, serving endpoint, SQL warehouse, or Unity Catalog securable.
"""
permissions: VariableOrList[AppPermission] = field(default_factory=list)
"""
Access control list for the app. Multiple permissions can be defined for different principals.
"""
lifecycle: VariableOrOptional[Lifecycle] = None
"""
Lifecycle is a struct that contains the lifecycle settings for a resource. It controls the behavior of the resource when it is deployed or destroyed.
"""
config: VariableOrDict[Any] = field(default_factory=dict)
"""
Application-specific configuration.
This can include various settings such as:
- command: List of strings for the command to run the app
- env: List of environment variable configurations with 'name', 'value', or 'valueFrom'
- Any other custom app-specific settings
See AppConfigDict for common configuration structure.
"""
@classmethod
def from_dict(cls, value: "AppDict") -> "Self":
return _transform(cls, value)
def as_dict(self) -> "AppDict":
return _transform_to_json_value(self) # type:ignore
class AppDict(TypedDict, total=False):
"""Databricks App resource"""
name: VariableOr[str]
"""
The name of the app. The name must be unique within the workspace.
"""
source_code_path: VariableOrOptional[str]
"""
Path to the app source code on local disk. This is used by DABs to deploy the app.
"""
description: VariableOrOptional[str]
"""
The description of the app.
"""
resources: VariableOrList[AppResourceParam]
"""
A list of workspace resources associated with the app.
Each resource can be a job, secret, serving endpoint, SQL warehouse, or Unity Catalog securable.
"""
permissions: VariableOrList[AppPermissionParam]
"""
Access control list for the app. Multiple permissions can be defined for different principals.
"""
lifecycle: VariableOrOptional[LifecycleParam]
"""
Lifecycle is a struct that contains the lifecycle settings for a resource. It controls the behavior of the resource when it is deployed or destroyed.
"""
config: VariableOrDict[Any]
"""
Application-specific configuration.
This can include various settings such as:
- command: List of strings for the command to run the app
- env: List of environment variable configurations with 'name', 'value', or 'valueFrom'
- Any other custom app-specific settings
See AppConfigDict for common configuration structure.
"""
AppParam = AppDict | App