diff --git a/acceptance/bundle/python/apps-support/app1/placeholder.txt b/acceptance/bundle/python/apps-support/app1/placeholder.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/acceptance/bundle/python/apps-support/app2/placeholder.txt b/acceptance/bundle/python/apps-support/app2/placeholder.txt new file mode 100644 index 00000000000..e69de29bb2d diff --git a/acceptance/bundle/python/apps-support/databricks.yml b/acceptance/bundle/python/apps-support/databricks.yml new file mode 100644 index 00000000000..6b65d541d4a --- /dev/null +++ b/acceptance/bundle/python/apps-support/databricks.yml @@ -0,0 +1,17 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_app" + +resources: + apps: + my_app_1: + name: "my_app_1" + description: "My app" + source_code_path: "./app1" diff --git a/acceptance/bundle/python/apps-support/mutators.py b/acceptance/bundle/python/apps-support/mutators.py new file mode 100644 index 00000000000..ab2d11dd921 --- /dev/null +++ b/acceptance/bundle/python/apps-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.apps import App +from databricks.bundles.core import app_mutator + + +@app_mutator +def update_app(app: App) -> App: + assert isinstance(app.name, str) + + return replace(app, name=f"{app.name} (updated)") diff --git a/acceptance/bundle/python/apps-support/out.test.toml b/acceptance/bundle/python/apps-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/apps-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/apps-support/output.txt b/acceptance/bundle/python/apps-support/output.txt new file mode 100644 index 00000000000..a640e206e55 --- /dev/null +++ b/acceptance/bundle/python/apps-support/output.txt @@ -0,0 +1,28 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_app" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "apps": { + "my_app_1": { + "description": "My app", + "name": "my_app_1 (updated)", + "source_code_path": "/Workspace/Users/[USERNAME]/.bundle/my_project/default/files/app1" + }, + "my_app_2": { + "description": "My app (2)", + "name": "my_app_2 (updated)", + "source_code_path": "/Workspace/Users/[USERNAME]/.bundle/my_project/default/files/app2" + } + } + } +} diff --git a/acceptance/bundle/python/apps-support/resources.py b/acceptance/bundle/python/apps-support/resources.py new file mode 100644 index 00000000000..593123f6e6c --- /dev/null +++ b/acceptance/bundle/python/apps-support/resources.py @@ -0,0 +1,16 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_app( + "my_app_2", + { + "name": "my_app_2", + "description": "My app (2)", + "source_code_path": "./app2", + }, + ) + + return resources diff --git a/acceptance/bundle/python/apps-support/script b/acceptance/bundle/python/apps-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/apps-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/apps-support/test.toml b/acceptance/bundle/python/apps-support/test.toml new file mode 100644 index 00000000000..b7fda406b0c --- /dev/null +++ b/acceptance/bundle/python/apps-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# apps are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/clusters-support/databricks.yml b/acceptance/bundle/python/clusters-support/databricks.yml new file mode 100644 index 00000000000..7c90267663e --- /dev/null +++ b/acceptance/bundle/python/clusters-support/databricks.yml @@ -0,0 +1,17 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_cluster" + +resources: + clusters: + my_cluster_1: + cluster_name: "my_cluster_1" + spark_version: "13.3.x-scala2.12" + num_workers: 1 diff --git a/acceptance/bundle/python/clusters-support/mutators.py b/acceptance/bundle/python/clusters-support/mutators.py new file mode 100644 index 00000000000..8aad2a5bc8c --- /dev/null +++ b/acceptance/bundle/python/clusters-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.clusters import Cluster +from databricks.bundles.core import cluster_mutator + + +@cluster_mutator +def update_cluster(cluster: Cluster) -> Cluster: + assert isinstance(cluster.cluster_name, str) + + return replace(cluster, cluster_name=f"{cluster.cluster_name} (updated)") diff --git a/acceptance/bundle/python/clusters-support/out.test.toml b/acceptance/bundle/python/clusters-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/clusters-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/clusters-support/output.txt b/acceptance/bundle/python/clusters-support/output.txt new file mode 100644 index 00000000000..6088a23cb7d --- /dev/null +++ b/acceptance/bundle/python/clusters-support/output.txt @@ -0,0 +1,30 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_cluster" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "clusters": { + "my_cluster_1": { + "autotermination_minutes": 60, + "cluster_name": "my_cluster_1 (updated)", + "num_workers": 1, + "spark_version": "13.3.x-scala2.12" + }, + "my_cluster_2": { + "autotermination_minutes": 60, + "cluster_name": "my_cluster_2 (updated)", + "num_workers": 1, + "spark_version": "13.3.x-scala2.12" + } + } + } +} diff --git a/acceptance/bundle/python/clusters-support/resources.py b/acceptance/bundle/python/clusters-support/resources.py new file mode 100644 index 00000000000..434349b2bbe --- /dev/null +++ b/acceptance/bundle/python/clusters-support/resources.py @@ -0,0 +1,16 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_cluster( + "my_cluster_2", + { + "cluster_name": "my_cluster_2", + "spark_version": "13.3.x-scala2.12", + "num_workers": 1, + }, + ) + + return resources diff --git a/acceptance/bundle/python/clusters-support/script b/acceptance/bundle/python/clusters-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/clusters-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/clusters-support/test.toml b/acceptance/bundle/python/clusters-support/test.toml new file mode 100644 index 00000000000..7b118126b12 --- /dev/null +++ b/acceptance/bundle/python/clusters-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# clusters are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/database_catalogs-support/databricks.yml b/acceptance/bundle/python/database_catalogs-support/databricks.yml new file mode 100644 index 00000000000..869592c9a17 --- /dev/null +++ b/acceptance/bundle/python/database_catalogs-support/databricks.yml @@ -0,0 +1,17 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_database_catalog" + +resources: + database_catalogs: + my_database_catalog_1: + database_instance_name: "test_instance" + database_name: "test_db" + name: "my_database_catalog_1" diff --git a/acceptance/bundle/python/database_catalogs-support/mutators.py b/acceptance/bundle/python/database_catalogs-support/mutators.py new file mode 100644 index 00000000000..802a2a40bfc --- /dev/null +++ b/acceptance/bundle/python/database_catalogs-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.core import database_catalog_mutator +from databricks.bundles.database_catalogs import DatabaseCatalog + + +@database_catalog_mutator +def update_database_catalog(database_catalog: DatabaseCatalog) -> DatabaseCatalog: + assert isinstance(database_catalog.name, str) + + return replace(database_catalog, name=f"{database_catalog.name} (updated)") diff --git a/acceptance/bundle/python/database_catalogs-support/out.test.toml b/acceptance/bundle/python/database_catalogs-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/database_catalogs-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/database_catalogs-support/output.txt b/acceptance/bundle/python/database_catalogs-support/output.txt new file mode 100644 index 00000000000..5b72712ddaa --- /dev/null +++ b/acceptance/bundle/python/database_catalogs-support/output.txt @@ -0,0 +1,28 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_database_catalog" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "database_catalogs": { + "my_database_catalog_1": { + "database_instance_name": "test_instance", + "database_name": "test_db", + "name": "my_database_catalog_1 (updated)" + }, + "my_database_catalog_2": { + "database_instance_name": "test_instance", + "database_name": "test_db_2", + "name": "my_database_catalog_2 (updated)" + } + } + } +} diff --git a/acceptance/bundle/python/database_catalogs-support/resources.py b/acceptance/bundle/python/database_catalogs-support/resources.py new file mode 100644 index 00000000000..8aa8ca8a96b --- /dev/null +++ b/acceptance/bundle/python/database_catalogs-support/resources.py @@ -0,0 +1,16 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_database_catalog( + "my_database_catalog_2", + { + "database_instance_name": "test_instance", + "database_name": "test_db_2", + "name": "my_database_catalog_2", + }, + ) + + return resources diff --git a/acceptance/bundle/python/database_catalogs-support/script b/acceptance/bundle/python/database_catalogs-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/database_catalogs-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/database_catalogs-support/test.toml b/acceptance/bundle/python/database_catalogs-support/test.toml new file mode 100644 index 00000000000..8ef152dbe21 --- /dev/null +++ b/acceptance/bundle/python/database_catalogs-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# database_catalogs are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/database_instances-support/databricks.yml b/acceptance/bundle/python/database_instances-support/databricks.yml new file mode 100644 index 00000000000..fd6e9f200ae --- /dev/null +++ b/acceptance/bundle/python/database_instances-support/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_database_instance" + +resources: + database_instances: + my_database_instance_1: + name: "my_database_instance_1" + capacity: "CU_1" diff --git a/acceptance/bundle/python/database_instances-support/mutators.py b/acceptance/bundle/python/database_instances-support/mutators.py new file mode 100644 index 00000000000..685551d1ee6 --- /dev/null +++ b/acceptance/bundle/python/database_instances-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.database_instances import DatabaseInstance +from databricks.bundles.core import database_instance_mutator + + +@database_instance_mutator +def update_database_instance(database_instance: DatabaseInstance) -> DatabaseInstance: + assert isinstance(database_instance.name, str) + + return replace(database_instance, name=f"{database_instance.name} (updated)") diff --git a/acceptance/bundle/python/database_instances-support/out.test.toml b/acceptance/bundle/python/database_instances-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/database_instances-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/database_instances-support/output.txt b/acceptance/bundle/python/database_instances-support/output.txt new file mode 100644 index 00000000000..6ce8aadf764 --- /dev/null +++ b/acceptance/bundle/python/database_instances-support/output.txt @@ -0,0 +1,26 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_database_instance" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "database_instances": { + "my_database_instance_1": { + "capacity": "CU_1", + "name": "my_database_instance_1 (updated)" + }, + "my_database_instance_2": { + "capacity": "CU_1", + "name": "my_database_instance_2 (updated)" + } + } + } +} diff --git a/acceptance/bundle/python/database_instances-support/resources.py b/acceptance/bundle/python/database_instances-support/resources.py new file mode 100644 index 00000000000..ab65ede3d26 --- /dev/null +++ b/acceptance/bundle/python/database_instances-support/resources.py @@ -0,0 +1,15 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_database_instance( + "my_database_instance_2", + { + "name": "my_database_instance_2", + "capacity": "CU_1", + }, + ) + + return resources diff --git a/acceptance/bundle/python/database_instances-support/script b/acceptance/bundle/python/database_instances-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/database_instances-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/database_instances-support/test.toml b/acceptance/bundle/python/database_instances-support/test.toml new file mode 100644 index 00000000000..a2093f387f2 --- /dev/null +++ b/acceptance/bundle/python/database_instances-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# database_instances are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/experiments-support/databricks.yml b/acceptance/bundle/python/experiments-support/databricks.yml new file mode 100644 index 00000000000..8f891041585 --- /dev/null +++ b/acceptance/bundle/python/experiments-support/databricks.yml @@ -0,0 +1,15 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_mlflow_experiment" + +resources: + experiments: + my_experiment_1: + name: "/my_experiment_1" diff --git a/acceptance/bundle/python/experiments-support/mutators.py b/acceptance/bundle/python/experiments-support/mutators.py new file mode 100644 index 00000000000..682f2ee8e99 --- /dev/null +++ b/acceptance/bundle/python/experiments-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.experiments import MlflowExperiment +from databricks.bundles.core import mlflow_experiment_mutator + + +@mlflow_experiment_mutator +def update_mlflow_experiment(experiment: MlflowExperiment) -> MlflowExperiment: + assert isinstance(experiment.name, str) + + return replace(experiment, name=f"{experiment.name} (updated)") diff --git a/acceptance/bundle/python/experiments-support/out.test.toml b/acceptance/bundle/python/experiments-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/experiments-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/experiments-support/output.txt b/acceptance/bundle/python/experiments-support/output.txt new file mode 100644 index 00000000000..4280a2bc8de --- /dev/null +++ b/acceptance/bundle/python/experiments-support/output.txt @@ -0,0 +1,24 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_mlflow_experiment" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "experiments": { + "my_experiment_1": { + "name": "//my_experiment_1 (updated)" + }, + "my_experiment_2": { + "name": "//my_experiment_2 (updated)" + } + } + } +} diff --git a/acceptance/bundle/python/experiments-support/resources.py b/acceptance/bundle/python/experiments-support/resources.py new file mode 100644 index 00000000000..a3db67dac41 --- /dev/null +++ b/acceptance/bundle/python/experiments-support/resources.py @@ -0,0 +1,14 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_mlflow_experiment( + "my_experiment_2", + { + "name": "/my_experiment_2", + }, + ) + + return resources diff --git a/acceptance/bundle/python/experiments-support/script b/acceptance/bundle/python/experiments-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/experiments-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/experiments-support/test.toml b/acceptance/bundle/python/experiments-support/test.toml new file mode 100644 index 00000000000..1c1599a11cb --- /dev/null +++ b/acceptance/bundle/python/experiments-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# experiments are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/external_locations-support/databricks.yml b/acceptance/bundle/python/external_locations-support/databricks.yml new file mode 100644 index 00000000000..55b0c8cc6fd --- /dev/null +++ b/acceptance/bundle/python/external_locations-support/databricks.yml @@ -0,0 +1,17 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_external_location" + +resources: + external_locations: + my_location_1: + name: "my_location_1" + url: "s3://test-bucket/path" + credential_name: "test_cred" diff --git a/acceptance/bundle/python/external_locations-support/mutators.py b/acceptance/bundle/python/external_locations-support/mutators.py new file mode 100644 index 00000000000..f0030a43639 --- /dev/null +++ b/acceptance/bundle/python/external_locations-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.core import external_location_mutator +from databricks.bundles.external_locations import ExternalLocation + + +@external_location_mutator +def update_external_location(location: ExternalLocation) -> ExternalLocation: + assert isinstance(location.name, str) + + return replace(location, name=f"{location.name} (updated)") diff --git a/acceptance/bundle/python/external_locations-support/out.test.toml b/acceptance/bundle/python/external_locations-support/out.test.toml new file mode 100644 index 00000000000..8feac676720 --- /dev/null +++ b/acceptance/bundle/python/external_locations-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/external_locations-support/output.txt b/acceptance/bundle/python/external_locations-support/output.txt new file mode 100644 index 00000000000..0f9ca1b7fea --- /dev/null +++ b/acceptance/bundle/python/external_locations-support/output.txt @@ -0,0 +1,28 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_external_location" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "external_locations": { + "my_location_1": { + "credential_name": "test_cred", + "name": "my_location_1 (updated)", + "url": "s3://test-bucket/path" + }, + "my_location_2": { + "credential_name": "test_cred", + "name": "my_location_2 (updated)", + "url": "s3://test-bucket/path2" + } + } + } +} diff --git a/acceptance/bundle/python/external_locations-support/resources.py b/acceptance/bundle/python/external_locations-support/resources.py new file mode 100644 index 00000000000..cdbc16df964 --- /dev/null +++ b/acceptance/bundle/python/external_locations-support/resources.py @@ -0,0 +1,16 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_external_location( + "my_location_2", + { + "name": "my_location_2", + "url": "s3://test-bucket/path2", + "credential_name": "test_cred", + }, + ) + + return resources diff --git a/acceptance/bundle/python/external_locations-support/script b/acceptance/bundle/python/external_locations-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/external_locations-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/external_locations-support/test.toml b/acceptance/bundle/python/external_locations-support/test.toml new file mode 100644 index 00000000000..bc1dcb19111 --- /dev/null +++ b/acceptance/bundle/python/external_locations-support/test.toml @@ -0,0 +1,7 @@ +Cloud = false # tests don't interact with APIs + +# external_locations are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] + +# external_locations are only supported on the direct deployment engine +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/python/instance_pools-support/databricks.yml b/acceptance/bundle/python/instance_pools-support/databricks.yml new file mode 100644 index 00000000000..9760325c97e --- /dev/null +++ b/acceptance/bundle/python/instance_pools-support/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_instance_pool" + +resources: + instance_pools: + my_pool_1: + instance_pool_name: "my_pool_1" + node_type_id: "i3.xlarge" diff --git a/acceptance/bundle/python/instance_pools-support/mutators.py b/acceptance/bundle/python/instance_pools-support/mutators.py new file mode 100644 index 00000000000..49a8b200263 --- /dev/null +++ b/acceptance/bundle/python/instance_pools-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.core import instance_pool_mutator +from databricks.bundles.instance_pools import InstancePool + + +@instance_pool_mutator +def update_instance_pool(pool: InstancePool) -> InstancePool: + assert isinstance(pool.instance_pool_name, str) + + return replace(pool, instance_pool_name=f"{pool.instance_pool_name} (updated)") diff --git a/acceptance/bundle/python/instance_pools-support/out.test.toml b/acceptance/bundle/python/instance_pools-support/out.test.toml new file mode 100644 index 00000000000..8feac676720 --- /dev/null +++ b/acceptance/bundle/python/instance_pools-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/instance_pools-support/output.txt b/acceptance/bundle/python/instance_pools-support/output.txt new file mode 100644 index 00000000000..701d3a8b1d2 --- /dev/null +++ b/acceptance/bundle/python/instance_pools-support/output.txt @@ -0,0 +1,26 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_instance_pool" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "instance_pools": { + "my_pool_1": { + "instance_pool_name": "my_pool_1 (updated)", + "node_type_id": "[NODE_TYPE_ID]" + }, + "my_pool_2": { + "instance_pool_name": "my_pool_2 (updated)", + "node_type_id": "[NODE_TYPE_ID]" + } + } + } +} diff --git a/acceptance/bundle/python/instance_pools-support/resources.py b/acceptance/bundle/python/instance_pools-support/resources.py new file mode 100644 index 00000000000..8ef6bf4789e --- /dev/null +++ b/acceptance/bundle/python/instance_pools-support/resources.py @@ -0,0 +1,15 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_instance_pool( + "my_pool_2", + { + "instance_pool_name": "my_pool_2", + "node_type_id": "i3.xlarge", + }, + ) + + return resources diff --git a/acceptance/bundle/python/instance_pools-support/script b/acceptance/bundle/python/instance_pools-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/instance_pools-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/instance_pools-support/test.toml b/acceptance/bundle/python/instance_pools-support/test.toml new file mode 100644 index 00000000000..4f7794ae00c --- /dev/null +++ b/acceptance/bundle/python/instance_pools-support/test.toml @@ -0,0 +1,7 @@ +Cloud = false # tests don't interact with APIs + +# instance_pools are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] + +# instance_pools are only supported on the direct deployment engine +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/python/job_runs-support/databricks.yml b/acceptance/bundle/python/job_runs-support/databricks.yml new file mode 100644 index 00000000000..6edcb37c932 --- /dev/null +++ b/acceptance/bundle/python/job_runs-support/databricks.yml @@ -0,0 +1,17 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_job_run" + +resources: + job_runs: + my_run_1: + job_id: 1 + job_parameters: + description: "test" diff --git a/acceptance/bundle/python/job_runs-support/mutators.py b/acceptance/bundle/python/job_runs-support/mutators.py new file mode 100644 index 00000000000..0ec911f9fda --- /dev/null +++ b/acceptance/bundle/python/job_runs-support/mutators.py @@ -0,0 +1,19 @@ +from dataclasses import replace +from typing import Any, Dict + +from databricks.bundles.core import job_run_mutator +from databricks.bundles.job_runs import JobRun + + +@job_run_mutator +def update_job_run(run: JobRun) -> JobRun: + # Update job_parameters dict with " (updated)" suffix to description + params = run.job_parameters or {} + updated_params: Dict[str, Any] = {} + for key, value in params.items(): + if key == "description" and isinstance(value, str): + updated_params[key] = f"{value} (updated)" + else: + updated_params[key] = value + + return replace(run, job_parameters=updated_params) diff --git a/acceptance/bundle/python/job_runs-support/out.test.toml b/acceptance/bundle/python/job_runs-support/out.test.toml new file mode 100644 index 00000000000..8feac676720 --- /dev/null +++ b/acceptance/bundle/python/job_runs-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/job_runs-support/output.txt b/acceptance/bundle/python/job_runs-support/output.txt new file mode 100644 index 00000000000..a926f628b96 --- /dev/null +++ b/acceptance/bundle/python/job_runs-support/output.txt @@ -0,0 +1,30 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_job_run" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "job_runs": { + "my_run_1": { + "job_id": 1, + "job_parameters": { + "description": "test (updated)" + } + }, + "my_run_2": { + "job_id": 1, + "job_parameters": { + "description": "test (updated)" + } + } + } + } +} diff --git a/acceptance/bundle/python/job_runs-support/resources.py b/acceptance/bundle/python/job_runs-support/resources.py new file mode 100644 index 00000000000..5cf76ef752a --- /dev/null +++ b/acceptance/bundle/python/job_runs-support/resources.py @@ -0,0 +1,15 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_job_run( + "my_run_2", + { + "job_id": 1, + "job_parameters": {"description": "test"}, + }, + ) + + return resources diff --git a/acceptance/bundle/python/job_runs-support/script b/acceptance/bundle/python/job_runs-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/job_runs-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/job_runs-support/test.toml b/acceptance/bundle/python/job_runs-support/test.toml new file mode 100644 index 00000000000..56c3e19efc8 --- /dev/null +++ b/acceptance/bundle/python/job_runs-support/test.toml @@ -0,0 +1,7 @@ +Cloud = false # tests don't interact with APIs + +# job_runs are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] + +# job_runs are only supported on the direct deployment engine +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/python/model_serving_endpoints-support/databricks.yml b/acceptance/bundle/python/model_serving_endpoints-support/databricks.yml new file mode 100644 index 00000000000..bf1e1a324cf --- /dev/null +++ b/acceptance/bundle/python/model_serving_endpoints-support/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_model_serving_endpoint" + +resources: + model_serving_endpoints: + my_endpoint_1: + name: "my_endpoint_1" + description: "My endpoint" diff --git a/acceptance/bundle/python/model_serving_endpoints-support/mutators.py b/acceptance/bundle/python/model_serving_endpoints-support/mutators.py new file mode 100644 index 00000000000..a86c55757a3 --- /dev/null +++ b/acceptance/bundle/python/model_serving_endpoints-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.model_serving_endpoints import ModelServingEndpoint +from databricks.bundles.core import model_serving_endpoint_mutator + + +@model_serving_endpoint_mutator +def update_model_serving_endpoint(endpoint: ModelServingEndpoint) -> ModelServingEndpoint: + assert isinstance(endpoint.name, str) + + return replace(endpoint, name=f"{endpoint.name} (updated)") diff --git a/acceptance/bundle/python/model_serving_endpoints-support/out.test.toml b/acceptance/bundle/python/model_serving_endpoints-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/model_serving_endpoints-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/model_serving_endpoints-support/output.txt b/acceptance/bundle/python/model_serving_endpoints-support/output.txt new file mode 100644 index 00000000000..3adc3abd079 --- /dev/null +++ b/acceptance/bundle/python/model_serving_endpoints-support/output.txt @@ -0,0 +1,26 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_model_serving_endpoint" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "model_serving_endpoints": { + "my_endpoint_1": { + "description": "My endpoint", + "name": "my_endpoint_1 (updated)" + }, + "my_endpoint_2": { + "description": "My endpoint (2)", + "name": "my_endpoint_2 (updated)" + } + } + } +} diff --git a/acceptance/bundle/python/model_serving_endpoints-support/resources.py b/acceptance/bundle/python/model_serving_endpoints-support/resources.py new file mode 100644 index 00000000000..08dc2faa72d --- /dev/null +++ b/acceptance/bundle/python/model_serving_endpoints-support/resources.py @@ -0,0 +1,15 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_model_serving_endpoint( + "my_endpoint_2", + { + "name": "my_endpoint_2", + "description": "My endpoint (2)", + }, + ) + + return resources diff --git a/acceptance/bundle/python/model_serving_endpoints-support/script b/acceptance/bundle/python/model_serving_endpoints-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/model_serving_endpoints-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/model_serving_endpoints-support/test.toml b/acceptance/bundle/python/model_serving_endpoints-support/test.toml new file mode 100644 index 00000000000..4669afde3f0 --- /dev/null +++ b/acceptance/bundle/python/model_serving_endpoints-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# model_serving_endpoints are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/models-support/databricks.yml b/acceptance/bundle/python/models-support/databricks.yml new file mode 100644 index 00000000000..2167c246e2a --- /dev/null +++ b/acceptance/bundle/python/models-support/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_mlflow_model" + +resources: + models: + my_model_1: + name: "my_model_1" + description: "My model" diff --git a/acceptance/bundle/python/models-support/mutators.py b/acceptance/bundle/python/models-support/mutators.py new file mode 100644 index 00000000000..8a8f7cd8918 --- /dev/null +++ b/acceptance/bundle/python/models-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.models import MlflowModel +from databricks.bundles.core import mlflow_model_mutator + + +@mlflow_model_mutator +def update_mlflow_model(model: MlflowModel) -> MlflowModel: + assert isinstance(model.name, str) + + return replace(model, name=f"{model.name} (updated)") diff --git a/acceptance/bundle/python/models-support/out.test.toml b/acceptance/bundle/python/models-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/models-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/models-support/output.txt b/acceptance/bundle/python/models-support/output.txt new file mode 100644 index 00000000000..d7e8e47d885 --- /dev/null +++ b/acceptance/bundle/python/models-support/output.txt @@ -0,0 +1,26 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_mlflow_model" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "models": { + "my_model_1": { + "description": "My model", + "name": "my_model_1 (updated)" + }, + "my_model_2": { + "description": "My model (2)", + "name": "my_model_2 (updated)" + } + } + } +} diff --git a/acceptance/bundle/python/models-support/resources.py b/acceptance/bundle/python/models-support/resources.py new file mode 100644 index 00000000000..593507b61d7 --- /dev/null +++ b/acceptance/bundle/python/models-support/resources.py @@ -0,0 +1,15 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_mlflow_model( + "my_model_2", + { + "name": "my_model_2", + "description": "My model (2)", + }, + ) + + return resources diff --git a/acceptance/bundle/python/models-support/script b/acceptance/bundle/python/models-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/models-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/models-support/test.toml b/acceptance/bundle/python/models-support/test.toml new file mode 100644 index 00000000000..88fe8ee4990 --- /dev/null +++ b/acceptance/bundle/python/models-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# models are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/quality_monitors-support/databricks.yml b/acceptance/bundle/python/quality_monitors-support/databricks.yml new file mode 100644 index 00000000000..7fd203d8bf1 --- /dev/null +++ b/acceptance/bundle/python/quality_monitors-support/databricks.yml @@ -0,0 +1,17 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_quality_monitor" + +resources: + quality_monitors: + my_monitor_1: + assets_dir: "/Workspace/monitoring" + output_schema_name: "default.monitoring" + table_name: "default.test_table" diff --git a/acceptance/bundle/python/quality_monitors-support/mutators.py b/acceptance/bundle/python/quality_monitors-support/mutators.py new file mode 100644 index 00000000000..d53fed2f9a3 --- /dev/null +++ b/acceptance/bundle/python/quality_monitors-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.core import quality_monitor_mutator +from databricks.bundles.quality_monitors import QualityMonitor + + +@quality_monitor_mutator +def update_quality_monitor(monitor: QualityMonitor) -> QualityMonitor: + assert isinstance(monitor.output_schema_name, str) + + return replace(monitor, output_schema_name=f"{monitor.output_schema_name} (updated)") diff --git a/acceptance/bundle/python/quality_monitors-support/out.test.toml b/acceptance/bundle/python/quality_monitors-support/out.test.toml new file mode 100644 index 00000000000..8feac676720 --- /dev/null +++ b/acceptance/bundle/python/quality_monitors-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/quality_monitors-support/output.txt b/acceptance/bundle/python/quality_monitors-support/output.txt new file mode 100644 index 00000000000..708ce30fc88 --- /dev/null +++ b/acceptance/bundle/python/quality_monitors-support/output.txt @@ -0,0 +1,28 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_quality_monitor" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "quality_monitors": { + "my_monitor_1": { + "assets_dir": "/Workspace/monitoring", + "output_schema_name": "default.monitoring (updated)", + "table_name": "default.test_table" + }, + "my_monitor_2": { + "assets_dir": "/Workspace/monitoring", + "output_schema_name": "default.monitoring (updated)", + "table_name": "default.test_table" + } + } + } +} diff --git a/acceptance/bundle/python/quality_monitors-support/resources.py b/acceptance/bundle/python/quality_monitors-support/resources.py new file mode 100644 index 00000000000..8e26b02bc1e --- /dev/null +++ b/acceptance/bundle/python/quality_monitors-support/resources.py @@ -0,0 +1,16 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_quality_monitor( + "my_monitor_2", + { + "assets_dir": "/Workspace/monitoring", + "output_schema_name": "default.monitoring", + "table_name": "default.test_table", + }, + ) + + return resources diff --git a/acceptance/bundle/python/quality_monitors-support/script b/acceptance/bundle/python/quality_monitors-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/quality_monitors-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/quality_monitors-support/test.toml b/acceptance/bundle/python/quality_monitors-support/test.toml new file mode 100644 index 00000000000..3e8bfd9efd3 --- /dev/null +++ b/acceptance/bundle/python/quality_monitors-support/test.toml @@ -0,0 +1,7 @@ +Cloud = false # tests don't interact with APIs + +# quality_monitors are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] + +# quality_monitors are only supported on the direct deployment engine +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/python/registered_models-support/databricks.yml b/acceptance/bundle/python/registered_models-support/databricks.yml new file mode 100644 index 00000000000..8de75616dba --- /dev/null +++ b/acceptance/bundle/python/registered_models-support/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_registered_model" + +resources: + registered_models: + my_registered_model_1: + name: "my_registered_model_1" + comment: "My model" diff --git a/acceptance/bundle/python/registered_models-support/mutators.py b/acceptance/bundle/python/registered_models-support/mutators.py new file mode 100644 index 00000000000..b48e8b1a86f --- /dev/null +++ b/acceptance/bundle/python/registered_models-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.core import registered_model_mutator +from databricks.bundles.registered_models import RegisteredModel + + +@registered_model_mutator +def update_registered_model(registered_model: RegisteredModel) -> RegisteredModel: + assert isinstance(registered_model.comment, str) + + return replace(registered_model, comment=f"{registered_model.comment} (updated)") diff --git a/acceptance/bundle/python/registered_models-support/out.test.toml b/acceptance/bundle/python/registered_models-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/registered_models-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/registered_models-support/output.txt b/acceptance/bundle/python/registered_models-support/output.txt new file mode 100644 index 00000000000..1a6fbbde43b --- /dev/null +++ b/acceptance/bundle/python/registered_models-support/output.txt @@ -0,0 +1,26 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_registered_model" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "registered_models": { + "my_registered_model_1": { + "comment": "My model (updated)", + "name": "my_registered_model_1" + }, + "my_registered_model_2": { + "comment": "My model (2) (updated)", + "name": "my_registered_model_2" + } + } + } +} diff --git a/acceptance/bundle/python/registered_models-support/resources.py b/acceptance/bundle/python/registered_models-support/resources.py new file mode 100644 index 00000000000..b05fbbca011 --- /dev/null +++ b/acceptance/bundle/python/registered_models-support/resources.py @@ -0,0 +1,15 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_registered_model( + "my_registered_model_2", + { + "name": "my_registered_model_2", + "comment": "My model (2)", + }, + ) + + return resources diff --git a/acceptance/bundle/python/registered_models-support/script b/acceptance/bundle/python/registered_models-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/registered_models-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/registered_models-support/test.toml b/acceptance/bundle/python/registered_models-support/test.toml new file mode 100644 index 00000000000..b8a3736ca28 --- /dev/null +++ b/acceptance/bundle/python/registered_models-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# registered_models are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/secret_scopes-support/databricks.yml b/acceptance/bundle/python/secret_scopes-support/databricks.yml new file mode 100644 index 00000000000..3be6b161c51 --- /dev/null +++ b/acceptance/bundle/python/secret_scopes-support/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_secret_scope" + +resources: + secret_scopes: + my_scope_1: + name: "my_scope_1" + backend_type: "DATABRICKS" diff --git a/acceptance/bundle/python/secret_scopes-support/mutators.py b/acceptance/bundle/python/secret_scopes-support/mutators.py new file mode 100644 index 00000000000..ace70fd68f4 --- /dev/null +++ b/acceptance/bundle/python/secret_scopes-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.secret_scopes import SecretScope +from databricks.bundles.core import secret_scope_mutator + + +@secret_scope_mutator +def update_secret_scope(scope: SecretScope) -> SecretScope: + assert isinstance(scope.name, str) + + return replace(scope, name=f"{scope.name} (updated)") diff --git a/acceptance/bundle/python/secret_scopes-support/out.test.toml b/acceptance/bundle/python/secret_scopes-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/secret_scopes-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/secret_scopes-support/output.txt b/acceptance/bundle/python/secret_scopes-support/output.txt new file mode 100644 index 00000000000..c3139333141 --- /dev/null +++ b/acceptance/bundle/python/secret_scopes-support/output.txt @@ -0,0 +1,26 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_secret_scope" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "secret_scopes": { + "my_scope_1": { + "backend_type": "DATABRICKS", + "name": "my_scope_1 (updated)" + }, + "my_scope_2": { + "backend_type": "DATABRICKS", + "name": "my_scope_2 (updated)" + } + } + } +} diff --git a/acceptance/bundle/python/secret_scopes-support/resources.py b/acceptance/bundle/python/secret_scopes-support/resources.py new file mode 100644 index 00000000000..64c21b39f9a --- /dev/null +++ b/acceptance/bundle/python/secret_scopes-support/resources.py @@ -0,0 +1,15 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_secret_scope( + "my_scope_2", + { + "name": "my_scope_2", + "backend_type": "DATABRICKS", + }, + ) + + return resources diff --git a/acceptance/bundle/python/secret_scopes-support/script b/acceptance/bundle/python/secret_scopes-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/secret_scopes-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/secret_scopes-support/test.toml b/acceptance/bundle/python/secret_scopes-support/test.toml new file mode 100644 index 00000000000..b9d934df8fe --- /dev/null +++ b/acceptance/bundle/python/secret_scopes-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# secret_scopes are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/sql_warehouses-support/databricks.yml b/acceptance/bundle/python/sql_warehouses-support/databricks.yml new file mode 100644 index 00000000000..3a7a3012756 --- /dev/null +++ b/acceptance/bundle/python/sql_warehouses-support/databricks.yml @@ -0,0 +1,20 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_sql_warehouse" + +resources: + sql_warehouses: + my_sql_warehouse_1: + name: "my_sql_warehouse_1" + cluster_size: "2X-Small" + auto_stop_mins: 10 + max_num_clusters: 1 + min_num_clusters: 1 + warehouse_type: "CLASSIC" diff --git a/acceptance/bundle/python/sql_warehouses-support/mutators.py b/acceptance/bundle/python/sql_warehouses-support/mutators.py new file mode 100644 index 00000000000..67cf5d9b07d --- /dev/null +++ b/acceptance/bundle/python/sql_warehouses-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.core import sql_warehouse_mutator +from databricks.bundles.sql_warehouses import SqlWarehouse + + +@sql_warehouse_mutator +def update_sql_warehouse(sql_warehouse: SqlWarehouse) -> SqlWarehouse: + assert isinstance(sql_warehouse.name, str) + + return replace(sql_warehouse, name=f"{sql_warehouse.name} (updated)") diff --git a/acceptance/bundle/python/sql_warehouses-support/out.test.toml b/acceptance/bundle/python/sql_warehouses-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/sql_warehouses-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/sql_warehouses-support/output.txt b/acceptance/bundle/python/sql_warehouses-support/output.txt new file mode 100644 index 00000000000..65c2cae42b2 --- /dev/null +++ b/acceptance/bundle/python/sql_warehouses-support/output.txt @@ -0,0 +1,38 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_sql_warehouse" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "sql_warehouses": { + "my_sql_warehouse_1": { + "auto_stop_mins": 10, + "cluster_size": "2X-Small", + "enable_photon": true, + "max_num_clusters": 1, + "min_num_clusters": 1, + "name": "my_sql_warehouse_1 (updated)", + "spot_instance_policy": "COST_OPTIMIZED", + "warehouse_type": "CLASSIC" + }, + "my_sql_warehouse_2": { + "auto_stop_mins": 10, + "cluster_size": "2X-Small", + "enable_photon": true, + "max_num_clusters": 1, + "min_num_clusters": 1, + "name": "my_sql_warehouse_2 (updated)", + "spot_instance_policy": "COST_OPTIMIZED", + "warehouse_type": "CLASSIC" + } + } + } +} diff --git a/acceptance/bundle/python/sql_warehouses-support/resources.py b/acceptance/bundle/python/sql_warehouses-support/resources.py new file mode 100644 index 00000000000..bcd2f0676a6 --- /dev/null +++ b/acceptance/bundle/python/sql_warehouses-support/resources.py @@ -0,0 +1,19 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_sql_warehouse( + "my_sql_warehouse_2", + { + "name": "my_sql_warehouse_2", + "cluster_size": "2X-Small", + "auto_stop_mins": 10, + "max_num_clusters": 1, + "min_num_clusters": 1, + "warehouse_type": "CLASSIC", + }, + ) + + return resources diff --git a/acceptance/bundle/python/sql_warehouses-support/script b/acceptance/bundle/python/sql_warehouses-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/sql_warehouses-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/sql_warehouses-support/test.toml b/acceptance/bundle/python/sql_warehouses-support/test.toml new file mode 100644 index 00000000000..964cb938f02 --- /dev/null +++ b/acceptance/bundle/python/sql_warehouses-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# sql_warehouses are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/synced_database_tables-support/databricks.yml b/acceptance/bundle/python/synced_database_tables-support/databricks.yml new file mode 100644 index 00000000000..0867ea43b6c --- /dev/null +++ b/acceptance/bundle/python/synced_database_tables-support/databricks.yml @@ -0,0 +1,15 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_synced_database_table" + +resources: + synced_database_tables: + my_synced_table_1: + name: "main.default.my_synced_table_1" diff --git a/acceptance/bundle/python/synced_database_tables-support/mutators.py b/acceptance/bundle/python/synced_database_tables-support/mutators.py new file mode 100644 index 00000000000..2c9cd6ec3c0 --- /dev/null +++ b/acceptance/bundle/python/synced_database_tables-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.core import synced_database_table_mutator +from databricks.bundles.synced_database_tables import SyncedDatabaseTable + + +@synced_database_table_mutator +def update_synced_database_table(synced_database_table: SyncedDatabaseTable) -> SyncedDatabaseTable: + assert isinstance(synced_database_table.name, str) + + return replace(synced_database_table, name=f"{synced_database_table.name} (updated)") diff --git a/acceptance/bundle/python/synced_database_tables-support/out.test.toml b/acceptance/bundle/python/synced_database_tables-support/out.test.toml new file mode 100644 index 00000000000..02da5baab89 --- /dev/null +++ b/acceptance/bundle/python/synced_database_tables-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["terraform", "direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/synced_database_tables-support/output.txt b/acceptance/bundle/python/synced_database_tables-support/output.txt new file mode 100644 index 00000000000..643fccdfcad --- /dev/null +++ b/acceptance/bundle/python/synced_database_tables-support/output.txt @@ -0,0 +1,24 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_synced_database_table" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "synced_database_tables": { + "my_synced_table_1": { + "name": "main.default.my_synced_table_1 (updated)" + }, + "my_synced_table_2": { + "name": "main.default.my_synced_table_2 (updated)" + } + } + } +} diff --git a/acceptance/bundle/python/synced_database_tables-support/resources.py b/acceptance/bundle/python/synced_database_tables-support/resources.py new file mode 100644 index 00000000000..3e416b28f2e --- /dev/null +++ b/acceptance/bundle/python/synced_database_tables-support/resources.py @@ -0,0 +1,14 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_synced_database_table( + "my_synced_table_2", + { + "name": "main.default.my_synced_table_2", + }, + ) + + return resources diff --git a/acceptance/bundle/python/synced_database_tables-support/script b/acceptance/bundle/python/synced_database_tables-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/synced_database_tables-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/synced_database_tables-support/test.toml b/acceptance/bundle/python/synced_database_tables-support/test.toml new file mode 100644 index 00000000000..08a67723677 --- /dev/null +++ b/acceptance/bundle/python/synced_database_tables-support/test.toml @@ -0,0 +1,4 @@ +Cloud = false # tests don't interact with APIs + +# synced_database_tables are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/vector_search_endpoints-support/databricks.yml b/acceptance/bundle/python/vector_search_endpoints-support/databricks.yml new file mode 100644 index 00000000000..94dfd6f2e99 --- /dev/null +++ b/acceptance/bundle/python/vector_search_endpoints-support/databricks.yml @@ -0,0 +1,16 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_vector_search_endpoint" + +resources: + vector_search_endpoints: + my_endpoint_1: + name: "my_endpoint_1" + endpoint_type: "STANDARD" diff --git a/acceptance/bundle/python/vector_search_endpoints-support/mutators.py b/acceptance/bundle/python/vector_search_endpoints-support/mutators.py new file mode 100644 index 00000000000..743001fd4c8 --- /dev/null +++ b/acceptance/bundle/python/vector_search_endpoints-support/mutators.py @@ -0,0 +1,13 @@ +from dataclasses import replace + +from databricks.bundles.core import vector_search_endpoint_mutator +from databricks.bundles.vector_search_endpoints import VectorSearchEndpoint + + +@vector_search_endpoint_mutator +def update_vector_search_endpoint( + endpoint: VectorSearchEndpoint, +) -> VectorSearchEndpoint: + assert isinstance(endpoint.name, str) + + return replace(endpoint, name=f"{endpoint.name} (updated)") diff --git a/acceptance/bundle/python/vector_search_endpoints-support/out.test.toml b/acceptance/bundle/python/vector_search_endpoints-support/out.test.toml new file mode 100644 index 00000000000..8feac676720 --- /dev/null +++ b/acceptance/bundle/python/vector_search_endpoints-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/vector_search_endpoints-support/output.txt b/acceptance/bundle/python/vector_search_endpoints-support/output.txt new file mode 100644 index 00000000000..b0316919bac --- /dev/null +++ b/acceptance/bundle/python/vector_search_endpoints-support/output.txt @@ -0,0 +1,26 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_vector_search_endpoint" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "vector_search_endpoints": { + "my_endpoint_1": { + "endpoint_type": "STANDARD", + "name": "my_endpoint_1 (updated)" + }, + "my_endpoint_2": { + "endpoint_type": "STANDARD", + "name": "my_endpoint_2 (updated)" + } + } + } +} diff --git a/acceptance/bundle/python/vector_search_endpoints-support/resources.py b/acceptance/bundle/python/vector_search_endpoints-support/resources.py new file mode 100644 index 00000000000..df66ab797d6 --- /dev/null +++ b/acceptance/bundle/python/vector_search_endpoints-support/resources.py @@ -0,0 +1,15 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_vector_search_endpoint( + "my_endpoint_2", + { + "name": "my_endpoint_2", + "endpoint_type": "STANDARD", + }, + ) + + return resources diff --git a/acceptance/bundle/python/vector_search_endpoints-support/script b/acceptance/bundle/python/vector_search_endpoints-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/vector_search_endpoints-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/vector_search_endpoints-support/test.toml b/acceptance/bundle/python/vector_search_endpoints-support/test.toml new file mode 100644 index 00000000000..b8e53177777 --- /dev/null +++ b/acceptance/bundle/python/vector_search_endpoints-support/test.toml @@ -0,0 +1,7 @@ +Cloud = false # tests don't interact with APIs + +# vector_search_endpoints are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] + +# vector_search_endpoints are only supported on the direct deployment engine +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/acceptance/bundle/python/vector_search_indexes-support/databricks.yml b/acceptance/bundle/python/vector_search_indexes-support/databricks.yml new file mode 100644 index 00000000000..82d228e3198 --- /dev/null +++ b/acceptance/bundle/python/vector_search_indexes-support/databricks.yml @@ -0,0 +1,18 @@ +bundle: + name: my_project + +sync: {paths: []} # don't need to copy files + +python: + resources: + - "resources:load_resources" + mutators: + - "mutators:update_vector_search_index" + +resources: + vector_search_indexes: + my_index_1: + name: "my_index_1" + endpoint_name: "my_endpoint" + primary_key: "id" + index_type: "DELTA_SYNC" diff --git a/acceptance/bundle/python/vector_search_indexes-support/mutators.py b/acceptance/bundle/python/vector_search_indexes-support/mutators.py new file mode 100644 index 00000000000..e1e7fa5a62b --- /dev/null +++ b/acceptance/bundle/python/vector_search_indexes-support/mutators.py @@ -0,0 +1,11 @@ +from dataclasses import replace + +from databricks.bundles.core import vector_search_index_mutator +from databricks.bundles.vector_search_indexes import VectorSearchIndex + + +@vector_search_index_mutator +def update_vector_search_index(index: VectorSearchIndex) -> VectorSearchIndex: + assert isinstance(index.name, str) + + return replace(index, name=f"{index.name} (updated)") diff --git a/acceptance/bundle/python/vector_search_indexes-support/out.test.toml b/acceptance/bundle/python/vector_search_indexes-support/out.test.toml new file mode 100644 index 00000000000..8feac676720 --- /dev/null +++ b/acceptance/bundle/python/vector_search_indexes-support/out.test.toml @@ -0,0 +1,4 @@ +Cloud = false +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] +EnvMatrix.DMS = ["", "true"] +EnvMatrix.PYDAB_VERSION = ["current"] diff --git a/acceptance/bundle/python/vector_search_indexes-support/output.txt b/acceptance/bundle/python/vector_search_indexes-support/output.txt new file mode 100644 index 00000000000..08fc86da293 --- /dev/null +++ b/acceptance/bundle/python/vector_search_indexes-support/output.txt @@ -0,0 +1,30 @@ + +>>> uv run [UV_ARGS] -q [CLI] bundle validate --output json +{ + "experimental": { + "python": { + "mutators": [ + "mutators:update_vector_search_index" + ], + "resources": [ + "resources:load_resources" + ] + } + }, + "resources": { + "vector_search_indexes": { + "my_index_1": { + "endpoint_name": "my_endpoint", + "index_type": "DELTA_SYNC", + "name": "my_index_1 (updated)", + "primary_key": "id" + }, + "my_index_2": { + "endpoint_name": "my_endpoint", + "index_type": "DELTA_SYNC", + "name": "my_index_2 (updated)", + "primary_key": "id" + } + } + } +} diff --git a/acceptance/bundle/python/vector_search_indexes-support/resources.py b/acceptance/bundle/python/vector_search_indexes-support/resources.py new file mode 100644 index 00000000000..5433fc7258f --- /dev/null +++ b/acceptance/bundle/python/vector_search_indexes-support/resources.py @@ -0,0 +1,17 @@ +from databricks.bundles.core import Resources + + +def load_resources() -> Resources: + resources = Resources() + + resources.add_vector_search_index( + "my_index_2", + { + "name": "my_index_2", + "endpoint_name": "my_endpoint", + "primary_key": "id", + "index_type": "DELTA_SYNC", + }, + ) + + return resources diff --git a/acceptance/bundle/python/vector_search_indexes-support/script b/acceptance/bundle/python/vector_search_indexes-support/script new file mode 100644 index 00000000000..e273fb45a53 --- /dev/null +++ b/acceptance/bundle/python/vector_search_indexes-support/script @@ -0,0 +1,5 @@ + +trace uv run $UV_ARGS -q $CLI bundle validate --output json | \ + jq "pick(.experimental.python, .resources)" + +rm -fr .databricks __pycache__ diff --git a/acceptance/bundle/python/vector_search_indexes-support/test.toml b/acceptance/bundle/python/vector_search_indexes-support/test.toml new file mode 100644 index 00000000000..856a2743169 --- /dev/null +++ b/acceptance/bundle/python/vector_search_indexes-support/test.toml @@ -0,0 +1,7 @@ +Cloud = false # tests don't interact with APIs + +# vector_search_indexes are only supported in the current version of the wheel +EnvMatrix.PYDAB_VERSION = ["current"] + +# vector_search_indexes are only supported on the direct deployment engine +EnvMatrix.DATABRICKS_BUNDLE_ENGINE = ["direct"] diff --git a/python/codegen/codegen/generated_dataclass.py b/python/codegen/codegen/generated_dataclass.py index eb20dabb6e2..ad4f6133aa5 100644 --- a/python/codegen/codegen/generated_dataclass.py +++ b/python/codegen/codegen/generated_dataclass.py @@ -6,7 +6,7 @@ import codegen.packages as packages from codegen.code_builder import CodeBuilder -from codegen.jsonschema import LaunchStage, Property, Schema +from codegen.jsonschema import Property, Schema, is_experimental_stage from codegen.packages import is_resource @@ -161,7 +161,7 @@ def generate_field( default=None, default_factory="dict", create_func_default="None", - experimental=prop.stage == LaunchStage.PRIVATE_PREVIEW, + experimental=is_experimental_stage(prop.stage), deprecated=prop.deprecated or False, ) elif field_type.name == "VariableOrList": @@ -174,7 +174,7 @@ def generate_field( default=None, default_factory="list", create_func_default="None", - experimental=prop.stage == LaunchStage.PRIVATE_PREVIEW, + experimental=is_experimental_stage(prop.stage), deprecated=prop.deprecated or False, ) elif is_required: @@ -187,7 +187,7 @@ def generate_field( default=None, default_factory=None, create_func_default=None, - experimental=prop.stage == LaunchStage.PRIVATE_PREVIEW, + experimental=is_experimental_stage(prop.stage), deprecated=prop.deprecated or False, ) else: @@ -200,7 +200,7 @@ def generate_field( default="None", default_factory=None, create_func_default="None", - experimental=prop.stage == LaunchStage.PRIVATE_PREVIEW, + experimental=is_experimental_stage(prop.stage), deprecated=prop.deprecated or False, ) @@ -335,7 +335,7 @@ def generate_dataclass( description=schema.description, fields=fields, extends=extends, - experimental=schema.stage == LaunchStage.PRIVATE_PREVIEW, + experimental=is_experimental_stage(schema.stage), deprecated=schema.deprecated or False, ) diff --git a/python/codegen/codegen/generated_enum.py b/python/codegen/codegen/generated_enum.py index 84bb79e957c..8f6b4ecbcaa 100644 --- a/python/codegen/codegen/generated_enum.py +++ b/python/codegen/codegen/generated_enum.py @@ -5,7 +5,7 @@ import codegen.packages as packages from codegen.code_builder import CodeBuilder from codegen.generated_dataclass import _append_description -from codegen.jsonschema import LaunchStage, Schema +from codegen.jsonschema import Schema, is_experimental_stage @dataclass(kw_only=True) @@ -35,7 +35,7 @@ def generate_enum(namespace: str, schema_name: str, schema: Schema) -> Generated package=package, values=values, description=schema.description, - experimental=schema.stage == LaunchStage.PRIVATE_PREVIEW, + experimental=is_experimental_stage(schema.stage), deprecated=schema.deprecated or False, ) @@ -81,5 +81,6 @@ def get_code(generated: GeneratedEnum) -> str: def _camel_to_upper_snake(value): s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", value) - - return re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).upper() + s1 = re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1) + # Non-identifier chars (e.g. "-" in "amazon-bedrock") become "_". + return re.sub(r"[^0-9a-zA-Z]+", "_", s1).upper() diff --git a/python/codegen/codegen/generated_wiring.py b/python/codegen/codegen/generated_wiring.py index b9ae99015d0..b5caa80c62b 100644 --- a/python/codegen/codegen/generated_wiring.py +++ b/python/codegen/codegen/generated_wiring.py @@ -56,7 +56,7 @@ def _wired_resources() -> list[_WiredResource]: resources.append( _WiredResource( class_name=class_name, - singular_name=class_name.lower(), + singular_name=packages.to_snake_case(class_name), plural_name=namespace, model_module=packages.get_package(namespace, ref), ) diff --git a/python/codegen/codegen/jsonschema.py b/python/codegen/codegen/jsonschema.py index c780d1dc522..9ad7191a55c 100644 --- a/python/codegen/codegen/jsonschema.py +++ b/python/codegen/codegen/jsonschema.py @@ -8,17 +8,20 @@ class LaunchStage: - # Mirrors clijson.LaunchStage in the Go code. jsonschema.json only carries - # x-databricks-launch-stage for private-preview fields (the Go schema - # generator emits it only there, to mark them experimental and exclude them - # from the generated documentation), but the full set is mirrored here for - # completeness. + # Mirrors clijson.LaunchStage in the Go code. GA = "GA" PUBLIC_PREVIEW = "PUBLIC_PREVIEW" PUBLIC_BETA = "PUBLIC_BETA" PRIVATE_PREVIEW = "PRIVATE_PREVIEW" +def is_experimental_stage(stage: Optional[str]) -> bool: + # Beta and private preview may still change; GA and public preview are frozen. + # Since PyDABs is typed so field behavior can change in experimental stages, + # this can lead to breaking changes hence these fields are declared experimental. + return stage in (LaunchStage.PUBLIC_BETA, LaunchStage.PRIVATE_PREVIEW) + + @dataclass class Property: ref: str diff --git a/python/codegen/codegen/packages.py b/python/codegen/codegen/packages.py index f5c2a53fb39..c3741c93907 100644 --- a/python/codegen/codegen/packages.py +++ b/python/codegen/codegen/packages.py @@ -1,16 +1,65 @@ +import json import re +from pathlib import Path from typing import Optional -# All supported resource types and their namespace -RESOURCE_NAMESPACE = { - "resources.Job": "jobs", - "resources.Pipeline": "pipelines", - "resources.Catalog": "catalogs", - "resources.Schema": "schemas", - "resources.Volume": "volumes", - "resources.Alert": "alerts", +# Resources with a field type the generator can't model yet. Excluded until +# support for that type is added. +RESOURCE_DENYLIST = { + "resources.ClusterPolicy", # interface{} + "resources.Dashboard", # interface{} + "resources.GenieSpace", # interface{} + "resources.Secret", # time.Time } +# Only GA and public-preview resources are generated; later stages may still change. +_EXCLUDED_RESOURCE_STAGES = {"PUBLIC_BETA", "PRIVATE_PREVIEW"} + + +def _resource_stage(config: dict, type_name: str) -> Optional[str]: + node = config.get(type_name, {}) + if "x-databricks-launch-stage" in node: + return node["x-databricks-launch-stage"] + for option in node.get("oneOf", []): + if "x-databricks-launch-stage" in option: + return option["x-databricks-launch-stage"] + return None + + +def _load_resource_namespace() -> dict[str, str]: + """Map each generated resource type to its bundle section (plural) name. + + Derived from the Resources struct in the bundle schema so it stays in sync + with the Go source, minus denylisted and non-public resources. + """ + path = Path(__file__).parent / ".." / ".." / ".." / "bundle/schema/jsonschema.json" + bundle = json.load(path.open())["$defs"]["github.com"]["databricks"]["cli"][ + "bundle" + ] + config = bundle["config"] + properties = bundle["config.Resources"]["oneOf"][0]["properties"] + + namespace = {} + for plural, prop in properties.items(): + ref = prop.get("$ref") + if ref is None: + options = prop.get("oneOf", []) + prop.get("anyOf", []) + ref = next(o["$ref"] for o in options if o.get("$ref")) + type_name = ref.split("/")[-1] + + if type_name in RESOURCE_DENYLIST: + continue + if _resource_stage(config, type_name) in _EXCLUDED_RESOURCE_STAGES: + continue + + namespace[type_name] = plural + + return namespace + + +# All supported resource types and their namespace. +RESOURCE_NAMESPACE = _load_resource_namespace() + RESOURCE_TYPES = list(RESOURCE_NAMESPACE.keys()) RENAMES = { @@ -41,6 +90,11 @@ def get_class_name(ref: str) -> str: return RENAMES.get(name, name) +def to_snake_case(name: str) -> str: + # "VectorSearchIndex" -> "vector_search_index" + return re.sub(r"(? bool: return ref in RESOURCE_TYPES diff --git a/python/databricks/bundles/apps/__init__.py b/python/databricks/bundles/apps/__init__.py new file mode 100644 index 00000000000..7b92e6d61bb --- /dev/null +++ b/python/databricks/bundles/apps/__init__.py @@ -0,0 +1,237 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "App", + "AppConfig", + "AppConfigDict", + "AppConfigParam", + "AppDict", + "AppEnvVar", + "AppEnvVarDict", + "AppEnvVarParam", + "AppParam", + "AppPermission", + "AppPermissionDict", + "AppPermissionLevel", + "AppPermissionLevelParam", + "AppPermissionParam", + "AppResource", + "AppResourceApp", + "AppResourceAppAppPermission", + "AppResourceAppAppPermissionParam", + "AppResourceAppDict", + "AppResourceAppParam", + "AppResourceDatabase", + "AppResourceDatabaseDatabasePermission", + "AppResourceDatabaseDatabasePermissionParam", + "AppResourceDatabaseDict", + "AppResourceDatabaseParam", + "AppResourceDict", + "AppResourceExperiment", + "AppResourceExperimentDict", + "AppResourceExperimentExperimentPermission", + "AppResourceExperimentExperimentPermissionParam", + "AppResourceExperimentParam", + "AppResourceGenieSpace", + "AppResourceGenieSpaceDict", + "AppResourceGenieSpaceGenieSpacePermission", + "AppResourceGenieSpaceGenieSpacePermissionParam", + "AppResourceGenieSpaceParam", + "AppResourceJob", + "AppResourceJobDict", + "AppResourceJobJobPermission", + "AppResourceJobJobPermissionParam", + "AppResourceJobParam", + "AppResourceParam", + "AppResourcePostgres", + "AppResourcePostgresDict", + "AppResourcePostgresParam", + "AppResourcePostgresPostgresPermission", + "AppResourcePostgresPostgresPermissionParam", + "AppResourceSecret", + "AppResourceSecretDict", + "AppResourceSecretParam", + "AppResourceSecretSecretPermission", + "AppResourceSecretSecretPermissionParam", + "AppResourceServingEndpoint", + "AppResourceServingEndpointDict", + "AppResourceServingEndpointParam", + "AppResourceServingEndpointServingEndpointPermission", + "AppResourceServingEndpointServingEndpointPermissionParam", + "AppResourceSqlWarehouse", + "AppResourceSqlWarehouseDict", + "AppResourceSqlWarehouseParam", + "AppResourceSqlWarehouseSqlWarehousePermission", + "AppResourceSqlWarehouseSqlWarehousePermissionParam", + "AppResourceUcSecurable", + "AppResourceUcSecurableDict", + "AppResourceUcSecurableParam", + "AppResourceUcSecurableUcSecurablePermission", + "AppResourceUcSecurableUcSecurablePermissionParam", + "AppResourceUcSecurableUcSecurableType", + "AppResourceUcSecurableUcSecurableTypeParam", + "ComputeSize", + "ComputeSizeParam", + "GitRepository", + "GitRepositoryDict", + "GitRepositoryParam", + "GitSource", + "GitSourceDict", + "GitSourceParam", + "LifecycleWithStarted", + "LifecycleWithStartedDict", + "LifecycleWithStartedParam", + "TelemetryExportDestination", + "TelemetryExportDestinationDict", + "TelemetryExportDestinationParam", + "UnityCatalog", + "UnityCatalogDict", + "UnityCatalogParam", +] + + +from databricks.bundles.apps._models.app import App, AppDict, AppParam +from databricks.bundles.apps._models.app_config import ( + AppConfig, + AppConfigDict, + AppConfigParam, +) +from databricks.bundles.apps._models.app_env_var import ( + AppEnvVar, + AppEnvVarDict, + AppEnvVarParam, +) +from databricks.bundles.apps._models.app_permission import ( + AppPermission, + AppPermissionDict, + AppPermissionParam, +) +from databricks.bundles.apps._models.app_permission_level import ( + AppPermissionLevel, + AppPermissionLevelParam, +) +from databricks.bundles.apps._models.app_resource import ( + AppResource, + AppResourceDict, + AppResourceParam, +) +from databricks.bundles.apps._models.app_resource_app import ( + AppResourceApp, + AppResourceAppDict, + AppResourceAppParam, +) +from databricks.bundles.apps._models.app_resource_app_app_permission import ( + AppResourceAppAppPermission, + AppResourceAppAppPermissionParam, +) +from databricks.bundles.apps._models.app_resource_database import ( + AppResourceDatabase, + AppResourceDatabaseDict, + AppResourceDatabaseParam, +) +from databricks.bundles.apps._models.app_resource_database_database_permission import ( + AppResourceDatabaseDatabasePermission, + AppResourceDatabaseDatabasePermissionParam, +) +from databricks.bundles.apps._models.app_resource_experiment import ( + AppResourceExperiment, + AppResourceExperimentDict, + AppResourceExperimentParam, +) +from databricks.bundles.apps._models.app_resource_experiment_experiment_permission import ( + AppResourceExperimentExperimentPermission, + AppResourceExperimentExperimentPermissionParam, +) +from databricks.bundles.apps._models.app_resource_genie_space import ( + AppResourceGenieSpace, + AppResourceGenieSpaceDict, + AppResourceGenieSpaceParam, +) +from databricks.bundles.apps._models.app_resource_genie_space_genie_space_permission import ( + AppResourceGenieSpaceGenieSpacePermission, + AppResourceGenieSpaceGenieSpacePermissionParam, +) +from databricks.bundles.apps._models.app_resource_job import ( + AppResourceJob, + AppResourceJobDict, + AppResourceJobParam, +) +from databricks.bundles.apps._models.app_resource_job_job_permission import ( + AppResourceJobJobPermission, + AppResourceJobJobPermissionParam, +) +from databricks.bundles.apps._models.app_resource_postgres import ( + AppResourcePostgres, + AppResourcePostgresDict, + AppResourcePostgresParam, +) +from databricks.bundles.apps._models.app_resource_postgres_postgres_permission import ( + AppResourcePostgresPostgresPermission, + AppResourcePostgresPostgresPermissionParam, +) +from databricks.bundles.apps._models.app_resource_secret import ( + AppResourceSecret, + AppResourceSecretDict, + AppResourceSecretParam, +) +from databricks.bundles.apps._models.app_resource_secret_secret_permission import ( + AppResourceSecretSecretPermission, + AppResourceSecretSecretPermissionParam, +) +from databricks.bundles.apps._models.app_resource_serving_endpoint import ( + AppResourceServingEndpoint, + AppResourceServingEndpointDict, + AppResourceServingEndpointParam, +) +from databricks.bundles.apps._models.app_resource_serving_endpoint_serving_endpoint_permission import ( + AppResourceServingEndpointServingEndpointPermission, + AppResourceServingEndpointServingEndpointPermissionParam, +) +from databricks.bundles.apps._models.app_resource_sql_warehouse import ( + AppResourceSqlWarehouse, + AppResourceSqlWarehouseDict, + AppResourceSqlWarehouseParam, +) +from databricks.bundles.apps._models.app_resource_sql_warehouse_sql_warehouse_permission import ( + AppResourceSqlWarehouseSqlWarehousePermission, + AppResourceSqlWarehouseSqlWarehousePermissionParam, +) +from databricks.bundles.apps._models.app_resource_uc_securable import ( + AppResourceUcSecurable, + AppResourceUcSecurableDict, + AppResourceUcSecurableParam, +) +from databricks.bundles.apps._models.app_resource_uc_securable_uc_securable_permission import ( + AppResourceUcSecurableUcSecurablePermission, + AppResourceUcSecurableUcSecurablePermissionParam, +) +from databricks.bundles.apps._models.app_resource_uc_securable_uc_securable_type import ( + AppResourceUcSecurableUcSecurableType, + AppResourceUcSecurableUcSecurableTypeParam, +) +from databricks.bundles.apps._models.compute_size import ComputeSize, ComputeSizeParam +from databricks.bundles.apps._models.git_repository import ( + GitRepository, + GitRepositoryDict, + GitRepositoryParam, +) +from databricks.bundles.apps._models.git_source import ( + GitSource, + GitSourceDict, + GitSourceParam, +) +from databricks.bundles.apps._models.lifecycle_with_started import ( + LifecycleWithStarted, + LifecycleWithStartedDict, + LifecycleWithStartedParam, +) +from databricks.bundles.apps._models.telemetry_export_destination import ( + TelemetryExportDestination, + TelemetryExportDestinationDict, + TelemetryExportDestinationParam, +) +from databricks.bundles.apps._models.unity_catalog import ( + UnityCatalog, + UnityCatalogDict, + UnityCatalogParam, +) diff --git a/python/databricks/bundles/apps/_models/app.py b/python/databricks/bundles/apps/_models/app.py new file mode 100644 index 00000000000..a700c7b26ac --- /dev/null +++ b/python/databricks/bundles/apps/_models/app.py @@ -0,0 +1,260 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_config import ( + AppConfig, + AppConfigParam, +) +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.compute_size import ComputeSize, ComputeSizeParam +from databricks.bundles.apps._models.git_repository import ( + GitRepository, + GitRepositoryParam, +) +from databricks.bundles.apps._models.git_source import GitSource, GitSourceParam +from databricks.bundles.apps._models.lifecycle_with_started import ( + LifecycleWithStarted, + LifecycleWithStartedParam, +) +from databricks.bundles.apps._models.telemetry_export_destination import ( + TelemetryExportDestination, + TelemetryExportDestinationParam, +) +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, + VariableOrList, + VariableOrOptional, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class App(Resource): + """""" + + name: VariableOr[str] + """ + The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. + It must be unique within the workspace. + """ + + budget_policy_id: VariableOrOptional[str] = None + """ + [Public Preview] + """ + + compute_max_instances: VariableOrOptional[int] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Maximum number of app instances. Must be set together with `compute_min_instances`. + """ + + compute_min_instances: VariableOrOptional[int] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Minimum number of app instances. Must be set together with `compute_max_instances`. + """ + + compute_size: VariableOrOptional[ComputeSize] = None + + config: VariableOrOptional[AppConfig] = None + + description: VariableOrOptional[str] = None + """ + The description of the app. + """ + + forward_user_access_token: VariableOrOptional[bool] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Forward the user's access token to the app. Requires stopping and starting app compute to take effect. + """ + + git_repository: VariableOrOptional[GitRepository] = None + """ + Git repository configuration for app deployments. When specified, deployments can + reference code from this repository by providing only the git reference (branch, tag, or commit). + """ + + git_source: VariableOrOptional[GitSource] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] Git source configuration for app deployments. Specifies which git reference (branch, tag, or commit) + to use when deploying the app. Used in conjunction with git_repository to deploy code directly from git. + The source_code_path within git_source specifies the relative path to the app code within the repository. + """ + + lifecycle: VariableOrOptional[LifecycleWithStarted] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[AppPermission] = field(default_factory=list) + """ + The permissions to apply to this resource. + """ + + resources: VariableOrList[AppResource] = field(default_factory=list) + """ + Resources for the app. + """ + + source_code_path: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] + """ + + space: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Name of the space this app belongs to. + """ + + telemetry_export_destinations: VariableOrList[TelemetryExportDestination] = field( + default_factory=list + ) + """ + [Public Preview] + """ + + usage_policy_id: VariableOrOptional[str] = None + """ + [Public Preview] + """ + + user_api_scopes: VariableOrList[str] = field(default_factory=list) + """ + [Public Preview] + """ + + @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): + """""" + + name: VariableOr[str] + """ + The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. + It must be unique within the workspace. + """ + + budget_policy_id: VariableOrOptional[str] + """ + [Public Preview] + """ + + compute_max_instances: VariableOrOptional[int] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Maximum number of app instances. Must be set together with `compute_min_instances`. + """ + + compute_min_instances: VariableOrOptional[int] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Minimum number of app instances. Must be set together with `compute_max_instances`. + """ + + compute_size: VariableOrOptional[ComputeSizeParam] + + config: VariableOrOptional[AppConfigParam] + + description: VariableOrOptional[str] + """ + The description of the app. + """ + + forward_user_access_token: VariableOrOptional[bool] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Forward the user's access token to the app. Requires stopping and starting app compute to take effect. + """ + + git_repository: VariableOrOptional[GitRepositoryParam] + """ + Git repository configuration for app deployments. When specified, deployments can + reference code from this repository by providing only the git reference (branch, tag, or commit). + """ + + git_source: VariableOrOptional[GitSourceParam] + """ + :meta private: [EXPERIMENTAL] + + [Beta] Git source configuration for app deployments. Specifies which git reference (branch, tag, or commit) + to use when deploying the app. Used in conjunction with git_repository to deploy code directly from git. + The source_code_path within git_source specifies the relative path to the app code within the repository. + """ + + lifecycle: VariableOrOptional[LifecycleWithStartedParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[AppPermissionParam] + """ + The permissions to apply to this resource. + """ + + resources: VariableOrList[AppResourceParam] + """ + Resources for the app. + """ + + source_code_path: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] + """ + + space: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Name of the space this app belongs to. + """ + + telemetry_export_destinations: VariableOrList[TelemetryExportDestinationParam] + """ + [Public Preview] + """ + + usage_policy_id: VariableOrOptional[str] + """ + [Public Preview] + """ + + user_api_scopes: VariableOrList[str] + """ + [Public Preview] + """ + + +AppParam = AppDict | App diff --git a/python/databricks/bundles/apps/_models/app_config.py b/python/databricks/bundles/apps/_models/app_config.py new file mode 100644 index 00000000000..e8a8f5fd70e --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_config.py @@ -0,0 +1,39 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_env_var import AppEnvVar, AppEnvVarParam +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 VariableOrList + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppConfig: + """""" + + command: VariableOrList[str] = field(default_factory=list) + + env: VariableOrList[AppEnvVar] = field(default_factory=list) + + @classmethod + def from_dict(cls, value: "AppConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class AppConfigDict(TypedDict, total=False): + """""" + + command: VariableOrList[str] + + env: VariableOrList[AppEnvVarParam] + + +AppConfigParam = AppConfigDict | AppConfig diff --git a/python/databricks/bundles/apps/_models/app_env_var.py b/python/databricks/bundles/apps/_models/app_env_var.py new file mode 100644 index 00000000000..a0afec4223a --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_env_var.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppEnvVar: + """""" + + name: VariableOr[str] + + value: VariableOrOptional[str] = None + + value_from: VariableOrOptional[str] = None + + @classmethod + def from_dict(cls, value: "AppEnvVarDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppEnvVarDict": + return _transform_to_json_value(self) # type:ignore + + +class AppEnvVarDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + + value: VariableOrOptional[str] + + value_from: VariableOrOptional[str] + + +AppEnvVarParam = AppEnvVarDict | AppEnvVar diff --git a/python/databricks/bundles/apps/_models/app_permission.py b/python/databricks/bundles/apps/_models/app_permission.py new file mode 100644 index 00000000000..f04638d0df2 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_permission.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_permission_level import ( + AppPermissionLevel, + AppPermissionLevelParam, +) +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppPermission: + """""" + + level: VariableOr[AppPermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. + """ + + @classmethod + def from_dict(cls, value: "AppPermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppPermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class AppPermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[AppPermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. + """ + + +AppPermissionParam = AppPermissionDict | AppPermission diff --git a/python/databricks/bundles/apps/_models/app_permission_level.py b/python/databricks/bundles/apps/_models/app_permission_level.py new file mode 100644 index 00000000000..a951c137ea7 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_permission_level.py @@ -0,0 +1,16 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppPermissionLevel(Enum): + """ + Permission level + """ + + CAN_MANAGE = "CAN_MANAGE" + CAN_USE = "CAN_USE" + + +AppPermissionLevelParam = Literal["CAN_MANAGE", "CAN_USE"] | AppPermissionLevel diff --git a/python/databricks/bundles/apps/_models/app_resource.py b/python/databricks/bundles/apps/_models/app_resource.py new file mode 100644 index 00000000000..cc96b083c2c --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource.py @@ -0,0 +1,130 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_app import ( + AppResourceApp, + AppResourceAppParam, +) +from databricks.bundles.apps._models.app_resource_database import ( + AppResourceDatabase, + AppResourceDatabaseParam, +) +from databricks.bundles.apps._models.app_resource_experiment import ( + AppResourceExperiment, + AppResourceExperimentParam, +) +from databricks.bundles.apps._models.app_resource_genie_space import ( + AppResourceGenieSpace, + AppResourceGenieSpaceParam, +) +from databricks.bundles.apps._models.app_resource_job import ( + AppResourceJob, + AppResourceJobParam, +) +from databricks.bundles.apps._models.app_resource_postgres import ( + AppResourcePostgres, + AppResourcePostgresParam, +) +from databricks.bundles.apps._models.app_resource_secret import ( + AppResourceSecret, + AppResourceSecretParam, +) +from databricks.bundles.apps._models.app_resource_serving_endpoint import ( + AppResourceServingEndpoint, + AppResourceServingEndpointParam, +) +from databricks.bundles.apps._models.app_resource_sql_warehouse import ( + AppResourceSqlWarehouse, + AppResourceSqlWarehouseParam, +) +from databricks.bundles.apps._models.app_resource_uc_securable import ( + AppResourceUcSecurable, + AppResourceUcSecurableParam, +) +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResource: + """""" + + name: VariableOr[str] + """ + Name of the App Resource. + """ + + app: VariableOrOptional[AppResourceApp] = None + + database: VariableOrOptional[AppResourceDatabase] = None + + description: VariableOrOptional[str] = None + """ + Description of the App Resource. + """ + + experiment: VariableOrOptional[AppResourceExperiment] = None + + genie_space: VariableOrOptional[AppResourceGenieSpace] = None + + job: VariableOrOptional[AppResourceJob] = None + + postgres: VariableOrOptional[AppResourcePostgres] = None + + secret: VariableOrOptional[AppResourceSecret] = None + + serving_endpoint: VariableOrOptional[AppResourceServingEndpoint] = None + + sql_warehouse: VariableOrOptional[AppResourceSqlWarehouse] = None + + uc_securable: VariableOrOptional[AppResourceUcSecurable] = None + + @classmethod + def from_dict(cls, value: "AppResourceDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + Name of the App Resource. + """ + + app: VariableOrOptional[AppResourceAppParam] + + database: VariableOrOptional[AppResourceDatabaseParam] + + description: VariableOrOptional[str] + """ + Description of the App Resource. + """ + + experiment: VariableOrOptional[AppResourceExperimentParam] + + genie_space: VariableOrOptional[AppResourceGenieSpaceParam] + + job: VariableOrOptional[AppResourceJobParam] + + postgres: VariableOrOptional[AppResourcePostgresParam] + + secret: VariableOrOptional[AppResourceSecretParam] + + serving_endpoint: VariableOrOptional[AppResourceServingEndpointParam] + + sql_warehouse: VariableOrOptional[AppResourceSqlWarehouseParam] + + uc_securable: VariableOrOptional[AppResourceUcSecurableParam] + + +AppResourceParam = AppResourceDict | AppResource diff --git a/python/databricks/bundles/apps/_models/app_resource_app.py b/python/databricks/bundles/apps/_models/app_resource_app.py new file mode 100644 index 00000000000..a7a05689c2e --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_app.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_app_app_permission import ( + AppResourceAppAppPermission, + AppResourceAppAppPermissionParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceApp: + """""" + + name: VariableOrOptional[str] = None + + permission: VariableOrOptional[AppResourceAppAppPermission] = None + + @classmethod + def from_dict(cls, value: "AppResourceAppDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceAppDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceAppDict(TypedDict, total=False): + """""" + + name: VariableOrOptional[str] + + permission: VariableOrOptional[AppResourceAppAppPermissionParam] + + +AppResourceAppParam = AppResourceAppDict | AppResourceApp diff --git a/python/databricks/bundles/apps/_models/app_resource_app_app_permission.py b/python/databricks/bundles/apps/_models/app_resource_app_app_permission.py new file mode 100644 index 00000000000..a58dca414e4 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_app_app_permission.py @@ -0,0 +1,11 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceAppAppPermission(Enum): + CAN_USE = "CAN_USE" + + +AppResourceAppAppPermissionParam = Literal["CAN_USE"] | AppResourceAppAppPermission diff --git a/python/databricks/bundles/apps/_models/app_resource_database.py b/python/databricks/bundles/apps/_models/app_resource_database.py new file mode 100644 index 00000000000..b29ce973105 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_database.py @@ -0,0 +1,46 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_database_database_permission import ( + AppResourceDatabaseDatabasePermission, + AppResourceDatabaseDatabasePermissionParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceDatabase: + """""" + + database_name: VariableOr[str] + + instance_name: VariableOr[str] + + permission: VariableOr[AppResourceDatabaseDatabasePermission] + + @classmethod + def from_dict(cls, value: "AppResourceDatabaseDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceDatabaseDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceDatabaseDict(TypedDict, total=False): + """""" + + database_name: VariableOr[str] + + instance_name: VariableOr[str] + + permission: VariableOr[AppResourceDatabaseDatabasePermissionParam] + + +AppResourceDatabaseParam = AppResourceDatabaseDict | AppResourceDatabase diff --git a/python/databricks/bundles/apps/_models/app_resource_database_database_permission.py b/python/databricks/bundles/apps/_models/app_resource_database_database_permission.py new file mode 100644 index 00000000000..447d015a1c2 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_database_database_permission.py @@ -0,0 +1,13 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceDatabaseDatabasePermission(Enum): + CAN_CONNECT_AND_CREATE = "CAN_CONNECT_AND_CREATE" + + +AppResourceDatabaseDatabasePermissionParam = ( + Literal["CAN_CONNECT_AND_CREATE"] | AppResourceDatabaseDatabasePermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_experiment.py b/python/databricks/bundles/apps/_models/app_resource_experiment.py new file mode 100644 index 00000000000..e69d4be1a17 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_experiment.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_experiment_experiment_permission import ( + AppResourceExperimentExperimentPermission, + AppResourceExperimentExperimentPermissionParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceExperiment: + """""" + + experiment_id: VariableOr[str] + + permission: VariableOr[AppResourceExperimentExperimentPermission] + + @classmethod + def from_dict(cls, value: "AppResourceExperimentDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceExperimentDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceExperimentDict(TypedDict, total=False): + """""" + + experiment_id: VariableOr[str] + + permission: VariableOr[AppResourceExperimentExperimentPermissionParam] + + +AppResourceExperimentParam = AppResourceExperimentDict | AppResourceExperiment diff --git a/python/databricks/bundles/apps/_models/app_resource_experiment_experiment_permission.py b/python/databricks/bundles/apps/_models/app_resource_experiment_experiment_permission.py new file mode 100644 index 00000000000..230b8d5c06e --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_experiment_experiment_permission.py @@ -0,0 +1,16 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceExperimentExperimentPermission(Enum): + CAN_MANAGE = "CAN_MANAGE" + CAN_EDIT = "CAN_EDIT" + CAN_READ = "CAN_READ" + + +AppResourceExperimentExperimentPermissionParam = ( + Literal["CAN_MANAGE", "CAN_EDIT", "CAN_READ"] + | AppResourceExperimentExperimentPermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_genie_space.py b/python/databricks/bundles/apps/_models/app_resource_genie_space.py new file mode 100644 index 00000000000..0cfdaf316f4 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_genie_space.py @@ -0,0 +1,46 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_genie_space_genie_space_permission import ( + AppResourceGenieSpaceGenieSpacePermission, + AppResourceGenieSpaceGenieSpacePermissionParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceGenieSpace: + """""" + + name: VariableOr[str] + + permission: VariableOr[AppResourceGenieSpaceGenieSpacePermission] + + space_id: VariableOr[str] + + @classmethod + def from_dict(cls, value: "AppResourceGenieSpaceDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceGenieSpaceDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceGenieSpaceDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + + permission: VariableOr[AppResourceGenieSpaceGenieSpacePermissionParam] + + space_id: VariableOr[str] + + +AppResourceGenieSpaceParam = AppResourceGenieSpaceDict | AppResourceGenieSpace diff --git a/python/databricks/bundles/apps/_models/app_resource_genie_space_genie_space_permission.py b/python/databricks/bundles/apps/_models/app_resource_genie_space_genie_space_permission.py new file mode 100644 index 00000000000..312897a8cce --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_genie_space_genie_space_permission.py @@ -0,0 +1,17 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceGenieSpaceGenieSpacePermission(Enum): + CAN_MANAGE = "CAN_MANAGE" + CAN_EDIT = "CAN_EDIT" + CAN_RUN = "CAN_RUN" + CAN_VIEW = "CAN_VIEW" + + +AppResourceGenieSpaceGenieSpacePermissionParam = ( + Literal["CAN_MANAGE", "CAN_EDIT", "CAN_RUN", "CAN_VIEW"] + | AppResourceGenieSpaceGenieSpacePermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_job.py b/python/databricks/bundles/apps/_models/app_resource_job.py new file mode 100644 index 00000000000..08ca1be6cfc --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_job.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_job_job_permission import ( + AppResourceJobJobPermission, + AppResourceJobJobPermissionParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceJob: + """""" + + id: VariableOr[str] + """ + Id of the job to grant permission on. + """ + + permission: VariableOr[AppResourceJobJobPermission] + """ + Permissions to grant on the Job. Supported permissions are: "CAN_MANAGE", "IS_OWNER", "CAN_MANAGE_RUN", "CAN_VIEW". + """ + + @classmethod + def from_dict(cls, value: "AppResourceJobDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceJobDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceJobDict(TypedDict, total=False): + """""" + + id: VariableOr[str] + """ + Id of the job to grant permission on. + """ + + permission: VariableOr[AppResourceJobJobPermissionParam] + """ + Permissions to grant on the Job. Supported permissions are: "CAN_MANAGE", "IS_OWNER", "CAN_MANAGE_RUN", "CAN_VIEW". + """ + + +AppResourceJobParam = AppResourceJobDict | AppResourceJob diff --git a/python/databricks/bundles/apps/_models/app_resource_job_job_permission.py b/python/databricks/bundles/apps/_models/app_resource_job_job_permission.py new file mode 100644 index 00000000000..29f08d0aab1 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_job_job_permission.py @@ -0,0 +1,17 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceJobJobPermission(Enum): + CAN_MANAGE = "CAN_MANAGE" + IS_OWNER = "IS_OWNER" + CAN_MANAGE_RUN = "CAN_MANAGE_RUN" + CAN_VIEW = "CAN_VIEW" + + +AppResourceJobJobPermissionParam = ( + Literal["CAN_MANAGE", "IS_OWNER", "CAN_MANAGE_RUN", "CAN_VIEW"] + | AppResourceJobJobPermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_postgres.py b/python/databricks/bundles/apps/_models/app_resource_postgres.py new file mode 100644 index 00000000000..0d3b6e39b17 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_postgres.py @@ -0,0 +1,46 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_postgres_postgres_permission import ( + AppResourcePostgresPostgresPermission, + AppResourcePostgresPostgresPermissionParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourcePostgres: + """""" + + branch: VariableOrOptional[str] = None + + database: VariableOrOptional[str] = None + + permission: VariableOrOptional[AppResourcePostgresPostgresPermission] = None + + @classmethod + def from_dict(cls, value: "AppResourcePostgresDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourcePostgresDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourcePostgresDict(TypedDict, total=False): + """""" + + branch: VariableOrOptional[str] + + database: VariableOrOptional[str] + + permission: VariableOrOptional[AppResourcePostgresPostgresPermissionParam] + + +AppResourcePostgresParam = AppResourcePostgresDict | AppResourcePostgres diff --git a/python/databricks/bundles/apps/_models/app_resource_postgres_postgres_permission.py b/python/databricks/bundles/apps/_models/app_resource_postgres_postgres_permission.py new file mode 100644 index 00000000000..85657edfc35 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_postgres_postgres_permission.py @@ -0,0 +1,13 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourcePostgresPostgresPermission(Enum): + CAN_CONNECT_AND_CREATE = "CAN_CONNECT_AND_CREATE" + + +AppResourcePostgresPostgresPermissionParam = ( + Literal["CAN_CONNECT_AND_CREATE"] | AppResourcePostgresPostgresPermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_secret.py b/python/databricks/bundles/apps/_models/app_resource_secret.py new file mode 100644 index 00000000000..3ecca5e2199 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_secret.py @@ -0,0 +1,64 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_secret_secret_permission import ( + AppResourceSecretSecretPermission, + AppResourceSecretSecretPermissionParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceSecret: + """""" + + key: VariableOr[str] + """ + Key of the secret to grant permission on. + """ + + permission: VariableOr[AppResourceSecretSecretPermission] + """ + Permission to grant on the secret scope. For secrets, only one permission is allowed. Permission must be one of: "READ", "WRITE", "MANAGE". + """ + + scope: VariableOr[str] + """ + Scope of the secret to grant permission on. + """ + + @classmethod + def from_dict(cls, value: "AppResourceSecretDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceSecretDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceSecretDict(TypedDict, total=False): + """""" + + key: VariableOr[str] + """ + Key of the secret to grant permission on. + """ + + permission: VariableOr[AppResourceSecretSecretPermissionParam] + """ + Permission to grant on the secret scope. For secrets, only one permission is allowed. Permission must be one of: "READ", "WRITE", "MANAGE". + """ + + scope: VariableOr[str] + """ + Scope of the secret to grant permission on. + """ + + +AppResourceSecretParam = AppResourceSecretDict | AppResourceSecret diff --git a/python/databricks/bundles/apps/_models/app_resource_secret_secret_permission.py b/python/databricks/bundles/apps/_models/app_resource_secret_secret_permission.py new file mode 100644 index 00000000000..c30b6d977ff --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_secret_secret_permission.py @@ -0,0 +1,19 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceSecretSecretPermission(Enum): + """ + Permission to grant on the secret scope. Supported permissions are: "READ", "WRITE", "MANAGE". + """ + + READ = "READ" + WRITE = "WRITE" + MANAGE = "MANAGE" + + +AppResourceSecretSecretPermissionParam = ( + Literal["READ", "WRITE", "MANAGE"] | AppResourceSecretSecretPermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_serving_endpoint.py b/python/databricks/bundles/apps/_models/app_resource_serving_endpoint.py new file mode 100644 index 00000000000..ee444cd7692 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_serving_endpoint.py @@ -0,0 +1,56 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_serving_endpoint_serving_endpoint_permission import ( + AppResourceServingEndpointServingEndpointPermission, + AppResourceServingEndpointServingEndpointPermissionParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceServingEndpoint: + """""" + + name: VariableOr[str] + """ + Name of the serving endpoint to grant permission on. + """ + + permission: VariableOr[AppResourceServingEndpointServingEndpointPermission] + """ + Permission to grant on the serving endpoint. Supported permissions are: "CAN_MANAGE", "CAN_QUERY", "CAN_VIEW". + """ + + @classmethod + def from_dict(cls, value: "AppResourceServingEndpointDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceServingEndpointDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceServingEndpointDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + Name of the serving endpoint to grant permission on. + """ + + permission: VariableOr[AppResourceServingEndpointServingEndpointPermissionParam] + """ + Permission to grant on the serving endpoint. Supported permissions are: "CAN_MANAGE", "CAN_QUERY", "CAN_VIEW". + """ + + +AppResourceServingEndpointParam = ( + AppResourceServingEndpointDict | AppResourceServingEndpoint +) diff --git a/python/databricks/bundles/apps/_models/app_resource_serving_endpoint_serving_endpoint_permission.py b/python/databricks/bundles/apps/_models/app_resource_serving_endpoint_serving_endpoint_permission.py new file mode 100644 index 00000000000..abfe5e63be0 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_serving_endpoint_serving_endpoint_permission.py @@ -0,0 +1,16 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceServingEndpointServingEndpointPermission(Enum): + CAN_MANAGE = "CAN_MANAGE" + CAN_QUERY = "CAN_QUERY" + CAN_VIEW = "CAN_VIEW" + + +AppResourceServingEndpointServingEndpointPermissionParam = ( + Literal["CAN_MANAGE", "CAN_QUERY", "CAN_VIEW"] + | AppResourceServingEndpointServingEndpointPermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_sql_warehouse.py b/python/databricks/bundles/apps/_models/app_resource_sql_warehouse.py new file mode 100644 index 00000000000..691528a0450 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_sql_warehouse.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_sql_warehouse_sql_warehouse_permission import ( + AppResourceSqlWarehouseSqlWarehousePermission, + AppResourceSqlWarehouseSqlWarehousePermissionParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceSqlWarehouse: + """""" + + id: VariableOr[str] + """ + Id of the SQL warehouse to grant permission on. + """ + + permission: VariableOr[AppResourceSqlWarehouseSqlWarehousePermission] + """ + Permission to grant on the SQL warehouse. Supported permissions are: "CAN_MANAGE", "CAN_USE", "IS_OWNER". + """ + + @classmethod + def from_dict(cls, value: "AppResourceSqlWarehouseDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceSqlWarehouseDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceSqlWarehouseDict(TypedDict, total=False): + """""" + + id: VariableOr[str] + """ + Id of the SQL warehouse to grant permission on. + """ + + permission: VariableOr[AppResourceSqlWarehouseSqlWarehousePermissionParam] + """ + Permission to grant on the SQL warehouse. Supported permissions are: "CAN_MANAGE", "CAN_USE", "IS_OWNER". + """ + + +AppResourceSqlWarehouseParam = AppResourceSqlWarehouseDict | AppResourceSqlWarehouse diff --git a/python/databricks/bundles/apps/_models/app_resource_sql_warehouse_sql_warehouse_permission.py b/python/databricks/bundles/apps/_models/app_resource_sql_warehouse_sql_warehouse_permission.py new file mode 100644 index 00000000000..ceb417a6edb --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_sql_warehouse_sql_warehouse_permission.py @@ -0,0 +1,16 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceSqlWarehouseSqlWarehousePermission(Enum): + CAN_MANAGE = "CAN_MANAGE" + CAN_USE = "CAN_USE" + IS_OWNER = "IS_OWNER" + + +AppResourceSqlWarehouseSqlWarehousePermissionParam = ( + Literal["CAN_MANAGE", "CAN_USE", "IS_OWNER"] + | AppResourceSqlWarehouseSqlWarehousePermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_uc_securable.py b/python/databricks/bundles/apps/_models/app_resource_uc_securable.py new file mode 100644 index 00000000000..196b2396592 --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_uc_securable.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.app_resource_uc_securable_uc_securable_permission import ( + AppResourceUcSecurableUcSecurablePermission, + AppResourceUcSecurableUcSecurablePermissionParam, +) +from databricks.bundles.apps._models.app_resource_uc_securable_uc_securable_type import ( + AppResourceUcSecurableUcSecurableType, + AppResourceUcSecurableUcSecurableTypeParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AppResourceUcSecurable: + """""" + + permission: VariableOr[AppResourceUcSecurableUcSecurablePermission] + + securable_full_name: VariableOr[str] + + securable_type: VariableOr[AppResourceUcSecurableUcSecurableType] + + @classmethod + def from_dict(cls, value: "AppResourceUcSecurableDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AppResourceUcSecurableDict": + return _transform_to_json_value(self) # type:ignore + + +class AppResourceUcSecurableDict(TypedDict, total=False): + """""" + + permission: VariableOr[AppResourceUcSecurableUcSecurablePermissionParam] + + securable_full_name: VariableOr[str] + + securable_type: VariableOr[AppResourceUcSecurableUcSecurableTypeParam] + + +AppResourceUcSecurableParam = AppResourceUcSecurableDict | AppResourceUcSecurable diff --git a/python/databricks/bundles/apps/_models/app_resource_uc_securable_uc_securable_permission.py b/python/databricks/bundles/apps/_models/app_resource_uc_securable_uc_securable_permission.py new file mode 100644 index 00000000000..bd4ed5005db --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_uc_securable_uc_securable_permission.py @@ -0,0 +1,21 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceUcSecurableUcSecurablePermission(Enum): + READ_VOLUME = "READ_VOLUME" + WRITE_VOLUME = "WRITE_VOLUME" + SELECT = "SELECT" + EXECUTE = "EXECUTE" + USE_CONNECTION = "USE_CONNECTION" + MODIFY = "MODIFY" + + +AppResourceUcSecurableUcSecurablePermissionParam = ( + Literal[ + "READ_VOLUME", "WRITE_VOLUME", "SELECT", "EXECUTE", "USE_CONNECTION", "MODIFY" + ] + | AppResourceUcSecurableUcSecurablePermission +) diff --git a/python/databricks/bundles/apps/_models/app_resource_uc_securable_uc_securable_type.py b/python/databricks/bundles/apps/_models/app_resource_uc_securable_uc_securable_type.py new file mode 100644 index 00000000000..592496010af --- /dev/null +++ b/python/databricks/bundles/apps/_models/app_resource_uc_securable_uc_securable_type.py @@ -0,0 +1,17 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AppResourceUcSecurableUcSecurableType(Enum): + VOLUME = "VOLUME" + TABLE = "TABLE" + FUNCTION = "FUNCTION" + CONNECTION = "CONNECTION" + + +AppResourceUcSecurableUcSecurableTypeParam = ( + Literal["VOLUME", "TABLE", "FUNCTION", "CONNECTION"] + | AppResourceUcSecurableUcSecurableType +) diff --git a/python/databricks/bundles/apps/_models/compute_size.py b/python/databricks/bundles/apps/_models/compute_size.py new file mode 100644 index 00000000000..4881d034935 --- /dev/null +++ b/python/databricks/bundles/apps/_models/compute_size.py @@ -0,0 +1,13 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ComputeSize(Enum): + MEDIUM = "MEDIUM" + LARGE = "LARGE" + XLARGE = "XLARGE" + + +ComputeSizeParam = Literal["MEDIUM", "LARGE", "XLARGE"] | ComputeSize diff --git a/python/databricks/bundles/apps/_models/git_repository.py b/python/databricks/bundles/apps/_models/git_repository.py new file mode 100644 index 00000000000..1ee7502580d --- /dev/null +++ b/python/databricks/bundles/apps/_models/git_repository.py @@ -0,0 +1,86 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class GitRepository: + """ + Git repository configuration specifying the location of the repository. + """ + + provider: VariableOr[str] + """ + Git provider. Case insensitive. Supported values: gitHub, gitHubEnterprise, bitbucketCloud, + bitbucketServer, azureDevOpsServices, gitLab, gitLabEnterpriseEdition, awsCodeCommit. + """ + + url: VariableOr[str] + """ + URL of the Git repository. + """ + + auto_deploy: VariableOrOptional[bool] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] When true, automatically deploys the app on push events to the branch configured in + the app's deployment_source.git_source. + """ + + caller_credential_id: VariableOrOptional[int] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] ID of a personal access token Git credential owned by the caller, used to + grant the app's service principal access to this repository. + """ + + @classmethod + def from_dict(cls, value: "GitRepositoryDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "GitRepositoryDict": + return _transform_to_json_value(self) # type:ignore + + +class GitRepositoryDict(TypedDict, total=False): + """""" + + provider: VariableOr[str] + """ + Git provider. Case insensitive. Supported values: gitHub, gitHubEnterprise, bitbucketCloud, + bitbucketServer, azureDevOpsServices, gitLab, gitLabEnterpriseEdition, awsCodeCommit. + """ + + url: VariableOr[str] + """ + URL of the Git repository. + """ + + auto_deploy: VariableOrOptional[bool] + """ + :meta private: [EXPERIMENTAL] + + [Beta] When true, automatically deploys the app on push events to the branch configured in + the app's deployment_source.git_source. + """ + + caller_credential_id: VariableOrOptional[int] + """ + :meta private: [EXPERIMENTAL] + + [Beta] ID of a personal access token Git credential owned by the caller, used to + grant the app's service principal access to this repository. + """ + + +GitRepositoryParam = GitRepositoryDict | GitRepository diff --git a/python/databricks/bundles/apps/_models/git_source.py b/python/databricks/bundles/apps/_models/git_source.py new file mode 100644 index 00000000000..93bd61f5aa4 --- /dev/null +++ b/python/databricks/bundles/apps/_models/git_source.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class GitSource: + """ + Complete git source specification including repository location and reference. + """ + + branch: VariableOrOptional[str] = None + """ + Git branch to checkout. + """ + + commit: VariableOrOptional[str] = None + """ + Git commit SHA to checkout. + """ + + source_code_path: VariableOrOptional[str] = None + """ + Relative path to the app source code within the Git repository. If not specified, the root + of the repository is used. + """ + + tag: VariableOrOptional[str] = None + """ + Git tag to checkout. + """ + + @classmethod + def from_dict(cls, value: "GitSourceDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "GitSourceDict": + return _transform_to_json_value(self) # type:ignore + + +class GitSourceDict(TypedDict, total=False): + """""" + + branch: VariableOrOptional[str] + """ + Git branch to checkout. + """ + + commit: VariableOrOptional[str] + """ + Git commit SHA to checkout. + """ + + source_code_path: VariableOrOptional[str] + """ + Relative path to the app source code within the Git repository. If not specified, the root + of the repository is used. + """ + + tag: VariableOrOptional[str] + """ + Git tag to checkout. + """ + + +GitSourceParam = GitSourceDict | GitSource diff --git a/python/databricks/bundles/apps/_models/lifecycle_with_started.py b/python/databricks/bundles/apps/_models/lifecycle_with_started.py new file mode 100644 index 00000000000..3ee1d2a01b3 --- /dev/null +++ b/python/databricks/bundles/apps/_models/lifecycle_with_started.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class LifecycleWithStarted: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + started: VariableOrOptional[bool] = None + """ + Lifecycle setting to deploy the resource in started mode. Only supported for apps, clusters, and sql_warehouses in direct deployment mode. + """ + + @classmethod + def from_dict(cls, value: "LifecycleWithStartedDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleWithStartedDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleWithStartedDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + started: VariableOrOptional[bool] + """ + Lifecycle setting to deploy the resource in started mode. Only supported for apps, clusters, and sql_warehouses in direct deployment mode. + """ + + +LifecycleWithStartedParam = LifecycleWithStartedDict | LifecycleWithStarted diff --git a/python/databricks/bundles/apps/_models/telemetry_export_destination.py b/python/databricks/bundles/apps/_models/telemetry_export_destination.py new file mode 100644 index 00000000000..6db241c044d --- /dev/null +++ b/python/databricks/bundles/apps/_models/telemetry_export_destination.py @@ -0,0 +1,48 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.apps._models.unity_catalog import ( + UnityCatalog, + UnityCatalogParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class TelemetryExportDestination: + """ + A single telemetry export destination with its configuration and status. + """ + + unity_catalog: VariableOrOptional[UnityCatalog] = None + """ + [Public Preview] Unity Catalog Destinations for OTEL telemetry export. + """ + + @classmethod + def from_dict(cls, value: "TelemetryExportDestinationDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "TelemetryExportDestinationDict": + return _transform_to_json_value(self) # type:ignore + + +class TelemetryExportDestinationDict(TypedDict, total=False): + """""" + + unity_catalog: VariableOrOptional[UnityCatalogParam] + """ + [Public Preview] Unity Catalog Destinations for OTEL telemetry export. + """ + + +TelemetryExportDestinationParam = ( + TelemetryExportDestinationDict | TelemetryExportDestination +) diff --git a/python/databricks/bundles/apps/_models/unity_catalog.py b/python/databricks/bundles/apps/_models/unity_catalog.py new file mode 100644 index 00000000000..39c521b7e4b --- /dev/null +++ b/python/databricks/bundles/apps/_models/unity_catalog.py @@ -0,0 +1,62 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class UnityCatalog: + """ + Unity Catalog Destinations for OTEL telemetry export. + """ + + logs_table: VariableOr[str] + """ + [Public Preview] Unity Catalog table for OTEL logs. + """ + + metrics_table: VariableOr[str] + """ + [Public Preview] Unity Catalog table for OTEL metrics. + """ + + traces_table: VariableOr[str] + """ + [Public Preview] Unity Catalog table for OTEL traces (spans). + """ + + @classmethod + def from_dict(cls, value: "UnityCatalogDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "UnityCatalogDict": + return _transform_to_json_value(self) # type:ignore + + +class UnityCatalogDict(TypedDict, total=False): + """""" + + logs_table: VariableOr[str] + """ + [Public Preview] Unity Catalog table for OTEL logs. + """ + + metrics_table: VariableOr[str] + """ + [Public Preview] Unity Catalog table for OTEL metrics. + """ + + traces_table: VariableOr[str] + """ + [Public Preview] Unity Catalog table for OTEL traces (spans). + """ + + +UnityCatalogParam = UnityCatalogDict | UnityCatalog diff --git a/python/databricks/bundles/clusters/__init__.py b/python/databricks/bundles/clusters/__init__.py new file mode 100644 index 00000000000..a24c8ac4fdc --- /dev/null +++ b/python/databricks/bundles/clusters/__init__.py @@ -0,0 +1,239 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "Adlsgen2Info", + "Adlsgen2InfoDict", + "Adlsgen2InfoParam", + "AutoScale", + "AutoScaleDict", + "AutoScaleParam", + "AwsAttributes", + "AwsAttributesDict", + "AwsAttributesParam", + "AwsAvailability", + "AwsAvailabilityParam", + "AzureAttributes", + "AzureAttributesDict", + "AzureAttributesParam", + "AzureAvailability", + "AzureAvailabilityParam", + "ClientsTypes", + "ClientsTypesDict", + "ClientsTypesParam", + "Cluster", + "ClusterDict", + "ClusterLogConf", + "ClusterLogConfDict", + "ClusterLogConfParam", + "ClusterParam", + "ClusterPermission", + "ClusterPermissionDict", + "ClusterPermissionLevel", + "ClusterPermissionLevelParam", + "ClusterPermissionParam", + "ConfidentialComputeType", + "ConfidentialComputeTypeParam", + "DataSecurityMode", + "DataSecurityModeParam", + "DbfsStorageInfo", + "DbfsStorageInfoDict", + "DbfsStorageInfoParam", + "DependencyMode", + "DependencyModeParam", + "DockerBasicAuth", + "DockerBasicAuthDict", + "DockerBasicAuthParam", + "DockerImage", + "DockerImageDict", + "DockerImageParam", + "EbsVolumeType", + "EbsVolumeTypeParam", + "GcpAttributes", + "GcpAttributesDict", + "GcpAttributesParam", + "GcpAvailability", + "GcpAvailabilityParam", + "GcsStorageInfo", + "GcsStorageInfoDict", + "GcsStorageInfoParam", + "InitScriptInfo", + "InitScriptInfoDict", + "InitScriptInfoParam", + "Kind", + "KindParam", + "LifecycleWithStarted", + "LifecycleWithStartedDict", + "LifecycleWithStartedParam", + "LocalFileInfo", + "LocalFileInfoDict", + "LocalFileInfoParam", + "LogAnalyticsInfo", + "LogAnalyticsInfoDict", + "LogAnalyticsInfoParam", + "NodeTypeFlexibility", + "NodeTypeFlexibilityDict", + "NodeTypeFlexibilityParam", + "RuntimeEngine", + "RuntimeEngineParam", + "S3StorageInfo", + "S3StorageInfoDict", + "S3StorageInfoParam", + "VolumesStorageInfo", + "VolumesStorageInfoDict", + "VolumesStorageInfoParam", + "WorkloadType", + "WorkloadTypeDict", + "WorkloadTypeParam", + "WorkspaceStorageInfo", + "WorkspaceStorageInfoDict", + "WorkspaceStorageInfoParam", +] + + +from databricks.bundles.clusters._models.adlsgen2_info import ( + Adlsgen2Info, + Adlsgen2InfoDict, + Adlsgen2InfoParam, +) +from databricks.bundles.clusters._models.auto_scale import ( + AutoScale, + AutoScaleDict, + AutoScaleParam, +) +from databricks.bundles.clusters._models.aws_attributes import ( + AwsAttributes, + AwsAttributesDict, + AwsAttributesParam, +) +from databricks.bundles.clusters._models.aws_availability import ( + AwsAvailability, + AwsAvailabilityParam, +) +from databricks.bundles.clusters._models.azure_attributes import ( + AzureAttributes, + AzureAttributesDict, + AzureAttributesParam, +) +from databricks.bundles.clusters._models.azure_availability import ( + AzureAvailability, + AzureAvailabilityParam, +) +from databricks.bundles.clusters._models.clients_types import ( + ClientsTypes, + ClientsTypesDict, + ClientsTypesParam, +) +from databricks.bundles.clusters._models.cluster import ( + Cluster, + ClusterDict, + ClusterParam, +) +from databricks.bundles.clusters._models.cluster_log_conf import ( + ClusterLogConf, + ClusterLogConfDict, + ClusterLogConfParam, +) +from databricks.bundles.clusters._models.cluster_permission import ( + ClusterPermission, + ClusterPermissionDict, + ClusterPermissionParam, +) +from databricks.bundles.clusters._models.cluster_permission_level import ( + ClusterPermissionLevel, + ClusterPermissionLevelParam, +) +from databricks.bundles.clusters._models.confidential_compute_type import ( + ConfidentialComputeType, + ConfidentialComputeTypeParam, +) +from databricks.bundles.clusters._models.data_security_mode import ( + DataSecurityMode, + DataSecurityModeParam, +) +from databricks.bundles.clusters._models.dbfs_storage_info import ( + DbfsStorageInfo, + DbfsStorageInfoDict, + DbfsStorageInfoParam, +) +from databricks.bundles.clusters._models.dependency_mode import ( + DependencyMode, + DependencyModeParam, +) +from databricks.bundles.clusters._models.docker_basic_auth import ( + DockerBasicAuth, + DockerBasicAuthDict, + DockerBasicAuthParam, +) +from databricks.bundles.clusters._models.docker_image import ( + DockerImage, + DockerImageDict, + DockerImageParam, +) +from databricks.bundles.clusters._models.ebs_volume_type import ( + EbsVolumeType, + EbsVolumeTypeParam, +) +from databricks.bundles.clusters._models.gcp_attributes import ( + GcpAttributes, + GcpAttributesDict, + GcpAttributesParam, +) +from databricks.bundles.clusters._models.gcp_availability import ( + GcpAvailability, + GcpAvailabilityParam, +) +from databricks.bundles.clusters._models.gcs_storage_info import ( + GcsStorageInfo, + GcsStorageInfoDict, + GcsStorageInfoParam, +) +from databricks.bundles.clusters._models.init_script_info import ( + InitScriptInfo, + InitScriptInfoDict, + InitScriptInfoParam, +) +from databricks.bundles.clusters._models.kind import Kind, KindParam +from databricks.bundles.clusters._models.lifecycle_with_started import ( + LifecycleWithStarted, + LifecycleWithStartedDict, + LifecycleWithStartedParam, +) +from databricks.bundles.clusters._models.local_file_info import ( + LocalFileInfo, + LocalFileInfoDict, + LocalFileInfoParam, +) +from databricks.bundles.clusters._models.log_analytics_info import ( + LogAnalyticsInfo, + LogAnalyticsInfoDict, + LogAnalyticsInfoParam, +) +from databricks.bundles.clusters._models.node_type_flexibility import ( + NodeTypeFlexibility, + NodeTypeFlexibilityDict, + NodeTypeFlexibilityParam, +) +from databricks.bundles.clusters._models.runtime_engine import ( + RuntimeEngine, + RuntimeEngineParam, +) +from databricks.bundles.clusters._models.s3_storage_info import ( + S3StorageInfo, + S3StorageInfoDict, + S3StorageInfoParam, +) +from databricks.bundles.clusters._models.volumes_storage_info import ( + VolumesStorageInfo, + VolumesStorageInfoDict, + VolumesStorageInfoParam, +) +from databricks.bundles.clusters._models.workload_type import ( + WorkloadType, + WorkloadTypeDict, + WorkloadTypeParam, +) +from databricks.bundles.clusters._models.workspace_storage_info import ( + WorkspaceStorageInfo, + WorkspaceStorageInfoDict, + WorkspaceStorageInfoParam, +) diff --git a/python/databricks/bundles/clusters/_models/adlsgen2_info.py b/python/databricks/bundles/clusters/_models/adlsgen2_info.py new file mode 100644 index 00000000000..87c883adeb9 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/adlsgen2_info.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Adlsgen2Info: + """ + A storage location in Adls Gen2 + """ + + destination: VariableOr[str] + """ + abfss destination, e.g. `abfss://@.dfs.core.windows.net/`. + """ + + @classmethod + def from_dict(cls, value: "Adlsgen2InfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "Adlsgen2InfoDict": + return _transform_to_json_value(self) # type:ignore + + +class Adlsgen2InfoDict(TypedDict, total=False): + """""" + + destination: VariableOr[str] + """ + abfss destination, e.g. `abfss://@.dfs.core.windows.net/`. + """ + + +Adlsgen2InfoParam = Adlsgen2InfoDict | Adlsgen2Info diff --git a/python/databricks/bundles/clusters/_models/auto_scale.py b/python/databricks/bundles/clusters/_models/auto_scale.py new file mode 100644 index 00000000000..10ca50c26d7 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/auto_scale.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AutoScale: + """""" + + max_workers: VariableOrOptional[int] = None + """ + The maximum number of workers to which the cluster can scale up when overloaded. + Note that `max_workers` must be strictly greater than `min_workers`. + """ + + min_workers: VariableOrOptional[int] = None + """ + The minimum number of workers to which the cluster can scale down when underutilized. + It is also the initial number of workers the cluster will have after creation. + """ + + @classmethod + def from_dict(cls, value: "AutoScaleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AutoScaleDict": + return _transform_to_json_value(self) # type:ignore + + +class AutoScaleDict(TypedDict, total=False): + """""" + + max_workers: VariableOrOptional[int] + """ + The maximum number of workers to which the cluster can scale up when overloaded. + Note that `max_workers` must be strictly greater than `min_workers`. + """ + + min_workers: VariableOrOptional[int] + """ + The minimum number of workers to which the cluster can scale down when underutilized. + It is also the initial number of workers the cluster will have after creation. + """ + + +AutoScaleParam = AutoScaleDict | AutoScale diff --git a/python/databricks/bundles/clusters/_models/aws_attributes.py b/python/databricks/bundles/clusters/_models/aws_attributes.py new file mode 100644 index 00000000000..2ff19359882 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/aws_attributes.py @@ -0,0 +1,234 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.aws_availability import ( + AwsAvailability, + AwsAvailabilityParam, +) +from databricks.bundles.clusters._models.ebs_volume_type import ( + EbsVolumeType, + EbsVolumeTypeParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AwsAttributes: + """ + Attributes set during cluster creation which are related to Amazon Web Services. + """ + + availability: VariableOrOptional[AwsAvailability] = None + """ + Availability type used for all subsequent nodes past the `first_on_demand` ones. + + Note: If `first_on_demand` is zero, this availability type will be used for the entire cluster. + """ + + ebs_volume_count: VariableOrOptional[int] = None + """ + The number of volumes launched for each instance. Users can choose up to 10 volumes. + This feature is only enabled for supported node types. Legacy node types cannot specify + custom EBS volumes. + For node types with no instance store, at least one EBS volume needs to be specified; + otherwise, cluster creation will fail. + + These EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc. + Instance store volumes will be mounted at `/local_disk0`, `/local_disk1`, and etc. + + If EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for + scratch storage because heterogenously sized scratch devices can lead to inefficient disk + utilization. If no EBS volumes are attached, Databricks will configure Spark to use instance + store volumes. + + Please note that if EBS volumes are specified, then the Spark configuration `spark.local.dir` + will be overridden. + """ + + ebs_volume_iops: VariableOrOptional[int] = None + """ + If using gp3 volumes, what IOPS to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used. + """ + + ebs_volume_size: VariableOrOptional[int] = None + """ + The size of each EBS volume (in GiB) launched for each instance. For general purpose + SSD, this value must be within the range 100 - 4096. For throughput optimized HDD, + this value must be within the range 500 - 4096. + """ + + ebs_volume_throughput: VariableOrOptional[int] = None + """ + If using gp3 volumes, what throughput to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used. + """ + + ebs_volume_type: VariableOrOptional[EbsVolumeType] = None + """ + The type of EBS volumes that will be launched with this cluster. + """ + + first_on_demand: VariableOrOptional[int] = None + """ + The first `first_on_demand` nodes of the cluster will be placed on on-demand instances. + If this value is greater than 0, the cluster driver node in particular will be placed on an + on-demand instance. If this value is greater than or equal to the current cluster size, all + nodes will be placed on on-demand instances. If this value is less than the current cluster + size, `first_on_demand` nodes will be placed on on-demand instances and the remainder will + be placed on `availability` instances. Note that this value does not affect + cluster size and cannot currently be mutated over the lifetime of a cluster. + """ + + instance_profile_arn: VariableOrOptional[str] = None + """ + Nodes for this cluster will only be placed on AWS instances with this instance profile. If + ommitted, nodes will be placed on instances without an IAM instance profile. The instance + profile must have previously been added to the Databricks environment by an account + administrator. + + This feature may only be available to certain customer plans. + """ + + spot_bid_price_percent: VariableOrOptional[int] = None + """ + The bid price for AWS spot instances, as a percentage of the corresponding instance type's + on-demand price. + For example, if this field is set to 50, and the cluster needs a new `r3.xlarge` spot + instance, then the bid price is half of the price of + on-demand `r3.xlarge` instances. Similarly, if this field is set to 200, the bid price is twice + the price of on-demand `r3.xlarge` instances. If not specified, the default value is 100. + When spot instances are requested for this cluster, only spot instances whose bid price + percentage matches this field will be considered. + Note that, for safety, we enforce this field to be no more than 10000. + """ + + zone_id: VariableOrOptional[str] = None + """ + Identifier for the availability zone/datacenter in which the cluster resides. + This string will be of a form like "us-west-2a". The provided availability + zone must be in the same region as the Databricks deployment. For example, "us-west-2a" + is not a valid zone id if the Databricks deployment resides in the "us-east-1" region. + This is an optional field at cluster creation, and if not specified, the zone "auto" will be used. + If the zone specified is "auto", will try to place cluster in a zone with high availability, + and will retry placement in a different AZ if there is not enough capacity. + + The list of available zones as well as the default value can be found by using the + `List Zones` method. + """ + + @classmethod + def from_dict(cls, value: "AwsAttributesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AwsAttributesDict": + return _transform_to_json_value(self) # type:ignore + + +class AwsAttributesDict(TypedDict, total=False): + """""" + + availability: VariableOrOptional[AwsAvailabilityParam] + """ + Availability type used for all subsequent nodes past the `first_on_demand` ones. + + Note: If `first_on_demand` is zero, this availability type will be used for the entire cluster. + """ + + ebs_volume_count: VariableOrOptional[int] + """ + The number of volumes launched for each instance. Users can choose up to 10 volumes. + This feature is only enabled for supported node types. Legacy node types cannot specify + custom EBS volumes. + For node types with no instance store, at least one EBS volume needs to be specified; + otherwise, cluster creation will fail. + + These EBS volumes will be mounted at `/ebs0`, `/ebs1`, and etc. + Instance store volumes will be mounted at `/local_disk0`, `/local_disk1`, and etc. + + If EBS volumes are attached, Databricks will configure Spark to use only the EBS volumes for + scratch storage because heterogenously sized scratch devices can lead to inefficient disk + utilization. If no EBS volumes are attached, Databricks will configure Spark to use instance + store volumes. + + Please note that if EBS volumes are specified, then the Spark configuration `spark.local.dir` + will be overridden. + """ + + ebs_volume_iops: VariableOrOptional[int] + """ + If using gp3 volumes, what IOPS to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used. + """ + + ebs_volume_size: VariableOrOptional[int] + """ + The size of each EBS volume (in GiB) launched for each instance. For general purpose + SSD, this value must be within the range 100 - 4096. For throughput optimized HDD, + this value must be within the range 500 - 4096. + """ + + ebs_volume_throughput: VariableOrOptional[int] + """ + If using gp3 volumes, what throughput to use for the disk. If this is not set, the maximum performance of a gp2 volume with the same volume size will be used. + """ + + ebs_volume_type: VariableOrOptional[EbsVolumeTypeParam] + """ + The type of EBS volumes that will be launched with this cluster. + """ + + first_on_demand: VariableOrOptional[int] + """ + The first `first_on_demand` nodes of the cluster will be placed on on-demand instances. + If this value is greater than 0, the cluster driver node in particular will be placed on an + on-demand instance. If this value is greater than or equal to the current cluster size, all + nodes will be placed on on-demand instances. If this value is less than the current cluster + size, `first_on_demand` nodes will be placed on on-demand instances and the remainder will + be placed on `availability` instances. Note that this value does not affect + cluster size and cannot currently be mutated over the lifetime of a cluster. + """ + + instance_profile_arn: VariableOrOptional[str] + """ + Nodes for this cluster will only be placed on AWS instances with this instance profile. If + ommitted, nodes will be placed on instances without an IAM instance profile. The instance + profile must have previously been added to the Databricks environment by an account + administrator. + + This feature may only be available to certain customer plans. + """ + + spot_bid_price_percent: VariableOrOptional[int] + """ + The bid price for AWS spot instances, as a percentage of the corresponding instance type's + on-demand price. + For example, if this field is set to 50, and the cluster needs a new `r3.xlarge` spot + instance, then the bid price is half of the price of + on-demand `r3.xlarge` instances. Similarly, if this field is set to 200, the bid price is twice + the price of on-demand `r3.xlarge` instances. If not specified, the default value is 100. + When spot instances are requested for this cluster, only spot instances whose bid price + percentage matches this field will be considered. + Note that, for safety, we enforce this field to be no more than 10000. + """ + + zone_id: VariableOrOptional[str] + """ + Identifier for the availability zone/datacenter in which the cluster resides. + This string will be of a form like "us-west-2a". The provided availability + zone must be in the same region as the Databricks deployment. For example, "us-west-2a" + is not a valid zone id if the Databricks deployment resides in the "us-east-1" region. + This is an optional field at cluster creation, and if not specified, the zone "auto" will be used. + If the zone specified is "auto", will try to place cluster in a zone with high availability, + and will retry placement in a different AZ if there is not enough capacity. + + The list of available zones as well as the default value can be found by using the + `List Zones` method. + """ + + +AwsAttributesParam = AwsAttributesDict | AwsAttributes diff --git a/python/databricks/bundles/clusters/_models/aws_availability.py b/python/databricks/bundles/clusters/_models/aws_availability.py new file mode 100644 index 00000000000..4c3810f067e --- /dev/null +++ b/python/databricks/bundles/clusters/_models/aws_availability.py @@ -0,0 +1,21 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AwsAvailability(Enum): + """ + Availability type used for all subsequent nodes past the `first_on_demand` ones. + + Note: If `first_on_demand` is zero, this availability type will be used for the entire cluster. + """ + + SPOT = "SPOT" + ON_DEMAND = "ON_DEMAND" + SPOT_WITH_FALLBACK = "SPOT_WITH_FALLBACK" + + +AwsAvailabilityParam = ( + Literal["SPOT", "ON_DEMAND", "SPOT_WITH_FALLBACK"] | AwsAvailability +) diff --git a/python/databricks/bundles/clusters/_models/azure_attributes.py b/python/databricks/bundles/clusters/_models/azure_attributes.py new file mode 100644 index 00000000000..f5c5cbee36d --- /dev/null +++ b/python/databricks/bundles/clusters/_models/azure_attributes.py @@ -0,0 +1,132 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.azure_availability import ( + AzureAvailability, + AzureAvailabilityParam, +) +from databricks.bundles.clusters._models.log_analytics_info import ( + LogAnalyticsInfo, + LogAnalyticsInfoParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AzureAttributes: + """ + Attributes set during cluster creation which are related to Microsoft Azure. + """ + + availability: VariableOrOptional[AzureAvailability] = None + """ + Availability type used for all subsequent nodes past the `first_on_demand` ones. + Note: If `first_on_demand` is zero, this availability + type will be used for the entire cluster. + """ + + capacity_reservation_group: VariableOrOptional[str] = None + """ + The Azure capacity reservation group resource ID to use for launching VMs. + When specified, VMs will be launched using the provided capacity reservation. + + Capacity reservations can only be specified when the workspace uses injected vnet (i.e. customer defined vnet not + managed by databricks). Ensure the databricks-login-prod Enterprise Application is granted the following four permissions: + 1. Microsoft.Compute/capacityReservationGroups/read + 2. Microsoft.Compute/capacityReservationGroups/deploy/action + 3. Microsoft.Compute/capacityReservationGroups/capacityReservations/read + 4. Microsoft.Compute/capacityReservationGroups/capacityReservations/deploy/action + + Format: `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}` + """ + + first_on_demand: VariableOrOptional[int] = None + """ + The first `first_on_demand` nodes of the cluster will be placed on on-demand instances. + This value should be greater than 0, to make sure the cluster driver node is placed on an + on-demand instance. If this value is greater than or equal to the current cluster size, all + nodes will be placed on on-demand instances. If this value is less than the current cluster + size, `first_on_demand` nodes will be placed on on-demand instances and the remainder will + be placed on `availability` instances. Note that this value does not affect + cluster size and cannot currently be mutated over the lifetime of a cluster. + """ + + log_analytics_info: VariableOrOptional[LogAnalyticsInfo] = None + """ + Defines values necessary to configure and run Azure Log Analytics agent + """ + + spot_bid_max_price: VariableOrOptional[float] = None + """ + The max bid price to be used for Azure spot instances. + The Max price for the bid cannot be higher than the on-demand price of the instance. + If not specified, the default value is -1, which specifies that the instance cannot be evicted + on the basis of price, and only on the basis of availability. Further, the value should > 0 or -1. + """ + + @classmethod + def from_dict(cls, value: "AzureAttributesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AzureAttributesDict": + return _transform_to_json_value(self) # type:ignore + + +class AzureAttributesDict(TypedDict, total=False): + """""" + + availability: VariableOrOptional[AzureAvailabilityParam] + """ + Availability type used for all subsequent nodes past the `first_on_demand` ones. + Note: If `first_on_demand` is zero, this availability + type will be used for the entire cluster. + """ + + capacity_reservation_group: VariableOrOptional[str] + """ + The Azure capacity reservation group resource ID to use for launching VMs. + When specified, VMs will be launched using the provided capacity reservation. + + Capacity reservations can only be specified when the workspace uses injected vnet (i.e. customer defined vnet not + managed by databricks). Ensure the databricks-login-prod Enterprise Application is granted the following four permissions: + 1. Microsoft.Compute/capacityReservationGroups/read + 2. Microsoft.Compute/capacityReservationGroups/deploy/action + 3. Microsoft.Compute/capacityReservationGroups/capacityReservations/read + 4. Microsoft.Compute/capacityReservationGroups/capacityReservations/deploy/action + + Format: `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}` + """ + + first_on_demand: VariableOrOptional[int] + """ + The first `first_on_demand` nodes of the cluster will be placed on on-demand instances. + This value should be greater than 0, to make sure the cluster driver node is placed on an + on-demand instance. If this value is greater than or equal to the current cluster size, all + nodes will be placed on on-demand instances. If this value is less than the current cluster + size, `first_on_demand` nodes will be placed on on-demand instances and the remainder will + be placed on `availability` instances. Note that this value does not affect + cluster size and cannot currently be mutated over the lifetime of a cluster. + """ + + log_analytics_info: VariableOrOptional[LogAnalyticsInfoParam] + """ + Defines values necessary to configure and run Azure Log Analytics agent + """ + + spot_bid_max_price: VariableOrOptional[float] + """ + The max bid price to be used for Azure spot instances. + The Max price for the bid cannot be higher than the on-demand price of the instance. + If not specified, the default value is -1, which specifies that the instance cannot be evicted + on the basis of price, and only on the basis of availability. Further, the value should > 0 or -1. + """ + + +AzureAttributesParam = AzureAttributesDict | AzureAttributes diff --git a/python/databricks/bundles/clusters/_models/azure_availability.py b/python/databricks/bundles/clusters/_models/azure_availability.py new file mode 100644 index 00000000000..a03cb1fdddf --- /dev/null +++ b/python/databricks/bundles/clusters/_models/azure_availability.py @@ -0,0 +1,21 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AzureAvailability(Enum): + """ + Availability type used for all subsequent nodes past the `first_on_demand` ones. + Note: If `first_on_demand` is zero, this availability type will be used for the entire cluster. + """ + + SPOT_AZURE = "SPOT_AZURE" + ON_DEMAND_AZURE = "ON_DEMAND_AZURE" + SPOT_WITH_FALLBACK_AZURE = "SPOT_WITH_FALLBACK_AZURE" + + +AzureAvailabilityParam = ( + Literal["SPOT_AZURE", "ON_DEMAND_AZURE", "SPOT_WITH_FALLBACK_AZURE"] + | AzureAvailability +) diff --git a/python/databricks/bundles/clusters/_models/clients_types.py b/python/databricks/bundles/clusters/_models/clients_types.py new file mode 100644 index 00000000000..87f92446ba5 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/clients_types.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ClientsTypes: + """""" + + jobs: VariableOrOptional[bool] = None + """ + With jobs set, the cluster can be used for jobs + """ + + notebooks: VariableOrOptional[bool] = None + """ + With notebooks set, this cluster can be used for notebooks + """ + + @classmethod + def from_dict(cls, value: "ClientsTypesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ClientsTypesDict": + return _transform_to_json_value(self) # type:ignore + + +class ClientsTypesDict(TypedDict, total=False): + """""" + + jobs: VariableOrOptional[bool] + """ + With jobs set, the cluster can be used for jobs + """ + + notebooks: VariableOrOptional[bool] + """ + With notebooks set, this cluster can be used for notebooks + """ + + +ClientsTypesParam = ClientsTypesDict | ClientsTypes diff --git a/python/databricks/bundles/clusters/_models/cluster.py b/python/databricks/bundles/clusters/_models/cluster.py new file mode 100644 index 00000000000..93eeadfca1e --- /dev/null +++ b/python/databricks/bundles/clusters/_models/cluster.py @@ -0,0 +1,648 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.auto_scale import ( + AutoScale, + AutoScaleParam, +) +from databricks.bundles.clusters._models.aws_attributes import ( + AwsAttributes, + AwsAttributesParam, +) +from databricks.bundles.clusters._models.azure_attributes import ( + AzureAttributes, + AzureAttributesParam, +) +from databricks.bundles.clusters._models.cluster_log_conf import ( + ClusterLogConf, + ClusterLogConfParam, +) +from databricks.bundles.clusters._models.cluster_permission import ( + ClusterPermission, + ClusterPermissionParam, +) +from databricks.bundles.clusters._models.data_security_mode import ( + DataSecurityMode, + DataSecurityModeParam, +) +from databricks.bundles.clusters._models.dependency_mode import ( + DependencyMode, + DependencyModeParam, +) +from databricks.bundles.clusters._models.docker_image import ( + DockerImage, + DockerImageParam, +) +from databricks.bundles.clusters._models.gcp_attributes import ( + GcpAttributes, + GcpAttributesParam, +) +from databricks.bundles.clusters._models.init_script_info import ( + InitScriptInfo, + InitScriptInfoParam, +) +from databricks.bundles.clusters._models.kind import Kind, KindParam +from databricks.bundles.clusters._models.lifecycle_with_started import ( + LifecycleWithStarted, + LifecycleWithStartedParam, +) +from databricks.bundles.clusters._models.node_type_flexibility import ( + NodeTypeFlexibility, + NodeTypeFlexibilityParam, +) +from databricks.bundles.clusters._models.runtime_engine import ( + RuntimeEngine, + RuntimeEngineParam, +) +from databricks.bundles.clusters._models.workload_type import ( + WorkloadType, + WorkloadTypeParam, +) +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 ( + VariableOrDict, + VariableOrList, + VariableOrOptional, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Cluster(Resource): + """ + Contains a snapshot of the latest user specified settings that were used to create/edit the cluster. + """ + + apply_policy_default_values: VariableOrOptional[bool] = None + """ + When set to true, fixed and default values from the policy will be used for fields that are omitted. When set to false, only fixed values from the policy will be applied. + """ + + autoscale: VariableOrOptional[AutoScale] = None + """ + Parameters needed in order to automatically scale clusters up and down based on load. + Note: autoscaling works best with DB runtime versions 3.0 or later. + """ + + autotermination_minutes: VariableOrOptional[int] = None + """ + Automatically terminates the cluster after it is inactive for this time in minutes. If not set, + this cluster will not be automatically terminated. If specified, the threshold must be between + 10 and 10000 minutes. + Users can also set this value to 0 to explicitly disable automatic termination. + """ + + aws_attributes: VariableOrOptional[AwsAttributes] = None + """ + Attributes related to clusters running on Amazon Web Services. + If not specified at cluster creation, a set of default values will be used. + """ + + azure_attributes: VariableOrOptional[AzureAttributes] = None + """ + Attributes related to clusters running on Microsoft Azure. + If not specified at cluster creation, a set of default values will be used. + """ + + cluster_log_conf: VariableOrOptional[ClusterLogConf] = None + """ + The configuration for delivering spark logs to a long-term storage destination. + Three kinds of destinations (DBFS, S3 and Unity Catalog volumes) are supported. Only one destination can be specified + for one cluster. If the conf is given, the logs will be delivered to the destination every + `5 mins`. The destination of driver logs is `$destination/$clusterId/driver`, while + the destination of executor logs is `$destination/$clusterId/executor`. + """ + + cluster_name: VariableOrOptional[str] = None + """ + Cluster name requested by the user. This doesn't have to be unique. + If not specified at creation, the cluster name will be an empty string. + For job clusters, the cluster name is automatically set based on the job and job run IDs. + """ + + custom_tags: VariableOrDict[str] = field(default_factory=dict) + """ + Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + + - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster tags + """ + + data_security_mode: VariableOrOptional[DataSecurityMode] = None + """ + Data security mode decides what data governance model to use when accessing data + from a cluster. + + * `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate access mode depending on your compute configuration. + * `DATA_SECURITY_MODE_STANDARD`: A secure cluster that can be shared by multiple users. Cluster users are fully isolated so that they cannot see each other’s data and credentials. Most data governance features are supported in this mode. But programming languages and cluster features might be limited. + * `DATA_SECURITY_MODE_DEDICATED`: A secure cluster that can only be exclusively used by a single user specified in `single_user_name`. Most programming languages, cluster features and data governance features are available in this mode. + + The following modes are legacy aliases for the above modes: + + * `USER_ISOLATION`: Legacy alias for `DATA_SECURITY_MODE_STANDARD`. + * `SINGLE_USER`: Legacy alias for `DATA_SECURITY_MODE_DEDICATED`. + + The following modes are deprecated starting with Databricks Runtime 15.0 and + will be removed for future Databricks Runtime versions: + + * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL clusters. + * `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy Passthrough on high concurrency clusters. + * `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy Passthrough on standard clusters. + * `LEGACY_SINGLE_USER_STANDARD`: This mode provides a way that doesn’t have UC nor passthrough enabled. + """ + + dependency_mode: VariableOrOptional[DependencyMode] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] Controls dependency configuration for the cluster. + """ + + docker_image: VariableOrOptional[DockerImage] = None + """ + Custom docker image BYOC + """ + + driver_instance_pool_id: VariableOrOptional[str] = None + """ + The optional ID of the instance pool for the driver of the cluster belongs. + The pool cluster uses the instance pool with id (instance_pool_id) if the driver pool is not + assigned. + """ + + driver_node_type_flexibility: VariableOrOptional[NodeTypeFlexibility] = None + """ + Flexible node type configuration for the driver node. + """ + + driver_node_type_id: VariableOrOptional[str] = None + """ + The node type of the Spark driver. + Note that this field is optional; if unset, the driver node type will be set as the same value + as `node_type_id` defined above. + + This field, along with node_type_id, should not be set if virtual_cluster_size is set. + If both driver_node_type_id, node_type_id, and virtual_cluster_size are specified, driver_node_type_id and node_type_id take precedence. + """ + + enable_elastic_disk: VariableOrOptional[bool] = None + """ + Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk + space when its Spark workers are running low on disk space. + """ + + enable_local_disk_encryption: VariableOrOptional[bool] = None + """ + Whether to enable LUKS on cluster VMs' local disks + """ + + gcp_attributes: VariableOrOptional[GcpAttributes] = None + """ + Attributes related to clusters running on Google Cloud Platform. + If not specified at cluster creation, a set of default values will be used. + """ + + init_scripts: VariableOrList[InitScriptInfo] = field(default_factory=list) + """ + The configuration for storing init scripts. Any number of destinations can be specified. + The scripts are executed sequentially in the order provided. + If `cluster_log_conf` is specified, init script logs are sent to `//init_scripts`. + """ + + instance_pool_id: VariableOrOptional[str] = None + """ + The optional ID of the instance pool to which the cluster belongs. + """ + + is_single_node: VariableOrOptional[bool] = None + """ + This field can only be used when `kind = CLASSIC_PREVIEW`. + + When set to true, Databricks will automatically set single node related `custom_tags`, `spark_conf`, and `num_workers` + """ + + kind: VariableOrOptional[Kind] = None + """ + The kind of compute described by this compute specification. + + Depending on `kind`, different validations and default values will be applied. + + Clusters with `kind = CLASSIC_PREVIEW` support the following fields, whereas clusters with no specified `kind` do not. + * [is_single_node](/api/workspace/clusters/create#is_single_node) + * [use_ml_runtime](/api/workspace/clusters/create#use_ml_runtime) + + By using the [simple form](https://docs.databricks.com/compute/simple-form.html), your clusters are automatically using `kind = CLASSIC_PREVIEW`. + """ + + lifecycle: VariableOrOptional[LifecycleWithStarted] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + node_type_id: VariableOrOptional[str] = None + """ + This field encodes, through a single value, the resources available to each of + the Spark nodes in this cluster. For example, the Spark nodes can be provisioned + and optimized for memory or compute intensive workloads. A list of available node + types can be retrieved by using the [clusters/listNodeTypes](https://docs.databricks.com/api/workspace/clusters/listnodetypes) API call. + """ + + num_workers: VariableOrOptional[int] = None + """ + Number of worker nodes that this cluster should have. A cluster has one Spark Driver + and `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number + of workers rather than the actual current number of workers. For instance, if a cluster + is resized from 5 to 10 workers, this field will immediately be updated to reflect + the target size of 10 workers, whereas the workers listed in `spark_info` will gradually + increase from 5 to 10 as the new nodes are provisioned. + """ + + permissions: VariableOrList[ClusterPermission] = field(default_factory=list) + """ + The permissions to apply to this resource. + """ + + policy_id: VariableOrOptional[str] = None + """ + The ID of the cluster policy used to create the cluster if applicable. + """ + + remote_disk_throughput: VariableOrOptional[int] = None + """ + If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED disks. + """ + + runtime_engine: VariableOrOptional[RuntimeEngine] = None + """ + Determines the cluster's runtime engine, either standard or Photon. + + This field is not compatible with legacy `spark_version` values that contain `-photon-`. + Remove `-photon-` from the `spark_version` and set `runtime_engine` to `PHOTON`. + + If left unspecified, the runtime engine defaults to standard unless the spark_version + contains -photon-, in which case Photon will be used. + """ + + single_user_name: VariableOrOptional[str] = None + """ + Single user name if data_security_mode is `SINGLE_USER` + """ + + spark_conf: VariableOrDict[str] = field(default_factory=dict) + """ + An object containing a set of optional, user-specified Spark configuration key-value pairs. + Users can also pass in a string of extra JVM options to the driver and the executors via + `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively. + """ + + spark_env_vars: VariableOrDict[str] = field(default_factory=dict) + """ + An object containing a set of optional, user-specified environment variable key-value pairs. + Please note that key-value pair of the form (X,Y) will be exported as is (i.e., + `export X='Y'`) while launching the driver and workers. + + In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending + them to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all + default databricks managed environmental variables are included as well. + + Example Spark environment variables: + `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": "/local_disk0"}` or + `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` + """ + + spark_version: VariableOrOptional[str] = None + """ + The Spark version of the cluster, e.g. `3.3.x-scala2.11`. + A list of available Spark versions can be retrieved by using + the [clusters/sparkVersions](https://docs.databricks.com/api/workspace/clusters/sparkversions) API call. + """ + + ssh_public_keys: VariableOrList[str] = field(default_factory=list) + """ + SSH public key contents that will be added to each Spark node in this cluster. The + corresponding private keys can be used to login with the user name `ubuntu` on port `2200`. + Up to 10 keys can be specified. + """ + + total_initial_remote_disk_size: VariableOrOptional[int] = None + """ + If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED disks. + """ + + use_ml_runtime: VariableOrOptional[bool] = None + """ + This field can only be used when `kind = CLASSIC_PREVIEW`. + + `effective_spark_version` is determined by `spark_version` (DBR release), this field `use_ml_runtime`, and whether `node_type_id` is gpu node or not. + """ + + worker_node_type_flexibility: VariableOrOptional[NodeTypeFlexibility] = None + """ + Flexible node type configuration for worker nodes. + """ + + workload_type: VariableOrOptional[WorkloadType] = None + """ + Cluster Attributes showing for clusters workload types. + """ + + @classmethod + def from_dict(cls, value: "ClusterDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ClusterDict": + return _transform_to_json_value(self) # type:ignore + + +class ClusterDict(TypedDict, total=False): + """""" + + apply_policy_default_values: VariableOrOptional[bool] + """ + When set to true, fixed and default values from the policy will be used for fields that are omitted. When set to false, only fixed values from the policy will be applied. + """ + + autoscale: VariableOrOptional[AutoScaleParam] + """ + Parameters needed in order to automatically scale clusters up and down based on load. + Note: autoscaling works best with DB runtime versions 3.0 or later. + """ + + autotermination_minutes: VariableOrOptional[int] + """ + Automatically terminates the cluster after it is inactive for this time in minutes. If not set, + this cluster will not be automatically terminated. If specified, the threshold must be between + 10 and 10000 minutes. + Users can also set this value to 0 to explicitly disable automatic termination. + """ + + aws_attributes: VariableOrOptional[AwsAttributesParam] + """ + Attributes related to clusters running on Amazon Web Services. + If not specified at cluster creation, a set of default values will be used. + """ + + azure_attributes: VariableOrOptional[AzureAttributesParam] + """ + Attributes related to clusters running on Microsoft Azure. + If not specified at cluster creation, a set of default values will be used. + """ + + cluster_log_conf: VariableOrOptional[ClusterLogConfParam] + """ + The configuration for delivering spark logs to a long-term storage destination. + Three kinds of destinations (DBFS, S3 and Unity Catalog volumes) are supported. Only one destination can be specified + for one cluster. If the conf is given, the logs will be delivered to the destination every + `5 mins`. The destination of driver logs is `$destination/$clusterId/driver`, while + the destination of executor logs is `$destination/$clusterId/executor`. + """ + + cluster_name: VariableOrOptional[str] + """ + Cluster name requested by the user. This doesn't have to be unique. + If not specified at creation, the cluster name will be an empty string. + For job clusters, the cluster name is automatically set based on the job and job run IDs. + """ + + custom_tags: VariableOrDict[str] + """ + Additional tags for cluster resources. Databricks will tag all cluster resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + + - Clusters can only reuse cloud resources if the resources' tags are a subset of the cluster tags + """ + + data_security_mode: VariableOrOptional[DataSecurityModeParam] + """ + Data security mode decides what data governance model to use when accessing data + from a cluster. + + * `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate access mode depending on your compute configuration. + * `DATA_SECURITY_MODE_STANDARD`: A secure cluster that can be shared by multiple users. Cluster users are fully isolated so that they cannot see each other’s data and credentials. Most data governance features are supported in this mode. But programming languages and cluster features might be limited. + * `DATA_SECURITY_MODE_DEDICATED`: A secure cluster that can only be exclusively used by a single user specified in `single_user_name`. Most programming languages, cluster features and data governance features are available in this mode. + + The following modes are legacy aliases for the above modes: + + * `USER_ISOLATION`: Legacy alias for `DATA_SECURITY_MODE_STANDARD`. + * `SINGLE_USER`: Legacy alias for `DATA_SECURITY_MODE_DEDICATED`. + + The following modes are deprecated starting with Databricks Runtime 15.0 and + will be removed for future Databricks Runtime versions: + + * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL clusters. + * `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy Passthrough on high concurrency clusters. + * `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy Passthrough on standard clusters. + * `LEGACY_SINGLE_USER_STANDARD`: This mode provides a way that doesn’t have UC nor passthrough enabled. + """ + + dependency_mode: VariableOrOptional[DependencyModeParam] + """ + :meta private: [EXPERIMENTAL] + + [Beta] Controls dependency configuration for the cluster. + """ + + docker_image: VariableOrOptional[DockerImageParam] + """ + Custom docker image BYOC + """ + + driver_instance_pool_id: VariableOrOptional[str] + """ + The optional ID of the instance pool for the driver of the cluster belongs. + The pool cluster uses the instance pool with id (instance_pool_id) if the driver pool is not + assigned. + """ + + driver_node_type_flexibility: VariableOrOptional[NodeTypeFlexibilityParam] + """ + Flexible node type configuration for the driver node. + """ + + driver_node_type_id: VariableOrOptional[str] + """ + The node type of the Spark driver. + Note that this field is optional; if unset, the driver node type will be set as the same value + as `node_type_id` defined above. + + This field, along with node_type_id, should not be set if virtual_cluster_size is set. + If both driver_node_type_id, node_type_id, and virtual_cluster_size are specified, driver_node_type_id and node_type_id take precedence. + """ + + enable_elastic_disk: VariableOrOptional[bool] + """ + Autoscaling Local Storage: when enabled, this cluster will dynamically acquire additional disk + space when its Spark workers are running low on disk space. + """ + + enable_local_disk_encryption: VariableOrOptional[bool] + """ + Whether to enable LUKS on cluster VMs' local disks + """ + + gcp_attributes: VariableOrOptional[GcpAttributesParam] + """ + Attributes related to clusters running on Google Cloud Platform. + If not specified at cluster creation, a set of default values will be used. + """ + + init_scripts: VariableOrList[InitScriptInfoParam] + """ + The configuration for storing init scripts. Any number of destinations can be specified. + The scripts are executed sequentially in the order provided. + If `cluster_log_conf` is specified, init script logs are sent to `//init_scripts`. + """ + + instance_pool_id: VariableOrOptional[str] + """ + The optional ID of the instance pool to which the cluster belongs. + """ + + is_single_node: VariableOrOptional[bool] + """ + This field can only be used when `kind = CLASSIC_PREVIEW`. + + When set to true, Databricks will automatically set single node related `custom_tags`, `spark_conf`, and `num_workers` + """ + + kind: VariableOrOptional[KindParam] + """ + The kind of compute described by this compute specification. + + Depending on `kind`, different validations and default values will be applied. + + Clusters with `kind = CLASSIC_PREVIEW` support the following fields, whereas clusters with no specified `kind` do not. + * [is_single_node](/api/workspace/clusters/create#is_single_node) + * [use_ml_runtime](/api/workspace/clusters/create#use_ml_runtime) + + By using the [simple form](https://docs.databricks.com/compute/simple-form.html), your clusters are automatically using `kind = CLASSIC_PREVIEW`. + """ + + lifecycle: VariableOrOptional[LifecycleWithStartedParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + node_type_id: VariableOrOptional[str] + """ + This field encodes, through a single value, the resources available to each of + the Spark nodes in this cluster. For example, the Spark nodes can be provisioned + and optimized for memory or compute intensive workloads. A list of available node + types can be retrieved by using the [clusters/listNodeTypes](https://docs.databricks.com/api/workspace/clusters/listnodetypes) API call. + """ + + num_workers: VariableOrOptional[int] + """ + Number of worker nodes that this cluster should have. A cluster has one Spark Driver + and `num_workers` Executors for a total of `num_workers` + 1 Spark nodes. + + Note: When reading the properties of a cluster, this field reflects the desired number + of workers rather than the actual current number of workers. For instance, if a cluster + is resized from 5 to 10 workers, this field will immediately be updated to reflect + the target size of 10 workers, whereas the workers listed in `spark_info` will gradually + increase from 5 to 10 as the new nodes are provisioned. + """ + + permissions: VariableOrList[ClusterPermissionParam] + """ + The permissions to apply to this resource. + """ + + policy_id: VariableOrOptional[str] + """ + The ID of the cluster policy used to create the cluster if applicable. + """ + + remote_disk_throughput: VariableOrOptional[int] + """ + If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED disks. + """ + + runtime_engine: VariableOrOptional[RuntimeEngineParam] + """ + Determines the cluster's runtime engine, either standard or Photon. + + This field is not compatible with legacy `spark_version` values that contain `-photon-`. + Remove `-photon-` from the `spark_version` and set `runtime_engine` to `PHOTON`. + + If left unspecified, the runtime engine defaults to standard unless the spark_version + contains -photon-, in which case Photon will be used. + """ + + single_user_name: VariableOrOptional[str] + """ + Single user name if data_security_mode is `SINGLE_USER` + """ + + spark_conf: VariableOrDict[str] + """ + An object containing a set of optional, user-specified Spark configuration key-value pairs. + Users can also pass in a string of extra JVM options to the driver and the executors via + `spark.driver.extraJavaOptions` and `spark.executor.extraJavaOptions` respectively. + """ + + spark_env_vars: VariableOrDict[str] + """ + An object containing a set of optional, user-specified environment variable key-value pairs. + Please note that key-value pair of the form (X,Y) will be exported as is (i.e., + `export X='Y'`) while launching the driver and workers. + + In order to specify an additional set of `SPARK_DAEMON_JAVA_OPTS`, we recommend appending + them to `$SPARK_DAEMON_JAVA_OPTS` as shown in the example below. This ensures that all + default databricks managed environmental variables are included as well. + + Example Spark environment variables: + `{"SPARK_WORKER_MEMORY": "28000m", "SPARK_LOCAL_DIRS": "/local_disk0"}` or + `{"SPARK_DAEMON_JAVA_OPTS": "$SPARK_DAEMON_JAVA_OPTS -Dspark.shuffle.service.enabled=true"}` + """ + + spark_version: VariableOrOptional[str] + """ + The Spark version of the cluster, e.g. `3.3.x-scala2.11`. + A list of available Spark versions can be retrieved by using + the [clusters/sparkVersions](https://docs.databricks.com/api/workspace/clusters/sparkversions) API call. + """ + + ssh_public_keys: VariableOrList[str] + """ + SSH public key contents that will be added to each Spark node in this cluster. The + corresponding private keys can be used to login with the user name `ubuntu` on port `2200`. + Up to 10 keys can be specified. + """ + + total_initial_remote_disk_size: VariableOrOptional[int] + """ + If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED disks. + """ + + use_ml_runtime: VariableOrOptional[bool] + """ + This field can only be used when `kind = CLASSIC_PREVIEW`. + + `effective_spark_version` is determined by `spark_version` (DBR release), this field `use_ml_runtime`, and whether `node_type_id` is gpu node or not. + """ + + worker_node_type_flexibility: VariableOrOptional[NodeTypeFlexibilityParam] + """ + Flexible node type configuration for worker nodes. + """ + + workload_type: VariableOrOptional[WorkloadTypeParam] + """ + Cluster Attributes showing for clusters workload types. + """ + + +ClusterParam = ClusterDict | Cluster diff --git a/python/databricks/bundles/clusters/_models/cluster_log_conf.py b/python/databricks/bundles/clusters/_models/cluster_log_conf.py new file mode 100644 index 00000000000..c087a2ad463 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/cluster_log_conf.py @@ -0,0 +1,84 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.dbfs_storage_info import ( + DbfsStorageInfo, + DbfsStorageInfoParam, +) +from databricks.bundles.clusters._models.s3_storage_info import ( + S3StorageInfo, + S3StorageInfoParam, +) +from databricks.bundles.clusters._models.volumes_storage_info import ( + VolumesStorageInfo, + VolumesStorageInfoParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ClusterLogConf: + """ + Cluster log delivery config + """ + + dbfs: VariableOrOptional[DbfsStorageInfo] = None + """ + destination needs to be provided. e.g. + `{ "dbfs" : { "destination" : "dbfs:/home/cluster_log" } }` + """ + + s3: VariableOrOptional[S3StorageInfo] = None + """ + destination and either the region or endpoint need to be provided. e.g. + `{ "s3": { "destination" : "s3://cluster_log_bucket/prefix", "region" : "us-west-2" } }` + Cluster iam role is used to access s3, please make sure the cluster iam role in + `instance_profile_arn` has permission to write data to the s3 destination. + """ + + volumes: VariableOrOptional[VolumesStorageInfo] = None + """ + destination needs to be provided, e.g. + `{ "volumes": { "destination": "/Volumes/catalog/schema/volume/cluster_log" } }` + """ + + @classmethod + def from_dict(cls, value: "ClusterLogConfDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ClusterLogConfDict": + return _transform_to_json_value(self) # type:ignore + + +class ClusterLogConfDict(TypedDict, total=False): + """""" + + dbfs: VariableOrOptional[DbfsStorageInfoParam] + """ + destination needs to be provided. e.g. + `{ "dbfs" : { "destination" : "dbfs:/home/cluster_log" } }` + """ + + s3: VariableOrOptional[S3StorageInfoParam] + """ + destination and either the region or endpoint need to be provided. e.g. + `{ "s3": { "destination" : "s3://cluster_log_bucket/prefix", "region" : "us-west-2" } }` + Cluster iam role is used to access s3, please make sure the cluster iam role in + `instance_profile_arn` has permission to write data to the s3 destination. + """ + + volumes: VariableOrOptional[VolumesStorageInfoParam] + """ + destination needs to be provided, e.g. + `{ "volumes": { "destination": "/Volumes/catalog/schema/volume/cluster_log" } }` + """ + + +ClusterLogConfParam = ClusterLogConfDict | ClusterLogConf diff --git a/python/databricks/bundles/clusters/_models/cluster_permission.py b/python/databricks/bundles/clusters/_models/cluster_permission.py new file mode 100644 index 00000000000..537e136780a --- /dev/null +++ b/python/databricks/bundles/clusters/_models/cluster_permission.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.cluster_permission_level import ( + ClusterPermissionLevel, + ClusterPermissionLevelParam, +) +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ClusterPermission: + """""" + + level: VariableOr[ClusterPermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. + """ + + @classmethod + def from_dict(cls, value: "ClusterPermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ClusterPermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class ClusterPermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[ClusterPermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. + """ + + +ClusterPermissionParam = ClusterPermissionDict | ClusterPermission diff --git a/python/databricks/bundles/clusters/_models/cluster_permission_level.py b/python/databricks/bundles/clusters/_models/cluster_permission_level.py new file mode 100644 index 00000000000..bb8b1347d92 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/cluster_permission_level.py @@ -0,0 +1,19 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ClusterPermissionLevel(Enum): + """ + Permission level + """ + + CAN_MANAGE = "CAN_MANAGE" + CAN_RESTART = "CAN_RESTART" + CAN_ATTACH_TO = "CAN_ATTACH_TO" + + +ClusterPermissionLevelParam = ( + Literal["CAN_MANAGE", "CAN_RESTART", "CAN_ATTACH_TO"] | ClusterPermissionLevel +) diff --git a/python/databricks/bundles/clusters/_models/confidential_compute_type.py b/python/databricks/bundles/clusters/_models/confidential_compute_type.py new file mode 100644 index 00000000000..e881295bd47 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/confidential_compute_type.py @@ -0,0 +1,23 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ConfidentialComputeType(Enum): + """ + :meta private: [EXPERIMENTAL] + + Confidential computing technology for GCP instances. + Aligns with gcloud's --confidential-compute-type flag and the REST API's + confidentialInstanceConfig.confidentialInstanceType field. + See: https://cloud.google.com/confidential-computing/confidential-vm/docs/create-a-confidential-vm-instance + """ + + CONFIDENTIAL_COMPUTE_TYPE_NONE = "CONFIDENTIAL_COMPUTE_TYPE_NONE" + SEV_SNP = "SEV_SNP" + + +ConfidentialComputeTypeParam = ( + Literal["CONFIDENTIAL_COMPUTE_TYPE_NONE", "SEV_SNP"] | ConfidentialComputeType +) diff --git a/python/databricks/bundles/clusters/_models/data_security_mode.py b/python/databricks/bundles/clusters/_models/data_security_mode.py new file mode 100644 index 00000000000..ae1aafcf085 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/data_security_mode.py @@ -0,0 +1,56 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class DataSecurityMode(Enum): + """ + Data security mode decides what data governance model to use when accessing data + from a cluster. + + * `DATA_SECURITY_MODE_AUTO`: Databricks will choose the most appropriate access mode depending on your compute configuration. + * `DATA_SECURITY_MODE_STANDARD`: A secure cluster that can be shared by multiple users. Cluster users are fully isolated so that they cannot see each other’s data and credentials. Most data governance features are supported in this mode. But programming languages and cluster features might be limited. + * `DATA_SECURITY_MODE_DEDICATED`: A secure cluster that can only be exclusively used by a single user specified in `single_user_name`. Most programming languages, cluster features and data governance features are available in this mode. + + The following modes are legacy aliases for the above modes: + + * `USER_ISOLATION`: Legacy alias for `DATA_SECURITY_MODE_STANDARD`. + * `SINGLE_USER`: Legacy alias for `DATA_SECURITY_MODE_DEDICATED`. + + The following modes are deprecated starting with Databricks Runtime 15.0 and + will be removed for future Databricks Runtime versions: + + * `LEGACY_TABLE_ACL`: This mode is for users migrating from legacy Table ACL clusters. + * `LEGACY_PASSTHROUGH`: This mode is for users migrating from legacy Passthrough on high concurrency clusters. + * `LEGACY_SINGLE_USER`: This mode is for users migrating from legacy Passthrough on standard clusters. + * `LEGACY_SINGLE_USER_STANDARD`: This mode provides a way that doesn’t have UC nor passthrough enabled. + """ + + NONE = "NONE" + SINGLE_USER = "SINGLE_USER" + USER_ISOLATION = "USER_ISOLATION" + LEGACY_TABLE_ACL = "LEGACY_TABLE_ACL" + LEGACY_PASSTHROUGH = "LEGACY_PASSTHROUGH" + LEGACY_SINGLE_USER = "LEGACY_SINGLE_USER" + LEGACY_SINGLE_USER_STANDARD = "LEGACY_SINGLE_USER_STANDARD" + DATA_SECURITY_MODE_STANDARD = "DATA_SECURITY_MODE_STANDARD" + DATA_SECURITY_MODE_DEDICATED = "DATA_SECURITY_MODE_DEDICATED" + DATA_SECURITY_MODE_AUTO = "DATA_SECURITY_MODE_AUTO" + + +DataSecurityModeParam = ( + Literal[ + "NONE", + "SINGLE_USER", + "USER_ISOLATION", + "LEGACY_TABLE_ACL", + "LEGACY_PASSTHROUGH", + "LEGACY_SINGLE_USER", + "LEGACY_SINGLE_USER_STANDARD", + "DATA_SECURITY_MODE_STANDARD", + "DATA_SECURITY_MODE_DEDICATED", + "DATA_SECURITY_MODE_AUTO", + ] + | DataSecurityMode +) diff --git a/python/databricks/bundles/clusters/_models/dbfs_storage_info.py b/python/databricks/bundles/clusters/_models/dbfs_storage_info.py new file mode 100644 index 00000000000..29744acf26a --- /dev/null +++ b/python/databricks/bundles/clusters/_models/dbfs_storage_info.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DbfsStorageInfo: + """ + A storage location in DBFS + """ + + destination: VariableOr[str] + """ + dbfs destination, e.g. `dbfs:/my/path` + """ + + @classmethod + def from_dict(cls, value: "DbfsStorageInfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DbfsStorageInfoDict": + return _transform_to_json_value(self) # type:ignore + + +class DbfsStorageInfoDict(TypedDict, total=False): + """""" + + destination: VariableOr[str] + """ + dbfs destination, e.g. `dbfs:/my/path` + """ + + +DbfsStorageInfoParam = DbfsStorageInfoDict | DbfsStorageInfo diff --git a/python/databricks/bundles/clusters/_models/dependency_mode.py b/python/databricks/bundles/clusters/_models/dependency_mode.py new file mode 100644 index 00000000000..1fdc22cfa4c --- /dev/null +++ b/python/databricks/bundles/clusters/_models/dependency_mode.py @@ -0,0 +1,28 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class DependencyMode(Enum): + """ + Controls dependency configuration for the cluster. + + * `DEPENDENCY_MODE_AUTO`: Databricks will choose the most appropriate dependency mode based on your compute configuration. + * `DEPENDENCY_MODE_ENVIRONMENTS`: Enables a unified dependency management experience across classic and serverless, resulting in increased stability and performance. Supported only on DBR 19+ in Standard access mode. + * `DEPENDENCY_MODE_CLUSTER_LIBRARIES`: Legacy mode: dependencies come from cluster libraries and init scripts. + """ + + DEPENDENCY_MODE_ENVIRONMENTS = "DEPENDENCY_MODE_ENVIRONMENTS" + DEPENDENCY_MODE_CLUSTER_LIBRARIES = "DEPENDENCY_MODE_CLUSTER_LIBRARIES" + DEPENDENCY_MODE_AUTO = "DEPENDENCY_MODE_AUTO" + + +DependencyModeParam = ( + Literal[ + "DEPENDENCY_MODE_ENVIRONMENTS", + "DEPENDENCY_MODE_CLUSTER_LIBRARIES", + "DEPENDENCY_MODE_AUTO", + ] + | DependencyMode +) diff --git a/python/databricks/bundles/clusters/_models/docker_basic_auth.py b/python/databricks/bundles/clusters/_models/docker_basic_auth.py new file mode 100644 index 00000000000..552ea90a83b --- /dev/null +++ b/python/databricks/bundles/clusters/_models/docker_basic_auth.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DockerBasicAuth: + """""" + + password: VariableOrOptional[str] = None + """ + Password of the user + """ + + username: VariableOrOptional[str] = None + """ + Name of the user + """ + + @classmethod + def from_dict(cls, value: "DockerBasicAuthDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DockerBasicAuthDict": + return _transform_to_json_value(self) # type:ignore + + +class DockerBasicAuthDict(TypedDict, total=False): + """""" + + password: VariableOrOptional[str] + """ + Password of the user + """ + + username: VariableOrOptional[str] + """ + Name of the user + """ + + +DockerBasicAuthParam = DockerBasicAuthDict | DockerBasicAuth diff --git a/python/databricks/bundles/clusters/_models/docker_image.py b/python/databricks/bundles/clusters/_models/docker_image.py new file mode 100644 index 00000000000..f7c47633e07 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/docker_image.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.docker_basic_auth import ( + DockerBasicAuth, + DockerBasicAuthParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DockerImage: + """""" + + basic_auth: VariableOrOptional[DockerBasicAuth] = None + """ + Basic auth with username and password + """ + + url: VariableOrOptional[str] = None + """ + URL of the docker image. + """ + + @classmethod + def from_dict(cls, value: "DockerImageDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DockerImageDict": + return _transform_to_json_value(self) # type:ignore + + +class DockerImageDict(TypedDict, total=False): + """""" + + basic_auth: VariableOrOptional[DockerBasicAuthParam] + """ + Basic auth with username and password + """ + + url: VariableOrOptional[str] + """ + URL of the docker image. + """ + + +DockerImageParam = DockerImageDict | DockerImage diff --git a/python/databricks/bundles/clusters/_models/ebs_volume_type.py b/python/databricks/bundles/clusters/_models/ebs_volume_type.py new file mode 100644 index 00000000000..d8f3ef13f89 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/ebs_volume_type.py @@ -0,0 +1,19 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class EbsVolumeType(Enum): + """ + All EBS volume types that Databricks supports. + See https://aws.amazon.com/ebs/details/ for details. + """ + + GENERAL_PURPOSE_SSD = "GENERAL_PURPOSE_SSD" + THROUGHPUT_OPTIMIZED_HDD = "THROUGHPUT_OPTIMIZED_HDD" + + +EbsVolumeTypeParam = ( + Literal["GENERAL_PURPOSE_SSD", "THROUGHPUT_OPTIMIZED_HDD"] | EbsVolumeType +) diff --git a/python/databricks/bundles/clusters/_models/gcp_attributes.py b/python/databricks/bundles/clusters/_models/gcp_attributes.py new file mode 100644 index 00000000000..ece322d04e0 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/gcp_attributes.py @@ -0,0 +1,168 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.confidential_compute_type import ( + ConfidentialComputeType, + ConfidentialComputeTypeParam, +) +from databricks.bundles.clusters._models.gcp_availability import ( + GcpAvailability, + GcpAvailabilityParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class GcpAttributes: + """ + Attributes set during cluster creation which are related to GCP. + """ + + availability: VariableOrOptional[GcpAvailability] = None + """ + This field determines whether the spark executors will be scheduled to run on preemptible + VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs if the former is unavailable. + """ + + boot_disk_size: VariableOrOptional[int] = None + """ + Boot disk size in GB + """ + + confidential_compute_type: VariableOrOptional[ConfidentialComputeType] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The confidential computing technology for this cluster's instances. + Currently only SEV_SNP is supported, and only on N2D instance types. + When not set, no confidential computing is applied. + """ + + first_on_demand: VariableOrOptional[int] = None + """ + The first `first_on_demand` nodes of the cluster will be placed on on-demand instances. + This value should be greater than 0, to make sure the cluster driver node is placed on an + on-demand instance. If this value is greater than or equal to the current cluster size, all + nodes will be placed on on-demand instances. If this value is less than the current cluster + size, `first_on_demand` nodes will be placed on on-demand instances and the remainder will + be placed on `availability` instances. Note that this value does not affect + cluster size and cannot currently be mutated over the lifetime of a cluster. + """ + + google_service_account: VariableOrOptional[str] = None + """ + If provided, the cluster will impersonate the google service account when accessing + gcloud services (like GCS). The google service account + must have previously been added to the Databricks environment by an account + administrator. + """ + + local_ssd_count: VariableOrOptional[int] = None + """ + If provided, each node (workers and driver) in the cluster will have this number of local SSDs attached. + Each local SSD is 375GB in size. + Refer to [GCP documentation](https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds) + for the supported number of local SSDs for each instance type. + """ + + use_preemptible_executors: VariableOrOptional[bool] = None + """ + [DEPRECATED] This field determines whether the spark executors will be scheduled to run on preemptible + VMs (when set to true) versus standard compute engine VMs (when set to false; default). + Note: Soon to be deprecated, use the 'availability' field instead. + """ + + zone_id: VariableOrOptional[str] = None + """ + Identifier for the availability zone in which the cluster resides. + This can be one of the following: + - "HA" => High availability, spread nodes across availability zones for a Databricks deployment region [default]. + - "AUTO" => Databricks picks an availability zone to schedule the cluster on. + - A GCP availability zone => Pick One of the available zones for (machine type + region) from + https://cloud.google.com/compute/docs/regions-zones. + """ + + @classmethod + def from_dict(cls, value: "GcpAttributesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "GcpAttributesDict": + return _transform_to_json_value(self) # type:ignore + + +class GcpAttributesDict(TypedDict, total=False): + """""" + + availability: VariableOrOptional[GcpAvailabilityParam] + """ + This field determines whether the spark executors will be scheduled to run on preemptible + VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs if the former is unavailable. + """ + + boot_disk_size: VariableOrOptional[int] + """ + Boot disk size in GB + """ + + confidential_compute_type: VariableOrOptional[ConfidentialComputeTypeParam] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The confidential computing technology for this cluster's instances. + Currently only SEV_SNP is supported, and only on N2D instance types. + When not set, no confidential computing is applied. + """ + + first_on_demand: VariableOrOptional[int] + """ + The first `first_on_demand` nodes of the cluster will be placed on on-demand instances. + This value should be greater than 0, to make sure the cluster driver node is placed on an + on-demand instance. If this value is greater than or equal to the current cluster size, all + nodes will be placed on on-demand instances. If this value is less than the current cluster + size, `first_on_demand` nodes will be placed on on-demand instances and the remainder will + be placed on `availability` instances. Note that this value does not affect + cluster size and cannot currently be mutated over the lifetime of a cluster. + """ + + google_service_account: VariableOrOptional[str] + """ + If provided, the cluster will impersonate the google service account when accessing + gcloud services (like GCS). The google service account + must have previously been added to the Databricks environment by an account + administrator. + """ + + local_ssd_count: VariableOrOptional[int] + """ + If provided, each node (workers and driver) in the cluster will have this number of local SSDs attached. + Each local SSD is 375GB in size. + Refer to [GCP documentation](https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds) + for the supported number of local SSDs for each instance type. + """ + + use_preemptible_executors: VariableOrOptional[bool] + """ + [DEPRECATED] This field determines whether the spark executors will be scheduled to run on preemptible + VMs (when set to true) versus standard compute engine VMs (when set to false; default). + Note: Soon to be deprecated, use the 'availability' field instead. + """ + + zone_id: VariableOrOptional[str] + """ + Identifier for the availability zone in which the cluster resides. + This can be one of the following: + - "HA" => High availability, spread nodes across availability zones for a Databricks deployment region [default]. + - "AUTO" => Databricks picks an availability zone to schedule the cluster on. + - A GCP availability zone => Pick One of the available zones for (machine type + region) from + https://cloud.google.com/compute/docs/regions-zones. + """ + + +GcpAttributesParam = GcpAttributesDict | GcpAttributes diff --git a/python/databricks/bundles/clusters/_models/gcp_availability.py b/python/databricks/bundles/clusters/_models/gcp_availability.py new file mode 100644 index 00000000000..0d391b87fe3 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/gcp_availability.py @@ -0,0 +1,21 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class GcpAvailability(Enum): + """ + This field determines whether the instance pool will contain preemptible + VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs if the former is unavailable. + """ + + PREEMPTIBLE_GCP = "PREEMPTIBLE_GCP" + ON_DEMAND_GCP = "ON_DEMAND_GCP" + PREEMPTIBLE_WITH_FALLBACK_GCP = "PREEMPTIBLE_WITH_FALLBACK_GCP" + + +GcpAvailabilityParam = ( + Literal["PREEMPTIBLE_GCP", "ON_DEMAND_GCP", "PREEMPTIBLE_WITH_FALLBACK_GCP"] + | GcpAvailability +) diff --git a/python/databricks/bundles/clusters/_models/gcs_storage_info.py b/python/databricks/bundles/clusters/_models/gcs_storage_info.py new file mode 100644 index 00000000000..e8f1059373b --- /dev/null +++ b/python/databricks/bundles/clusters/_models/gcs_storage_info.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class GcsStorageInfo: + """ + A storage location in Google Cloud Platform's GCS + """ + + destination: VariableOr[str] + """ + GCS destination/URI, e.g. `gs://my-bucket/some-prefix` + """ + + @classmethod + def from_dict(cls, value: "GcsStorageInfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "GcsStorageInfoDict": + return _transform_to_json_value(self) # type:ignore + + +class GcsStorageInfoDict(TypedDict, total=False): + """""" + + destination: VariableOr[str] + """ + GCS destination/URI, e.g. `gs://my-bucket/some-prefix` + """ + + +GcsStorageInfoParam = GcsStorageInfoDict | GcsStorageInfo diff --git a/python/databricks/bundles/clusters/_models/init_script_info.py b/python/databricks/bundles/clusters/_models/init_script_info.py new file mode 100644 index 00000000000..6d78d16bf92 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/init_script_info.py @@ -0,0 +1,146 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.adlsgen2_info import ( + Adlsgen2Info, + Adlsgen2InfoParam, +) +from databricks.bundles.clusters._models.dbfs_storage_info import ( + DbfsStorageInfo, + DbfsStorageInfoParam, +) +from databricks.bundles.clusters._models.gcs_storage_info import ( + GcsStorageInfo, + GcsStorageInfoParam, +) +from databricks.bundles.clusters._models.local_file_info import ( + LocalFileInfo, + LocalFileInfoParam, +) +from databricks.bundles.clusters._models.s3_storage_info import ( + S3StorageInfo, + S3StorageInfoParam, +) +from databricks.bundles.clusters._models.volumes_storage_info import ( + VolumesStorageInfo, + VolumesStorageInfoParam, +) +from databricks.bundles.clusters._models.workspace_storage_info import ( + WorkspaceStorageInfo, + WorkspaceStorageInfoParam, +) +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class InitScriptInfo: + """ + Config for an individual init script + """ + + abfss: VariableOrOptional[Adlsgen2Info] = None + """ + Contains the Azure Data Lake Storage destination path + """ + + dbfs: VariableOrOptional[DbfsStorageInfo] = None + """ + [DEPRECATED] destination needs to be provided. e.g. + `{ "dbfs": { "destination" : "dbfs:/home/cluster_log" } }` + """ + + file: VariableOrOptional[LocalFileInfo] = None + """ + destination needs to be provided, e.g. + `{ "file": { "destination": "file:/my/local/file.sh" } }` + """ + + gcs: VariableOrOptional[GcsStorageInfo] = None + """ + destination needs to be provided, e.g. + `{ "gcs": { "destination": "gs://my-bucket/file.sh" } }` + """ + + s3: VariableOrOptional[S3StorageInfo] = None + """ + destination and either the region or endpoint need to be provided. e.g. + `{ \"s3\": { \"destination\": \"s3://cluster_log_bucket/prefix\", \"region\": \"us-west-2\" } }` + Cluster iam role is used to access s3, please make sure the cluster iam role in + `instance_profile_arn` has permission to write data to the s3 destination. + """ + + volumes: VariableOrOptional[VolumesStorageInfo] = None + """ + destination needs to be provided. e.g. + `{ \"volumes\" : { \"destination\" : \"/Volumes/my-init.sh\" } }` + """ + + workspace: VariableOrOptional[WorkspaceStorageInfo] = None + """ + destination needs to be provided, e.g. + `{ "workspace": { "destination": "/cluster-init-scripts/setup-datadog.sh" } }` + """ + + @classmethod + def from_dict(cls, value: "InitScriptInfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "InitScriptInfoDict": + return _transform_to_json_value(self) # type:ignore + + +class InitScriptInfoDict(TypedDict, total=False): + """""" + + abfss: VariableOrOptional[Adlsgen2InfoParam] + """ + Contains the Azure Data Lake Storage destination path + """ + + dbfs: VariableOrOptional[DbfsStorageInfoParam] + """ + [DEPRECATED] destination needs to be provided. e.g. + `{ "dbfs": { "destination" : "dbfs:/home/cluster_log" } }` + """ + + file: VariableOrOptional[LocalFileInfoParam] + """ + destination needs to be provided, e.g. + `{ "file": { "destination": "file:/my/local/file.sh" } }` + """ + + gcs: VariableOrOptional[GcsStorageInfoParam] + """ + destination needs to be provided, e.g. + `{ "gcs": { "destination": "gs://my-bucket/file.sh" } }` + """ + + s3: VariableOrOptional[S3StorageInfoParam] + """ + destination and either the region or endpoint need to be provided. e.g. + `{ \"s3\": { \"destination\": \"s3://cluster_log_bucket/prefix\", \"region\": \"us-west-2\" } }` + Cluster iam role is used to access s3, please make sure the cluster iam role in + `instance_profile_arn` has permission to write data to the s3 destination. + """ + + volumes: VariableOrOptional[VolumesStorageInfoParam] + """ + destination needs to be provided. e.g. + `{ \"volumes\" : { \"destination\" : \"/Volumes/my-init.sh\" } }` + """ + + workspace: VariableOrOptional[WorkspaceStorageInfoParam] + """ + destination needs to be provided, e.g. + `{ "workspace": { "destination": "/cluster-init-scripts/setup-datadog.sh" } }` + """ + + +InitScriptInfoParam = InitScriptInfoDict | InitScriptInfo diff --git a/python/databricks/bundles/clusters/_models/kind.py b/python/databricks/bundles/clusters/_models/kind.py new file mode 100644 index 00000000000..8614e25dd52 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/kind.py @@ -0,0 +1,23 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class Kind(Enum): + """ + The kind of compute described by this compute specification. + + Depending on `kind`, different validations and default values will be applied. + + Clusters with `kind = CLASSIC_PREVIEW` support the following fields, whereas clusters with no specified `kind` do not. + * [is_single_node](/api/workspace/clusters/create#is_single_node) + * [use_ml_runtime](/api/workspace/clusters/create#use_ml_runtime) + + By using the [simple form](https://docs.databricks.com/compute/simple-form.html), your clusters are automatically using `kind = CLASSIC_PREVIEW`. + """ + + CLASSIC_PREVIEW = "CLASSIC_PREVIEW" + + +KindParam = Literal["CLASSIC_PREVIEW"] | Kind diff --git a/python/databricks/bundles/clusters/_models/lifecycle_with_started.py b/python/databricks/bundles/clusters/_models/lifecycle_with_started.py new file mode 100644 index 00000000000..3ee1d2a01b3 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/lifecycle_with_started.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class LifecycleWithStarted: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + started: VariableOrOptional[bool] = None + """ + Lifecycle setting to deploy the resource in started mode. Only supported for apps, clusters, and sql_warehouses in direct deployment mode. + """ + + @classmethod + def from_dict(cls, value: "LifecycleWithStartedDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleWithStartedDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleWithStartedDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + started: VariableOrOptional[bool] + """ + Lifecycle setting to deploy the resource in started mode. Only supported for apps, clusters, and sql_warehouses in direct deployment mode. + """ + + +LifecycleWithStartedParam = LifecycleWithStartedDict | LifecycleWithStarted diff --git a/python/databricks/bundles/clusters/_models/local_file_info.py b/python/databricks/bundles/clusters/_models/local_file_info.py new file mode 100644 index 00000000000..875f2fe8353 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/local_file_info.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class LocalFileInfo: + """""" + + destination: VariableOr[str] + """ + local file destination, e.g. `file:/my/local/file.sh` + """ + + @classmethod + def from_dict(cls, value: "LocalFileInfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LocalFileInfoDict": + return _transform_to_json_value(self) # type:ignore + + +class LocalFileInfoDict(TypedDict, total=False): + """""" + + destination: VariableOr[str] + """ + local file destination, e.g. `file:/my/local/file.sh` + """ + + +LocalFileInfoParam = LocalFileInfoDict | LocalFileInfo diff --git a/python/databricks/bundles/clusters/_models/log_analytics_info.py b/python/databricks/bundles/clusters/_models/log_analytics_info.py new file mode 100644 index 00000000000..67cdf85b2b9 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/log_analytics_info.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class LogAnalyticsInfo: + """""" + + log_analytics_primary_key: VariableOrOptional[str] = None + """ + The primary key for the Azure Log Analytics agent configuration + """ + + log_analytics_workspace_id: VariableOrOptional[str] = None + """ + The workspace ID for the Azure Log Analytics agent configuration + """ + + @classmethod + def from_dict(cls, value: "LogAnalyticsInfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LogAnalyticsInfoDict": + return _transform_to_json_value(self) # type:ignore + + +class LogAnalyticsInfoDict(TypedDict, total=False): + """""" + + log_analytics_primary_key: VariableOrOptional[str] + """ + The primary key for the Azure Log Analytics agent configuration + """ + + log_analytics_workspace_id: VariableOrOptional[str] + """ + The workspace ID for the Azure Log Analytics agent configuration + """ + + +LogAnalyticsInfoParam = LogAnalyticsInfoDict | LogAnalyticsInfo diff --git a/python/databricks/bundles/clusters/_models/node_type_flexibility.py b/python/databricks/bundles/clusters/_models/node_type_flexibility.py new file mode 100644 index 00000000000..aa582b763a8 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/node_type_flexibility.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class NodeTypeFlexibility: + """ + Configuration for flexible node types, allowing fallback to alternate node types during cluster launch and upscale. + """ + + alternate_node_type_ids: VariableOrList[str] = field(default_factory=list) + """ + A list of node type IDs to use as fallbacks when the primary node type is unavailable. + """ + + @classmethod + def from_dict(cls, value: "NodeTypeFlexibilityDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "NodeTypeFlexibilityDict": + return _transform_to_json_value(self) # type:ignore + + +class NodeTypeFlexibilityDict(TypedDict, total=False): + """""" + + alternate_node_type_ids: VariableOrList[str] + """ + A list of node type IDs to use as fallbacks when the primary node type is unavailable. + """ + + +NodeTypeFlexibilityParam = NodeTypeFlexibilityDict | NodeTypeFlexibility diff --git a/python/databricks/bundles/clusters/_models/runtime_engine.py b/python/databricks/bundles/clusters/_models/runtime_engine.py new file mode 100644 index 00000000000..2e1559fa801 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/runtime_engine.py @@ -0,0 +1,13 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class RuntimeEngine(Enum): + NULL = "NULL" + STANDARD = "STANDARD" + PHOTON = "PHOTON" + + +RuntimeEngineParam = Literal["NULL", "STANDARD", "PHOTON"] | RuntimeEngine diff --git a/python/databricks/bundles/clusters/_models/s3_storage_info.py b/python/databricks/bundles/clusters/_models/s3_storage_info.py new file mode 100644 index 00000000000..071abd5b6f3 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/s3_storage_info.py @@ -0,0 +1,124 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class S3StorageInfo: + """ + A storage location in Amazon S3 + """ + + destination: VariableOr[str] + """ + S3 destination, e.g. `s3://my-bucket/some-prefix` Note that logs will be delivered using + cluster iam role, please make sure you set cluster iam role and the role has write access to the + destination. Please also note that you cannot use AWS keys to deliver logs. + """ + + canned_acl: VariableOrOptional[str] = None + """ + (Optional) Set canned access control list for the logs, e.g. `bucket-owner-full-control`. + If `canned_cal` is set, please make sure the cluster iam role has `s3:PutObjectAcl` permission on + the destination bucket and prefix. The full list of possible canned acl can be found at + http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl. + Please also note that by default only the object owner gets full controls. If you are using cross account + role for writing data, you may want to set `bucket-owner-full-control` to make bucket owner able to + read the logs. + """ + + enable_encryption: VariableOrOptional[bool] = None + """ + (Optional) Flag to enable server side encryption, `false` by default. + """ + + encryption_type: VariableOrOptional[str] = None + """ + (Optional) The encryption type, it could be `sse-s3` or `sse-kms`. It will be used only when + encryption is enabled and the default type is `sse-s3`. + """ + + endpoint: VariableOrOptional[str] = None + """ + S3 endpoint, e.g. `https://s3-us-west-2.amazonaws.com`. Either region or endpoint needs to be set. + If both are set, endpoint will be used. + """ + + kms_key: VariableOrOptional[str] = None + """ + (Optional) Kms key which will be used if encryption is enabled and encryption type is set to `sse-kms`. + """ + + region: VariableOrOptional[str] = None + """ + S3 region, e.g. `us-west-2`. Either region or endpoint needs to be set. If both are set, + endpoint will be used. + """ + + @classmethod + def from_dict(cls, value: "S3StorageInfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "S3StorageInfoDict": + return _transform_to_json_value(self) # type:ignore + + +class S3StorageInfoDict(TypedDict, total=False): + """""" + + destination: VariableOr[str] + """ + S3 destination, e.g. `s3://my-bucket/some-prefix` Note that logs will be delivered using + cluster iam role, please make sure you set cluster iam role and the role has write access to the + destination. Please also note that you cannot use AWS keys to deliver logs. + """ + + canned_acl: VariableOrOptional[str] + """ + (Optional) Set canned access control list for the logs, e.g. `bucket-owner-full-control`. + If `canned_cal` is set, please make sure the cluster iam role has `s3:PutObjectAcl` permission on + the destination bucket and prefix. The full list of possible canned acl can be found at + http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl. + Please also note that by default only the object owner gets full controls. If you are using cross account + role for writing data, you may want to set `bucket-owner-full-control` to make bucket owner able to + read the logs. + """ + + enable_encryption: VariableOrOptional[bool] + """ + (Optional) Flag to enable server side encryption, `false` by default. + """ + + encryption_type: VariableOrOptional[str] + """ + (Optional) The encryption type, it could be `sse-s3` or `sse-kms`. It will be used only when + encryption is enabled and the default type is `sse-s3`. + """ + + endpoint: VariableOrOptional[str] + """ + S3 endpoint, e.g. `https://s3-us-west-2.amazonaws.com`. Either region or endpoint needs to be set. + If both are set, endpoint will be used. + """ + + kms_key: VariableOrOptional[str] + """ + (Optional) Kms key which will be used if encryption is enabled and encryption type is set to `sse-kms`. + """ + + region: VariableOrOptional[str] + """ + S3 region, e.g. `us-west-2`. Either region or endpoint needs to be set. If both are set, + endpoint will be used. + """ + + +S3StorageInfoParam = S3StorageInfoDict | S3StorageInfo diff --git a/python/databricks/bundles/clusters/_models/volumes_storage_info.py b/python/databricks/bundles/clusters/_models/volumes_storage_info.py new file mode 100644 index 00000000000..1eb4fff7bc2 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/volumes_storage_info.py @@ -0,0 +1,44 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class VolumesStorageInfo: + """ + A storage location back by UC Volumes. + """ + + destination: VariableOr[str] + """ + UC Volumes destination, e.g. `/Volumes/catalog/schema/vol1/init-scripts/setup-datadog.sh` + or `dbfs:/Volumes/catalog/schema/vol1/init-scripts/setup-datadog.sh` + """ + + @classmethod + def from_dict(cls, value: "VolumesStorageInfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "VolumesStorageInfoDict": + return _transform_to_json_value(self) # type:ignore + + +class VolumesStorageInfoDict(TypedDict, total=False): + """""" + + destination: VariableOr[str] + """ + UC Volumes destination, e.g. `/Volumes/catalog/schema/vol1/init-scripts/setup-datadog.sh` + or `dbfs:/Volumes/catalog/schema/vol1/init-scripts/setup-datadog.sh` + """ + + +VolumesStorageInfoParam = VolumesStorageInfoDict | VolumesStorageInfo diff --git a/python/databricks/bundles/clusters/_models/workload_type.py b/python/databricks/bundles/clusters/_models/workload_type.py new file mode 100644 index 00000000000..6760e7d7edd --- /dev/null +++ b/python/databricks/bundles/clusters/_models/workload_type.py @@ -0,0 +1,46 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.clusters._models.clients_types import ( + ClientsTypes, + ClientsTypesParam, +) +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class WorkloadType: + """ + Cluster Attributes showing for clusters workload types. + """ + + clients: VariableOr[ClientsTypes] + """ + defined what type of clients can use the cluster. E.g. Notebooks, Jobs + """ + + @classmethod + def from_dict(cls, value: "WorkloadTypeDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "WorkloadTypeDict": + return _transform_to_json_value(self) # type:ignore + + +class WorkloadTypeDict(TypedDict, total=False): + """""" + + clients: VariableOr[ClientsTypesParam] + """ + defined what type of clients can use the cluster. E.g. Notebooks, Jobs + """ + + +WorkloadTypeParam = WorkloadTypeDict | WorkloadType diff --git a/python/databricks/bundles/clusters/_models/workspace_storage_info.py b/python/databricks/bundles/clusters/_models/workspace_storage_info.py new file mode 100644 index 00000000000..49aef9256c8 --- /dev/null +++ b/python/databricks/bundles/clusters/_models/workspace_storage_info.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class WorkspaceStorageInfo: + """ + A storage location in Workspace Filesystem (WSFS) + """ + + destination: VariableOr[str] + """ + wsfs destination, e.g. `workspace:/cluster-init-scripts/setup-datadog.sh` + """ + + @classmethod + def from_dict(cls, value: "WorkspaceStorageInfoDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "WorkspaceStorageInfoDict": + return _transform_to_json_value(self) # type:ignore + + +class WorkspaceStorageInfoDict(TypedDict, total=False): + """""" + + destination: VariableOr[str] + """ + wsfs destination, e.g. `workspace:/cluster-init-scripts/setup-datadog.sh` + """ + + +WorkspaceStorageInfoParam = WorkspaceStorageInfoDict | WorkspaceStorageInfo diff --git a/python/databricks/bundles/core/__init__.py b/python/databricks/bundles/core/__init__.py index cbf4661aed8..3625cf525c4 100644 --- a/python/databricks/bundles/core/__init__.py +++ b/python/databricks/bundles/core/__init__.py @@ -15,15 +15,32 @@ "VariableOrList", "VariableOrOptional", "alert_mutator", + "app_mutator", "catalog_mutator", + "cluster_mutator", + "database_catalog_mutator", + "database_instance_mutator", + "external_location_mutator", + "instance_pool_mutator", "job_mutator", + "job_run_mutator", "load_resources_from_current_package_module", "load_resources_from_module", "load_resources_from_modules", "load_resources_from_package_module", + "mlflow_experiment_mutator", + "mlflow_model_mutator", + "model_serving_endpoint_mutator", "pipeline_mutator", + "quality_monitor_mutator", + "registered_model_mutator", "schema_mutator", + "secret_scope_mutator", + "sql_warehouse_mutator", + "synced_database_table_mutator", "variables", + "vector_search_endpoint_mutator", + "vector_search_index_mutator", "volume_mutator", ] @@ -35,10 +52,27 @@ ) from databricks.bundles.core._generated import ( alert_mutator, + app_mutator, catalog_mutator, + cluster_mutator, + database_catalog_mutator, + database_instance_mutator, + external_location_mutator, + instance_pool_mutator, job_mutator, + job_run_mutator, + mlflow_experiment_mutator, + mlflow_model_mutator, + model_serving_endpoint_mutator, pipeline_mutator, + quality_monitor_mutator, + registered_model_mutator, schema_mutator, + secret_scope_mutator, + sql_warehouse_mutator, + synced_database_table_mutator, + vector_search_endpoint_mutator, + vector_search_index_mutator, volume_mutator, ) from databricks.bundles.core._load import ( diff --git a/python/databricks/bundles/core/_generated/__init__.py b/python/databricks/bundles/core/_generated/__init__.py index ade9313238c..a29e96bda72 100644 --- a/python/databricks/bundles/core/_generated/__init__.py +++ b/python/databricks/bundles/core/_generated/__init__.py @@ -3,16 +3,81 @@ from typing import TYPE_CHECKING from databricks.bundles.core._generated.alerts import _AlertResources, alert_mutator +from databricks.bundles.core._generated.apps import _AppResources, app_mutator from databricks.bundles.core._generated.catalogs import ( _CatalogResources, catalog_mutator, ) +from databricks.bundles.core._generated.clusters import ( + _ClusterResources, + cluster_mutator, +) +from databricks.bundles.core._generated.database_catalogs import ( + _DatabaseCatalogResources, + database_catalog_mutator, +) +from databricks.bundles.core._generated.database_instances import ( + _DatabaseInstanceResources, + database_instance_mutator, +) +from databricks.bundles.core._generated.experiments import ( + _MlflowExperimentResources, + mlflow_experiment_mutator, +) +from databricks.bundles.core._generated.external_locations import ( + _ExternalLocationResources, + external_location_mutator, +) +from databricks.bundles.core._generated.instance_pools import ( + _InstancePoolResources, + instance_pool_mutator, +) +from databricks.bundles.core._generated.job_runs import ( + _JobRunResources, + job_run_mutator, +) from databricks.bundles.core._generated.jobs import _JobResources, job_mutator +from databricks.bundles.core._generated.model_serving_endpoints import ( + _ModelServingEndpointResources, + model_serving_endpoint_mutator, +) +from databricks.bundles.core._generated.models import ( + _MlflowModelResources, + mlflow_model_mutator, +) from databricks.bundles.core._generated.pipelines import ( _PipelineResources, pipeline_mutator, ) +from databricks.bundles.core._generated.quality_monitors import ( + _QualityMonitorResources, + quality_monitor_mutator, +) +from databricks.bundles.core._generated.registered_models import ( + _RegisteredModelResources, + registered_model_mutator, +) from databricks.bundles.core._generated.schemas import _SchemaResources, schema_mutator +from databricks.bundles.core._generated.secret_scopes import ( + _SecretScopeResources, + secret_scope_mutator, +) +from databricks.bundles.core._generated.sql_warehouses import ( + _SqlWarehouseResources, + sql_warehouse_mutator, +) +from databricks.bundles.core._generated.synced_database_tables import ( + _SyncedDatabaseTableResources, + synced_database_table_mutator, +) +from databricks.bundles.core._generated.vector_search_endpoints import ( + _VectorSearchEndpointResources, + vector_search_endpoint_mutator, +) +from databricks.bundles.core._generated.vector_search_indexes import ( + _VectorSearchIndexResources, + vector_search_index_mutator, +) from databricks.bundles.core._generated.volumes import _VolumeResources, volume_mutator if TYPE_CHECKING: @@ -22,20 +87,54 @@ "_GeneratedResources", "_all_resource_types", "alert_mutator", + "app_mutator", "catalog_mutator", + "cluster_mutator", + "database_catalog_mutator", + "database_instance_mutator", + "external_location_mutator", + "instance_pool_mutator", "job_mutator", + "job_run_mutator", + "mlflow_experiment_mutator", + "mlflow_model_mutator", + "model_serving_endpoint_mutator", "pipeline_mutator", + "quality_monitor_mutator", + "registered_model_mutator", "schema_mutator", + "secret_scope_mutator", + "sql_warehouse_mutator", + "synced_database_table_mutator", + "vector_search_endpoint_mutator", + "vector_search_index_mutator", "volume_mutator", ] class _GeneratedResources( _AlertResources, + _AppResources, _CatalogResources, + _ClusterResources, + _DatabaseCatalogResources, + _DatabaseInstanceResources, + _MlflowExperimentResources, + _ExternalLocationResources, + _InstancePoolResources, + _JobRunResources, _JobResources, + _ModelServingEndpointResources, + _MlflowModelResources, _PipelineResources, + _QualityMonitorResources, + _RegisteredModelResources, _SchemaResources, + _SecretScopeResources, + _SqlWarehouseResources, + _SyncedDatabaseTableResources, + _VectorSearchEndpointResources, + _VectorSearchIndexResources, _VolumeResources, ): pass @@ -44,18 +143,52 @@ class _GeneratedResources( def _all_resource_types() -> "tuple[_ResourceType, ...]": from databricks.bundles.core._generated import ( alerts, + apps, catalogs, + clusters, + database_catalogs, + database_instances, + experiments, + external_locations, + instance_pools, + job_runs, jobs, + model_serving_endpoints, + models, pipelines, + quality_monitors, + registered_models, schemas, + secret_scopes, + sql_warehouses, + synced_database_tables, + vector_search_endpoints, + vector_search_indexes, volumes, ) return ( alerts._resource_type(), + apps._resource_type(), catalogs._resource_type(), + clusters._resource_type(), + database_catalogs._resource_type(), + database_instances._resource_type(), + experiments._resource_type(), + external_locations._resource_type(), + instance_pools._resource_type(), + job_runs._resource_type(), jobs._resource_type(), + model_serving_endpoints._resource_type(), + models._resource_type(), pipelines._resource_type(), + quality_monitors._resource_type(), + registered_models._resource_type(), schemas._resource_type(), + secret_scopes._resource_type(), + sql_warehouses._resource_type(), + synced_database_tables._resource_type(), + vector_search_endpoints._resource_type(), + vector_search_indexes._resource_type(), volumes._resource_type(), ) diff --git a/python/databricks/bundles/core/_generated/apps.py b/python/databricks/bundles/core/_generated/apps.py new file mode 100644 index 00000000000..51d14e2c602 --- /dev/null +++ b/python/databricks/bundles/core/_generated/apps.py @@ -0,0 +1,115 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.apps._models.app import App, AppParam + from databricks.bundles.core._resource_type import _ResourceType + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.apps._models.app import App + from databricks.bundles.core._resource_type import _ResourceType + + return _ResourceType( + resource_type=App, + singular_name="app", + plural_name="apps", + ) + + +class _AppResources: + """ + Generated app accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def apps(self) -> dict[str, "App"]: + return self._resources["apps"] + + def add_app( + self, + resource_name: str, + app: "AppParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource app to the collection of resources. Resource name must be unique across all apps. + + :param resource_name: unique identifier for the app + :param app: the app to add, can be App or dict + :param location: optional location of the app in the source code + """ + from databricks.bundles.apps._models.app import App + + app = _transform(App, app) + path = ("resources", "apps", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["apps"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'app'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["apps"][resource_name] = app + + +@overload +def app_mutator( + function: Callable[[Bundle, "App"], "App"], +) -> ResourceMutator["App"]: ... + + +@overload +def app_mutator( + function: Callable[["App"], "App"], +) -> ResourceMutator["App"]: ... + + +def app_mutator(function: Callable) -> ResourceMutator["App"]: + """ + Decorator for defining mutator for apps. Function should return a new instance of the app + with the desired changes, instead of mutating the input app. + + Example: + + .. code-block:: python + + @app_mutator + def my_app_mutator(bundle: Bundle, app: App) -> App: + return replace(app, ...) + + :param function: Function that mutates apps. + """ + from databricks.bundles.apps._models.app import App + + return ResourceMutator(resource_type=App, function=function) diff --git a/python/databricks/bundles/core/_generated/clusters.py b/python/databricks/bundles/core/_generated/clusters.py new file mode 100644 index 00000000000..44c94108ac4 --- /dev/null +++ b/python/databricks/bundles/core/_generated/clusters.py @@ -0,0 +1,115 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.clusters._models.cluster import Cluster, ClusterParam + from databricks.bundles.core._resource_type import _ResourceType + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.clusters._models.cluster import Cluster + from databricks.bundles.core._resource_type import _ResourceType + + return _ResourceType( + resource_type=Cluster, + singular_name="cluster", + plural_name="clusters", + ) + + +class _ClusterResources: + """ + Generated cluster accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def clusters(self) -> dict[str, "Cluster"]: + return self._resources["clusters"] + + def add_cluster( + self, + resource_name: str, + cluster: "ClusterParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource cluster to the collection of resources. Resource name must be unique across all clusters. + + :param resource_name: unique identifier for the cluster + :param cluster: the cluster to add, can be Cluster or dict + :param location: optional location of the cluster in the source code + """ + from databricks.bundles.clusters._models.cluster import Cluster + + cluster = _transform(Cluster, cluster) + path = ("resources", "clusters", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["clusters"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'cluster'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["clusters"][resource_name] = cluster + + +@overload +def cluster_mutator( + function: Callable[[Bundle, "Cluster"], "Cluster"], +) -> ResourceMutator["Cluster"]: ... + + +@overload +def cluster_mutator( + function: Callable[["Cluster"], "Cluster"], +) -> ResourceMutator["Cluster"]: ... + + +def cluster_mutator(function: Callable) -> ResourceMutator["Cluster"]: + """ + Decorator for defining mutator for clusters. Function should return a new instance of the cluster + with the desired changes, instead of mutating the input cluster. + + Example: + + .. code-block:: python + + @cluster_mutator + def my_cluster_mutator(bundle: Bundle, cluster: Cluster) -> Cluster: + return replace(cluster, ...) + + :param function: Function that mutates clusters. + """ + from databricks.bundles.clusters._models.cluster import Cluster + + return ResourceMutator(resource_type=Cluster, function=function) diff --git a/python/databricks/bundles/core/_generated/database_catalogs.py b/python/databricks/bundles/core/_generated/database_catalogs.py new file mode 100644 index 00000000000..a11e165b17f --- /dev/null +++ b/python/databricks/bundles/core/_generated/database_catalogs.py @@ -0,0 +1,124 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.database_catalogs._models.database_catalog import ( + DatabaseCatalog, + DatabaseCatalogParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.database_catalogs._models.database_catalog import ( + DatabaseCatalog, + ) + + return _ResourceType( + resource_type=DatabaseCatalog, + singular_name="database_catalog", + plural_name="database_catalogs", + ) + + +class _DatabaseCatalogResources: + """ + Generated database_catalog accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def database_catalogs(self) -> dict[str, "DatabaseCatalog"]: + return self._resources["database_catalogs"] + + def add_database_catalog( + self, + resource_name: str, + database_catalog: "DatabaseCatalogParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource database_catalog to the collection of resources. Resource name must be unique across all database_catalogs. + + :param resource_name: unique identifier for the database_catalog + :param database_catalog: the database_catalog to add, can be DatabaseCatalog or dict + :param location: optional location of the database_catalog in the source code + """ + from databricks.bundles.database_catalogs._models.database_catalog import ( + DatabaseCatalog, + ) + + database_catalog = _transform(DatabaseCatalog, database_catalog) + path = ("resources", "database_catalogs", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["database_catalogs"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'database_catalog'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["database_catalogs"][resource_name] = database_catalog + + +@overload +def database_catalog_mutator( + function: Callable[[Bundle, "DatabaseCatalog"], "DatabaseCatalog"], +) -> ResourceMutator["DatabaseCatalog"]: ... + + +@overload +def database_catalog_mutator( + function: Callable[["DatabaseCatalog"], "DatabaseCatalog"], +) -> ResourceMutator["DatabaseCatalog"]: ... + + +def database_catalog_mutator(function: Callable) -> ResourceMutator["DatabaseCatalog"]: + """ + Decorator for defining mutator for database_catalogs. Function should return a new instance of the database_catalog + with the desired changes, instead of mutating the input database_catalog. + + Example: + + .. code-block:: python + + @database_catalog_mutator + def my_database_catalog_mutator(bundle: Bundle, database_catalog: DatabaseCatalog) -> DatabaseCatalog: + return replace(database_catalog, ...) + + :param function: Function that mutates database_catalogs. + """ + from databricks.bundles.database_catalogs._models.database_catalog import ( + DatabaseCatalog, + ) + + return ResourceMutator(resource_type=DatabaseCatalog, function=function) diff --git a/python/databricks/bundles/core/_generated/database_instances.py b/python/databricks/bundles/core/_generated/database_instances.py new file mode 100644 index 00000000000..9352ce5a37f --- /dev/null +++ b/python/databricks/bundles/core/_generated/database_instances.py @@ -0,0 +1,126 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.database_instances._models.database_instance import ( + DatabaseInstance, + DatabaseInstanceParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.database_instances._models.database_instance import ( + DatabaseInstance, + ) + + return _ResourceType( + resource_type=DatabaseInstance, + singular_name="database_instance", + plural_name="database_instances", + ) + + +class _DatabaseInstanceResources: + """ + Generated database_instance accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def database_instances(self) -> dict[str, "DatabaseInstance"]: + return self._resources["database_instances"] + + def add_database_instance( + self, + resource_name: str, + database_instance: "DatabaseInstanceParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource database_instance to the collection of resources. Resource name must be unique across all database_instances. + + :param resource_name: unique identifier for the database_instance + :param database_instance: the database_instance to add, can be DatabaseInstance or dict + :param location: optional location of the database_instance in the source code + """ + from databricks.bundles.database_instances._models.database_instance import ( + DatabaseInstance, + ) + + database_instance = _transform(DatabaseInstance, database_instance) + path = ("resources", "database_instances", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["database_instances"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'database_instance'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["database_instances"][resource_name] = database_instance + + +@overload +def database_instance_mutator( + function: Callable[[Bundle, "DatabaseInstance"], "DatabaseInstance"], +) -> ResourceMutator["DatabaseInstance"]: ... + + +@overload +def database_instance_mutator( + function: Callable[["DatabaseInstance"], "DatabaseInstance"], +) -> ResourceMutator["DatabaseInstance"]: ... + + +def database_instance_mutator( + function: Callable, +) -> ResourceMutator["DatabaseInstance"]: + """ + Decorator for defining mutator for database_instances. Function should return a new instance of the database_instance + with the desired changes, instead of mutating the input database_instance. + + Example: + + .. code-block:: python + + @database_instance_mutator + def my_database_instance_mutator(bundle: Bundle, database_instance: DatabaseInstance) -> DatabaseInstance: + return replace(database_instance, ...) + + :param function: Function that mutates database_instances. + """ + from databricks.bundles.database_instances._models.database_instance import ( + DatabaseInstance, + ) + + return ResourceMutator(resource_type=DatabaseInstance, function=function) diff --git a/python/databricks/bundles/core/_generated/experiments.py b/python/databricks/bundles/core/_generated/experiments.py new file mode 100644 index 00000000000..ca0860f3155 --- /dev/null +++ b/python/databricks/bundles/core/_generated/experiments.py @@ -0,0 +1,126 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.experiments._models.mlflow_experiment import ( + MlflowExperiment, + MlflowExperimentParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.experiments._models.mlflow_experiment import ( + MlflowExperiment, + ) + + return _ResourceType( + resource_type=MlflowExperiment, + singular_name="mlflow_experiment", + plural_name="experiments", + ) + + +class _MlflowExperimentResources: + """ + Generated mlflow_experiment accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def experiments(self) -> dict[str, "MlflowExperiment"]: + return self._resources["experiments"] + + def add_mlflow_experiment( + self, + resource_name: str, + mlflow_experiment: "MlflowExperimentParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource mlflow_experiment to the collection of resources. Resource name must be unique across all experiments. + + :param resource_name: unique identifier for the mlflow_experiment + :param mlflow_experiment: the mlflow_experiment to add, can be MlflowExperiment or dict + :param location: optional location of the mlflow_experiment in the source code + """ + from databricks.bundles.experiments._models.mlflow_experiment import ( + MlflowExperiment, + ) + + mlflow_experiment = _transform(MlflowExperiment, mlflow_experiment) + path = ("resources", "experiments", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["experiments"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'mlflow_experiment'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["experiments"][resource_name] = mlflow_experiment + + +@overload +def mlflow_experiment_mutator( + function: Callable[[Bundle, "MlflowExperiment"], "MlflowExperiment"], +) -> ResourceMutator["MlflowExperiment"]: ... + + +@overload +def mlflow_experiment_mutator( + function: Callable[["MlflowExperiment"], "MlflowExperiment"], +) -> ResourceMutator["MlflowExperiment"]: ... + + +def mlflow_experiment_mutator( + function: Callable, +) -> ResourceMutator["MlflowExperiment"]: + """ + Decorator for defining mutator for experiments. Function should return a new instance of the mlflow_experiment + with the desired changes, instead of mutating the input mlflow_experiment. + + Example: + + .. code-block:: python + + @mlflow_experiment_mutator + def my_mlflow_experiment_mutator(bundle: Bundle, mlflow_experiment: MlflowExperiment) -> MlflowExperiment: + return replace(mlflow_experiment, ...) + + :param function: Function that mutates experiments. + """ + from databricks.bundles.experiments._models.mlflow_experiment import ( + MlflowExperiment, + ) + + return ResourceMutator(resource_type=MlflowExperiment, function=function) diff --git a/python/databricks/bundles/core/_generated/external_locations.py b/python/databricks/bundles/core/_generated/external_locations.py new file mode 100644 index 00000000000..d30243989a2 --- /dev/null +++ b/python/databricks/bundles/core/_generated/external_locations.py @@ -0,0 +1,126 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.external_locations._models.external_location import ( + ExternalLocation, + ExternalLocationParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.external_locations._models.external_location import ( + ExternalLocation, + ) + + return _ResourceType( + resource_type=ExternalLocation, + singular_name="external_location", + plural_name="external_locations", + ) + + +class _ExternalLocationResources: + """ + Generated external_location accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def external_locations(self) -> dict[str, "ExternalLocation"]: + return self._resources["external_locations"] + + def add_external_location( + self, + resource_name: str, + external_location: "ExternalLocationParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource external_location to the collection of resources. Resource name must be unique across all external_locations. + + :param resource_name: unique identifier for the external_location + :param external_location: the external_location to add, can be ExternalLocation or dict + :param location: optional location of the external_location in the source code + """ + from databricks.bundles.external_locations._models.external_location import ( + ExternalLocation, + ) + + external_location = _transform(ExternalLocation, external_location) + path = ("resources", "external_locations", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["external_locations"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'external_location'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["external_locations"][resource_name] = external_location + + +@overload +def external_location_mutator( + function: Callable[[Bundle, "ExternalLocation"], "ExternalLocation"], +) -> ResourceMutator["ExternalLocation"]: ... + + +@overload +def external_location_mutator( + function: Callable[["ExternalLocation"], "ExternalLocation"], +) -> ResourceMutator["ExternalLocation"]: ... + + +def external_location_mutator( + function: Callable, +) -> ResourceMutator["ExternalLocation"]: + """ + Decorator for defining mutator for external_locations. Function should return a new instance of the external_location + with the desired changes, instead of mutating the input external_location. + + Example: + + .. code-block:: python + + @external_location_mutator + def my_external_location_mutator(bundle: Bundle, external_location: ExternalLocation) -> ExternalLocation: + return replace(external_location, ...) + + :param function: Function that mutates external_locations. + """ + from databricks.bundles.external_locations._models.external_location import ( + ExternalLocation, + ) + + return ResourceMutator(resource_type=ExternalLocation, function=function) diff --git a/python/databricks/bundles/core/_generated/instance_pools.py b/python/databricks/bundles/core/_generated/instance_pools.py new file mode 100644 index 00000000000..0ce75fc3d2e --- /dev/null +++ b/python/databricks/bundles/core/_generated/instance_pools.py @@ -0,0 +1,118 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.instance_pools._models.instance_pool import ( + InstancePool, + InstancePoolParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.instance_pools._models.instance_pool import InstancePool + + return _ResourceType( + resource_type=InstancePool, + singular_name="instance_pool", + plural_name="instance_pools", + ) + + +class _InstancePoolResources: + """ + Generated instance_pool accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def instance_pools(self) -> dict[str, "InstancePool"]: + return self._resources["instance_pools"] + + def add_instance_pool( + self, + resource_name: str, + instance_pool: "InstancePoolParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource instance_pool to the collection of resources. Resource name must be unique across all instance_pools. + + :param resource_name: unique identifier for the instance_pool + :param instance_pool: the instance_pool to add, can be InstancePool or dict + :param location: optional location of the instance_pool in the source code + """ + from databricks.bundles.instance_pools._models.instance_pool import InstancePool + + instance_pool = _transform(InstancePool, instance_pool) + path = ("resources", "instance_pools", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["instance_pools"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'instance_pool'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["instance_pools"][resource_name] = instance_pool + + +@overload +def instance_pool_mutator( + function: Callable[[Bundle, "InstancePool"], "InstancePool"], +) -> ResourceMutator["InstancePool"]: ... + + +@overload +def instance_pool_mutator( + function: Callable[["InstancePool"], "InstancePool"], +) -> ResourceMutator["InstancePool"]: ... + + +def instance_pool_mutator(function: Callable) -> ResourceMutator["InstancePool"]: + """ + Decorator for defining mutator for instance_pools. Function should return a new instance of the instance_pool + with the desired changes, instead of mutating the input instance_pool. + + Example: + + .. code-block:: python + + @instance_pool_mutator + def my_instance_pool_mutator(bundle: Bundle, instance_pool: InstancePool) -> InstancePool: + return replace(instance_pool, ...) + + :param function: Function that mutates instance_pools. + """ + from databricks.bundles.instance_pools._models.instance_pool import InstancePool + + return ResourceMutator(resource_type=InstancePool, function=function) diff --git a/python/databricks/bundles/core/_generated/job_runs.py b/python/databricks/bundles/core/_generated/job_runs.py new file mode 100644 index 00000000000..243a27a931f --- /dev/null +++ b/python/databricks/bundles/core/_generated/job_runs.py @@ -0,0 +1,115 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.job_runs._models.job_run import JobRun, JobRunParam + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.job_runs._models.job_run import JobRun + + return _ResourceType( + resource_type=JobRun, + singular_name="job_run", + plural_name="job_runs", + ) + + +class _JobRunResources: + """ + Generated job_run accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def job_runs(self) -> dict[str, "JobRun"]: + return self._resources["job_runs"] + + def add_job_run( + self, + resource_name: str, + job_run: "JobRunParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource job_run to the collection of resources. Resource name must be unique across all job_runs. + + :param resource_name: unique identifier for the job_run + :param job_run: the job_run to add, can be JobRun or dict + :param location: optional location of the job_run in the source code + """ + from databricks.bundles.job_runs._models.job_run import JobRun + + job_run = _transform(JobRun, job_run) + path = ("resources", "job_runs", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["job_runs"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'job_run'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["job_runs"][resource_name] = job_run + + +@overload +def job_run_mutator( + function: Callable[[Bundle, "JobRun"], "JobRun"], +) -> ResourceMutator["JobRun"]: ... + + +@overload +def job_run_mutator( + function: Callable[["JobRun"], "JobRun"], +) -> ResourceMutator["JobRun"]: ... + + +def job_run_mutator(function: Callable) -> ResourceMutator["JobRun"]: + """ + Decorator for defining mutator for job_runs. Function should return a new instance of the job_run + with the desired changes, instead of mutating the input job_run. + + Example: + + .. code-block:: python + + @job_run_mutator + def my_job_run_mutator(bundle: Bundle, job_run: JobRun) -> JobRun: + return replace(job_run, ...) + + :param function: Function that mutates job_runs. + """ + from databricks.bundles.job_runs._models.job_run import JobRun + + return ResourceMutator(resource_type=JobRun, function=function) diff --git a/python/databricks/bundles/core/_generated/model_serving_endpoints.py b/python/databricks/bundles/core/_generated/model_serving_endpoints.py new file mode 100644 index 00000000000..56a9ecde661 --- /dev/null +++ b/python/databricks/bundles/core/_generated/model_serving_endpoints.py @@ -0,0 +1,130 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint import ( + ModelServingEndpoint, + ModelServingEndpointParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint import ( + ModelServingEndpoint, + ) + + return _ResourceType( + resource_type=ModelServingEndpoint, + singular_name="model_serving_endpoint", + plural_name="model_serving_endpoints", + ) + + +class _ModelServingEndpointResources: + """ + Generated model_serving_endpoint accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def model_serving_endpoints(self) -> dict[str, "ModelServingEndpoint"]: + return self._resources["model_serving_endpoints"] + + def add_model_serving_endpoint( + self, + resource_name: str, + model_serving_endpoint: "ModelServingEndpointParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource model_serving_endpoint to the collection of resources. Resource name must be unique across all model_serving_endpoints. + + :param resource_name: unique identifier for the model_serving_endpoint + :param model_serving_endpoint: the model_serving_endpoint to add, can be ModelServingEndpoint or dict + :param location: optional location of the model_serving_endpoint in the source code + """ + from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint import ( + ModelServingEndpoint, + ) + + model_serving_endpoint = _transform( + ModelServingEndpoint, model_serving_endpoint + ) + path = ("resources", "model_serving_endpoints", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["model_serving_endpoints"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'model_serving_endpoint'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["model_serving_endpoints"][resource_name] = ( + model_serving_endpoint + ) + + +@overload +def model_serving_endpoint_mutator( + function: Callable[[Bundle, "ModelServingEndpoint"], "ModelServingEndpoint"], +) -> ResourceMutator["ModelServingEndpoint"]: ... + + +@overload +def model_serving_endpoint_mutator( + function: Callable[["ModelServingEndpoint"], "ModelServingEndpoint"], +) -> ResourceMutator["ModelServingEndpoint"]: ... + + +def model_serving_endpoint_mutator( + function: Callable, +) -> ResourceMutator["ModelServingEndpoint"]: + """ + Decorator for defining mutator for model_serving_endpoints. Function should return a new instance of the model_serving_endpoint + with the desired changes, instead of mutating the input model_serving_endpoint. + + Example: + + .. code-block:: python + + @model_serving_endpoint_mutator + def my_model_serving_endpoint_mutator(bundle: Bundle, model_serving_endpoint: ModelServingEndpoint) -> ModelServingEndpoint: + return replace(model_serving_endpoint, ...) + + :param function: Function that mutates model_serving_endpoints. + """ + from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint import ( + ModelServingEndpoint, + ) + + return ResourceMutator(resource_type=ModelServingEndpoint, function=function) diff --git a/python/databricks/bundles/core/_generated/models.py b/python/databricks/bundles/core/_generated/models.py new file mode 100644 index 00000000000..df7a4c6d6a3 --- /dev/null +++ b/python/databricks/bundles/core/_generated/models.py @@ -0,0 +1,118 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.models._models.mlflow_model import ( + MlflowModel, + MlflowModelParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.models._models.mlflow_model import MlflowModel + + return _ResourceType( + resource_type=MlflowModel, + singular_name="mlflow_model", + plural_name="models", + ) + + +class _MlflowModelResources: + """ + Generated mlflow_model accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def models(self) -> dict[str, "MlflowModel"]: + return self._resources["models"] + + def add_mlflow_model( + self, + resource_name: str, + mlflow_model: "MlflowModelParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource mlflow_model to the collection of resources. Resource name must be unique across all models. + + :param resource_name: unique identifier for the mlflow_model + :param mlflow_model: the mlflow_model to add, can be MlflowModel or dict + :param location: optional location of the mlflow_model in the source code + """ + from databricks.bundles.models._models.mlflow_model import MlflowModel + + mlflow_model = _transform(MlflowModel, mlflow_model) + path = ("resources", "models", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["models"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'mlflow_model'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["models"][resource_name] = mlflow_model + + +@overload +def mlflow_model_mutator( + function: Callable[[Bundle, "MlflowModel"], "MlflowModel"], +) -> ResourceMutator["MlflowModel"]: ... + + +@overload +def mlflow_model_mutator( + function: Callable[["MlflowModel"], "MlflowModel"], +) -> ResourceMutator["MlflowModel"]: ... + + +def mlflow_model_mutator(function: Callable) -> ResourceMutator["MlflowModel"]: + """ + Decorator for defining mutator for models. Function should return a new instance of the mlflow_model + with the desired changes, instead of mutating the input mlflow_model. + + Example: + + .. code-block:: python + + @mlflow_model_mutator + def my_mlflow_model_mutator(bundle: Bundle, mlflow_model: MlflowModel) -> MlflowModel: + return replace(mlflow_model, ...) + + :param function: Function that mutates models. + """ + from databricks.bundles.models._models.mlflow_model import MlflowModel + + return ResourceMutator(resource_type=MlflowModel, function=function) diff --git a/python/databricks/bundles/core/_generated/quality_monitors.py b/python/databricks/bundles/core/_generated/quality_monitors.py new file mode 100644 index 00000000000..ba3f52a75ae --- /dev/null +++ b/python/databricks/bundles/core/_generated/quality_monitors.py @@ -0,0 +1,124 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.quality_monitors._models.quality_monitor import ( + QualityMonitor, + QualityMonitorParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.quality_monitors._models.quality_monitor import ( + QualityMonitor, + ) + + return _ResourceType( + resource_type=QualityMonitor, + singular_name="quality_monitor", + plural_name="quality_monitors", + ) + + +class _QualityMonitorResources: + """ + Generated quality_monitor accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def quality_monitors(self) -> dict[str, "QualityMonitor"]: + return self._resources["quality_monitors"] + + def add_quality_monitor( + self, + resource_name: str, + quality_monitor: "QualityMonitorParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource quality_monitor to the collection of resources. Resource name must be unique across all quality_monitors. + + :param resource_name: unique identifier for the quality_monitor + :param quality_monitor: the quality_monitor to add, can be QualityMonitor or dict + :param location: optional location of the quality_monitor in the source code + """ + from databricks.bundles.quality_monitors._models.quality_monitor import ( + QualityMonitor, + ) + + quality_monitor = _transform(QualityMonitor, quality_monitor) + path = ("resources", "quality_monitors", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["quality_monitors"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'quality_monitor'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["quality_monitors"][resource_name] = quality_monitor + + +@overload +def quality_monitor_mutator( + function: Callable[[Bundle, "QualityMonitor"], "QualityMonitor"], +) -> ResourceMutator["QualityMonitor"]: ... + + +@overload +def quality_monitor_mutator( + function: Callable[["QualityMonitor"], "QualityMonitor"], +) -> ResourceMutator["QualityMonitor"]: ... + + +def quality_monitor_mutator(function: Callable) -> ResourceMutator["QualityMonitor"]: + """ + Decorator for defining mutator for quality_monitors. Function should return a new instance of the quality_monitor + with the desired changes, instead of mutating the input quality_monitor. + + Example: + + .. code-block:: python + + @quality_monitor_mutator + def my_quality_monitor_mutator(bundle: Bundle, quality_monitor: QualityMonitor) -> QualityMonitor: + return replace(quality_monitor, ...) + + :param function: Function that mutates quality_monitors. + """ + from databricks.bundles.quality_monitors._models.quality_monitor import ( + QualityMonitor, + ) + + return ResourceMutator(resource_type=QualityMonitor, function=function) diff --git a/python/databricks/bundles/core/_generated/registered_models.py b/python/databricks/bundles/core/_generated/registered_models.py new file mode 100644 index 00000000000..cdc492beeb3 --- /dev/null +++ b/python/databricks/bundles/core/_generated/registered_models.py @@ -0,0 +1,124 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.registered_models._models.registered_model import ( + RegisteredModel, + RegisteredModelParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.registered_models._models.registered_model import ( + RegisteredModel, + ) + + return _ResourceType( + resource_type=RegisteredModel, + singular_name="registered_model", + plural_name="registered_models", + ) + + +class _RegisteredModelResources: + """ + Generated registered_model accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def registered_models(self) -> dict[str, "RegisteredModel"]: + return self._resources["registered_models"] + + def add_registered_model( + self, + resource_name: str, + registered_model: "RegisteredModelParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource registered_model to the collection of resources. Resource name must be unique across all registered_models. + + :param resource_name: unique identifier for the registered_model + :param registered_model: the registered_model to add, can be RegisteredModel or dict + :param location: optional location of the registered_model in the source code + """ + from databricks.bundles.registered_models._models.registered_model import ( + RegisteredModel, + ) + + registered_model = _transform(RegisteredModel, registered_model) + path = ("resources", "registered_models", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["registered_models"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'registered_model'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["registered_models"][resource_name] = registered_model + + +@overload +def registered_model_mutator( + function: Callable[[Bundle, "RegisteredModel"], "RegisteredModel"], +) -> ResourceMutator["RegisteredModel"]: ... + + +@overload +def registered_model_mutator( + function: Callable[["RegisteredModel"], "RegisteredModel"], +) -> ResourceMutator["RegisteredModel"]: ... + + +def registered_model_mutator(function: Callable) -> ResourceMutator["RegisteredModel"]: + """ + Decorator for defining mutator for registered_models. Function should return a new instance of the registered_model + with the desired changes, instead of mutating the input registered_model. + + Example: + + .. code-block:: python + + @registered_model_mutator + def my_registered_model_mutator(bundle: Bundle, registered_model: RegisteredModel) -> RegisteredModel: + return replace(registered_model, ...) + + :param function: Function that mutates registered_models. + """ + from databricks.bundles.registered_models._models.registered_model import ( + RegisteredModel, + ) + + return ResourceMutator(resource_type=RegisteredModel, function=function) diff --git a/python/databricks/bundles/core/_generated/secret_scopes.py b/python/databricks/bundles/core/_generated/secret_scopes.py new file mode 100644 index 00000000000..a8be3660a6a --- /dev/null +++ b/python/databricks/bundles/core/_generated/secret_scopes.py @@ -0,0 +1,118 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.secret_scopes._models.secret_scope import ( + SecretScope, + SecretScopeParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.secret_scopes._models.secret_scope import SecretScope + + return _ResourceType( + resource_type=SecretScope, + singular_name="secret_scope", + plural_name="secret_scopes", + ) + + +class _SecretScopeResources: + """ + Generated secret_scope accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def secret_scopes(self) -> dict[str, "SecretScope"]: + return self._resources["secret_scopes"] + + def add_secret_scope( + self, + resource_name: str, + secret_scope: "SecretScopeParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource secret_scope to the collection of resources. Resource name must be unique across all secret_scopes. + + :param resource_name: unique identifier for the secret_scope + :param secret_scope: the secret_scope to add, can be SecretScope or dict + :param location: optional location of the secret_scope in the source code + """ + from databricks.bundles.secret_scopes._models.secret_scope import SecretScope + + secret_scope = _transform(SecretScope, secret_scope) + path = ("resources", "secret_scopes", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["secret_scopes"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'secret_scope'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["secret_scopes"][resource_name] = secret_scope + + +@overload +def secret_scope_mutator( + function: Callable[[Bundle, "SecretScope"], "SecretScope"], +) -> ResourceMutator["SecretScope"]: ... + + +@overload +def secret_scope_mutator( + function: Callable[["SecretScope"], "SecretScope"], +) -> ResourceMutator["SecretScope"]: ... + + +def secret_scope_mutator(function: Callable) -> ResourceMutator["SecretScope"]: + """ + Decorator for defining mutator for secret_scopes. Function should return a new instance of the secret_scope + with the desired changes, instead of mutating the input secret_scope. + + Example: + + .. code-block:: python + + @secret_scope_mutator + def my_secret_scope_mutator(bundle: Bundle, secret_scope: SecretScope) -> SecretScope: + return replace(secret_scope, ...) + + :param function: Function that mutates secret_scopes. + """ + from databricks.bundles.secret_scopes._models.secret_scope import SecretScope + + return ResourceMutator(resource_type=SecretScope, function=function) diff --git a/python/databricks/bundles/core/_generated/sql_warehouses.py b/python/databricks/bundles/core/_generated/sql_warehouses.py new file mode 100644 index 00000000000..05f8bb0cf76 --- /dev/null +++ b/python/databricks/bundles/core/_generated/sql_warehouses.py @@ -0,0 +1,118 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.sql_warehouses._models.sql_warehouse import ( + SqlWarehouse, + SqlWarehouseParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.sql_warehouses._models.sql_warehouse import SqlWarehouse + + return _ResourceType( + resource_type=SqlWarehouse, + singular_name="sql_warehouse", + plural_name="sql_warehouses", + ) + + +class _SqlWarehouseResources: + """ + Generated sql_warehouse accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def sql_warehouses(self) -> dict[str, "SqlWarehouse"]: + return self._resources["sql_warehouses"] + + def add_sql_warehouse( + self, + resource_name: str, + sql_warehouse: "SqlWarehouseParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource sql_warehouse to the collection of resources. Resource name must be unique across all sql_warehouses. + + :param resource_name: unique identifier for the sql_warehouse + :param sql_warehouse: the sql_warehouse to add, can be SqlWarehouse or dict + :param location: optional location of the sql_warehouse in the source code + """ + from databricks.bundles.sql_warehouses._models.sql_warehouse import SqlWarehouse + + sql_warehouse = _transform(SqlWarehouse, sql_warehouse) + path = ("resources", "sql_warehouses", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["sql_warehouses"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'sql_warehouse'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["sql_warehouses"][resource_name] = sql_warehouse + + +@overload +def sql_warehouse_mutator( + function: Callable[[Bundle, "SqlWarehouse"], "SqlWarehouse"], +) -> ResourceMutator["SqlWarehouse"]: ... + + +@overload +def sql_warehouse_mutator( + function: Callable[["SqlWarehouse"], "SqlWarehouse"], +) -> ResourceMutator["SqlWarehouse"]: ... + + +def sql_warehouse_mutator(function: Callable) -> ResourceMutator["SqlWarehouse"]: + """ + Decorator for defining mutator for sql_warehouses. Function should return a new instance of the sql_warehouse + with the desired changes, instead of mutating the input sql_warehouse. + + Example: + + .. code-block:: python + + @sql_warehouse_mutator + def my_sql_warehouse_mutator(bundle: Bundle, sql_warehouse: SqlWarehouse) -> SqlWarehouse: + return replace(sql_warehouse, ...) + + :param function: Function that mutates sql_warehouses. + """ + from databricks.bundles.sql_warehouses._models.sql_warehouse import SqlWarehouse + + return ResourceMutator(resource_type=SqlWarehouse, function=function) diff --git a/python/databricks/bundles/core/_generated/synced_database_tables.py b/python/databricks/bundles/core/_generated/synced_database_tables.py new file mode 100644 index 00000000000..2d0c7e598c0 --- /dev/null +++ b/python/databricks/bundles/core/_generated/synced_database_tables.py @@ -0,0 +1,128 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.synced_database_tables._models.synced_database_table import ( + SyncedDatabaseTable, + SyncedDatabaseTableParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.synced_database_tables._models.synced_database_table import ( + SyncedDatabaseTable, + ) + + return _ResourceType( + resource_type=SyncedDatabaseTable, + singular_name="synced_database_table", + plural_name="synced_database_tables", + ) + + +class _SyncedDatabaseTableResources: + """ + Generated synced_database_table accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def synced_database_tables(self) -> dict[str, "SyncedDatabaseTable"]: + return self._resources["synced_database_tables"] + + def add_synced_database_table( + self, + resource_name: str, + synced_database_table: "SyncedDatabaseTableParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource synced_database_table to the collection of resources. Resource name must be unique across all synced_database_tables. + + :param resource_name: unique identifier for the synced_database_table + :param synced_database_table: the synced_database_table to add, can be SyncedDatabaseTable or dict + :param location: optional location of the synced_database_table in the source code + """ + from databricks.bundles.synced_database_tables._models.synced_database_table import ( + SyncedDatabaseTable, + ) + + synced_database_table = _transform(SyncedDatabaseTable, synced_database_table) + path = ("resources", "synced_database_tables", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["synced_database_tables"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'synced_database_table'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["synced_database_tables"][resource_name] = ( + synced_database_table + ) + + +@overload +def synced_database_table_mutator( + function: Callable[[Bundle, "SyncedDatabaseTable"], "SyncedDatabaseTable"], +) -> ResourceMutator["SyncedDatabaseTable"]: ... + + +@overload +def synced_database_table_mutator( + function: Callable[["SyncedDatabaseTable"], "SyncedDatabaseTable"], +) -> ResourceMutator["SyncedDatabaseTable"]: ... + + +def synced_database_table_mutator( + function: Callable, +) -> ResourceMutator["SyncedDatabaseTable"]: + """ + Decorator for defining mutator for synced_database_tables. Function should return a new instance of the synced_database_table + with the desired changes, instead of mutating the input synced_database_table. + + Example: + + .. code-block:: python + + @synced_database_table_mutator + def my_synced_database_table_mutator(bundle: Bundle, synced_database_table: SyncedDatabaseTable) -> SyncedDatabaseTable: + return replace(synced_database_table, ...) + + :param function: Function that mutates synced_database_tables. + """ + from databricks.bundles.synced_database_tables._models.synced_database_table import ( + SyncedDatabaseTable, + ) + + return ResourceMutator(resource_type=SyncedDatabaseTable, function=function) diff --git a/python/databricks/bundles/core/_generated/vector_search_endpoints.py b/python/databricks/bundles/core/_generated/vector_search_endpoints.py new file mode 100644 index 00000000000..839831dafc6 --- /dev/null +++ b/python/databricks/bundles/core/_generated/vector_search_endpoints.py @@ -0,0 +1,130 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint import ( + VectorSearchEndpoint, + VectorSearchEndpointParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint import ( + VectorSearchEndpoint, + ) + + return _ResourceType( + resource_type=VectorSearchEndpoint, + singular_name="vector_search_endpoint", + plural_name="vector_search_endpoints", + ) + + +class _VectorSearchEndpointResources: + """ + Generated vector_search_endpoint accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def vector_search_endpoints(self) -> dict[str, "VectorSearchEndpoint"]: + return self._resources["vector_search_endpoints"] + + def add_vector_search_endpoint( + self, + resource_name: str, + vector_search_endpoint: "VectorSearchEndpointParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource vector_search_endpoint to the collection of resources. Resource name must be unique across all vector_search_endpoints. + + :param resource_name: unique identifier for the vector_search_endpoint + :param vector_search_endpoint: the vector_search_endpoint to add, can be VectorSearchEndpoint or dict + :param location: optional location of the vector_search_endpoint in the source code + """ + from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint import ( + VectorSearchEndpoint, + ) + + vector_search_endpoint = _transform( + VectorSearchEndpoint, vector_search_endpoint + ) + path = ("resources", "vector_search_endpoints", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["vector_search_endpoints"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'vector_search_endpoint'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["vector_search_endpoints"][resource_name] = ( + vector_search_endpoint + ) + + +@overload +def vector_search_endpoint_mutator( + function: Callable[[Bundle, "VectorSearchEndpoint"], "VectorSearchEndpoint"], +) -> ResourceMutator["VectorSearchEndpoint"]: ... + + +@overload +def vector_search_endpoint_mutator( + function: Callable[["VectorSearchEndpoint"], "VectorSearchEndpoint"], +) -> ResourceMutator["VectorSearchEndpoint"]: ... + + +def vector_search_endpoint_mutator( + function: Callable, +) -> ResourceMutator["VectorSearchEndpoint"]: + """ + Decorator for defining mutator for vector_search_endpoints. Function should return a new instance of the vector_search_endpoint + with the desired changes, instead of mutating the input vector_search_endpoint. + + Example: + + .. code-block:: python + + @vector_search_endpoint_mutator + def my_vector_search_endpoint_mutator(bundle: Bundle, vector_search_endpoint: VectorSearchEndpoint) -> VectorSearchEndpoint: + return replace(vector_search_endpoint, ...) + + :param function: Function that mutates vector_search_endpoints. + """ + from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint import ( + VectorSearchEndpoint, + ) + + return ResourceMutator(resource_type=VectorSearchEndpoint, function=function) diff --git a/python/databricks/bundles/core/_generated/vector_search_indexes.py b/python/databricks/bundles/core/_generated/vector_search_indexes.py new file mode 100644 index 00000000000..7c84a0d00c8 --- /dev/null +++ b/python/databricks/bundles/core/_generated/vector_search_indexes.py @@ -0,0 +1,128 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from collections.abc import Callable +from typing import TYPE_CHECKING, Optional, overload + +from databricks.bundles.core._bundle import Bundle +from databricks.bundles.core._location import Location +from databricks.bundles.core._resource_mutator import ResourceMutator +from databricks.bundles.core._transform import _transform + +if TYPE_CHECKING: + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.vector_search_indexes._models.vector_search_index import ( + VectorSearchIndex, + VectorSearchIndexParam, + ) + + +def _resource_type() -> "_ResourceType": + from databricks.bundles.core._resource_type import _ResourceType + from databricks.bundles.vector_search_indexes._models.vector_search_index import ( + VectorSearchIndex, + ) + + return _ResourceType( + resource_type=VectorSearchIndex, + singular_name="vector_search_index", + plural_name="vector_search_indexes", + ) + + +class _VectorSearchIndexResources: + """ + Generated vector_search_index accessors, mixed into Resources. + """ + + # Provided by the Resources subclass; declared here so the generated methods + # below type-check. + _resources: dict[str, dict] + + if TYPE_CHECKING: + + def add_location(self, path: tuple[str, ...], location: Location) -> None: ... + + def add_diagnostic_error( + self, + msg: str, + *, + detail: Optional[str] = None, + path: Optional[tuple[str, ...]] = None, + location: Optional[Location] = None, + ) -> None: ... + + @property + def vector_search_indexes(self) -> dict[str, "VectorSearchIndex"]: + return self._resources["vector_search_indexes"] + + def add_vector_search_index( + self, + resource_name: str, + vector_search_index: "VectorSearchIndexParam", + *, + location: Optional[Location] = None, + ) -> None: + """ + Adds the resource vector_search_index to the collection of resources. Resource name must be unique across all vector_search_indexes. + + :param resource_name: unique identifier for the vector_search_index + :param vector_search_index: the vector_search_index to add, can be VectorSearchIndex or dict + :param location: optional location of the vector_search_index in the source code + """ + from databricks.bundles.vector_search_indexes._models.vector_search_index import ( + VectorSearchIndex, + ) + + vector_search_index = _transform(VectorSearchIndex, vector_search_index) + path = ("resources", "vector_search_indexes", resource_name) + location = location or Location.from_stack_frame(depth=1) + + if self._resources["vector_search_indexes"].get(resource_name): + self.add_diagnostic_error( + msg=f"Duplicate resource name '{resource_name}' for resource 'vector_search_index'. Resource names must be unique.", + location=location, + path=path, + ) + else: + if location: + self.add_location(path, location) + + self._resources["vector_search_indexes"][resource_name] = ( + vector_search_index + ) + + +@overload +def vector_search_index_mutator( + function: Callable[[Bundle, "VectorSearchIndex"], "VectorSearchIndex"], +) -> ResourceMutator["VectorSearchIndex"]: ... + + +@overload +def vector_search_index_mutator( + function: Callable[["VectorSearchIndex"], "VectorSearchIndex"], +) -> ResourceMutator["VectorSearchIndex"]: ... + + +def vector_search_index_mutator( + function: Callable, +) -> ResourceMutator["VectorSearchIndex"]: + """ + Decorator for defining mutator for vector_search_indexes. Function should return a new instance of the vector_search_index + with the desired changes, instead of mutating the input vector_search_index. + + Example: + + .. code-block:: python + + @vector_search_index_mutator + def my_vector_search_index_mutator(bundle: Bundle, vector_search_index: VectorSearchIndex) -> VectorSearchIndex: + return replace(vector_search_index, ...) + + :param function: Function that mutates vector_search_indexes. + """ + from databricks.bundles.vector_search_indexes._models.vector_search_index import ( + VectorSearchIndex, + ) + + return ResourceMutator(resource_type=VectorSearchIndex, function=function) diff --git a/python/databricks/bundles/database_catalogs/__init__.py b/python/databricks/bundles/database_catalogs/__init__.py new file mode 100644 index 00000000000..fdd1d167302 --- /dev/null +++ b/python/databricks/bundles/database_catalogs/__init__.py @@ -0,0 +1,22 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "DatabaseCatalog", + "DatabaseCatalogDict", + "DatabaseCatalogParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", +] + + +from databricks.bundles.database_catalogs._models.database_catalog import ( + DatabaseCatalog, + DatabaseCatalogDict, + DatabaseCatalogParam, +) +from databricks.bundles.database_catalogs._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) diff --git a/python/databricks/bundles/database_catalogs/_models/database_catalog.py b/python/databricks/bundles/database_catalogs/_models/database_catalog.py new file mode 100644 index 00000000000..a224ac7a316 --- /dev/null +++ b/python/databricks/bundles/database_catalogs/_models/database_catalog.py @@ -0,0 +1,85 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.database_catalogs._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DatabaseCatalog(Resource): + """""" + + database_instance_name: VariableOr[str] + """ + [Public Preview] The name of the DatabaseInstance housing the database. + """ + + database_name: VariableOr[str] + """ + [Public Preview] The name of the database (in an instance) associated with the catalog. + """ + + name: VariableOr[str] + """ + [Public Preview] The name of the catalog in UC. + """ + + create_database_if_not_exists: VariableOrOptional[bool] = None + """ + [Public Preview] + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "DatabaseCatalogDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DatabaseCatalogDict": + return _transform_to_json_value(self) # type:ignore + + +class DatabaseCatalogDict(TypedDict, total=False): + """""" + + database_instance_name: VariableOr[str] + """ + [Public Preview] The name of the DatabaseInstance housing the database. + """ + + database_name: VariableOr[str] + """ + [Public Preview] The name of the database (in an instance) associated with the catalog. + """ + + name: VariableOr[str] + """ + [Public Preview] The name of the catalog in UC. + """ + + create_database_if_not_exists: VariableOrOptional[bool] + """ + [Public Preview] + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + +DatabaseCatalogParam = DatabaseCatalogDict | DatabaseCatalog diff --git a/python/databricks/bundles/database_catalogs/_models/lifecycle.py b/python/databricks/bundles/database_catalogs/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/database_catalogs/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/database_instances/__init__.py b/python/databricks/bundles/database_instances/__init__.py new file mode 100644 index 00000000000..13674b646a5 --- /dev/null +++ b/python/databricks/bundles/database_instances/__init__.py @@ -0,0 +1,52 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "CustomTag", + "CustomTagDict", + "CustomTagParam", + "DatabaseInstance", + "DatabaseInstanceDict", + "DatabaseInstanceParam", + "DatabaseInstanceRef", + "DatabaseInstanceRefDict", + "DatabaseInstanceRefParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "Permission", + "PermissionDict", + "PermissionLevel", + "PermissionLevelParam", + "PermissionParam", +] + + +from databricks.bundles.database_instances._models.custom_tag import ( + CustomTag, + CustomTagDict, + CustomTagParam, +) +from databricks.bundles.database_instances._models.database_instance import ( + DatabaseInstance, + DatabaseInstanceDict, + DatabaseInstanceParam, +) +from databricks.bundles.database_instances._models.database_instance_ref import ( + DatabaseInstanceRef, + DatabaseInstanceRefDict, + DatabaseInstanceRefParam, +) +from databricks.bundles.database_instances._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.database_instances._models.permission import ( + Permission, + PermissionDict, + PermissionParam, +) +from databricks.bundles.database_instances._models.permission_level import ( + PermissionLevel, + PermissionLevelParam, +) diff --git a/python/databricks/bundles/database_instances/_models/custom_tag.py b/python/databricks/bundles/database_instances/_models/custom_tag.py new file mode 100644 index 00000000000..e08eb459bf7 --- /dev/null +++ b/python/databricks/bundles/database_instances/_models/custom_tag.py @@ -0,0 +1,58 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class CustomTag: + """""" + + key: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] The key of the custom tag. + """ + + value: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] The value of the custom tag. + """ + + @classmethod + def from_dict(cls, value: "CustomTagDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "CustomTagDict": + return _transform_to_json_value(self) # type:ignore + + +class CustomTagDict(TypedDict, total=False): + """""" + + key: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] The key of the custom tag. + """ + + value: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] The value of the custom tag. + """ + + +CustomTagParam = CustomTagDict | CustomTag diff --git a/python/databricks/bundles/database_instances/_models/database_instance.py b/python/databricks/bundles/database_instances/_models/database_instance.py new file mode 100644 index 00000000000..beea60bfd1f --- /dev/null +++ b/python/databricks/bundles/database_instances/_models/database_instance.py @@ -0,0 +1,193 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.database_instances._models.custom_tag import ( + CustomTag, + CustomTagParam, +) +from databricks.bundles.database_instances._models.database_instance_ref import ( + DatabaseInstanceRef, + DatabaseInstanceRefParam, +) +from databricks.bundles.database_instances._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.database_instances._models.permission import ( + Permission, + PermissionParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DatabaseInstance(Resource): + """ + A DatabaseInstance represents a logical Postgres instance, comprised of both compute and storage. + """ + + name: VariableOr[str] + """ + [Public Preview] The name of the instance. This is the unique identifier for the instance. + """ + + capacity: VariableOrOptional[str] = None + """ + [Public Preview] The sku of the instance. Valid values are "CU_1", "CU_2", "CU_4", "CU_8". + """ + + custom_tags: VariableOrList[CustomTag] = field(default_factory=list) + """ + :meta private: [EXPERIMENTAL] + + [Beta] Custom tags associated with the instance. This field is only included on create and update responses. + """ + + enable_pg_native_login: VariableOrOptional[bool] = None + """ + [Public Preview] Whether to enable PG native password login on the instance. Defaults to false. + """ + + enable_readable_secondaries: VariableOrOptional[bool] = None + """ + [Public Preview] Whether to enable secondaries to serve read-only traffic. Defaults to false. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + node_count: VariableOrOptional[int] = None + """ + [Public Preview] The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults to + 1 primary and 0 secondaries. This field is input only, see effective_node_count for the output. + """ + + parent_instance_ref: VariableOrOptional[DatabaseInstanceRef] = None + """ + [Public Preview] The ref of the parent instance. This is only available if the instance is + child instance. + Input: For specifying the parent instance to create a child instance. Optional. + Output: Only populated if provided as input to create a child instance. + """ + + permissions: VariableOrList[Permission] = field(default_factory=list) + """ + The permissions to apply to this resource. + """ + + retention_window_in_days: VariableOrOptional[int] = None + """ + [Public Preview] The retention window for the instance. This is the time window in days + for which the historical data is retained. The default value is 7 days. + Valid values are 2 to 35 days. + """ + + stopped: VariableOrOptional[bool] = None + """ + [Public Preview] Whether to stop the instance. An input only param, see effective_stopped for the output. + """ + + usage_policy_id: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] The desired usage policy to associate with the instance. + """ + + @classmethod + def from_dict(cls, value: "DatabaseInstanceDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DatabaseInstanceDict": + return _transform_to_json_value(self) # type:ignore + + +class DatabaseInstanceDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + [Public Preview] The name of the instance. This is the unique identifier for the instance. + """ + + capacity: VariableOrOptional[str] + """ + [Public Preview] The sku of the instance. Valid values are "CU_1", "CU_2", "CU_4", "CU_8". + """ + + custom_tags: VariableOrList[CustomTagParam] + """ + :meta private: [EXPERIMENTAL] + + [Beta] Custom tags associated with the instance. This field is only included on create and update responses. + """ + + enable_pg_native_login: VariableOrOptional[bool] + """ + [Public Preview] Whether to enable PG native password login on the instance. Defaults to false. + """ + + enable_readable_secondaries: VariableOrOptional[bool] + """ + [Public Preview] Whether to enable secondaries to serve read-only traffic. Defaults to false. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + node_count: VariableOrOptional[int] + """ + [Public Preview] The number of nodes in the instance, composed of 1 primary and 0 or more secondaries. Defaults to + 1 primary and 0 secondaries. This field is input only, see effective_node_count for the output. + """ + + parent_instance_ref: VariableOrOptional[DatabaseInstanceRefParam] + """ + [Public Preview] The ref of the parent instance. This is only available if the instance is + child instance. + Input: For specifying the parent instance to create a child instance. Optional. + Output: Only populated if provided as input to create a child instance. + """ + + permissions: VariableOrList[PermissionParam] + """ + The permissions to apply to this resource. + """ + + retention_window_in_days: VariableOrOptional[int] + """ + [Public Preview] The retention window for the instance. This is the time window in days + for which the historical data is retained. The default value is 7 days. + Valid values are 2 to 35 days. + """ + + stopped: VariableOrOptional[bool] + """ + [Public Preview] Whether to stop the instance. An input only param, see effective_stopped for the output. + """ + + usage_policy_id: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] The desired usage policy to associate with the instance. + """ + + +DatabaseInstanceParam = DatabaseInstanceDict | DatabaseInstance diff --git a/python/databricks/bundles/database_instances/_models/database_instance_ref.py b/python/databricks/bundles/database_instances/_models/database_instance_ref.py new file mode 100644 index 00000000000..8c3e582f280 --- /dev/null +++ b/python/databricks/bundles/database_instances/_models/database_instance_ref.py @@ -0,0 +1,87 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DatabaseInstanceRef: + """ + DatabaseInstanceRef is a reference to a database instance. It is used in the + DatabaseInstance object to refer to the parent instance of an instance and + to refer the child instances of an instance. + To specify as a parent instance during creation of an instance, + the lsn and branch_time fields are optional. If not specified, the child + instance will be created from the latest lsn of the parent. + If both lsn and branch_time are specified, the lsn will be used to create + the child instance. + """ + + branch_time: VariableOrOptional[str] = None + """ + [Public Preview] Branch time of the ref database instance. + For a parent ref instance, this is the point in time on the parent instance from which the + instance was created. + For a child ref instance, this is the point in time on the instance from which the child + instance was created. + Input: For specifying the point in time to create a child instance. Optional. + Output: Only populated if provided as input to create a child instance. + """ + + lsn: VariableOrOptional[str] = None + """ + [Public Preview] User-specified WAL LSN of the ref database instance. + + Input: For specifying the WAL LSN to create a child instance. Optional. + Output: Only populated if provided as input to create a child instance. + """ + + name: VariableOrOptional[str] = None + """ + [Public Preview] Name of the ref database instance. + """ + + @classmethod + def from_dict(cls, value: "DatabaseInstanceRefDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DatabaseInstanceRefDict": + return _transform_to_json_value(self) # type:ignore + + +class DatabaseInstanceRefDict(TypedDict, total=False): + """""" + + branch_time: VariableOrOptional[str] + """ + [Public Preview] Branch time of the ref database instance. + For a parent ref instance, this is the point in time on the parent instance from which the + instance was created. + For a child ref instance, this is the point in time on the instance from which the child + instance was created. + Input: For specifying the point in time to create a child instance. Optional. + Output: Only populated if provided as input to create a child instance. + """ + + lsn: VariableOrOptional[str] + """ + [Public Preview] User-specified WAL LSN of the ref database instance. + + Input: For specifying the WAL LSN to create a child instance. Optional. + Output: Only populated if provided as input to create a child instance. + """ + + name: VariableOrOptional[str] + """ + [Public Preview] Name of the ref database instance. + """ + + +DatabaseInstanceRefParam = DatabaseInstanceRefDict | DatabaseInstanceRef diff --git a/python/databricks/bundles/database_instances/_models/lifecycle.py b/python/databricks/bundles/database_instances/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/database_instances/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/database_instances/_models/permission.py b/python/databricks/bundles/database_instances/_models/permission.py new file mode 100644 index 00000000000..da0f1e44ad2 --- /dev/null +++ b/python/databricks/bundles/database_instances/_models/permission.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.database_instances._models.permission_level import ( + PermissionLevel, + PermissionLevelParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Permission: + """""" + + level: VariableOr[PermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. + """ + + @classmethod + def from_dict(cls, value: "PermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "PermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class PermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[PermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. + """ + + +PermissionParam = PermissionDict | Permission diff --git a/python/databricks/bundles/database_instances/_models/permission_level.py b/python/databricks/bundles/database_instances/_models/permission_level.py new file mode 100644 index 00000000000..c6111911b29 --- /dev/null +++ b/python/databricks/bundles/database_instances/_models/permission_level.py @@ -0,0 +1,58 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class PermissionLevel(Enum): + """ + Permission level + """ + + CAN_MANAGE = "CAN_MANAGE" + CAN_RESTART = "CAN_RESTART" + CAN_ATTACH_TO = "CAN_ATTACH_TO" + IS_OWNER = "IS_OWNER" + CAN_MANAGE_RUN = "CAN_MANAGE_RUN" + CAN_VIEW = "CAN_VIEW" + CAN_READ = "CAN_READ" + CAN_RUN = "CAN_RUN" + CAN_EDIT = "CAN_EDIT" + CAN_USE = "CAN_USE" + CAN_MANAGE_STAGING_VERSIONS = "CAN_MANAGE_STAGING_VERSIONS" + CAN_MANAGE_PRODUCTION_VERSIONS = "CAN_MANAGE_PRODUCTION_VERSIONS" + CAN_EDIT_METADATA = "CAN_EDIT_METADATA" + CAN_VIEW_METADATA = "CAN_VIEW_METADATA" + CAN_BIND = "CAN_BIND" + CAN_QUERY = "CAN_QUERY" + CAN_MONITOR = "CAN_MONITOR" + CAN_CREATE = "CAN_CREATE" + CAN_MONITOR_ONLY = "CAN_MONITOR_ONLY" + CAN_CREATE_APP = "CAN_CREATE_APP" + + +PermissionLevelParam = ( + Literal[ + "CAN_MANAGE", + "CAN_RESTART", + "CAN_ATTACH_TO", + "IS_OWNER", + "CAN_MANAGE_RUN", + "CAN_VIEW", + "CAN_READ", + "CAN_RUN", + "CAN_EDIT", + "CAN_USE", + "CAN_MANAGE_STAGING_VERSIONS", + "CAN_MANAGE_PRODUCTION_VERSIONS", + "CAN_EDIT_METADATA", + "CAN_VIEW_METADATA", + "CAN_BIND", + "CAN_QUERY", + "CAN_MONITOR", + "CAN_CREATE", + "CAN_MONITOR_ONLY", + "CAN_CREATE_APP", + ] + | PermissionLevel +) diff --git a/python/databricks/bundles/experiments/__init__.py b/python/databricks/bundles/experiments/__init__.py new file mode 100644 index 00000000000..e1ae26cc521 --- /dev/null +++ b/python/databricks/bundles/experiments/__init__.py @@ -0,0 +1,60 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "ExperimentPermissionLevel", + "ExperimentPermissionLevelParam", + "ExperimentTag", + "ExperimentTagDict", + "ExperimentTagParam", + "ExperimentTraceLocation", + "ExperimentTraceLocationDict", + "ExperimentTraceLocationParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "MlflowExperiment", + "MlflowExperimentDict", + "MlflowExperimentParam", + "MlflowExperimentPermission", + "MlflowExperimentPermissionDict", + "MlflowExperimentPermissionParam", + "UcTraceLocation", + "UcTraceLocationDict", + "UcTraceLocationParam", +] + + +from databricks.bundles.experiments._models.experiment_permission_level import ( + ExperimentPermissionLevel, + ExperimentPermissionLevelParam, +) +from databricks.bundles.experiments._models.experiment_tag import ( + ExperimentTag, + ExperimentTagDict, + ExperimentTagParam, +) +from databricks.bundles.experiments._models.experiment_trace_location import ( + ExperimentTraceLocation, + ExperimentTraceLocationDict, + ExperimentTraceLocationParam, +) +from databricks.bundles.experiments._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.experiments._models.mlflow_experiment import ( + MlflowExperiment, + MlflowExperimentDict, + MlflowExperimentParam, +) +from databricks.bundles.experiments._models.mlflow_experiment_permission import ( + MlflowExperimentPermission, + MlflowExperimentPermissionDict, + MlflowExperimentPermissionParam, +) +from databricks.bundles.experiments._models.uc_trace_location import ( + UcTraceLocation, + UcTraceLocationDict, + UcTraceLocationParam, +) diff --git a/python/databricks/bundles/experiments/_models/experiment_permission_level.py b/python/databricks/bundles/experiments/_models/experiment_permission_level.py new file mode 100644 index 00000000000..056727ac92c --- /dev/null +++ b/python/databricks/bundles/experiments/_models/experiment_permission_level.py @@ -0,0 +1,19 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ExperimentPermissionLevel(Enum): + """ + Permission level + """ + + CAN_MANAGE = "CAN_MANAGE" + CAN_EDIT = "CAN_EDIT" + CAN_READ = "CAN_READ" + + +ExperimentPermissionLevelParam = ( + Literal["CAN_MANAGE", "CAN_EDIT", "CAN_READ"] | ExperimentPermissionLevel +) diff --git a/python/databricks/bundles/experiments/_models/experiment_tag.py b/python/databricks/bundles/experiments/_models/experiment_tag.py new file mode 100644 index 00000000000..2c78a181b17 --- /dev/null +++ b/python/databricks/bundles/experiments/_models/experiment_tag.py @@ -0,0 +1,52 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ExperimentTag: + """ + A tag for an experiment. + """ + + key: VariableOrOptional[str] = None + """ + The tag key. + """ + + value: VariableOrOptional[str] = None + """ + The tag value. + """ + + @classmethod + def from_dict(cls, value: "ExperimentTagDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ExperimentTagDict": + return _transform_to_json_value(self) # type:ignore + + +class ExperimentTagDict(TypedDict, total=False): + """""" + + key: VariableOrOptional[str] + """ + The tag key. + """ + + value: VariableOrOptional[str] + """ + The tag value. + """ + + +ExperimentTagParam = ExperimentTagDict | ExperimentTag diff --git a/python/databricks/bundles/experiments/_models/experiment_trace_location.py b/python/databricks/bundles/experiments/_models/experiment_trace_location.py new file mode 100644 index 00000000000..cbc9dffb6cf --- /dev/null +++ b/python/databricks/bundles/experiments/_models/experiment_trace_location.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.experiments._models.uc_trace_location import ( + UcTraceLocation, + UcTraceLocationParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ExperimentTraceLocation: + """ + :meta private: [EXPERIMENTAL] + + The storage location for an experiment's traces. + """ + + uc_trace_location: VariableOrOptional[UcTraceLocation] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] A Unity Catalog schema where the experiment's traces are stored as + Delta tables. + """ + + @classmethod + def from_dict(cls, value: "ExperimentTraceLocationDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ExperimentTraceLocationDict": + return _transform_to_json_value(self) # type:ignore + + +class ExperimentTraceLocationDict(TypedDict, total=False): + """""" + + uc_trace_location: VariableOrOptional[UcTraceLocationParam] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] A Unity Catalog schema where the experiment's traces are stored as + Delta tables. + """ + + +ExperimentTraceLocationParam = ExperimentTraceLocationDict | ExperimentTraceLocation diff --git a/python/databricks/bundles/experiments/_models/lifecycle.py b/python/databricks/bundles/experiments/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/experiments/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/experiments/_models/mlflow_experiment.py b/python/databricks/bundles/experiments/_models/mlflow_experiment.py new file mode 100644 index 00000000000..8a9d5368e99 --- /dev/null +++ b/python/databricks/bundles/experiments/_models/mlflow_experiment.py @@ -0,0 +1,131 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.experiments._models.experiment_tag import ( + ExperimentTag, + ExperimentTagParam, +) +from databricks.bundles.experiments._models.experiment_trace_location import ( + ExperimentTraceLocation, + ExperimentTraceLocationParam, +) +from databricks.bundles.experiments._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.experiments._models.mlflow_experiment_permission import ( + MlflowExperimentPermission, + MlflowExperimentPermissionParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MlflowExperiment(Resource): + """""" + + name: VariableOr[str] + """ + Experiment name. + """ + + artifact_location: VariableOrOptional[str] = None + """ + Location where all artifacts for the experiment are stored. + If not provided, the remote server will select an appropriate default. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[MlflowExperimentPermission] = field( + default_factory=list + ) + """ + The permissions to apply to this resource. + """ + + tags: VariableOrList[ExperimentTag] = field(default_factory=list) + """ + A collection of tags to set on the experiment. Maximum tag size and number of tags per request + depends on the storage backend. All storage backends are guaranteed to support tag keys up + to 250 bytes in size and tag values up to 5000 bytes in size. All storage backends are also + guaranteed to support up to 20 tags per request. + """ + + trace_location: VariableOrOptional[ExperimentTraceLocation] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The location where the experiment's traces are stored. When set, the + underlying storage is provisioned and the experiment's traces are routed + to it. When unset, traces are stored in the default MLflow backend. This + field cannot be updated after the experiment is created. + """ + + @classmethod + def from_dict(cls, value: "MlflowExperimentDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MlflowExperimentDict": + return _transform_to_json_value(self) # type:ignore + + +class MlflowExperimentDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + Experiment name. + """ + + artifact_location: VariableOrOptional[str] + """ + Location where all artifacts for the experiment are stored. + If not provided, the remote server will select an appropriate default. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[MlflowExperimentPermissionParam] + """ + The permissions to apply to this resource. + """ + + tags: VariableOrList[ExperimentTagParam] + """ + A collection of tags to set on the experiment. Maximum tag size and number of tags per request + depends on the storage backend. All storage backends are guaranteed to support tag keys up + to 250 bytes in size and tag values up to 5000 bytes in size. All storage backends are also + guaranteed to support up to 20 tags per request. + """ + + trace_location: VariableOrOptional[ExperimentTraceLocationParam] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The location where the experiment's traces are stored. When set, the + underlying storage is provisioned and the experiment's traces are routed + to it. When unset, traces are stored in the default MLflow backend. This + field cannot be updated after the experiment is created. + """ + + +MlflowExperimentParam = MlflowExperimentDict | MlflowExperiment diff --git a/python/databricks/bundles/experiments/_models/mlflow_experiment_permission.py b/python/databricks/bundles/experiments/_models/mlflow_experiment_permission.py new file mode 100644 index 00000000000..041b02d91b3 --- /dev/null +++ b/python/databricks/bundles/experiments/_models/mlflow_experiment_permission.py @@ -0,0 +1,76 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.experiments._models.experiment_permission_level import ( + ExperimentPermissionLevel, + ExperimentPermissionLevelParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MlflowExperimentPermission: + """""" + + level: VariableOr[ExperimentPermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. + """ + + @classmethod + def from_dict(cls, value: "MlflowExperimentPermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MlflowExperimentPermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class MlflowExperimentPermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[ExperimentPermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. + """ + + +MlflowExperimentPermissionParam = ( + MlflowExperimentPermissionDict | MlflowExperimentPermission +) diff --git a/python/databricks/bundles/experiments/_models/uc_trace_location.py b/python/databricks/bundles/experiments/_models/uc_trace_location.py new file mode 100644 index 00000000000..b7b8148823e --- /dev/null +++ b/python/databricks/bundles/experiments/_models/uc_trace_location.py @@ -0,0 +1,87 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class UcTraceLocation: + """ + :meta private: [EXPERIMENTAL] + + A Unity Catalog trace storage location. Traces are stored as Delta tables + in the specified catalog and schema. + """ + + catalog: VariableOr[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The name of the Unity Catalog catalog. + """ + + schema: VariableOr[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The name of the Unity Catalog schema within `catalog`. + """ + + table_prefix: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The prefix for the trace tables, which are named + `{catalog}.{schema}.{table_prefix}_otel_*`. May only contain letters, + digits, and underscores, and may be at most 238 characters. When unset, a + server-generated prefix derived from the experiment ID is used and this + field stays empty on read; the resolved value is always available in + `effective_table_prefix`. + """ + + @classmethod + def from_dict(cls, value: "UcTraceLocationDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "UcTraceLocationDict": + return _transform_to_json_value(self) # type:ignore + + +class UcTraceLocationDict(TypedDict, total=False): + """""" + + catalog: VariableOr[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The name of the Unity Catalog catalog. + """ + + schema: VariableOr[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The name of the Unity Catalog schema within `catalog`. + """ + + table_prefix: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The prefix for the trace tables, which are named + `{catalog}.{schema}.{table_prefix}_otel_*`. May only contain letters, + digits, and underscores, and may be at most 238 characters. When unset, a + server-generated prefix derived from the experiment ID is used and this + field stays empty on read; the resolved value is always available in + `effective_table_prefix`. + """ + + +UcTraceLocationParam = UcTraceLocationDict | UcTraceLocation diff --git a/python/databricks/bundles/external_locations/__init__.py b/python/databricks/bundles/external_locations/__init__.py new file mode 100644 index 00000000000..d6aa3bf908c --- /dev/null +++ b/python/databricks/bundles/external_locations/__init__.py @@ -0,0 +1,90 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "AwsSqsQueue", + "AwsSqsQueueDict", + "AwsSqsQueueParam", + "AzureQueueStorage", + "AzureQueueStorageDict", + "AzureQueueStorageParam", + "EncryptionDetails", + "EncryptionDetailsDict", + "EncryptionDetailsParam", + "ExternalLocation", + "ExternalLocationDict", + "ExternalLocationParam", + "FileEventQueue", + "FileEventQueueDict", + "FileEventQueueParam", + "GcpPubsub", + "GcpPubsubDict", + "GcpPubsubParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "Privilege", + "PrivilegeAssignment", + "PrivilegeAssignmentDict", + "PrivilegeAssignmentParam", + "PrivilegeParam", + "SseEncryptionDetails", + "SseEncryptionDetailsAlgorithm", + "SseEncryptionDetailsAlgorithmParam", + "SseEncryptionDetailsDict", + "SseEncryptionDetailsParam", +] + + +from databricks.bundles.external_locations._models.aws_sqs_queue import ( + AwsSqsQueue, + AwsSqsQueueDict, + AwsSqsQueueParam, +) +from databricks.bundles.external_locations._models.azure_queue_storage import ( + AzureQueueStorage, + AzureQueueStorageDict, + AzureQueueStorageParam, +) +from databricks.bundles.external_locations._models.encryption_details import ( + EncryptionDetails, + EncryptionDetailsDict, + EncryptionDetailsParam, +) +from databricks.bundles.external_locations._models.external_location import ( + ExternalLocation, + ExternalLocationDict, + ExternalLocationParam, +) +from databricks.bundles.external_locations._models.file_event_queue import ( + FileEventQueue, + FileEventQueueDict, + FileEventQueueParam, +) +from databricks.bundles.external_locations._models.gcp_pubsub import ( + GcpPubsub, + GcpPubsubDict, + GcpPubsubParam, +) +from databricks.bundles.external_locations._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.external_locations._models.privilege import ( + Privilege, + PrivilegeParam, +) +from databricks.bundles.external_locations._models.privilege_assignment import ( + PrivilegeAssignment, + PrivilegeAssignmentDict, + PrivilegeAssignmentParam, +) +from databricks.bundles.external_locations._models.sse_encryption_details import ( + SseEncryptionDetails, + SseEncryptionDetailsDict, + SseEncryptionDetailsParam, +) +from databricks.bundles.external_locations._models.sse_encryption_details_algorithm import ( + SseEncryptionDetailsAlgorithm, + SseEncryptionDetailsAlgorithmParam, +) diff --git a/python/databricks/bundles/external_locations/_models/aws_sqs_queue.py b/python/databricks/bundles/external_locations/_models/aws_sqs_queue.py new file mode 100644 index 00000000000..53c7a0b7062 --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/aws_sqs_queue.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AwsSqsQueue: + """""" + + queue_url: VariableOrOptional[str] = None + """ + The AQS queue url in the format https://sqs.{region}.amazonaws.com/{account id}/{queue name}. + Only required for provided_sqs. + """ + + @classmethod + def from_dict(cls, value: "AwsSqsQueueDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AwsSqsQueueDict": + return _transform_to_json_value(self) # type:ignore + + +class AwsSqsQueueDict(TypedDict, total=False): + """""" + + queue_url: VariableOrOptional[str] + """ + The AQS queue url in the format https://sqs.{region}.amazonaws.com/{account id}/{queue name}. + Only required for provided_sqs. + """ + + +AwsSqsQueueParam = AwsSqsQueueDict | AwsSqsQueue diff --git a/python/databricks/bundles/external_locations/_models/azure_queue_storage.py b/python/databricks/bundles/external_locations/_models/azure_queue_storage.py new file mode 100644 index 00000000000..a8d182421f7 --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/azure_queue_storage.py @@ -0,0 +1,70 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AzureQueueStorage: + """""" + + queue_url: VariableOrOptional[str] = None + """ + The AQS queue url in the format https://{storage account}.queue.core.windows.net/{queue name} + Only required for provided_aqs. + """ + + resource_group: VariableOrOptional[str] = None + """ + Optional resource group for the queue, event grid subscription, and external location storage + account. + Only required for locations with a service principal storage credential + """ + + subscription_id: VariableOrOptional[str] = None + """ + Optional subscription id for the queue, event grid subscription, and external location storage + account. + Required for locations with a service principal storage credential + """ + + @classmethod + def from_dict(cls, value: "AzureQueueStorageDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AzureQueueStorageDict": + return _transform_to_json_value(self) # type:ignore + + +class AzureQueueStorageDict(TypedDict, total=False): + """""" + + queue_url: VariableOrOptional[str] + """ + The AQS queue url in the format https://{storage account}.queue.core.windows.net/{queue name} + Only required for provided_aqs. + """ + + resource_group: VariableOrOptional[str] + """ + Optional resource group for the queue, event grid subscription, and external location storage + account. + Only required for locations with a service principal storage credential + """ + + subscription_id: VariableOrOptional[str] + """ + Optional subscription id for the queue, event grid subscription, and external location storage + account. + Required for locations with a service principal storage credential + """ + + +AzureQueueStorageParam = AzureQueueStorageDict | AzureQueueStorage diff --git a/python/databricks/bundles/external_locations/_models/encryption_details.py b/python/databricks/bundles/external_locations/_models/encryption_details.py new file mode 100644 index 00000000000..d1b67fa76bd --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/encryption_details.py @@ -0,0 +1,46 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.external_locations._models.sse_encryption_details import ( + SseEncryptionDetails, + SseEncryptionDetailsParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class EncryptionDetails: + """ + Encryption options that apply to clients connecting to cloud storage. + """ + + sse_encryption_details: VariableOrOptional[SseEncryptionDetails] = None + """ + Server-Side Encryption properties for clients communicating with AWS s3. + """ + + @classmethod + def from_dict(cls, value: "EncryptionDetailsDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "EncryptionDetailsDict": + return _transform_to_json_value(self) # type:ignore + + +class EncryptionDetailsDict(TypedDict, total=False): + """""" + + sse_encryption_details: VariableOrOptional[SseEncryptionDetailsParam] + """ + Server-Side Encryption properties for clients communicating with AWS s3. + """ + + +EncryptionDetailsParam = EncryptionDetailsDict | EncryptionDetails diff --git a/python/databricks/bundles/external_locations/_models/external_location.py b/python/databricks/bundles/external_locations/_models/external_location.py new file mode 100644 index 00000000000..ea72a5da3dd --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/external_location.py @@ -0,0 +1,173 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.external_locations._models.encryption_details import ( + EncryptionDetails, + EncryptionDetailsParam, +) +from databricks.bundles.external_locations._models.file_event_queue import ( + FileEventQueue, + FileEventQueueParam, +) +from databricks.bundles.external_locations._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.external_locations._models.privilege_assignment import ( + PrivilegeAssignment, + PrivilegeAssignmentParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ExternalLocation(Resource): + """""" + + credential_name: VariableOr[str] + """ + Name of the storage credential used with this location. + """ + + name: VariableOr[str] + """ + Name of the external location. + """ + + url: VariableOr[str] + """ + Path URL of the external location. + """ + + comment: VariableOrOptional[str] = None + """ + User-provided free-form text description. + """ + + enable_file_events: VariableOrOptional[bool] = None + """ + Whether to enable file events on this external location. Default to `true`. Set to `false` to disable file events. + The actual applied value may differ due to server-side defaults; check `effective_enable_file_events` for the effective state. + """ + + encryption_details: VariableOrOptional[EncryptionDetails] = None + """ + Encryption options that apply to clients connecting to cloud storage. + """ + + fallback: VariableOrOptional[bool] = None + """ + Indicates whether fallback mode is enabled for this external location. When fallback mode is enabled, the access to the location falls back to cluster credentials if UC credentials are not sufficient. + """ + + file_event_queue: VariableOrOptional[FileEventQueue] = None + """ + File event queue settings. If `enable_file_events` is not `false`, must be defined and have exactly one of the documented properties. + """ + + grants: VariableOrList[PrivilegeAssignment] = field(default_factory=list) + """ + The Unity Catalog privileges to grant to principals on this securable. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + read_only: VariableOrOptional[bool] = None + """ + Indicates whether the external location is read-only. + """ + + skip_validation: VariableOrOptional[bool] = None + """ + Skips validation of the storage credential associated with the external location. + """ + + @classmethod + def from_dict(cls, value: "ExternalLocationDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ExternalLocationDict": + return _transform_to_json_value(self) # type:ignore + + +class ExternalLocationDict(TypedDict, total=False): + """""" + + credential_name: VariableOr[str] + """ + Name of the storage credential used with this location. + """ + + name: VariableOr[str] + """ + Name of the external location. + """ + + url: VariableOr[str] + """ + Path URL of the external location. + """ + + comment: VariableOrOptional[str] + """ + User-provided free-form text description. + """ + + enable_file_events: VariableOrOptional[bool] + """ + Whether to enable file events on this external location. Default to `true`. Set to `false` to disable file events. + The actual applied value may differ due to server-side defaults; check `effective_enable_file_events` for the effective state. + """ + + encryption_details: VariableOrOptional[EncryptionDetailsParam] + """ + Encryption options that apply to clients connecting to cloud storage. + """ + + fallback: VariableOrOptional[bool] + """ + Indicates whether fallback mode is enabled for this external location. When fallback mode is enabled, the access to the location falls back to cluster credentials if UC credentials are not sufficient. + """ + + file_event_queue: VariableOrOptional[FileEventQueueParam] + """ + File event queue settings. If `enable_file_events` is not `false`, must be defined and have exactly one of the documented properties. + """ + + grants: VariableOrList[PrivilegeAssignmentParam] + """ + The Unity Catalog privileges to grant to principals on this securable. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + read_only: VariableOrOptional[bool] + """ + Indicates whether the external location is read-only. + """ + + skip_validation: VariableOrOptional[bool] + """ + Skips validation of the storage credential associated with the external location. + """ + + +ExternalLocationParam = ExternalLocationDict | ExternalLocation diff --git a/python/databricks/bundles/external_locations/_models/file_event_queue.py b/python/databricks/bundles/external_locations/_models/file_event_queue.py new file mode 100644 index 00000000000..78a791766cd --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/file_event_queue.py @@ -0,0 +1,66 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.external_locations._models.aws_sqs_queue import ( + AwsSqsQueue, + AwsSqsQueueParam, +) +from databricks.bundles.external_locations._models.azure_queue_storage import ( + AzureQueueStorage, + AzureQueueStorageParam, +) +from databricks.bundles.external_locations._models.gcp_pubsub import ( + GcpPubsub, + GcpPubsubParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class FileEventQueue: + """""" + + managed_aqs: VariableOrOptional[AzureQueueStorage] = None + + managed_pubsub: VariableOrOptional[GcpPubsub] = None + + managed_sqs: VariableOrOptional[AwsSqsQueue] = None + + provided_aqs: VariableOrOptional[AzureQueueStorage] = None + + provided_pubsub: VariableOrOptional[GcpPubsub] = None + + provided_sqs: VariableOrOptional[AwsSqsQueue] = None + + @classmethod + def from_dict(cls, value: "FileEventQueueDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "FileEventQueueDict": + return _transform_to_json_value(self) # type:ignore + + +class FileEventQueueDict(TypedDict, total=False): + """""" + + managed_aqs: VariableOrOptional[AzureQueueStorageParam] + + managed_pubsub: VariableOrOptional[GcpPubsubParam] + + managed_sqs: VariableOrOptional[AwsSqsQueueParam] + + provided_aqs: VariableOrOptional[AzureQueueStorageParam] + + provided_pubsub: VariableOrOptional[GcpPubsubParam] + + provided_sqs: VariableOrOptional[AwsSqsQueueParam] + + +FileEventQueueParam = FileEventQueueDict | FileEventQueue diff --git a/python/databricks/bundles/external_locations/_models/gcp_pubsub.py b/python/databricks/bundles/external_locations/_models/gcp_pubsub.py new file mode 100644 index 00000000000..926b27d2a55 --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/gcp_pubsub.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class GcpPubsub: + """""" + + subscription_name: VariableOrOptional[str] = None + """ + The Pub/Sub subscription name in the format projects/{project}/subscriptions/{subscription name}. + Only required for provided_pubsub. + """ + + @classmethod + def from_dict(cls, value: "GcpPubsubDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "GcpPubsubDict": + return _transform_to_json_value(self) # type:ignore + + +class GcpPubsubDict(TypedDict, total=False): + """""" + + subscription_name: VariableOrOptional[str] + """ + The Pub/Sub subscription name in the format projects/{project}/subscriptions/{subscription name}. + Only required for provided_pubsub. + """ + + +GcpPubsubParam = GcpPubsubDict | GcpPubsub diff --git a/python/databricks/bundles/external_locations/_models/lifecycle.py b/python/databricks/bundles/external_locations/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/external_locations/_models/privilege.py b/python/databricks/bundles/external_locations/_models/privilege.py new file mode 100644 index 00000000000..21a52a2f112 --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/privilege.py @@ -0,0 +1,116 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class Privilege(Enum): + SELECT = "SELECT" + READ_PRIVATE_FILES = "READ_PRIVATE_FILES" + WRITE_PRIVATE_FILES = "WRITE_PRIVATE_FILES" + CREATE = "CREATE" + USAGE = "USAGE" + USE_CATALOG = "USE_CATALOG" + USE_SCHEMA = "USE_SCHEMA" + CREATE_SCHEMA = "CREATE_SCHEMA" + CREATE_VIEW = "CREATE_VIEW" + CREATE_EXTERNAL_TABLE = "CREATE_EXTERNAL_TABLE" + CREATE_MATERIALIZED_VIEW = "CREATE_MATERIALIZED_VIEW" + CREATE_FUNCTION = "CREATE_FUNCTION" + CREATE_MODEL = "CREATE_MODEL" + CREATE_CATALOG = "CREATE_CATALOG" + CREATE_MANAGED_STORAGE = "CREATE_MANAGED_STORAGE" + CREATE_EXTERNAL_LOCATION = "CREATE_EXTERNAL_LOCATION" + CREATE_STORAGE_CREDENTIAL = "CREATE_STORAGE_CREDENTIAL" + CREATE_SERVICE_CREDENTIAL = "CREATE_SERVICE_CREDENTIAL" + ACCESS = "ACCESS" + CREATE_SHARE = "CREATE_SHARE" + CREATE_RECIPIENT = "CREATE_RECIPIENT" + CREATE_PROVIDER = "CREATE_PROVIDER" + USE_SHARE = "USE_SHARE" + USE_RECIPIENT = "USE_RECIPIENT" + USE_PROVIDER = "USE_PROVIDER" + USE_MARKETPLACE_ASSETS = "USE_MARKETPLACE_ASSETS" + SET_SHARE_PERMISSION = "SET_SHARE_PERMISSION" + MODIFY = "MODIFY" + REFRESH = "REFRESH" + EXECUTE = "EXECUTE" + READ_FILES = "READ_FILES" + WRITE_FILES = "WRITE_FILES" + CREATE_TABLE = "CREATE_TABLE" + ALL_PRIVILEGES = "ALL_PRIVILEGES" + CREATE_CONNECTION = "CREATE_CONNECTION" + USE_CONNECTION = "USE_CONNECTION" + APPLY_TAG = "APPLY_TAG" + CREATE_FOREIGN_CATALOG = "CREATE_FOREIGN_CATALOG" + CREATE_FOREIGN_SECURABLE = "CREATE_FOREIGN_SECURABLE" + MANAGE_ALLOWLIST = "MANAGE_ALLOWLIST" + CREATE_VOLUME = "CREATE_VOLUME" + CREATE_EXTERNAL_VOLUME = "CREATE_EXTERNAL_VOLUME" + READ_VOLUME = "READ_VOLUME" + WRITE_VOLUME = "WRITE_VOLUME" + MANAGE = "MANAGE" + BROWSE = "BROWSE" + CREATE_CLEAN_ROOM = "CREATE_CLEAN_ROOM" + MODIFY_CLEAN_ROOM = "MODIFY_CLEAN_ROOM" + EXECUTE_CLEAN_ROOM_TASK = "EXECUTE_CLEAN_ROOM_TASK" + EXTERNAL_USE_SCHEMA = "EXTERNAL_USE_SCHEMA" + READ_METADATA = "READ_METADATA" + + +PrivilegeParam = ( + Literal[ + "SELECT", + "READ_PRIVATE_FILES", + "WRITE_PRIVATE_FILES", + "CREATE", + "USAGE", + "USE_CATALOG", + "USE_SCHEMA", + "CREATE_SCHEMA", + "CREATE_VIEW", + "CREATE_EXTERNAL_TABLE", + "CREATE_MATERIALIZED_VIEW", + "CREATE_FUNCTION", + "CREATE_MODEL", + "CREATE_CATALOG", + "CREATE_MANAGED_STORAGE", + "CREATE_EXTERNAL_LOCATION", + "CREATE_STORAGE_CREDENTIAL", + "CREATE_SERVICE_CREDENTIAL", + "ACCESS", + "CREATE_SHARE", + "CREATE_RECIPIENT", + "CREATE_PROVIDER", + "USE_SHARE", + "USE_RECIPIENT", + "USE_PROVIDER", + "USE_MARKETPLACE_ASSETS", + "SET_SHARE_PERMISSION", + "MODIFY", + "REFRESH", + "EXECUTE", + "READ_FILES", + "WRITE_FILES", + "CREATE_TABLE", + "ALL_PRIVILEGES", + "CREATE_CONNECTION", + "USE_CONNECTION", + "APPLY_TAG", + "CREATE_FOREIGN_CATALOG", + "CREATE_FOREIGN_SECURABLE", + "MANAGE_ALLOWLIST", + "CREATE_VOLUME", + "CREATE_EXTERNAL_VOLUME", + "READ_VOLUME", + "WRITE_VOLUME", + "MANAGE", + "BROWSE", + "CREATE_CLEAN_ROOM", + "MODIFY_CLEAN_ROOM", + "EXECUTE_CLEAN_ROOM_TASK", + "EXTERNAL_USE_SCHEMA", + "READ_METADATA", + ] + | Privilege +) diff --git a/python/databricks/bundles/external_locations/_models/privilege_assignment.py b/python/databricks/bundles/external_locations/_models/privilege_assignment.py new file mode 100644 index 00000000000..f48f9511ac0 --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/privilege_assignment.py @@ -0,0 +1,56 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.external_locations._models.privilege import ( + Privilege, + PrivilegeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class PrivilegeAssignment: + """""" + + principal: VariableOrOptional[str] = None + """ + The principal (user email address or group name). + For deleted principals, `principal` is empty while `principal_id` is populated. + """ + + privileges: VariableOrList[Privilege] = field(default_factory=list) + """ + The privileges assigned to the principal. + """ + + @classmethod + def from_dict(cls, value: "PrivilegeAssignmentDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "PrivilegeAssignmentDict": + return _transform_to_json_value(self) # type:ignore + + +class PrivilegeAssignmentDict(TypedDict, total=False): + """""" + + principal: VariableOrOptional[str] + """ + The principal (user email address or group name). + For deleted principals, `principal` is empty while `principal_id` is populated. + """ + + privileges: VariableOrList[PrivilegeParam] + """ + The privileges assigned to the principal. + """ + + +PrivilegeAssignmentParam = PrivilegeAssignmentDict | PrivilegeAssignment diff --git a/python/databricks/bundles/external_locations/_models/sse_encryption_details.py b/python/databricks/bundles/external_locations/_models/sse_encryption_details.py new file mode 100644 index 00000000000..339b98b8b26 --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/sse_encryption_details.py @@ -0,0 +1,58 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.external_locations._models.sse_encryption_details_algorithm import ( + SseEncryptionDetailsAlgorithm, + SseEncryptionDetailsAlgorithmParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class SseEncryptionDetails: + """ + Server-Side Encryption properties for clients communicating with AWS s3. + """ + + algorithm: VariableOrOptional[SseEncryptionDetailsAlgorithm] = None + """ + Sets the value of the 'x-amz-server-side-encryption' header in S3 request. + """ + + aws_kms_key_arn: VariableOrOptional[str] = None + """ + Optional. The ARN of the SSE-KMS key used with the S3 location, when algorithm = "SSE-KMS". + Sets the value of the 'x-amz-server-side-encryption-aws-kms-key-id' header. + """ + + @classmethod + def from_dict(cls, value: "SseEncryptionDetailsDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "SseEncryptionDetailsDict": + return _transform_to_json_value(self) # type:ignore + + +class SseEncryptionDetailsDict(TypedDict, total=False): + """""" + + algorithm: VariableOrOptional[SseEncryptionDetailsAlgorithmParam] + """ + Sets the value of the 'x-amz-server-side-encryption' header in S3 request. + """ + + aws_kms_key_arn: VariableOrOptional[str] + """ + Optional. The ARN of the SSE-KMS key used with the S3 location, when algorithm = "SSE-KMS". + Sets the value of the 'x-amz-server-side-encryption-aws-kms-key-id' header. + """ + + +SseEncryptionDetailsParam = SseEncryptionDetailsDict | SseEncryptionDetails diff --git a/python/databricks/bundles/external_locations/_models/sse_encryption_details_algorithm.py b/python/databricks/bundles/external_locations/_models/sse_encryption_details_algorithm.py new file mode 100644 index 00000000000..d5d63383a74 --- /dev/null +++ b/python/databricks/bundles/external_locations/_models/sse_encryption_details_algorithm.py @@ -0,0 +1,18 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class SseEncryptionDetailsAlgorithm(Enum): + """ + SSE algorithm to use for encrypting S3 objects + """ + + AWS_SSE_S3 = "AWS_SSE_S3" + AWS_SSE_KMS = "AWS_SSE_KMS" + + +SseEncryptionDetailsAlgorithmParam = ( + Literal["AWS_SSE_S3", "AWS_SSE_KMS"] | SseEncryptionDetailsAlgorithm +) diff --git a/python/databricks/bundles/instance_pools/__init__.py b/python/databricks/bundles/instance_pools/__init__.py new file mode 100644 index 00000000000..2c5a0e1c4eb --- /dev/null +++ b/python/databricks/bundles/instance_pools/__init__.py @@ -0,0 +1,130 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "DiskSpec", + "DiskSpecDict", + "DiskSpecParam", + "DiskType", + "DiskTypeAzureDiskVolumeType", + "DiskTypeAzureDiskVolumeTypeParam", + "DiskTypeDict", + "DiskTypeEbsVolumeType", + "DiskTypeEbsVolumeTypeParam", + "DiskTypeParam", + "DockerBasicAuth", + "DockerBasicAuthDict", + "DockerBasicAuthParam", + "DockerImage", + "DockerImageDict", + "DockerImageParam", + "GcpAvailability", + "GcpAvailabilityParam", + "InstancePool", + "InstancePoolAwsAttributes", + "InstancePoolAwsAttributesAvailability", + "InstancePoolAwsAttributesAvailabilityParam", + "InstancePoolAwsAttributesDict", + "InstancePoolAwsAttributesParam", + "InstancePoolAzureAttributes", + "InstancePoolAzureAttributesAvailability", + "InstancePoolAzureAttributesAvailabilityParam", + "InstancePoolAzureAttributesDict", + "InstancePoolAzureAttributesParam", + "InstancePoolDict", + "InstancePoolGcpAttributes", + "InstancePoolGcpAttributesDict", + "InstancePoolGcpAttributesParam", + "InstancePoolParam", + "InstancePoolPermission", + "InstancePoolPermissionDict", + "InstancePoolPermissionLevel", + "InstancePoolPermissionLevelParam", + "InstancePoolPermissionParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "NodeTypeFlexibility", + "NodeTypeFlexibilityDict", + "NodeTypeFlexibilityParam", +] + + +from databricks.bundles.instance_pools._models.disk_spec import ( + DiskSpec, + DiskSpecDict, + DiskSpecParam, +) +from databricks.bundles.instance_pools._models.disk_type import ( + DiskType, + DiskTypeDict, + DiskTypeParam, +) +from databricks.bundles.instance_pools._models.disk_type_azure_disk_volume_type import ( + DiskTypeAzureDiskVolumeType, + DiskTypeAzureDiskVolumeTypeParam, +) +from databricks.bundles.instance_pools._models.disk_type_ebs_volume_type import ( + DiskTypeEbsVolumeType, + DiskTypeEbsVolumeTypeParam, +) +from databricks.bundles.instance_pools._models.docker_basic_auth import ( + DockerBasicAuth, + DockerBasicAuthDict, + DockerBasicAuthParam, +) +from databricks.bundles.instance_pools._models.docker_image import ( + DockerImage, + DockerImageDict, + DockerImageParam, +) +from databricks.bundles.instance_pools._models.gcp_availability import ( + GcpAvailability, + GcpAvailabilityParam, +) +from databricks.bundles.instance_pools._models.instance_pool import ( + InstancePool, + InstancePoolDict, + InstancePoolParam, +) +from databricks.bundles.instance_pools._models.instance_pool_aws_attributes import ( + InstancePoolAwsAttributes, + InstancePoolAwsAttributesDict, + InstancePoolAwsAttributesParam, +) +from databricks.bundles.instance_pools._models.instance_pool_aws_attributes_availability import ( + InstancePoolAwsAttributesAvailability, + InstancePoolAwsAttributesAvailabilityParam, +) +from databricks.bundles.instance_pools._models.instance_pool_azure_attributes import ( + InstancePoolAzureAttributes, + InstancePoolAzureAttributesDict, + InstancePoolAzureAttributesParam, +) +from databricks.bundles.instance_pools._models.instance_pool_azure_attributes_availability import ( + InstancePoolAzureAttributesAvailability, + InstancePoolAzureAttributesAvailabilityParam, +) +from databricks.bundles.instance_pools._models.instance_pool_gcp_attributes import ( + InstancePoolGcpAttributes, + InstancePoolGcpAttributesDict, + InstancePoolGcpAttributesParam, +) +from databricks.bundles.instance_pools._models.instance_pool_permission import ( + InstancePoolPermission, + InstancePoolPermissionDict, + InstancePoolPermissionParam, +) +from databricks.bundles.instance_pools._models.instance_pool_permission_level import ( + InstancePoolPermissionLevel, + InstancePoolPermissionLevelParam, +) +from databricks.bundles.instance_pools._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.instance_pools._models.node_type_flexibility import ( + NodeTypeFlexibility, + NodeTypeFlexibilityDict, + NodeTypeFlexibilityParam, +) diff --git a/python/databricks/bundles/instance_pools/_models/disk_spec.py b/python/databricks/bundles/instance_pools/_models/disk_spec.py new file mode 100644 index 00000000000..b9edbb5d4e8 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/disk_spec.py @@ -0,0 +1,136 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.instance_pools._models.disk_type import DiskType, DiskTypeParam + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DiskSpec: + """ + Describes the disks that are launched for each instance in the spark cluster. + For example, if the cluster has 3 instances, each instance is configured to launch + 2 disks, 100 GiB each, then Databricks will launch a total of 6 disks, + 100 GiB each, for this cluster. + """ + + disk_count: VariableOrOptional[int] = None + """ + The number of disks launched for each instance: + - This feature is only enabled for supported node types. + - Users can choose up to the limit of the disks supported by the node type. + - For node types with no OS disk, at least one disk must be specified; + otherwise, cluster creation will fail. + + If disks are attached, Databricks will configure Spark to use only the disks for + scratch storage, because heterogenously sized scratch devices can lead to inefficient disk + utilization. If no disks are attached, Databricks will configure Spark to use + instance store disks. + + Note: If disks are specified, then the Spark configuration + `spark.local.dir` will be overridden. + + Disks will be mounted at: + - For AWS: `/ebs0`, `/ebs1`, and etc. + - For Azure: `/remote_volume0`, `/remote_volume1`, and etc. + """ + + disk_iops: VariableOrOptional[int] = None + """ + The number of IOPS to provision for each attached disk. + """ + + disk_size: VariableOrOptional[int] = None + """ + The size of each disk (in GiB) launched for each instance. + Values must fall into the supported range for a particular instance type. + + For AWS: + - General Purpose SSD: 100 - 4096 GiB + - Throughput Optimized HDD: 500 - 4096 GiB + + For Azure: + - Premium LRS (SSD): 1 - 1023 GiB + - Standard LRS (HDD): 1- 1023 GiB + """ + + disk_throughput: VariableOrOptional[int] = None + """ + The disk throughput to provision for each attached disk, in MB per second. + """ + + disk_type: VariableOrOptional[DiskType] = None + """ + The type of disks that will be launched with this cluster. + """ + + @classmethod + def from_dict(cls, value: "DiskSpecDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DiskSpecDict": + return _transform_to_json_value(self) # type:ignore + + +class DiskSpecDict(TypedDict, total=False): + """""" + + disk_count: VariableOrOptional[int] + """ + The number of disks launched for each instance: + - This feature is only enabled for supported node types. + - Users can choose up to the limit of the disks supported by the node type. + - For node types with no OS disk, at least one disk must be specified; + otherwise, cluster creation will fail. + + If disks are attached, Databricks will configure Spark to use only the disks for + scratch storage, because heterogenously sized scratch devices can lead to inefficient disk + utilization. If no disks are attached, Databricks will configure Spark to use + instance store disks. + + Note: If disks are specified, then the Spark configuration + `spark.local.dir` will be overridden. + + Disks will be mounted at: + - For AWS: `/ebs0`, `/ebs1`, and etc. + - For Azure: `/remote_volume0`, `/remote_volume1`, and etc. + """ + + disk_iops: VariableOrOptional[int] + """ + The number of IOPS to provision for each attached disk. + """ + + disk_size: VariableOrOptional[int] + """ + The size of each disk (in GiB) launched for each instance. + Values must fall into the supported range for a particular instance type. + + For AWS: + - General Purpose SSD: 100 - 4096 GiB + - Throughput Optimized HDD: 500 - 4096 GiB + + For Azure: + - Premium LRS (SSD): 1 - 1023 GiB + - Standard LRS (HDD): 1- 1023 GiB + """ + + disk_throughput: VariableOrOptional[int] + """ + The disk throughput to provision for each attached disk, in MB per second. + """ + + disk_type: VariableOrOptional[DiskTypeParam] + """ + The type of disks that will be launched with this cluster. + """ + + +DiskSpecParam = DiskSpecDict | DiskSpec diff --git a/python/databricks/bundles/instance_pools/_models/disk_type.py b/python/databricks/bundles/instance_pools/_models/disk_type.py new file mode 100644 index 00000000000..752bf75bf78 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/disk_type.py @@ -0,0 +1,64 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.instance_pools._models.disk_type_azure_disk_volume_type import ( + DiskTypeAzureDiskVolumeType, + DiskTypeAzureDiskVolumeTypeParam, +) +from databricks.bundles.instance_pools._models.disk_type_ebs_volume_type import ( + DiskTypeEbsVolumeType, + DiskTypeEbsVolumeTypeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DiskType: + """ + Describes the disk type. + """ + + azure_disk_volume_type: VariableOrOptional[DiskTypeAzureDiskVolumeType] = None + """ + All Azure Disk types that Databricks supports. + See https://docs.microsoft.com/en-us/azure/storage/storage-about-disks-and-vhds-linux#types-of-disks + """ + + ebs_volume_type: VariableOrOptional[DiskTypeEbsVolumeType] = None + """ + All EBS volume types that Databricks supports. + See https://aws.amazon.com/ebs/details/ for details. + """ + + @classmethod + def from_dict(cls, value: "DiskTypeDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DiskTypeDict": + return _transform_to_json_value(self) # type:ignore + + +class DiskTypeDict(TypedDict, total=False): + """""" + + azure_disk_volume_type: VariableOrOptional[DiskTypeAzureDiskVolumeTypeParam] + """ + All Azure Disk types that Databricks supports. + See https://docs.microsoft.com/en-us/azure/storage/storage-about-disks-and-vhds-linux#types-of-disks + """ + + ebs_volume_type: VariableOrOptional[DiskTypeEbsVolumeTypeParam] + """ + All EBS volume types that Databricks supports. + See https://aws.amazon.com/ebs/details/ for details. + """ + + +DiskTypeParam = DiskTypeDict | DiskType diff --git a/python/databricks/bundles/instance_pools/_models/disk_type_azure_disk_volume_type.py b/python/databricks/bundles/instance_pools/_models/disk_type_azure_disk_volume_type.py new file mode 100644 index 00000000000..740ab2dd245 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/disk_type_azure_disk_volume_type.py @@ -0,0 +1,19 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class DiskTypeAzureDiskVolumeType(Enum): + """ + All Azure Disk types that Databricks supports. + See https://docs.microsoft.com/en-us/azure/storage/storage-about-disks-and-vhds-linux#types-of-disks + """ + + PREMIUM_LRS = "PREMIUM_LRS" + STANDARD_LRS = "STANDARD_LRS" + + +DiskTypeAzureDiskVolumeTypeParam = ( + Literal["PREMIUM_LRS", "STANDARD_LRS"] | DiskTypeAzureDiskVolumeType +) diff --git a/python/databricks/bundles/instance_pools/_models/disk_type_ebs_volume_type.py b/python/databricks/bundles/instance_pools/_models/disk_type_ebs_volume_type.py new file mode 100644 index 00000000000..cb5ae6b7a05 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/disk_type_ebs_volume_type.py @@ -0,0 +1,19 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class DiskTypeEbsVolumeType(Enum): + """ + All EBS volume types that Databricks supports. + See https://aws.amazon.com/ebs/details/ for details. + """ + + GENERAL_PURPOSE_SSD = "GENERAL_PURPOSE_SSD" + THROUGHPUT_OPTIMIZED_HDD = "THROUGHPUT_OPTIMIZED_HDD" + + +DiskTypeEbsVolumeTypeParam = ( + Literal["GENERAL_PURPOSE_SSD", "THROUGHPUT_OPTIMIZED_HDD"] | DiskTypeEbsVolumeType +) diff --git a/python/databricks/bundles/instance_pools/_models/docker_basic_auth.py b/python/databricks/bundles/instance_pools/_models/docker_basic_auth.py new file mode 100644 index 00000000000..552ea90a83b --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/docker_basic_auth.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DockerBasicAuth: + """""" + + password: VariableOrOptional[str] = None + """ + Password of the user + """ + + username: VariableOrOptional[str] = None + """ + Name of the user + """ + + @classmethod + def from_dict(cls, value: "DockerBasicAuthDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DockerBasicAuthDict": + return _transform_to_json_value(self) # type:ignore + + +class DockerBasicAuthDict(TypedDict, total=False): + """""" + + password: VariableOrOptional[str] + """ + Password of the user + """ + + username: VariableOrOptional[str] + """ + Name of the user + """ + + +DockerBasicAuthParam = DockerBasicAuthDict | DockerBasicAuth diff --git a/python/databricks/bundles/instance_pools/_models/docker_image.py b/python/databricks/bundles/instance_pools/_models/docker_image.py new file mode 100644 index 00000000000..15b43d46554 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/docker_image.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.instance_pools._models.docker_basic_auth import ( + DockerBasicAuth, + DockerBasicAuthParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DockerImage: + """""" + + basic_auth: VariableOrOptional[DockerBasicAuth] = None + """ + Basic auth with username and password + """ + + url: VariableOrOptional[str] = None + """ + URL of the docker image. + """ + + @classmethod + def from_dict(cls, value: "DockerImageDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DockerImageDict": + return _transform_to_json_value(self) # type:ignore + + +class DockerImageDict(TypedDict, total=False): + """""" + + basic_auth: VariableOrOptional[DockerBasicAuthParam] + """ + Basic auth with username and password + """ + + url: VariableOrOptional[str] + """ + URL of the docker image. + """ + + +DockerImageParam = DockerImageDict | DockerImage diff --git a/python/databricks/bundles/instance_pools/_models/gcp_availability.py b/python/databricks/bundles/instance_pools/_models/gcp_availability.py new file mode 100644 index 00000000000..0d391b87fe3 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/gcp_availability.py @@ -0,0 +1,21 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class GcpAvailability(Enum): + """ + This field determines whether the instance pool will contain preemptible + VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs if the former is unavailable. + """ + + PREEMPTIBLE_GCP = "PREEMPTIBLE_GCP" + ON_DEMAND_GCP = "ON_DEMAND_GCP" + PREEMPTIBLE_WITH_FALLBACK_GCP = "PREEMPTIBLE_WITH_FALLBACK_GCP" + + +GcpAvailabilityParam = ( + Literal["PREEMPTIBLE_GCP", "ON_DEMAND_GCP", "PREEMPTIBLE_WITH_FALLBACK_GCP"] + | GcpAvailability +) diff --git a/python/databricks/bundles/instance_pools/_models/instance_pool.py b/python/databricks/bundles/instance_pools/_models/instance_pool.py new file mode 100644 index 00000000000..2b10f210284 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/instance_pool.py @@ -0,0 +1,289 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, +) +from databricks.bundles.instance_pools._models.disk_spec import DiskSpec, DiskSpecParam +from databricks.bundles.instance_pools._models.docker_image import ( + DockerImage, + DockerImageParam, +) +from databricks.bundles.instance_pools._models.instance_pool_aws_attributes import ( + InstancePoolAwsAttributes, + InstancePoolAwsAttributesParam, +) +from databricks.bundles.instance_pools._models.instance_pool_azure_attributes import ( + InstancePoolAzureAttributes, + InstancePoolAzureAttributesParam, +) +from databricks.bundles.instance_pools._models.instance_pool_gcp_attributes import ( + InstancePoolGcpAttributes, + InstancePoolGcpAttributesParam, +) +from databricks.bundles.instance_pools._models.instance_pool_permission import ( + InstancePoolPermission, + InstancePoolPermissionParam, +) +from databricks.bundles.instance_pools._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.instance_pools._models.node_type_flexibility import ( + NodeTypeFlexibility, + NodeTypeFlexibilityParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class InstancePool(Resource): + """""" + + instance_pool_name: VariableOr[str] + """ + Pool name requested by the user. Pool name must be unique. Length must be between 1 and 100 + characters. + """ + + node_type_id: VariableOr[str] + """ + This field encodes, through a single value, the resources available to each of + the Spark nodes in this cluster. For example, the Spark nodes can be provisioned + and optimized for memory or compute intensive workloads. A list of available node + types can be retrieved by using the [clusters/listNodeTypes](https://docs.databricks.com/api/workspace/clusters/listnodetypes) API call. + """ + + aws_attributes: VariableOrOptional[InstancePoolAwsAttributes] = None + """ + Attributes related to instance pools running on Amazon Web Services. + If not specified at pool creation, a set of default values will be used. + """ + + azure_attributes: VariableOrOptional[InstancePoolAzureAttributes] = None + """ + Attributes related to instance pools running on Azure. + If not specified at pool creation, a set of default values will be used. + """ + + custom_tags: VariableOrDict[str] = field(default_factory=dict) + """ + Additional tags for pool resources. Databricks will tag all pool resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + """ + + disk_spec: VariableOrOptional[DiskSpec] = None + """ + Defines the specification of the disks that will be attached to all spark containers. + """ + + enable_elastic_disk: VariableOrOptional[bool] = None + """ + Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire + additional disk space when its Spark workers are running low on disk space. In AWS, this + feature requires specific AWS permissions to function correctly - refer to the User Guide for + more details. + """ + + gcp_attributes: VariableOrOptional[InstancePoolGcpAttributes] = None + """ + Attributes related to instance pools running on Google Cloud Platform. + If not specified at pool creation, a set of default values will be used. + """ + + idle_instance_autotermination_minutes: VariableOrOptional[int] = None + """ + Automatically terminates the extra instances in the pool cache after they are inactive for this + time in minutes if min_idle_instances requirement is already met. If not set, the extra pool + instances will be automatically terminated after a default timeout. If specified, the + threshold must be between 0 and 10000 minutes. + Users can also set this value to 0 to instantly remove idle instances from the cache if + min cache size could still hold. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + max_capacity: VariableOrOptional[int] = None + """ + Maximum number of outstanding instances to keep in the pool, including both instances used by + clusters and idle instances. Clusters that require further instance provisioning will fail during + upsize requests. + """ + + min_idle_instances: VariableOrOptional[int] = None + """ + Minimum number of idle instances to keep in the instance pool + """ + + node_type_flexibility: VariableOrOptional[NodeTypeFlexibility] = None + """ + Flexible node type configuration for the pool. + """ + + permissions: VariableOrList[InstancePoolPermission] = field(default_factory=list) + """ + The permissions to apply to this resource. + """ + + preloaded_docker_images: VariableOrList[DockerImage] = field(default_factory=list) + """ + Custom Docker Image BYOC + """ + + preloaded_spark_versions: VariableOrList[str] = field(default_factory=list) + """ + A list containing at most one preloaded Spark image version for the pool. Pool-backed clusters started + with the preloaded Spark version will start faster. A list of available Spark versions + can be retrieved by using the [clusters/sparkVersions](https://docs.databricks.com/api/workspace/clusters/sparkversions) API call. + """ + + remote_disk_throughput: VariableOrOptional[int] = None + """ + If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED types. + """ + + total_initial_remote_disk_size: VariableOrOptional[int] = None + """ + If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED types. + """ + + @classmethod + def from_dict(cls, value: "InstancePoolDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "InstancePoolDict": + return _transform_to_json_value(self) # type:ignore + + +class InstancePoolDict(TypedDict, total=False): + """""" + + instance_pool_name: VariableOr[str] + """ + Pool name requested by the user. Pool name must be unique. Length must be between 1 and 100 + characters. + """ + + node_type_id: VariableOr[str] + """ + This field encodes, through a single value, the resources available to each of + the Spark nodes in this cluster. For example, the Spark nodes can be provisioned + and optimized for memory or compute intensive workloads. A list of available node + types can be retrieved by using the [clusters/listNodeTypes](https://docs.databricks.com/api/workspace/clusters/listnodetypes) API call. + """ + + aws_attributes: VariableOrOptional[InstancePoolAwsAttributesParam] + """ + Attributes related to instance pools running on Amazon Web Services. + If not specified at pool creation, a set of default values will be used. + """ + + azure_attributes: VariableOrOptional[InstancePoolAzureAttributesParam] + """ + Attributes related to instance pools running on Azure. + If not specified at pool creation, a set of default values will be used. + """ + + custom_tags: VariableOrDict[str] + """ + Additional tags for pool resources. Databricks will tag all pool resources (e.g., AWS + instances and EBS volumes) with these tags in addition to `default_tags`. Notes: + + - Currently, Databricks allows at most 45 custom tags + """ + + disk_spec: VariableOrOptional[DiskSpecParam] + """ + Defines the specification of the disks that will be attached to all spark containers. + """ + + enable_elastic_disk: VariableOrOptional[bool] + """ + Autoscaling Local Storage: when enabled, this instances in this pool will dynamically acquire + additional disk space when its Spark workers are running low on disk space. In AWS, this + feature requires specific AWS permissions to function correctly - refer to the User Guide for + more details. + """ + + gcp_attributes: VariableOrOptional[InstancePoolGcpAttributesParam] + """ + Attributes related to instance pools running on Google Cloud Platform. + If not specified at pool creation, a set of default values will be used. + """ + + idle_instance_autotermination_minutes: VariableOrOptional[int] + """ + Automatically terminates the extra instances in the pool cache after they are inactive for this + time in minutes if min_idle_instances requirement is already met. If not set, the extra pool + instances will be automatically terminated after a default timeout. If specified, the + threshold must be between 0 and 10000 minutes. + Users can also set this value to 0 to instantly remove idle instances from the cache if + min cache size could still hold. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + max_capacity: VariableOrOptional[int] + """ + Maximum number of outstanding instances to keep in the pool, including both instances used by + clusters and idle instances. Clusters that require further instance provisioning will fail during + upsize requests. + """ + + min_idle_instances: VariableOrOptional[int] + """ + Minimum number of idle instances to keep in the instance pool + """ + + node_type_flexibility: VariableOrOptional[NodeTypeFlexibilityParam] + """ + Flexible node type configuration for the pool. + """ + + permissions: VariableOrList[InstancePoolPermissionParam] + """ + The permissions to apply to this resource. + """ + + preloaded_docker_images: VariableOrList[DockerImageParam] + """ + Custom Docker Image BYOC + """ + + preloaded_spark_versions: VariableOrList[str] + """ + A list containing at most one preloaded Spark image version for the pool. Pool-backed clusters started + with the preloaded Spark version will start faster. A list of available Spark versions + can be retrieved by using the [clusters/sparkVersions](https://docs.databricks.com/api/workspace/clusters/sparkversions) API call. + """ + + remote_disk_throughput: VariableOrOptional[int] + """ + If set, what the configurable throughput (in Mb/s) for the remote disk is. Currently only supported for GCP HYPERDISK_BALANCED types. + """ + + total_initial_remote_disk_size: VariableOrOptional[int] + """ + If set, what the total initial volume size (in GB) of the remote disks should be. Currently only supported for GCP HYPERDISK_BALANCED types. + """ + + +InstancePoolParam = InstancePoolDict | InstancePool diff --git a/python/databricks/bundles/instance_pools/_models/instance_pool_aws_attributes.py b/python/databricks/bundles/instance_pools/_models/instance_pool_aws_attributes.py new file mode 100644 index 00000000000..a67500571b9 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/instance_pool_aws_attributes.py @@ -0,0 +1,122 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.instance_pools._models.instance_pool_aws_attributes_availability import ( + InstancePoolAwsAttributesAvailability, + InstancePoolAwsAttributesAvailabilityParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class InstancePoolAwsAttributes: + """ + Attributes set during instance pool creation which are related to Amazon Web Services. + """ + + availability: VariableOrOptional[InstancePoolAwsAttributesAvailability] = None + """ + Availability type used for the spot nodes. + """ + + instance_profile_arn: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] All AWS instances belonging to the instance pool will have this instance profile. If omitted, instances + will initially be launched with the workspace's default instance profile. If defined, clusters that use the + pool will inherit the instance profile, and must not specify their own instance profile on cluster creation or + update. If the pool does not specify an instance profile, clusters using the pool may specify any instance profile. + The instance profile must have previously been added to the Databricks environment by an account administrator. + + This feature may only be available to certain customer plans. + """ + + spot_bid_price_percent: VariableOrOptional[int] = None + """ + Calculates the bid price for AWS spot instances, as a percentage of the corresponding instance type's + on-demand price. + For example, if this field is set to 50, and the cluster needs a new `r3.xlarge` spot + instance, then the bid price is half of the price of + on-demand `r3.xlarge` instances. Similarly, if this field is set to 200, the bid price is twice + the price of on-demand `r3.xlarge` instances. If not specified, the default value is 100. + When spot instances are requested for this cluster, only spot instances whose bid price + percentage matches this field will be considered. + Note that, for safety, we enforce this field to be no more than 10000. + """ + + zone_id: VariableOrOptional[str] = None + """ + Identifier for the availability zone/datacenter in which the cluster resides. + This string will be of a form like "us-west-2a". The provided availability + zone must be in the same region as the Databricks deployment. For example, "us-west-2a" + is not a valid zone id if the Databricks deployment resides in the "us-east-1" region. + This is an optional field at cluster creation, and if not specified, a default zone will be used. + The list of available zones as well as the default value can be found by using the + `List Zones` method. + """ + + @classmethod + def from_dict(cls, value: "InstancePoolAwsAttributesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "InstancePoolAwsAttributesDict": + return _transform_to_json_value(self) # type:ignore + + +class InstancePoolAwsAttributesDict(TypedDict, total=False): + """""" + + availability: VariableOrOptional[InstancePoolAwsAttributesAvailabilityParam] + """ + Availability type used for the spot nodes. + """ + + instance_profile_arn: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] All AWS instances belonging to the instance pool will have this instance profile. If omitted, instances + will initially be launched with the workspace's default instance profile. If defined, clusters that use the + pool will inherit the instance profile, and must not specify their own instance profile on cluster creation or + update. If the pool does not specify an instance profile, clusters using the pool may specify any instance profile. + The instance profile must have previously been added to the Databricks environment by an account administrator. + + This feature may only be available to certain customer plans. + """ + + spot_bid_price_percent: VariableOrOptional[int] + """ + Calculates the bid price for AWS spot instances, as a percentage of the corresponding instance type's + on-demand price. + For example, if this field is set to 50, and the cluster needs a new `r3.xlarge` spot + instance, then the bid price is half of the price of + on-demand `r3.xlarge` instances. Similarly, if this field is set to 200, the bid price is twice + the price of on-demand `r3.xlarge` instances. If not specified, the default value is 100. + When spot instances are requested for this cluster, only spot instances whose bid price + percentage matches this field will be considered. + Note that, for safety, we enforce this field to be no more than 10000. + """ + + zone_id: VariableOrOptional[str] + """ + Identifier for the availability zone/datacenter in which the cluster resides. + This string will be of a form like "us-west-2a". The provided availability + zone must be in the same region as the Databricks deployment. For example, "us-west-2a" + is not a valid zone id if the Databricks deployment resides in the "us-east-1" region. + This is an optional field at cluster creation, and if not specified, a default zone will be used. + The list of available zones as well as the default value can be found by using the + `List Zones` method. + """ + + +InstancePoolAwsAttributesParam = ( + InstancePoolAwsAttributesDict | InstancePoolAwsAttributes +) diff --git a/python/databricks/bundles/instance_pools/_models/instance_pool_aws_attributes_availability.py b/python/databricks/bundles/instance_pools/_models/instance_pool_aws_attributes_availability.py new file mode 100644 index 00000000000..5bc8a0350fa --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/instance_pool_aws_attributes_availability.py @@ -0,0 +1,18 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class InstancePoolAwsAttributesAvailability(Enum): + """ + The set of AWS availability types supported when setting up nodes for a cluster. + """ + + SPOT = "SPOT" + ON_DEMAND = "ON_DEMAND" + + +InstancePoolAwsAttributesAvailabilityParam = ( + Literal["SPOT", "ON_DEMAND"] | InstancePoolAwsAttributesAvailability +) diff --git a/python/databricks/bundles/instance_pools/_models/instance_pool_azure_attributes.py b/python/databricks/bundles/instance_pools/_models/instance_pool_azure_attributes.py new file mode 100644 index 00000000000..a080d5a5d7f --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/instance_pool_azure_attributes.py @@ -0,0 +1,100 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.instance_pools._models.instance_pool_azure_attributes_availability import ( + InstancePoolAzureAttributesAvailability, + InstancePoolAzureAttributesAvailabilityParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class InstancePoolAzureAttributes: + """ + Attributes set during instance pool creation which are related to Azure. + """ + + availability: VariableOrOptional[InstancePoolAzureAttributesAvailability] = None + """ + Availability type used for the spot nodes. + """ + + capacity_reservation_group: VariableOrOptional[str] = None + """ + The Azure capacity reservation group resource ID to use for launching VMs in this pool. + When specified, VMs will be launched using the provided capacity reservation. + + NOTE: Omitting this field will clear any existing configured capacity reservation group on the pool. + + Capacity reservations can only be specified when the workspace uses injected vnet (i.e. customer defined vnet not + managed by databricks). Ensure the databricks-login-prod Enterprise Application is granted the following four permissions: + 1. Microsoft.Compute/capacityReservationGroups/read + 2. Microsoft.Compute/capacityReservationGroups/deploy/action + 3. Microsoft.Compute/capacityReservationGroups/capacityReservations/read + 4. Microsoft.Compute/capacityReservationGroups/capacityReservations/deploy/action + + Format: `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}` + """ + + spot_bid_max_price: VariableOrOptional[float] = None + """ + With variable pricing, you have option to set a max price, in US dollars (USD) + For example, the value 2 would be a max price of $2.00 USD per hour. + If you set the max price to be -1, the VM won't be evicted based on price. + The price for the VM will be the current price for spot or the price for a standard VM, + which ever is less, as long as there is capacity and quota available. + """ + + @classmethod + def from_dict(cls, value: "InstancePoolAzureAttributesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "InstancePoolAzureAttributesDict": + return _transform_to_json_value(self) # type:ignore + + +class InstancePoolAzureAttributesDict(TypedDict, total=False): + """""" + + availability: VariableOrOptional[InstancePoolAzureAttributesAvailabilityParam] + """ + Availability type used for the spot nodes. + """ + + capacity_reservation_group: VariableOrOptional[str] + """ + The Azure capacity reservation group resource ID to use for launching VMs in this pool. + When specified, VMs will be launched using the provided capacity reservation. + + NOTE: Omitting this field will clear any existing configured capacity reservation group on the pool. + + Capacity reservations can only be specified when the workspace uses injected vnet (i.e. customer defined vnet not + managed by databricks). Ensure the databricks-login-prod Enterprise Application is granted the following four permissions: + 1. Microsoft.Compute/capacityReservationGroups/read + 2. Microsoft.Compute/capacityReservationGroups/deploy/action + 3. Microsoft.Compute/capacityReservationGroups/capacityReservations/read + 4. Microsoft.Compute/capacityReservationGroups/capacityReservations/deploy/action + + Format: `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/capacityReservationGroups/{capacityReservationGroupName}` + """ + + spot_bid_max_price: VariableOrOptional[float] + """ + With variable pricing, you have option to set a max price, in US dollars (USD) + For example, the value 2 would be a max price of $2.00 USD per hour. + If you set the max price to be -1, the VM won't be evicted based on price. + The price for the VM will be the current price for spot or the price for a standard VM, + which ever is less, as long as there is capacity and quota available. + """ + + +InstancePoolAzureAttributesParam = ( + InstancePoolAzureAttributesDict | InstancePoolAzureAttributes +) diff --git a/python/databricks/bundles/instance_pools/_models/instance_pool_azure_attributes_availability.py b/python/databricks/bundles/instance_pools/_models/instance_pool_azure_attributes_availability.py new file mode 100644 index 00000000000..6d41fe997dd --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/instance_pool_azure_attributes_availability.py @@ -0,0 +1,18 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class InstancePoolAzureAttributesAvailability(Enum): + """ + The set of Azure availability types supported when setting up nodes for a cluster. + """ + + SPOT_AZURE = "SPOT_AZURE" + ON_DEMAND_AZURE = "ON_DEMAND_AZURE" + + +InstancePoolAzureAttributesAvailabilityParam = ( + Literal["SPOT_AZURE", "ON_DEMAND_AZURE"] | InstancePoolAzureAttributesAvailability +) diff --git a/python/databricks/bundles/instance_pools/_models/instance_pool_gcp_attributes.py b/python/databricks/bundles/instance_pools/_models/instance_pool_gcp_attributes.py new file mode 100644 index 00000000000..df34c5867a5 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/instance_pool_gcp_attributes.py @@ -0,0 +1,94 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.instance_pools._models.gcp_availability import ( + GcpAvailability, + GcpAvailabilityParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class InstancePoolGcpAttributes: + """ + Attributes set during instance pool creation which are related to GCP. + """ + + gcp_availability: VariableOrOptional[GcpAvailability] = None + """ + This field determines whether the instance pool will contain preemptible + VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs if the former is unavailable. + """ + + local_ssd_count: VariableOrOptional[int] = None + """ + If provided, each node in the instance pool will have this number of local SSDs attached. + Each local SSD is 375GB in size. Refer to [GCP documentation](https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds) + for the supported number of local SSDs for each instance type. + """ + + zone_id: VariableOrOptional[str] = None + """ + Identifier for the availability zone/datacenter in which the cluster resides. + This string will be of a form like "us-west1-a". The provided availability + zone must be in the same region as the Databricks workspace. For example, "us-west1-a" + is not a valid zone id if the Databricks workspace resides in the "us-east1" region. + This is an optional field at instance pool creation, and if not specified, a default zone will be used. + + This field can be one of the following: + - "HA" => High availability, spread nodes across availability zones for a Databricks deployment region + - A GCP availability zone => Pick One of the available zones for (machine type + region) from https://cloud.google.com/compute/docs/regions-zones (e.g. "us-west1-a"). + + If empty, Databricks picks an availability zone to schedule the cluster on. + """ + + @classmethod + def from_dict(cls, value: "InstancePoolGcpAttributesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "InstancePoolGcpAttributesDict": + return _transform_to_json_value(self) # type:ignore + + +class InstancePoolGcpAttributesDict(TypedDict, total=False): + """""" + + gcp_availability: VariableOrOptional[GcpAvailabilityParam] + """ + This field determines whether the instance pool will contain preemptible + VMs, on-demand VMs, or preemptible VMs with a fallback to on-demand VMs if the former is unavailable. + """ + + local_ssd_count: VariableOrOptional[int] + """ + If provided, each node in the instance pool will have this number of local SSDs attached. + Each local SSD is 375GB in size. Refer to [GCP documentation](https://cloud.google.com/compute/docs/disks/local-ssd#choose_number_local_ssds) + for the supported number of local SSDs for each instance type. + """ + + zone_id: VariableOrOptional[str] + """ + Identifier for the availability zone/datacenter in which the cluster resides. + This string will be of a form like "us-west1-a". The provided availability + zone must be in the same region as the Databricks workspace. For example, "us-west1-a" + is not a valid zone id if the Databricks workspace resides in the "us-east1" region. + This is an optional field at instance pool creation, and if not specified, a default zone will be used. + + This field can be one of the following: + - "HA" => High availability, spread nodes across availability zones for a Databricks deployment region + - A GCP availability zone => Pick One of the available zones for (machine type + region) from https://cloud.google.com/compute/docs/regions-zones (e.g. "us-west1-a"). + + If empty, Databricks picks an availability zone to schedule the cluster on. + """ + + +InstancePoolGcpAttributesParam = ( + InstancePoolGcpAttributesDict | InstancePoolGcpAttributes +) diff --git a/python/databricks/bundles/instance_pools/_models/instance_pool_permission.py b/python/databricks/bundles/instance_pools/_models/instance_pool_permission.py new file mode 100644 index 00000000000..a81c2602aa6 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/instance_pool_permission.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.instance_pools._models.instance_pool_permission_level import ( + InstancePoolPermissionLevel, + InstancePoolPermissionLevelParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class InstancePoolPermission: + """""" + + level: VariableOr[InstancePoolPermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. + """ + + @classmethod + def from_dict(cls, value: "InstancePoolPermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "InstancePoolPermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class InstancePoolPermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[InstancePoolPermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. + """ + + +InstancePoolPermissionParam = InstancePoolPermissionDict | InstancePoolPermission diff --git a/python/databricks/bundles/instance_pools/_models/instance_pool_permission_level.py b/python/databricks/bundles/instance_pools/_models/instance_pool_permission_level.py new file mode 100644 index 00000000000..bb0468b742c --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/instance_pool_permission_level.py @@ -0,0 +1,18 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class InstancePoolPermissionLevel(Enum): + """ + Permission level + """ + + CAN_MANAGE = "CAN_MANAGE" + CAN_ATTACH_TO = "CAN_ATTACH_TO" + + +InstancePoolPermissionLevelParam = ( + Literal["CAN_MANAGE", "CAN_ATTACH_TO"] | InstancePoolPermissionLevel +) diff --git a/python/databricks/bundles/instance_pools/_models/lifecycle.py b/python/databricks/bundles/instance_pools/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/instance_pools/_models/node_type_flexibility.py b/python/databricks/bundles/instance_pools/_models/node_type_flexibility.py new file mode 100644 index 00000000000..aa582b763a8 --- /dev/null +++ b/python/databricks/bundles/instance_pools/_models/node_type_flexibility.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class NodeTypeFlexibility: + """ + Configuration for flexible node types, allowing fallback to alternate node types during cluster launch and upscale. + """ + + alternate_node_type_ids: VariableOrList[str] = field(default_factory=list) + """ + A list of node type IDs to use as fallbacks when the primary node type is unavailable. + """ + + @classmethod + def from_dict(cls, value: "NodeTypeFlexibilityDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "NodeTypeFlexibilityDict": + return _transform_to_json_value(self) # type:ignore + + +class NodeTypeFlexibilityDict(TypedDict, total=False): + """""" + + alternate_node_type_ids: VariableOrList[str] + """ + A list of node type IDs to use as fallbacks when the primary node type is unavailable. + """ + + +NodeTypeFlexibilityParam = NodeTypeFlexibilityDict | NodeTypeFlexibility diff --git a/python/databricks/bundles/job_runs/__init__.py b/python/databricks/bundles/job_runs/__init__.py new file mode 100644 index 00000000000..093f2201409 --- /dev/null +++ b/python/databricks/bundles/job_runs/__init__.py @@ -0,0 +1,48 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "JobRun", + "JobRunDict", + "JobRunLifecycle", + "JobRunLifecycleDict", + "JobRunLifecycleParam", + "JobRunParam", + "JobRunTrigger", + "JobRunTriggerDict", + "JobRunTriggerParam", + "PerformanceTarget", + "PerformanceTargetParam", + "PipelineParams", + "PipelineParamsDict", + "PipelineParamsParam", + "QueueSettings", + "QueueSettingsDict", + "QueueSettingsParam", +] + + +from databricks.bundles.job_runs._models.job_run import JobRun, JobRunDict, JobRunParam +from databricks.bundles.job_runs._models.job_run_lifecycle import ( + JobRunLifecycle, + JobRunLifecycleDict, + JobRunLifecycleParam, +) +from databricks.bundles.job_runs._models.job_run_trigger import ( + JobRunTrigger, + JobRunTriggerDict, + JobRunTriggerParam, +) +from databricks.bundles.job_runs._models.performance_target import ( + PerformanceTarget, + PerformanceTargetParam, +) +from databricks.bundles.job_runs._models.pipeline_params import ( + PipelineParams, + PipelineParamsDict, + PipelineParamsParam, +) +from databricks.bundles.job_runs._models.queue_settings import ( + QueueSettings, + QueueSettingsDict, + QueueSettingsParam, +) diff --git a/python/databricks/bundles/job_runs/_models/job_run.py b/python/databricks/bundles/job_runs/_models/job_run.py new file mode 100644 index 00000000000..82397df768c --- /dev/null +++ b/python/databricks/bundles/job_runs/_models/job_run.py @@ -0,0 +1,136 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, +) +from databricks.bundles.job_runs._models.job_run_lifecycle import ( + JobRunLifecycle, + JobRunLifecycleParam, +) +from databricks.bundles.job_runs._models.performance_target import ( + PerformanceTarget, + PerformanceTargetParam, +) +from databricks.bundles.job_runs._models.pipeline_params import ( + PipelineParams, + PipelineParamsParam, +) +from databricks.bundles.job_runs._models.queue_settings import ( + QueueSettings, + QueueSettingsParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class JobRun(Resource): + """""" + + job_id: VariableOr[int] + """ + The ID of the job to be executed + """ + + job_parameters: VariableOrDict[str] = field(default_factory=dict) + """ + Job-level parameters used in the run. for example `"param": "overriding_val"` + """ + + lifecycle: VariableOrOptional[JobRunLifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed and when the run re-fires. + """ + + only: VariableOrList[str] = field(default_factory=list) + """ + A list of task keys to run inside of the job. If this field is not provided, all tasks in the job will be run. + + Prefix a task key with `+` to also run its upstream tasks, or suffix it with `+` to also run its downstream tasks. + For example, `+my_task` runs `my_task` and everything upstream of it, `my_task+` runs `my_task` and everything + downstream of it, and `+my_task+` runs both. A task key with no `+` runs only that task. + """ + + performance_target: VariableOrOptional[PerformanceTarget] = None + """ + The performance mode on a serverless job. The performance target determines the level of compute performance or cost-efficiency for the run. This field overrides the performance target defined on the job level. + + * `STANDARD`: Enables cost-efficient execution of serverless workloads. + * `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times through rapid scaling and optimized cluster performance. + """ + + pipeline_params: VariableOrOptional[PipelineParams] = None + """ + Controls whether the pipeline should perform a full refresh + """ + + queue: VariableOrOptional[QueueSettings] = None + """ + The queue settings of the run. + """ + + @classmethod + def from_dict(cls, value: "JobRunDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "JobRunDict": + return _transform_to_json_value(self) # type:ignore + + +class JobRunDict(TypedDict, total=False): + """""" + + job_id: VariableOr[int] + """ + The ID of the job to be executed + """ + + job_parameters: VariableOrDict[str] + """ + Job-level parameters used in the run. for example `"param": "overriding_val"` + """ + + lifecycle: VariableOrOptional[JobRunLifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed and when the run re-fires. + """ + + only: VariableOrList[str] + """ + A list of task keys to run inside of the job. If this field is not provided, all tasks in the job will be run. + + Prefix a task key with `+` to also run its upstream tasks, or suffix it with `+` to also run its downstream tasks. + For example, `+my_task` runs `my_task` and everything upstream of it, `my_task+` runs `my_task` and everything + downstream of it, and `+my_task+` runs both. A task key with no `+` runs only that task. + """ + + performance_target: VariableOrOptional[PerformanceTargetParam] + """ + The performance mode on a serverless job. The performance target determines the level of compute performance or cost-efficiency for the run. This field overrides the performance target defined on the job level. + + * `STANDARD`: Enables cost-efficient execution of serverless workloads. + * `PERFORMANCE_OPTIMIZED`: Prioritizes fast startup and execution times through rapid scaling and optimized cluster performance. + """ + + pipeline_params: VariableOrOptional[PipelineParamsParam] + """ + Controls whether the pipeline should perform a full refresh + """ + + queue: VariableOrOptional[QueueSettingsParam] + """ + The queue settings of the run. + """ + + +JobRunParam = JobRunDict | JobRun diff --git a/python/databricks/bundles/job_runs/_models/job_run_lifecycle.py b/python/databricks/bundles/job_runs/_models/job_run_lifecycle.py new file mode 100644 index 00000000000..cb673b0245d --- /dev/null +++ b/python/databricks/bundles/job_runs/_models/job_run_lifecycle.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.job_runs._models.job_run_trigger import ( + JobRunTrigger, + JobRunTriggerParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class JobRunLifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + triggers: VariableOrList[JobRunTrigger] = field(default_factory=list) + """ + Conditions that re-fire this job run (in addition to configuration changes). + """ + + @classmethod + def from_dict(cls, value: "JobRunLifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "JobRunLifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class JobRunLifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + triggers: VariableOrList[JobRunTriggerParam] + """ + Conditions that re-fire this job run (in addition to configuration changes). + """ + + +JobRunLifecycleParam = JobRunLifecycleDict | JobRunLifecycle diff --git a/python/databricks/bundles/job_runs/_models/job_run_trigger.py b/python/databricks/bundles/job_runs/_models/job_run_trigger.py new file mode 100644 index 00000000000..50e7c0fe12c --- /dev/null +++ b/python/databricks/bundles/job_runs/_models/job_run_trigger.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class JobRunTrigger: + """""" + + on_bundle_deploy: VariableOrOptional[bool] = None + """ + If true, re-fire the run on every bundle deploy. Incompatible with lifecycle.prevent_destroy. + """ + + @classmethod + def from_dict(cls, value: "JobRunTriggerDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "JobRunTriggerDict": + return _transform_to_json_value(self) # type:ignore + + +class JobRunTriggerDict(TypedDict, total=False): + """""" + + on_bundle_deploy: VariableOrOptional[bool] + """ + If true, re-fire the run on every bundle deploy. Incompatible with lifecycle.prevent_destroy. + """ + + +JobRunTriggerParam = JobRunTriggerDict | JobRunTrigger diff --git a/python/databricks/bundles/job_runs/_models/performance_target.py b/python/databricks/bundles/job_runs/_models/performance_target.py new file mode 100644 index 00000000000..8dbe7e4a435 --- /dev/null +++ b/python/databricks/bundles/job_runs/_models/performance_target.py @@ -0,0 +1,20 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class PerformanceTarget(Enum): + """ + PerformanceTarget defines how performant (lower latency) or cost efficient the execution of run on serverless compute should be. + The performance mode on the job or pipeline should map to a performance setting that is passed to Cluster Manager + (see cluster-common PerformanceTarget). + """ + + PERFORMANCE_OPTIMIZED = "PERFORMANCE_OPTIMIZED" + STANDARD = "STANDARD" + + +PerformanceTargetParam = ( + Literal["PERFORMANCE_OPTIMIZED", "STANDARD"] | PerformanceTarget +) diff --git a/python/databricks/bundles/job_runs/_models/pipeline_params.py b/python/databricks/bundles/job_runs/_models/pipeline_params.py new file mode 100644 index 00000000000..ef2793b6580 --- /dev/null +++ b/python/databricks/bundles/job_runs/_models/pipeline_params.py @@ -0,0 +1,98 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class PipelineParams: + """""" + + full_refresh: VariableOrOptional[bool] = None + """ + If true, triggers a full refresh on the spark declarative pipeline. + """ + + full_refresh_selection: VariableOrList[str] = field(default_factory=list) + """ + :meta private: [EXPERIMENTAL] + + [Beta] A list of tables to update with fullRefresh. + """ + + refresh_flow_selection: VariableOrList[str] = field(default_factory=list) + """ + :meta private: [EXPERIMENTAL] + + [Beta] Flow names to selectively refresh. These are unioned with other selective refresh + options (refresh_selection, full_refresh_selection) to determine the final set of flows to refresh. + """ + + refresh_selection: VariableOrList[str] = field(default_factory=list) + """ + :meta private: [EXPERIMENTAL] + + [Beta] A list of tables to update without fullRefresh. + """ + + reset_checkpoint_selection: VariableOrList[str] = field(default_factory=list) + """ + :meta private: [EXPERIMENTAL] + + [Beta] A list of streaming flows to reset checkpoints without clearing data. + """ + + @classmethod + def from_dict(cls, value: "PipelineParamsDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "PipelineParamsDict": + return _transform_to_json_value(self) # type:ignore + + +class PipelineParamsDict(TypedDict, total=False): + """""" + + full_refresh: VariableOrOptional[bool] + """ + If true, triggers a full refresh on the spark declarative pipeline. + """ + + full_refresh_selection: VariableOrList[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] A list of tables to update with fullRefresh. + """ + + refresh_flow_selection: VariableOrList[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] Flow names to selectively refresh. These are unioned with other selective refresh + options (refresh_selection, full_refresh_selection) to determine the final set of flows to refresh. + """ + + refresh_selection: VariableOrList[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] A list of tables to update without fullRefresh. + """ + + reset_checkpoint_selection: VariableOrList[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] A list of streaming flows to reset checkpoints without clearing data. + """ + + +PipelineParamsParam = PipelineParamsDict | PipelineParams diff --git a/python/databricks/bundles/job_runs/_models/queue_settings.py b/python/databricks/bundles/job_runs/_models/queue_settings.py new file mode 100644 index 00000000000..a72921aed96 --- /dev/null +++ b/python/databricks/bundles/job_runs/_models/queue_settings.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class QueueSettings: + """""" + + enabled: VariableOr[bool] + """ + If true, enable queueing for the job. This is a required field. + """ + + @classmethod + def from_dict(cls, value: "QueueSettingsDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "QueueSettingsDict": + return _transform_to_json_value(self) # type:ignore + + +class QueueSettingsDict(TypedDict, total=False): + """""" + + enabled: VariableOr[bool] + """ + If true, enable queueing for the job. This is a required field. + """ + + +QueueSettingsParam = QueueSettingsDict | QueueSettings diff --git a/python/databricks/bundles/jobs/_models/ai_runtime_task.py b/python/databricks/bundles/jobs/_models/ai_runtime_task.py index 3c8a802d5be..e1257223f6a 100644 --- a/python/databricks/bundles/jobs/_models/ai_runtime_task.py +++ b/python/databricks/bundles/jobs/_models/ai_runtime_task.py @@ -61,6 +61,8 @@ class AiRuntimeTask: docker_image_url: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Optional Docker image URL for a custom container image. When set, the task runs on the specified container image instead of the default Databricks client image. Format: @@ -133,6 +135,8 @@ class AiRuntimeTaskDict(TypedDict, total=False): docker_image_url: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Optional Docker image URL for a custom container image. When set, the task runs on the specified container image instead of the default Databricks client image. Format: diff --git a/python/databricks/bundles/jobs/_models/cluster_spec.py b/python/databricks/bundles/jobs/_models/cluster_spec.py index 685863137f3..2edebdd2e93 100644 --- a/python/databricks/bundles/jobs/_models/cluster_spec.py +++ b/python/databricks/bundles/jobs/_models/cluster_spec.py @@ -149,6 +149,8 @@ class ClusterSpec: dependency_mode: VariableOrOptional[DependencyMode] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Controls dependency configuration for the cluster. """ @@ -425,6 +427,8 @@ class ClusterSpecDict(TypedDict, total=False): dependency_mode: VariableOrOptional[DependencyModeParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Controls dependency configuration for the cluster. """ diff --git a/python/databricks/bundles/jobs/_models/compute.py b/python/databricks/bundles/jobs/_models/compute.py index 6e6e47d1d7a..e967d342520 100644 --- a/python/databricks/bundles/jobs/_models/compute.py +++ b/python/databricks/bundles/jobs/_models/compute.py @@ -21,6 +21,8 @@ class Compute: hardware_accelerator: VariableOrOptional[HardwareAcceleratorType] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Hardware accelerator configuration for Serverless GPU workloads. """ @@ -37,6 +39,8 @@ class ComputeDict(TypedDict, total=False): hardware_accelerator: VariableOrOptional[HardwareAcceleratorTypeParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Hardware accelerator configuration for Serverless GPU workloads. """ diff --git a/python/databricks/bundles/jobs/_models/continuous_trigger_configuration.py b/python/databricks/bundles/jobs/_models/continuous_trigger_configuration.py index 866ffda4c61..2ad5f5a2336 100644 --- a/python/databricks/bundles/jobs/_models/continuous_trigger_configuration.py +++ b/python/databricks/bundles/jobs/_models/continuous_trigger_configuration.py @@ -24,6 +24,8 @@ class ContinuousTriggerConfiguration: task_retry_mode: VariableOrOptional[TaskRetryMode] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Whether the continuous job applies task-level retries. Defaults to NEVER. """ @@ -40,6 +42,8 @@ class ContinuousTriggerConfigurationDict(TypedDict, total=False): task_retry_mode: VariableOrOptional[TaskRetryModeParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Whether the continuous job applies task-level retries. Defaults to NEVER. """ diff --git a/python/databricks/bundles/jobs/_models/cron_trigger_configuration.py b/python/databricks/bundles/jobs/_models/cron_trigger_configuration.py index e62e51e217d..9e083514b15 100644 --- a/python/databricks/bundles/jobs/_models/cron_trigger_configuration.py +++ b/python/databricks/bundles/jobs/_models/cron_trigger_configuration.py @@ -20,12 +20,16 @@ class CronTriggerConfiguration: quartz_cron_expression: VariableOr[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A Cron expression using Quartz syntax that describes the schedule for this trigger. See [Cron Trigger](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html) for details. """ timezone_id: VariableOr[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A Java timezone ID. The schedule is resolved with respect to this timezone. See [Java TimeZone](https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html) for details. """ @@ -43,12 +47,16 @@ class CronTriggerConfigurationDict(TypedDict, total=False): quartz_cron_expression: VariableOr[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A Cron expression using Quartz syntax that describes the schedule for this trigger. See [Cron Trigger](http://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html) for details. """ timezone_id: VariableOr[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A Java timezone ID. The schedule is resolved with respect to this timezone. See [Java TimeZone](https://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html) for details. """ diff --git a/python/databricks/bundles/jobs/_models/job.py b/python/databricks/bundles/jobs/_models/job.py index d4010ac38f8..e9cdd9ac27a 100644 --- a/python/databricks/bundles/jobs/_models/job.py +++ b/python/databricks/bundles/jobs/_models/job.py @@ -217,6 +217,8 @@ class Job(Resource): triggers: VariableOrList[TriggerConfiguration] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] List of triggers attached to this job. A run starts when any active trigger evaluates to true. Cannot be set in the same request as the legacy `schedule`, `trigger`, or `continuous` fields. Gated behind the "Multiple Triggers" feature preview. """ @@ -386,6 +388,8 @@ class JobDict(TypedDict, total=False): triggers: VariableOrList[TriggerConfigurationParam] """ + :meta private: [EXPERIMENTAL] + [Beta] List of triggers attached to this job. A run starts when any active trigger evaluates to true. Cannot be set in the same request as the legacy `schedule`, `trigger`, or `continuous` fields. Gated behind the "Multiple Triggers" feature preview. """ diff --git a/python/databricks/bundles/jobs/_models/pipeline_params.py b/python/databricks/bundles/jobs/_models/pipeline_params.py index 0d84734931d..ef2793b6580 100644 --- a/python/databricks/bundles/jobs/_models/pipeline_params.py +++ b/python/databricks/bundles/jobs/_models/pipeline_params.py @@ -22,22 +22,30 @@ class PipelineParams: full_refresh_selection: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] A list of tables to update with fullRefresh. """ refresh_flow_selection: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] Flow names to selectively refresh. These are unioned with other selective refresh options (refresh_selection, full_refresh_selection) to determine the final set of flows to refresh. """ refresh_selection: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] A list of tables to update without fullRefresh. """ reset_checkpoint_selection: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] A list of streaming flows to reset checkpoints without clearing data. """ @@ -59,22 +67,30 @@ class PipelineParamsDict(TypedDict, total=False): full_refresh_selection: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A list of tables to update with fullRefresh. """ refresh_flow_selection: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Flow names to selectively refresh. These are unioned with other selective refresh options (refresh_selection, full_refresh_selection) to determine the final set of flows to refresh. """ refresh_selection: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A list of tables to update without fullRefresh. """ reset_checkpoint_selection: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A list of streaming flows to reset checkpoints without clearing data. """ diff --git a/python/databricks/bundles/jobs/_models/pipeline_task.py b/python/databricks/bundles/jobs/_models/pipeline_task.py index e23ed9da713..d249f0215d2 100644 --- a/python/databricks/bundles/jobs/_models/pipeline_task.py +++ b/python/databricks/bundles/jobs/_models/pipeline_task.py @@ -32,28 +32,38 @@ class PipelineTask: full_refresh_selection: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] A list of tables to update with fullRefresh. """ parameters: VariableOrDict[str] = field(default_factory=dict) """ + :meta private: [EXPERIMENTAL] + [Beta] Key/value-map of parameters passed to the pipeline execution. Limited to 10k characters in total. """ refresh_flow_selection: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] Flow names to selectively refresh. These are unioned with other selective refresh options (refresh_selection, full_refresh_selection) to determine the final set of flows to refresh. """ refresh_selection: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] A list of tables to update without fullRefresh. """ reset_checkpoint_selection: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] A list of streaming flows to reset checkpoints without clearing data. """ @@ -80,28 +90,38 @@ class PipelineTaskDict(TypedDict, total=False): full_refresh_selection: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A list of tables to update with fullRefresh. """ parameters: VariableOrDict[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Key/value-map of parameters passed to the pipeline execution. Limited to 10k characters in total. """ refresh_flow_selection: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Flow names to selectively refresh. These are unioned with other selective refresh options (refresh_selection, full_refresh_selection) to determine the final set of flows to refresh. """ refresh_selection: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A list of tables to update without fullRefresh. """ reset_checkpoint_selection: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] A list of streaming flows to reset checkpoints without clearing data. """ diff --git a/python/databricks/bundles/jobs/_models/task.py b/python/databricks/bundles/jobs/_models/task.py index 1b352983859..0a3217235d7 100644 --- a/python/databricks/bundles/jobs/_models/task.py +++ b/python/databricks/bundles/jobs/_models/task.py @@ -132,6 +132,8 @@ class Task: compute: VariableOrOptional[Compute] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Task level compute configuration. """ @@ -369,6 +371,8 @@ class TaskDict(TypedDict, total=False): compute: VariableOrOptional[ComputeParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Task level compute configuration. """ diff --git a/python/databricks/bundles/jobs/_models/trigger_configuration.py b/python/databricks/bundles/jobs/_models/trigger_configuration.py index 259c45c7f9d..60042222371 100644 --- a/python/databricks/bundles/jobs/_models/trigger_configuration.py +++ b/python/databricks/bundles/jobs/_models/trigger_configuration.py @@ -51,11 +51,15 @@ class TriggerConfiguration: continuous: VariableOrOptional[ContinuousTriggerConfiguration] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Continuous trigger configuration. """ file_arrival: VariableOrOptional[FileArrivalTriggerConfiguration] = None """ + :meta private: [EXPERIMENTAL] + [Beta] File arrival trigger configuration. """ @@ -68,17 +72,23 @@ class TriggerConfiguration: pause_status: VariableOrOptional[PauseStatus] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Whether this trigger is paused. Defaults to UNPAUSED when unset; the server always returns an explicit value on read. """ periodic: VariableOrOptional[PeriodicTriggerConfiguration] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Trigger type: exactly one must be set; mutual exclusivity is enforced in the API handler Periodic trigger configuration. """ schedule: VariableOrOptional[CronTriggerConfiguration] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Cron schedule trigger configuration. """ @@ -91,6 +101,8 @@ class TriggerConfiguration: table_update: VariableOrOptional[TableUpdateTriggerConfiguration] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Table update trigger configuration. """ @@ -107,11 +119,15 @@ class TriggerConfigurationDict(TypedDict, total=False): continuous: VariableOrOptional[ContinuousTriggerConfigurationParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Continuous trigger configuration. """ file_arrival: VariableOrOptional[FileArrivalTriggerConfigurationParam] """ + :meta private: [EXPERIMENTAL] + [Beta] File arrival trigger configuration. """ @@ -124,17 +140,23 @@ class TriggerConfigurationDict(TypedDict, total=False): pause_status: VariableOrOptional[PauseStatusParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Whether this trigger is paused. Defaults to UNPAUSED when unset; the server always returns an explicit value on read. """ periodic: VariableOrOptional[PeriodicTriggerConfigurationParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Trigger type: exactly one must be set; mutual exclusivity is enforced in the API handler Periodic trigger configuration. """ schedule: VariableOrOptional[CronTriggerConfigurationParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Cron schedule trigger configuration. """ @@ -147,6 +169,8 @@ class TriggerConfigurationDict(TypedDict, total=False): table_update: VariableOrOptional[TableUpdateTriggerConfigurationParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Table update trigger configuration. """ diff --git a/python/databricks/bundles/model_serving_endpoints/__init__.py b/python/databricks/bundles/model_serving_endpoints/__init__.py new file mode 100644 index 00000000000..0137c5e76b9 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/__init__.py @@ -0,0 +1,352 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "Ai21LabsConfig", + "Ai21LabsConfigDict", + "Ai21LabsConfigParam", + "AiGatewayConfig", + "AiGatewayConfigDict", + "AiGatewayConfigParam", + "AiGatewayGuardrailParameters", + "AiGatewayGuardrailParametersDict", + "AiGatewayGuardrailParametersParam", + "AiGatewayGuardrailPiiBehavior", + "AiGatewayGuardrailPiiBehaviorBehavior", + "AiGatewayGuardrailPiiBehaviorBehaviorParam", + "AiGatewayGuardrailPiiBehaviorDict", + "AiGatewayGuardrailPiiBehaviorParam", + "AiGatewayGuardrails", + "AiGatewayGuardrailsDict", + "AiGatewayGuardrailsParam", + "AiGatewayInferenceTableConfig", + "AiGatewayInferenceTableConfigDict", + "AiGatewayInferenceTableConfigParam", + "AiGatewayRateLimit", + "AiGatewayRateLimitDict", + "AiGatewayRateLimitKey", + "AiGatewayRateLimitKeyParam", + "AiGatewayRateLimitParam", + "AiGatewayRateLimitRenewalPeriod", + "AiGatewayRateLimitRenewalPeriodParam", + "AiGatewayUsageTrackingConfig", + "AiGatewayUsageTrackingConfigDict", + "AiGatewayUsageTrackingConfigParam", + "AmazonBedrockConfig", + "AmazonBedrockConfigBedrockProvider", + "AmazonBedrockConfigBedrockProviderParam", + "AmazonBedrockConfigDict", + "AmazonBedrockConfigParam", + "AnthropicConfig", + "AnthropicConfigDict", + "AnthropicConfigParam", + "ApiKeyAuth", + "ApiKeyAuthDict", + "ApiKeyAuthParam", + "AutoCaptureConfigInput", + "AutoCaptureConfigInputDict", + "AutoCaptureConfigInputParam", + "BearerTokenAuth", + "BearerTokenAuthDict", + "BearerTokenAuthParam", + "CohereConfig", + "CohereConfigDict", + "CohereConfigParam", + "CustomProviderConfig", + "CustomProviderConfigDict", + "CustomProviderConfigParam", + "DatabricksModelServingConfig", + "DatabricksModelServingConfigDict", + "DatabricksModelServingConfigParam", + "EmailNotifications", + "EmailNotificationsDict", + "EmailNotificationsParam", + "EndpointCoreConfigInput", + "EndpointCoreConfigInputDict", + "EndpointCoreConfigInputParam", + "EndpointTag", + "EndpointTagDict", + "EndpointTagParam", + "ExternalModel", + "ExternalModelDict", + "ExternalModelParam", + "ExternalModelProvider", + "ExternalModelProviderParam", + "FallbackConfig", + "FallbackConfigDict", + "FallbackConfigParam", + "GoogleCloudVertexAiConfig", + "GoogleCloudVertexAiConfigDict", + "GoogleCloudVertexAiConfigParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "ModelServingEndpoint", + "ModelServingEndpointDict", + "ModelServingEndpointParam", + "ModelServingEndpointPermission", + "ModelServingEndpointPermissionDict", + "ModelServingEndpointPermissionParam", + "OpenAiConfig", + "OpenAiConfigDict", + "OpenAiConfigParam", + "PaLmConfig", + "PaLmConfigDict", + "PaLmConfigParam", + "RateLimit", + "RateLimitDict", + "RateLimitKey", + "RateLimitKeyParam", + "RateLimitParam", + "RateLimitRenewalPeriod", + "RateLimitRenewalPeriodParam", + "Route", + "RouteDict", + "RouteParam", + "ServedEntityInput", + "ServedEntityInputDict", + "ServedEntityInputParam", + "ServedModelInput", + "ServedModelInputDict", + "ServedModelInputParam", + "ServedModelInputWorkloadType", + "ServedModelInputWorkloadTypeParam", + "ServingEndpointPermissionLevel", + "ServingEndpointPermissionLevelParam", + "ServingModelWorkloadType", + "ServingModelWorkloadTypeParam", + "TelemetryConfig", + "TelemetryConfigDict", + "TelemetryConfigParam", + "TelemetryFeature", + "TelemetryFeatureParam", + "TelemetryInferenceTableConfig", + "TelemetryInferenceTableConfigDict", + "TelemetryInferenceTableConfigParam", + "TrafficConfig", + "TrafficConfigDict", + "TrafficConfigParam", + "UnityCatalogTableNames", + "UnityCatalogTableNamesDict", + "UnityCatalogTableNamesParam", +] + + +from databricks.bundles.model_serving_endpoints._models.ai21_labs_config import ( + Ai21LabsConfig, + Ai21LabsConfigDict, + Ai21LabsConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_config import ( + AiGatewayConfig, + AiGatewayConfigDict, + AiGatewayConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_guardrail_parameters import ( + AiGatewayGuardrailParameters, + AiGatewayGuardrailParametersDict, + AiGatewayGuardrailParametersParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_guardrail_pii_behavior import ( + AiGatewayGuardrailPiiBehavior, + AiGatewayGuardrailPiiBehaviorDict, + AiGatewayGuardrailPiiBehaviorParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_guardrail_pii_behavior_behavior import ( + AiGatewayGuardrailPiiBehaviorBehavior, + AiGatewayGuardrailPiiBehaviorBehaviorParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_guardrails import ( + AiGatewayGuardrails, + AiGatewayGuardrailsDict, + AiGatewayGuardrailsParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_inference_table_config import ( + AiGatewayInferenceTableConfig, + AiGatewayInferenceTableConfigDict, + AiGatewayInferenceTableConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_rate_limit import ( + AiGatewayRateLimit, + AiGatewayRateLimitDict, + AiGatewayRateLimitParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_rate_limit_key import ( + AiGatewayRateLimitKey, + AiGatewayRateLimitKeyParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_rate_limit_renewal_period import ( + AiGatewayRateLimitRenewalPeriod, + AiGatewayRateLimitRenewalPeriodParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_usage_tracking_config import ( + AiGatewayUsageTrackingConfig, + AiGatewayUsageTrackingConfigDict, + AiGatewayUsageTrackingConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.amazon_bedrock_config import ( + AmazonBedrockConfig, + AmazonBedrockConfigDict, + AmazonBedrockConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.amazon_bedrock_config_bedrock_provider import ( + AmazonBedrockConfigBedrockProvider, + AmazonBedrockConfigBedrockProviderParam, +) +from databricks.bundles.model_serving_endpoints._models.anthropic_config import ( + AnthropicConfig, + AnthropicConfigDict, + AnthropicConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.api_key_auth import ( + ApiKeyAuth, + ApiKeyAuthDict, + ApiKeyAuthParam, +) +from databricks.bundles.model_serving_endpoints._models.auto_capture_config_input import ( + AutoCaptureConfigInput, + AutoCaptureConfigInputDict, + AutoCaptureConfigInputParam, +) +from databricks.bundles.model_serving_endpoints._models.bearer_token_auth import ( + BearerTokenAuth, + BearerTokenAuthDict, + BearerTokenAuthParam, +) +from databricks.bundles.model_serving_endpoints._models.cohere_config import ( + CohereConfig, + CohereConfigDict, + CohereConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.custom_provider_config import ( + CustomProviderConfig, + CustomProviderConfigDict, + CustomProviderConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.databricks_model_serving_config import ( + DatabricksModelServingConfig, + DatabricksModelServingConfigDict, + DatabricksModelServingConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.email_notifications import ( + EmailNotifications, + EmailNotificationsDict, + EmailNotificationsParam, +) +from databricks.bundles.model_serving_endpoints._models.endpoint_core_config_input import ( + EndpointCoreConfigInput, + EndpointCoreConfigInputDict, + EndpointCoreConfigInputParam, +) +from databricks.bundles.model_serving_endpoints._models.endpoint_tag import ( + EndpointTag, + EndpointTagDict, + EndpointTagParam, +) +from databricks.bundles.model_serving_endpoints._models.external_model import ( + ExternalModel, + ExternalModelDict, + ExternalModelParam, +) +from databricks.bundles.model_serving_endpoints._models.external_model_provider import ( + ExternalModelProvider, + ExternalModelProviderParam, +) +from databricks.bundles.model_serving_endpoints._models.fallback_config import ( + FallbackConfig, + FallbackConfigDict, + FallbackConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.google_cloud_vertex_ai_config import ( + GoogleCloudVertexAiConfig, + GoogleCloudVertexAiConfigDict, + GoogleCloudVertexAiConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint import ( + ModelServingEndpoint, + ModelServingEndpointDict, + ModelServingEndpointParam, +) +from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint_permission import ( + ModelServingEndpointPermission, + ModelServingEndpointPermissionDict, + ModelServingEndpointPermissionParam, +) +from databricks.bundles.model_serving_endpoints._models.open_ai_config import ( + OpenAiConfig, + OpenAiConfigDict, + OpenAiConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.pa_lm_config import ( + PaLmConfig, + PaLmConfigDict, + PaLmConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.rate_limit import ( + RateLimit, + RateLimitDict, + RateLimitParam, +) +from databricks.bundles.model_serving_endpoints._models.rate_limit_key import ( + RateLimitKey, + RateLimitKeyParam, +) +from databricks.bundles.model_serving_endpoints._models.rate_limit_renewal_period import ( + RateLimitRenewalPeriod, + RateLimitRenewalPeriodParam, +) +from databricks.bundles.model_serving_endpoints._models.route import ( + Route, + RouteDict, + RouteParam, +) +from databricks.bundles.model_serving_endpoints._models.served_entity_input import ( + ServedEntityInput, + ServedEntityInputDict, + ServedEntityInputParam, +) +from databricks.bundles.model_serving_endpoints._models.served_model_input import ( + ServedModelInput, + ServedModelInputDict, + ServedModelInputParam, +) +from databricks.bundles.model_serving_endpoints._models.served_model_input_workload_type import ( + ServedModelInputWorkloadType, + ServedModelInputWorkloadTypeParam, +) +from databricks.bundles.model_serving_endpoints._models.serving_endpoint_permission_level import ( + ServingEndpointPermissionLevel, + ServingEndpointPermissionLevelParam, +) +from databricks.bundles.model_serving_endpoints._models.serving_model_workload_type import ( + ServingModelWorkloadType, + ServingModelWorkloadTypeParam, +) +from databricks.bundles.model_serving_endpoints._models.telemetry_config import ( + TelemetryConfig, + TelemetryConfigDict, + TelemetryConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.telemetry_feature import ( + TelemetryFeature, + TelemetryFeatureParam, +) +from databricks.bundles.model_serving_endpoints._models.telemetry_inference_table_config import ( + TelemetryInferenceTableConfig, + TelemetryInferenceTableConfigDict, + TelemetryInferenceTableConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.traffic_config import ( + TrafficConfig, + TrafficConfigDict, + TrafficConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.unity_catalog_table_names import ( + UnityCatalogTableNames, + UnityCatalogTableNamesDict, + UnityCatalogTableNamesParam, +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai21_labs_config.py b/python/databricks/bundles/model_serving_endpoints/_models/ai21_labs_config.py new file mode 100644 index 00000000000..af06b6f6f1e --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai21_labs_config.py @@ -0,0 +1,62 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Ai21LabsConfig: + """""" + + ai21labs_api_key: VariableOrOptional[str] = None + """ + The Databricks secret key reference for an AI21 Labs API key. If you + prefer to paste your API key directly, see `ai21labs_api_key_plaintext`. + You must provide an API key using one of the following fields: + `ai21labs_api_key` or `ai21labs_api_key_plaintext`. + """ + + ai21labs_api_key_plaintext: VariableOrOptional[str] = None + """ + An AI21 Labs API key provided as a plaintext string. If you prefer to + reference your key using Databricks Secrets, see `ai21labs_api_key`. You + must provide an API key using one of the following fields: + `ai21labs_api_key` or `ai21labs_api_key_plaintext`. + """ + + @classmethod + def from_dict(cls, value: "Ai21LabsConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "Ai21LabsConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class Ai21LabsConfigDict(TypedDict, total=False): + """""" + + ai21labs_api_key: VariableOrOptional[str] + """ + The Databricks secret key reference for an AI21 Labs API key. If you + prefer to paste your API key directly, see `ai21labs_api_key_plaintext`. + You must provide an API key using one of the following fields: + `ai21labs_api_key` or `ai21labs_api_key_plaintext`. + """ + + ai21labs_api_key_plaintext: VariableOrOptional[str] + """ + An AI21 Labs API key provided as a plaintext string. If you prefer to + reference your key using Databricks Secrets, see `ai21labs_api_key`. You + must provide an API key using one of the following fields: + `ai21labs_api_key` or `ai21labs_api_key_plaintext`. + """ + + +Ai21LabsConfigParam = Ai21LabsConfigDict | Ai21LabsConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_config.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_config.py new file mode 100644 index 00000000000..24a4a967599 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_config.py @@ -0,0 +1,106 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.ai_gateway_guardrails import ( + AiGatewayGuardrails, + AiGatewayGuardrailsParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_inference_table_config import ( + AiGatewayInferenceTableConfig, + AiGatewayInferenceTableConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_rate_limit import ( + AiGatewayRateLimit, + AiGatewayRateLimitParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_usage_tracking_config import ( + AiGatewayUsageTrackingConfig, + AiGatewayUsageTrackingConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.fallback_config import ( + FallbackConfig, + FallbackConfigParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AiGatewayConfig: + """""" + + fallback_config: VariableOrOptional[FallbackConfig] = None + """ + Configuration for traffic fallback which auto fallbacks to other served entities if the request to a served + entity fails with certain error codes, to increase availability. + """ + + guardrails: VariableOrOptional[AiGatewayGuardrails] = None + """ + [Public Preview] Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and responses. + """ + + inference_table_config: VariableOrOptional[AiGatewayInferenceTableConfig] = None + """ + Configuration for payload logging using inference tables. + Use these tables to monitor and audit data being sent to and received from model APIs and to improve model quality. + """ + + rate_limits: VariableOrList[AiGatewayRateLimit] = field(default_factory=list) + """ + Configuration for rate limits which can be set to limit endpoint traffic. + """ + + usage_tracking_config: VariableOrOptional[AiGatewayUsageTrackingConfig] = None + """ + Configuration to enable usage tracking using system tables. + These tables allow you to monitor operational usage on endpoints and their associated costs. + """ + + @classmethod + def from_dict(cls, value: "AiGatewayConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AiGatewayConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class AiGatewayConfigDict(TypedDict, total=False): + """""" + + fallback_config: VariableOrOptional[FallbackConfigParam] + """ + Configuration for traffic fallback which auto fallbacks to other served entities if the request to a served + entity fails with certain error codes, to increase availability. + """ + + guardrails: VariableOrOptional[AiGatewayGuardrailsParam] + """ + [Public Preview] Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and responses. + """ + + inference_table_config: VariableOrOptional[AiGatewayInferenceTableConfigParam] + """ + Configuration for payload logging using inference tables. + Use these tables to monitor and audit data being sent to and received from model APIs and to improve model quality. + """ + + rate_limits: VariableOrList[AiGatewayRateLimitParam] + """ + Configuration for rate limits which can be set to limit endpoint traffic. + """ + + usage_tracking_config: VariableOrOptional[AiGatewayUsageTrackingConfigParam] + """ + Configuration to enable usage tracking using system tables. + These tables allow you to monitor operational usage on endpoints and their associated costs. + """ + + +AiGatewayConfigParam = AiGatewayConfigDict | AiGatewayConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_parameters.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_parameters.py new file mode 100644 index 00000000000..55b70a82669 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_parameters.py @@ -0,0 +1,80 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.ai_gateway_guardrail_pii_behavior import ( + AiGatewayGuardrailPiiBehavior, + AiGatewayGuardrailPiiBehaviorParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AiGatewayGuardrailParameters: + """""" + + invalid_keywords: VariableOrList[str] = field(default_factory=list) + """ + [DEPRECATED] [Public Preview] List of invalid keywords. + AI guardrail uses keyword or string matching to decide if the keyword exists in the request or response content. + """ + + pii: VariableOrOptional[AiGatewayGuardrailPiiBehavior] = None + """ + [Public Preview] Configuration for guardrail PII filter. + """ + + safety: VariableOrOptional[bool] = None + """ + [Public Preview] Indicates whether the safety filter is enabled. + """ + + valid_topics: VariableOrList[str] = field(default_factory=list) + """ + [DEPRECATED] [Public Preview] The list of allowed topics. + Given a chat request, this guardrail flags the request if its topic is not in the allowed topics. + """ + + @classmethod + def from_dict(cls, value: "AiGatewayGuardrailParametersDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AiGatewayGuardrailParametersDict": + return _transform_to_json_value(self) # type:ignore + + +class AiGatewayGuardrailParametersDict(TypedDict, total=False): + """""" + + invalid_keywords: VariableOrList[str] + """ + [DEPRECATED] [Public Preview] List of invalid keywords. + AI guardrail uses keyword or string matching to decide if the keyword exists in the request or response content. + """ + + pii: VariableOrOptional[AiGatewayGuardrailPiiBehaviorParam] + """ + [Public Preview] Configuration for guardrail PII filter. + """ + + safety: VariableOrOptional[bool] + """ + [Public Preview] Indicates whether the safety filter is enabled. + """ + + valid_topics: VariableOrList[str] + """ + [DEPRECATED] [Public Preview] The list of allowed topics. + Given a chat request, this guardrail flags the request if its topic is not in the allowed topics. + """ + + +AiGatewayGuardrailParametersParam = ( + AiGatewayGuardrailParametersDict | AiGatewayGuardrailParameters +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_pii_behavior.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_pii_behavior.py new file mode 100644 index 00000000000..577af194a55 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_pii_behavior.py @@ -0,0 +1,46 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.ai_gateway_guardrail_pii_behavior_behavior import ( + AiGatewayGuardrailPiiBehaviorBehavior, + AiGatewayGuardrailPiiBehaviorBehaviorParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AiGatewayGuardrailPiiBehavior: + """""" + + behavior: VariableOrOptional[AiGatewayGuardrailPiiBehaviorBehavior] = None + """ + [Public Preview] Configuration for input guardrail filters. + """ + + @classmethod + def from_dict(cls, value: "AiGatewayGuardrailPiiBehaviorDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AiGatewayGuardrailPiiBehaviorDict": + return _transform_to_json_value(self) # type:ignore + + +class AiGatewayGuardrailPiiBehaviorDict(TypedDict, total=False): + """""" + + behavior: VariableOrOptional[AiGatewayGuardrailPiiBehaviorBehaviorParam] + """ + [Public Preview] Configuration for input guardrail filters. + """ + + +AiGatewayGuardrailPiiBehaviorParam = ( + AiGatewayGuardrailPiiBehaviorDict | AiGatewayGuardrailPiiBehavior +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_pii_behavior_behavior.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_pii_behavior_behavior.py new file mode 100644 index 00000000000..bf9bf86fc68 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrail_pii_behavior_behavior.py @@ -0,0 +1,15 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AiGatewayGuardrailPiiBehaviorBehavior(Enum): + NONE = "NONE" + BLOCK = "BLOCK" + MASK = "MASK" + + +AiGatewayGuardrailPiiBehaviorBehaviorParam = ( + Literal["NONE", "BLOCK", "MASK"] | AiGatewayGuardrailPiiBehaviorBehavior +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrails.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrails.py new file mode 100644 index 00000000000..299859aa015 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_guardrails.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.ai_gateway_guardrail_parameters import ( + AiGatewayGuardrailParameters, + AiGatewayGuardrailParametersParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AiGatewayGuardrails: + """""" + + input: VariableOrOptional[AiGatewayGuardrailParameters] = None + """ + [Public Preview] Configuration for input guardrail filters. + """ + + output: VariableOrOptional[AiGatewayGuardrailParameters] = None + """ + [Public Preview] Configuration for output guardrail filters. + """ + + @classmethod + def from_dict(cls, value: "AiGatewayGuardrailsDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AiGatewayGuardrailsDict": + return _transform_to_json_value(self) # type:ignore + + +class AiGatewayGuardrailsDict(TypedDict, total=False): + """""" + + input: VariableOrOptional[AiGatewayGuardrailParametersParam] + """ + [Public Preview] Configuration for input guardrail filters. + """ + + output: VariableOrOptional[AiGatewayGuardrailParametersParam] + """ + [Public Preview] Configuration for output guardrail filters. + """ + + +AiGatewayGuardrailsParam = AiGatewayGuardrailsDict | AiGatewayGuardrails diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_inference_table_config.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_inference_table_config.py new file mode 100644 index 00000000000..a4d748dee3a --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_inference_table_config.py @@ -0,0 +1,78 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AiGatewayInferenceTableConfig: + """""" + + catalog_name: VariableOrOptional[str] = None + """ + The name of the catalog in Unity Catalog. Required when enabling inference tables. + NOTE: On update, you have to disable inference table first in order to change the catalog name. + """ + + enabled: VariableOrOptional[bool] = None + """ + Indicates whether the inference table is enabled. + """ + + schema_name: VariableOrOptional[str] = None + """ + The name of the schema in Unity Catalog. Required when enabling inference tables. + NOTE: On update, you have to disable inference table first in order to change the schema name. + """ + + table_name_prefix: VariableOrOptional[str] = None + """ + The prefix of the table in Unity Catalog. + NOTE: On update, you have to disable inference table first in order to change the prefix name. + """ + + @classmethod + def from_dict(cls, value: "AiGatewayInferenceTableConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AiGatewayInferenceTableConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class AiGatewayInferenceTableConfigDict(TypedDict, total=False): + """""" + + catalog_name: VariableOrOptional[str] + """ + The name of the catalog in Unity Catalog. Required when enabling inference tables. + NOTE: On update, you have to disable inference table first in order to change the catalog name. + """ + + enabled: VariableOrOptional[bool] + """ + Indicates whether the inference table is enabled. + """ + + schema_name: VariableOrOptional[str] + """ + The name of the schema in Unity Catalog. Required when enabling inference tables. + NOTE: On update, you have to disable inference table first in order to change the schema name. + """ + + table_name_prefix: VariableOrOptional[str] + """ + The prefix of the table in Unity Catalog. + NOTE: On update, you have to disable inference table first in order to change the prefix name. + """ + + +AiGatewayInferenceTableConfigParam = ( + AiGatewayInferenceTableConfigDict | AiGatewayInferenceTableConfig +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit.py new file mode 100644 index 00000000000..5848e04f895 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit.py @@ -0,0 +1,90 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.ai_gateway_rate_limit_key import ( + AiGatewayRateLimitKey, + AiGatewayRateLimitKeyParam, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_rate_limit_renewal_period import ( + AiGatewayRateLimitRenewalPeriod, + AiGatewayRateLimitRenewalPeriodParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AiGatewayRateLimit: + """""" + + renewal_period: VariableOr[AiGatewayRateLimitRenewalPeriod] + """ + Renewal period field for a rate limit. Currently, only 'minute' is supported. + """ + + calls: VariableOrOptional[int] = None + """ + Used to specify how many calls are allowed for a key within the renewal_period. + """ + + key: VariableOrOptional[AiGatewayRateLimitKey] = None + """ + Key field for a rate limit. Currently, 'user', 'user_group, 'service_principal', and 'endpoint' are supported, + with 'endpoint' being the default if not specified. + """ + + principal: VariableOrOptional[str] = None + """ + Principal field for a user, user group, or service principal to apply rate limiting to. Accepts a user email, group name, or service principal application ID. + """ + + tokens: VariableOrOptional[int] = None + """ + Used to specify how many tokens are allowed for a key within the renewal_period. + """ + + @classmethod + def from_dict(cls, value: "AiGatewayRateLimitDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AiGatewayRateLimitDict": + return _transform_to_json_value(self) # type:ignore + + +class AiGatewayRateLimitDict(TypedDict, total=False): + """""" + + renewal_period: VariableOr[AiGatewayRateLimitRenewalPeriodParam] + """ + Renewal period field for a rate limit. Currently, only 'minute' is supported. + """ + + calls: VariableOrOptional[int] + """ + Used to specify how many calls are allowed for a key within the renewal_period. + """ + + key: VariableOrOptional[AiGatewayRateLimitKeyParam] + """ + Key field for a rate limit. Currently, 'user', 'user_group, 'service_principal', and 'endpoint' are supported, + with 'endpoint' being the default if not specified. + """ + + principal: VariableOrOptional[str] + """ + Principal field for a user, user group, or service principal to apply rate limiting to. Accepts a user email, group name, or service principal application ID. + """ + + tokens: VariableOrOptional[int] + """ + Used to specify how many tokens are allowed for a key within the renewal_period. + """ + + +AiGatewayRateLimitParam = AiGatewayRateLimitDict | AiGatewayRateLimit diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit_key.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit_key.py new file mode 100644 index 00000000000..f166207b7e7 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit_key.py @@ -0,0 +1,17 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AiGatewayRateLimitKey(Enum): + USER = "user" + ENDPOINT = "endpoint" + USER_GROUP = "user_group" + SERVICE_PRINCIPAL = "service_principal" + + +AiGatewayRateLimitKeyParam = ( + Literal["user", "endpoint", "user_group", "service_principal"] + | AiGatewayRateLimitKey +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit_renewal_period.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit_renewal_period.py new file mode 100644 index 00000000000..e315d878c83 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_rate_limit_renewal_period.py @@ -0,0 +1,13 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AiGatewayRateLimitRenewalPeriod(Enum): + MINUTE = "minute" + + +AiGatewayRateLimitRenewalPeriodParam = ( + Literal["minute"] | AiGatewayRateLimitRenewalPeriod +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_usage_tracking_config.py b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_usage_tracking_config.py new file mode 100644 index 00000000000..bd5b5dd2806 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/ai_gateway_usage_tracking_config.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AiGatewayUsageTrackingConfig: + """""" + + enabled: VariableOrOptional[bool] = None + """ + Whether to enable usage tracking. + """ + + @classmethod + def from_dict(cls, value: "AiGatewayUsageTrackingConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AiGatewayUsageTrackingConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class AiGatewayUsageTrackingConfigDict(TypedDict, total=False): + """""" + + enabled: VariableOrOptional[bool] + """ + Whether to enable usage tracking. + """ + + +AiGatewayUsageTrackingConfigParam = ( + AiGatewayUsageTrackingConfigDict | AiGatewayUsageTrackingConfig +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/amazon_bedrock_config.py b/python/databricks/bundles/model_serving_endpoints/_models/amazon_bedrock_config.py new file mode 100644 index 00000000000..09c6b0304b7 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/amazon_bedrock_config.py @@ -0,0 +1,148 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.amazon_bedrock_config_bedrock_provider import ( + AmazonBedrockConfigBedrockProvider, + AmazonBedrockConfigBedrockProviderParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AmazonBedrockConfig: + """""" + + aws_region: VariableOr[str] + """ + The AWS region to use. Bedrock has to be enabled there. + """ + + bedrock_provider: VariableOr[AmazonBedrockConfigBedrockProvider] + """ + The underlying provider in Amazon Bedrock. Supported values (case + insensitive) include: Anthropic, Cohere, AI21Labs, Amazon. + """ + + aws_access_key_id: VariableOrOptional[str] = None + """ + The Databricks secret key reference for an AWS access key ID with + permissions to interact with Bedrock services. If you prefer to paste + your API key directly, see `aws_access_key_id_plaintext`. You must provide an API + key using one of the following fields: `aws_access_key_id` or + `aws_access_key_id_plaintext`. + """ + + aws_access_key_id_plaintext: VariableOrOptional[str] = None + """ + An AWS access key ID with permissions to interact with Bedrock services + provided as a plaintext string. If you prefer to reference your key using + Databricks Secrets, see `aws_access_key_id`. You must provide an API key + using one of the following fields: `aws_access_key_id` or + `aws_access_key_id_plaintext`. + """ + + aws_secret_access_key: VariableOrOptional[str] = None + """ + The Databricks secret key reference for an AWS secret access key paired + with the access key ID, with permissions to interact with Bedrock + services. If you prefer to paste your API key directly, see + `aws_secret_access_key_plaintext`. You must provide an API key using one + of the following fields: `aws_secret_access_key` or + `aws_secret_access_key_plaintext`. + """ + + aws_secret_access_key_plaintext: VariableOrOptional[str] = None + """ + An AWS secret access key paired with the access key ID, with permissions + to interact with Bedrock services provided as a plaintext string. If you + prefer to reference your key using Databricks Secrets, see + `aws_secret_access_key`. You must provide an API key using one of the + following fields: `aws_secret_access_key` or + `aws_secret_access_key_plaintext`. + """ + + instance_profile_arn: VariableOrOptional[str] = None + """ + ARN of the instance profile that the external model will use to access AWS resources. + You must authenticate using an instance profile or access keys. + If you prefer to authenticate using access keys, see `aws_access_key_id`, + `aws_access_key_id_plaintext`, `aws_secret_access_key` and `aws_secret_access_key_plaintext`. + """ + + @classmethod + def from_dict(cls, value: "AmazonBedrockConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AmazonBedrockConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class AmazonBedrockConfigDict(TypedDict, total=False): + """""" + + aws_region: VariableOr[str] + """ + The AWS region to use. Bedrock has to be enabled there. + """ + + bedrock_provider: VariableOr[AmazonBedrockConfigBedrockProviderParam] + """ + The underlying provider in Amazon Bedrock. Supported values (case + insensitive) include: Anthropic, Cohere, AI21Labs, Amazon. + """ + + aws_access_key_id: VariableOrOptional[str] + """ + The Databricks secret key reference for an AWS access key ID with + permissions to interact with Bedrock services. If you prefer to paste + your API key directly, see `aws_access_key_id_plaintext`. You must provide an API + key using one of the following fields: `aws_access_key_id` or + `aws_access_key_id_plaintext`. + """ + + aws_access_key_id_plaintext: VariableOrOptional[str] + """ + An AWS access key ID with permissions to interact with Bedrock services + provided as a plaintext string. If you prefer to reference your key using + Databricks Secrets, see `aws_access_key_id`. You must provide an API key + using one of the following fields: `aws_access_key_id` or + `aws_access_key_id_plaintext`. + """ + + aws_secret_access_key: VariableOrOptional[str] + """ + The Databricks secret key reference for an AWS secret access key paired + with the access key ID, with permissions to interact with Bedrock + services. If you prefer to paste your API key directly, see + `aws_secret_access_key_plaintext`. You must provide an API key using one + of the following fields: `aws_secret_access_key` or + `aws_secret_access_key_plaintext`. + """ + + aws_secret_access_key_plaintext: VariableOrOptional[str] + """ + An AWS secret access key paired with the access key ID, with permissions + to interact with Bedrock services provided as a plaintext string. If you + prefer to reference your key using Databricks Secrets, see + `aws_secret_access_key`. You must provide an API key using one of the + following fields: `aws_secret_access_key` or + `aws_secret_access_key_plaintext`. + """ + + instance_profile_arn: VariableOrOptional[str] + """ + ARN of the instance profile that the external model will use to access AWS resources. + You must authenticate using an instance profile or access keys. + If you prefer to authenticate using access keys, see `aws_access_key_id`, + `aws_access_key_id_plaintext`, `aws_secret_access_key` and `aws_secret_access_key_plaintext`. + """ + + +AmazonBedrockConfigParam = AmazonBedrockConfigDict | AmazonBedrockConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/amazon_bedrock_config_bedrock_provider.py b/python/databricks/bundles/model_serving_endpoints/_models/amazon_bedrock_config_bedrock_provider.py new file mode 100644 index 00000000000..bc3de02a2e0 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/amazon_bedrock_config_bedrock_provider.py @@ -0,0 +1,17 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class AmazonBedrockConfigBedrockProvider(Enum): + ANTHROPIC = "anthropic" + COHERE = "cohere" + AI21LABS = "ai21labs" + AMAZON = "amazon" + + +AmazonBedrockConfigBedrockProviderParam = ( + Literal["anthropic", "cohere", "ai21labs", "amazon"] + | AmazonBedrockConfigBedrockProvider +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/anthropic_config.py b/python/databricks/bundles/model_serving_endpoints/_models/anthropic_config.py new file mode 100644 index 00000000000..97ab29711b0 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/anthropic_config.py @@ -0,0 +1,62 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AnthropicConfig: + """""" + + anthropic_api_key: VariableOrOptional[str] = None + """ + The Databricks secret key reference for an Anthropic API key. If you + prefer to paste your API key directly, see `anthropic_api_key_plaintext`. + You must provide an API key using one of the following fields: + `anthropic_api_key` or `anthropic_api_key_plaintext`. + """ + + anthropic_api_key_plaintext: VariableOrOptional[str] = None + """ + The Anthropic API key provided as a plaintext string. If you prefer to + reference your key using Databricks Secrets, see `anthropic_api_key`. You + must provide an API key using one of the following fields: + `anthropic_api_key` or `anthropic_api_key_plaintext`. + """ + + @classmethod + def from_dict(cls, value: "AnthropicConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AnthropicConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class AnthropicConfigDict(TypedDict, total=False): + """""" + + anthropic_api_key: VariableOrOptional[str] + """ + The Databricks secret key reference for an Anthropic API key. If you + prefer to paste your API key directly, see `anthropic_api_key_plaintext`. + You must provide an API key using one of the following fields: + `anthropic_api_key` or `anthropic_api_key_plaintext`. + """ + + anthropic_api_key_plaintext: VariableOrOptional[str] + """ + The Anthropic API key provided as a plaintext string. If you prefer to + reference your key using Databricks Secrets, see `anthropic_api_key`. You + must provide an API key using one of the following fields: + `anthropic_api_key` or `anthropic_api_key_plaintext`. + """ + + +AnthropicConfigParam = AnthropicConfigDict | AnthropicConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/api_key_auth.py b/python/databricks/bundles/model_serving_endpoints/_models/api_key_auth.py new file mode 100644 index 00000000000..a5a33f0aad5 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/api_key_auth.py @@ -0,0 +1,64 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ApiKeyAuth: + """""" + + key: VariableOr[str] + """ + The name of the API key parameter used for authentication. + """ + + value: VariableOrOptional[str] = None + """ + The Databricks secret key reference for an API Key. + If you prefer to paste your token directly, see `value_plaintext`. + """ + + value_plaintext: VariableOrOptional[str] = None + """ + The API Key provided as a plaintext string. If you prefer to reference your + token using Databricks Secrets, see `value`. + """ + + @classmethod + def from_dict(cls, value: "ApiKeyAuthDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ApiKeyAuthDict": + return _transform_to_json_value(self) # type:ignore + + +class ApiKeyAuthDict(TypedDict, total=False): + """""" + + key: VariableOr[str] + """ + The name of the API key parameter used for authentication. + """ + + value: VariableOrOptional[str] + """ + The Databricks secret key reference for an API Key. + If you prefer to paste your token directly, see `value_plaintext`. + """ + + value_plaintext: VariableOrOptional[str] + """ + The API Key provided as a plaintext string. If you prefer to reference your + token using Databricks Secrets, see `value`. + """ + + +ApiKeyAuthParam = ApiKeyAuthDict | ApiKeyAuth diff --git a/python/databricks/bundles/model_serving_endpoints/_models/auto_capture_config_input.py b/python/databricks/bundles/model_serving_endpoints/_models/auto_capture_config_input.py new file mode 100644 index 00000000000..b7e3a5820bb --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/auto_capture_config_input.py @@ -0,0 +1,73 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AutoCaptureConfigInput: + """ + [DEPRECATED] Deprecated: legacy inference table configuration. Please use AI Gateway inference tables instead. + See https://docs.databricks.com/aws/en/ai-gateway/inference-tables. + """ + + catalog_name: VariableOrOptional[str] = None + """ + The name of the catalog in Unity Catalog. NOTE: On update, you cannot change the catalog name if the inference table is already enabled. + """ + + enabled: VariableOrOptional[bool] = None + """ + Indicates whether the inference table is enabled. + """ + + schema_name: VariableOrOptional[str] = None + """ + The name of the schema in Unity Catalog. NOTE: On update, you cannot change the schema name if the inference table is already enabled. + """ + + table_name_prefix: VariableOrOptional[str] = None + """ + The prefix of the table in Unity Catalog. NOTE: On update, you cannot change the prefix name if the inference table is already enabled. + """ + + @classmethod + def from_dict(cls, value: "AutoCaptureConfigInputDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AutoCaptureConfigInputDict": + return _transform_to_json_value(self) # type:ignore + + +class AutoCaptureConfigInputDict(TypedDict, total=False): + """""" + + catalog_name: VariableOrOptional[str] + """ + The name of the catalog in Unity Catalog. NOTE: On update, you cannot change the catalog name if the inference table is already enabled. + """ + + enabled: VariableOrOptional[bool] + """ + Indicates whether the inference table is enabled. + """ + + schema_name: VariableOrOptional[str] + """ + The name of the schema in Unity Catalog. NOTE: On update, you cannot change the schema name if the inference table is already enabled. + """ + + table_name_prefix: VariableOrOptional[str] + """ + The prefix of the table in Unity Catalog. NOTE: On update, you cannot change the prefix name if the inference table is already enabled. + """ + + +AutoCaptureConfigInputParam = AutoCaptureConfigInputDict | AutoCaptureConfigInput diff --git a/python/databricks/bundles/model_serving_endpoints/_models/bearer_token_auth.py b/python/databricks/bundles/model_serving_endpoints/_models/bearer_token_auth.py new file mode 100644 index 00000000000..dc05f6c53c2 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/bearer_token_auth.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class BearerTokenAuth: + """""" + + token: VariableOrOptional[str] = None + """ + The Databricks secret key reference for a token. + If you prefer to paste your token directly, see `token_plaintext`. + """ + + token_plaintext: VariableOrOptional[str] = None + """ + The token provided as a plaintext string. If you prefer to reference your + token using Databricks Secrets, see `token`. + """ + + @classmethod + def from_dict(cls, value: "BearerTokenAuthDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "BearerTokenAuthDict": + return _transform_to_json_value(self) # type:ignore + + +class BearerTokenAuthDict(TypedDict, total=False): + """""" + + token: VariableOrOptional[str] + """ + The Databricks secret key reference for a token. + If you prefer to paste your token directly, see `token_plaintext`. + """ + + token_plaintext: VariableOrOptional[str] + """ + The token provided as a plaintext string. If you prefer to reference your + token using Databricks Secrets, see `token`. + """ + + +BearerTokenAuthParam = BearerTokenAuthDict | BearerTokenAuth diff --git a/python/databricks/bundles/model_serving_endpoints/_models/cohere_config.py b/python/databricks/bundles/model_serving_endpoints/_models/cohere_config.py new file mode 100644 index 00000000000..e70c767e9c2 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/cohere_config.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class CohereConfig: + """""" + + cohere_api_base: VariableOrOptional[str] = None + """ + This is an optional field to provide a customized base URL for the Cohere + API. If left unspecified, the standard Cohere base URL is used. + """ + + cohere_api_key: VariableOrOptional[str] = None + """ + The Databricks secret key reference for a Cohere API key. If you prefer + to paste your API key directly, see `cohere_api_key_plaintext`. You must + provide an API key using one of the following fields: `cohere_api_key` or + `cohere_api_key_plaintext`. + """ + + cohere_api_key_plaintext: VariableOrOptional[str] = None + """ + The Cohere API key provided as a plaintext string. If you prefer to + reference your key using Databricks Secrets, see `cohere_api_key`. You + must provide an API key using one of the following fields: + `cohere_api_key` or `cohere_api_key_plaintext`. + """ + + @classmethod + def from_dict(cls, value: "CohereConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "CohereConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class CohereConfigDict(TypedDict, total=False): + """""" + + cohere_api_base: VariableOrOptional[str] + """ + This is an optional field to provide a customized base URL for the Cohere + API. If left unspecified, the standard Cohere base URL is used. + """ + + cohere_api_key: VariableOrOptional[str] + """ + The Databricks secret key reference for a Cohere API key. If you prefer + to paste your API key directly, see `cohere_api_key_plaintext`. You must + provide an API key using one of the following fields: `cohere_api_key` or + `cohere_api_key_plaintext`. + """ + + cohere_api_key_plaintext: VariableOrOptional[str] + """ + The Cohere API key provided as a plaintext string. If you prefer to + reference your key using Databricks Secrets, see `cohere_api_key`. You + must provide an API key using one of the following fields: + `cohere_api_key` or `cohere_api_key_plaintext`. + """ + + +CohereConfigParam = CohereConfigDict | CohereConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/custom_provider_config.py b/python/databricks/bundles/model_serving_endpoints/_models/custom_provider_config.py new file mode 100644 index 00000000000..e50b61d00ff --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/custom_provider_config.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.api_key_auth import ( + ApiKeyAuth, + ApiKeyAuthParam, +) +from databricks.bundles.model_serving_endpoints._models.bearer_token_auth import ( + BearerTokenAuth, + BearerTokenAuthParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class CustomProviderConfig: + """ + Configs needed to create a custom provider model route. + """ + + custom_provider_url: VariableOr[str] + """ + This is a field to provide the URL of the custom provider API. + """ + + api_key_auth: VariableOrOptional[ApiKeyAuth] = None + """ + This is a field to provide API key authentication for the custom provider API. + You can only specify one authentication method. + """ + + bearer_token_auth: VariableOrOptional[BearerTokenAuth] = None + """ + This is a field to provide bearer token authentication for the custom provider API. + You can only specify one authentication method. + """ + + @classmethod + def from_dict(cls, value: "CustomProviderConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "CustomProviderConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class CustomProviderConfigDict(TypedDict, total=False): + """""" + + custom_provider_url: VariableOr[str] + """ + This is a field to provide the URL of the custom provider API. + """ + + api_key_auth: VariableOrOptional[ApiKeyAuthParam] + """ + This is a field to provide API key authentication for the custom provider API. + You can only specify one authentication method. + """ + + bearer_token_auth: VariableOrOptional[BearerTokenAuthParam] + """ + This is a field to provide bearer token authentication for the custom provider API. + You can only specify one authentication method. + """ + + +CustomProviderConfigParam = CustomProviderConfigDict | CustomProviderConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/databricks_model_serving_config.py b/python/databricks/bundles/model_serving_endpoints/_models/databricks_model_serving_config.py new file mode 100644 index 00000000000..72f17e7c5de --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/databricks_model_serving_config.py @@ -0,0 +1,84 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DatabricksModelServingConfig: + """""" + + databricks_workspace_url: VariableOr[str] + """ + The URL of the Databricks workspace containing the model serving endpoint + pointed to by this external model. + """ + + databricks_api_token: VariableOrOptional[str] = None + """ + The Databricks secret key reference for a Databricks API token that + corresponds to a user or service principal with Can Query access to the + model serving endpoint pointed to by this external model. If you prefer + to paste your API key directly, see `databricks_api_token_plaintext`. You + must provide an API key using one of the following fields: + `databricks_api_token` or `databricks_api_token_plaintext`. + """ + + databricks_api_token_plaintext: VariableOrOptional[str] = None + """ + The Databricks API token that corresponds to a user or service principal + with Can Query access to the model serving endpoint pointed to by this + external model provided as a plaintext string. If you prefer to reference + your key using Databricks Secrets, see `databricks_api_token`. You must + provide an API key using one of the following fields: + `databricks_api_token` or `databricks_api_token_plaintext`. + """ + + @classmethod + def from_dict(cls, value: "DatabricksModelServingConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DatabricksModelServingConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class DatabricksModelServingConfigDict(TypedDict, total=False): + """""" + + databricks_workspace_url: VariableOr[str] + """ + The URL of the Databricks workspace containing the model serving endpoint + pointed to by this external model. + """ + + databricks_api_token: VariableOrOptional[str] + """ + The Databricks secret key reference for a Databricks API token that + corresponds to a user or service principal with Can Query access to the + model serving endpoint pointed to by this external model. If you prefer + to paste your API key directly, see `databricks_api_token_plaintext`. You + must provide an API key using one of the following fields: + `databricks_api_token` or `databricks_api_token_plaintext`. + """ + + databricks_api_token_plaintext: VariableOrOptional[str] + """ + The Databricks API token that corresponds to a user or service principal + with Can Query access to the model serving endpoint pointed to by this + external model provided as a plaintext string. If you prefer to reference + your key using Databricks Secrets, see `databricks_api_token`. You must + provide an API key using one of the following fields: + `databricks_api_token` or `databricks_api_token_plaintext`. + """ + + +DatabricksModelServingConfigParam = ( + DatabricksModelServingConfigDict | DatabricksModelServingConfig +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/email_notifications.py b/python/databricks/bundles/model_serving_endpoints/_models/email_notifications.py new file mode 100644 index 00000000000..3eaeb0a8358 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/email_notifications.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class EmailNotifications: + """""" + + on_update_failure: VariableOrList[str] = field(default_factory=list) + """ + A list of email addresses to be notified when an endpoint fails to update its configuration or state. + """ + + on_update_success: VariableOrList[str] = field(default_factory=list) + """ + A list of email addresses to be notified when an endpoint successfully updates its configuration or state. + """ + + @classmethod + def from_dict(cls, value: "EmailNotificationsDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "EmailNotificationsDict": + return _transform_to_json_value(self) # type:ignore + + +class EmailNotificationsDict(TypedDict, total=False): + """""" + + on_update_failure: VariableOrList[str] + """ + A list of email addresses to be notified when an endpoint fails to update its configuration or state. + """ + + on_update_success: VariableOrList[str] + """ + A list of email addresses to be notified when an endpoint successfully updates its configuration or state. + """ + + +EmailNotificationsParam = EmailNotificationsDict | EmailNotifications diff --git a/python/databricks/bundles/model_serving_endpoints/_models/endpoint_core_config_input.py b/python/databricks/bundles/model_serving_endpoints/_models/endpoint_core_config_input.py new file mode 100644 index 00000000000..b74a53e067d --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/endpoint_core_config_input.py @@ -0,0 +1,92 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.auto_capture_config_input import ( + AutoCaptureConfigInput, + AutoCaptureConfigInputParam, +) +from databricks.bundles.model_serving_endpoints._models.served_entity_input import ( + ServedEntityInput, + ServedEntityInputParam, +) +from databricks.bundles.model_serving_endpoints._models.served_model_input import ( + ServedModelInput, + ServedModelInputParam, +) +from databricks.bundles.model_serving_endpoints._models.traffic_config import ( + TrafficConfig, + TrafficConfigParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class EndpointCoreConfigInput: + """""" + + auto_capture_config: VariableOrOptional[AutoCaptureConfigInput] = None + """ + [DEPRECATED] Configuration for legacy Inference Tables which automatically log requests and responses to Unity + Catalog. + Deprecated: please use AI Gateway inference tables instead. See + https://docs.databricks.com/aws/en/ai-gateway/inference-tables. + """ + + served_entities: VariableOrList[ServedEntityInput] = field(default_factory=list) + """ + The list of served entities under the serving endpoint config. + """ + + served_models: VariableOrList[ServedModelInput] = field(default_factory=list) + """ + (Deprecated, use served_entities instead) The list of served models under the serving endpoint config. + """ + + traffic_config: VariableOrOptional[TrafficConfig] = None + """ + The traffic configuration associated with the serving endpoint config. + """ + + @classmethod + def from_dict(cls, value: "EndpointCoreConfigInputDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "EndpointCoreConfigInputDict": + return _transform_to_json_value(self) # type:ignore + + +class EndpointCoreConfigInputDict(TypedDict, total=False): + """""" + + auto_capture_config: VariableOrOptional[AutoCaptureConfigInputParam] + """ + [DEPRECATED] Configuration for legacy Inference Tables which automatically log requests and responses to Unity + Catalog. + Deprecated: please use AI Gateway inference tables instead. See + https://docs.databricks.com/aws/en/ai-gateway/inference-tables. + """ + + served_entities: VariableOrList[ServedEntityInputParam] + """ + The list of served entities under the serving endpoint config. + """ + + served_models: VariableOrList[ServedModelInputParam] + """ + (Deprecated, use served_entities instead) The list of served models under the serving endpoint config. + """ + + traffic_config: VariableOrOptional[TrafficConfigParam] + """ + The traffic configuration associated with the serving endpoint config. + """ + + +EndpointCoreConfigInputParam = EndpointCoreConfigInputDict | EndpointCoreConfigInput diff --git a/python/databricks/bundles/model_serving_endpoints/_models/endpoint_tag.py b/python/databricks/bundles/model_serving_endpoints/_models/endpoint_tag.py new file mode 100644 index 00000000000..ee2bc8943d1 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/endpoint_tag.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class EndpointTag: + """""" + + key: VariableOr[str] + """ + Key field for a serving endpoint tag. + """ + + value: VariableOrOptional[str] = None + """ + Optional value field for a serving endpoint tag. + """ + + @classmethod + def from_dict(cls, value: "EndpointTagDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "EndpointTagDict": + return _transform_to_json_value(self) # type:ignore + + +class EndpointTagDict(TypedDict, total=False): + """""" + + key: VariableOr[str] + """ + Key field for a serving endpoint tag. + """ + + value: VariableOrOptional[str] + """ + Optional value field for a serving endpoint tag. + """ + + +EndpointTagParam = EndpointTagDict | EndpointTag diff --git a/python/databricks/bundles/model_serving_endpoints/_models/external_model.py b/python/databricks/bundles/model_serving_endpoints/_models/external_model.py new file mode 100644 index 00000000000..0f2fe2a6224 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/external_model.py @@ -0,0 +1,194 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.ai21_labs_config import ( + Ai21LabsConfig, + Ai21LabsConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.amazon_bedrock_config import ( + AmazonBedrockConfig, + AmazonBedrockConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.anthropic_config import ( + AnthropicConfig, + AnthropicConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.cohere_config import ( + CohereConfig, + CohereConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.custom_provider_config import ( + CustomProviderConfig, + CustomProviderConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.databricks_model_serving_config import ( + DatabricksModelServingConfig, + DatabricksModelServingConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.external_model_provider import ( + ExternalModelProvider, + ExternalModelProviderParam, +) +from databricks.bundles.model_serving_endpoints._models.google_cloud_vertex_ai_config import ( + GoogleCloudVertexAiConfig, + GoogleCloudVertexAiConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.open_ai_config import ( + OpenAiConfig, + OpenAiConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.pa_lm_config import ( + PaLmConfig, + PaLmConfigParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ExternalModel: + """""" + + name: VariableOr[str] + """ + The name of the external model. + """ + + provider: VariableOr[ExternalModelProvider] + """ + The name of the provider for the external model. Currently, the supported providers are 'ai21labs', 'anthropic', 'amazon-bedrock', 'cohere', 'databricks-model-serving', 'google-cloud-vertex-ai', 'openai', 'palm', and 'custom'. + """ + + task: VariableOr[str] + """ + The task type of the external model. + """ + + ai21labs_config: VariableOrOptional[Ai21LabsConfig] = None + """ + AI21Labs Config. Only required if the provider is 'ai21labs'. + """ + + amazon_bedrock_config: VariableOrOptional[AmazonBedrockConfig] = None + """ + Amazon Bedrock Config. Only required if the provider is 'amazon-bedrock'. + """ + + anthropic_config: VariableOrOptional[AnthropicConfig] = None + """ + Anthropic Config. Only required if the provider is 'anthropic'. + """ + + cohere_config: VariableOrOptional[CohereConfig] = None + """ + Cohere Config. Only required if the provider is 'cohere'. + """ + + custom_provider_config: VariableOrOptional[CustomProviderConfig] = None + """ + Custom Provider Config. Only required if the provider is 'custom'. + """ + + databricks_model_serving_config: VariableOrOptional[ + DatabricksModelServingConfig + ] = None + """ + Databricks Model Serving Config. Only required if the provider is 'databricks-model-serving'. + """ + + google_cloud_vertex_ai_config: VariableOrOptional[GoogleCloudVertexAiConfig] = None + """ + Google Cloud Vertex AI Config. Only required if the provider is 'google-cloud-vertex-ai'. + """ + + openai_config: VariableOrOptional[OpenAiConfig] = None + """ + OpenAI Config. Only required if the provider is 'openai'. + """ + + palm_config: VariableOrOptional[PaLmConfig] = None + """ + PaLM Config. Only required if the provider is 'palm'. + """ + + @classmethod + def from_dict(cls, value: "ExternalModelDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ExternalModelDict": + return _transform_to_json_value(self) # type:ignore + + +class ExternalModelDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + The name of the external model. + """ + + provider: VariableOr[ExternalModelProviderParam] + """ + The name of the provider for the external model. Currently, the supported providers are 'ai21labs', 'anthropic', 'amazon-bedrock', 'cohere', 'databricks-model-serving', 'google-cloud-vertex-ai', 'openai', 'palm', and 'custom'. + """ + + task: VariableOr[str] + """ + The task type of the external model. + """ + + ai21labs_config: VariableOrOptional[Ai21LabsConfigParam] + """ + AI21Labs Config. Only required if the provider is 'ai21labs'. + """ + + amazon_bedrock_config: VariableOrOptional[AmazonBedrockConfigParam] + """ + Amazon Bedrock Config. Only required if the provider is 'amazon-bedrock'. + """ + + anthropic_config: VariableOrOptional[AnthropicConfigParam] + """ + Anthropic Config. Only required if the provider is 'anthropic'. + """ + + cohere_config: VariableOrOptional[CohereConfigParam] + """ + Cohere Config. Only required if the provider is 'cohere'. + """ + + custom_provider_config: VariableOrOptional[CustomProviderConfigParam] + """ + Custom Provider Config. Only required if the provider is 'custom'. + """ + + databricks_model_serving_config: VariableOrOptional[ + DatabricksModelServingConfigParam + ] + """ + Databricks Model Serving Config. Only required if the provider is 'databricks-model-serving'. + """ + + google_cloud_vertex_ai_config: VariableOrOptional[GoogleCloudVertexAiConfigParam] + """ + Google Cloud Vertex AI Config. Only required if the provider is 'google-cloud-vertex-ai'. + """ + + openai_config: VariableOrOptional[OpenAiConfigParam] + """ + OpenAI Config. Only required if the provider is 'openai'. + """ + + palm_config: VariableOrOptional[PaLmConfigParam] + """ + PaLM Config. Only required if the provider is 'palm'. + """ + + +ExternalModelParam = ExternalModelDict | ExternalModel diff --git a/python/databricks/bundles/model_serving_endpoints/_models/external_model_provider.py b/python/databricks/bundles/model_serving_endpoints/_models/external_model_provider.py new file mode 100644 index 00000000000..ee3ef3e0c08 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/external_model_provider.py @@ -0,0 +1,32 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ExternalModelProvider(Enum): + AI21LABS = "ai21labs" + ANTHROPIC = "anthropic" + AMAZON_BEDROCK = "amazon-bedrock" + COHERE = "cohere" + DATABRICKS_MODEL_SERVING = "databricks-model-serving" + GOOGLE_CLOUD_VERTEX_AI = "google-cloud-vertex-ai" + OPENAI = "openai" + PALM = "palm" + CUSTOM = "custom" + + +ExternalModelProviderParam = ( + Literal[ + "ai21labs", + "anthropic", + "amazon-bedrock", + "cohere", + "databricks-model-serving", + "google-cloud-vertex-ai", + "openai", + "palm", + "custom", + ] + | ExternalModelProvider +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/fallback_config.py b/python/databricks/bundles/model_serving_endpoints/_models/fallback_config.py new file mode 100644 index 00000000000..c96493b0982 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/fallback_config.py @@ -0,0 +1,46 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class FallbackConfig: + """""" + + enabled: VariableOr[bool] + """ + Whether to enable traffic fallback. When a served entity in the serving endpoint returns specific error + codes (e.g. 500), the request will automatically be round-robin attempted with other served entities in the same + endpoint, following the order of served entity list, until a successful response is returned. + If all attempts fail, return the last response with the error code. + """ + + @classmethod + def from_dict(cls, value: "FallbackConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "FallbackConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class FallbackConfigDict(TypedDict, total=False): + """""" + + enabled: VariableOr[bool] + """ + Whether to enable traffic fallback. When a served entity in the serving endpoint returns specific error + codes (e.g. 500), the request will automatically be round-robin attempted with other served entities in the same + endpoint, following the order of served entity list, until a successful response is returned. + If all attempts fail, return the last response with the error code. + """ + + +FallbackConfigParam = FallbackConfigDict | FallbackConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/google_cloud_vertex_ai_config.py b/python/databricks/bundles/model_serving_endpoints/_models/google_cloud_vertex_ai_config.py new file mode 100644 index 00000000000..5b8e3030f56 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/google_cloud_vertex_ai_config.py @@ -0,0 +1,110 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class GoogleCloudVertexAiConfig: + """""" + + project_id: VariableOr[str] + """ + This is the Google Cloud project id that the service account is + associated with. + """ + + region: VariableOr[str] + """ + This is the region for the Google Cloud Vertex AI Service. See [supported + regions] for more details. Some models are only available in specific + regions. + + [supported regions]: https://cloud.google.com/vertex-ai/docs/general/locations + """ + + private_key: VariableOrOptional[str] = None + """ + The Databricks secret key reference for a private key for the service + account which has access to the Google Cloud Vertex AI Service. See [Best + practices for managing service account keys]. If you prefer to paste your + API key directly, see `private_key_plaintext`. You must provide an API + key using one of the following fields: `private_key` or + `private_key_plaintext` + + [Best practices for managing service account keys]: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys + """ + + private_key_plaintext: VariableOrOptional[str] = None + """ + The private key for the service account which has access to the Google + Cloud Vertex AI Service provided as a plaintext secret. See [Best + practices for managing service account keys]. If you prefer to reference + your key using Databricks Secrets, see `private_key`. You must provide an + API key using one of the following fields: `private_key` or + `private_key_plaintext`. + + [Best practices for managing service account keys]: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys + """ + + @classmethod + def from_dict(cls, value: "GoogleCloudVertexAiConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "GoogleCloudVertexAiConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class GoogleCloudVertexAiConfigDict(TypedDict, total=False): + """""" + + project_id: VariableOr[str] + """ + This is the Google Cloud project id that the service account is + associated with. + """ + + region: VariableOr[str] + """ + This is the region for the Google Cloud Vertex AI Service. See [supported + regions] for more details. Some models are only available in specific + regions. + + [supported regions]: https://cloud.google.com/vertex-ai/docs/general/locations + """ + + private_key: VariableOrOptional[str] + """ + The Databricks secret key reference for a private key for the service + account which has access to the Google Cloud Vertex AI Service. See [Best + practices for managing service account keys]. If you prefer to paste your + API key directly, see `private_key_plaintext`. You must provide an API + key using one of the following fields: `private_key` or + `private_key_plaintext` + + [Best practices for managing service account keys]: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys + """ + + private_key_plaintext: VariableOrOptional[str] + """ + The private key for the service account which has access to the Google + Cloud Vertex AI Service provided as a plaintext secret. See [Best + practices for managing service account keys]. If you prefer to reference + your key using Databricks Secrets, see `private_key`. You must provide an + API key using one of the following fields: `private_key` or + `private_key_plaintext`. + + [Best practices for managing service account keys]: https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys + """ + + +GoogleCloudVertexAiConfigParam = ( + GoogleCloudVertexAiConfigDict | GoogleCloudVertexAiConfig +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/lifecycle.py b/python/databricks/bundles/model_serving_endpoints/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/model_serving_endpoints/_models/model_serving_endpoint.py b/python/databricks/bundles/model_serving_endpoints/_models/model_serving_endpoint.py new file mode 100644 index 00000000000..64ecfbd87d1 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/model_serving_endpoint.py @@ -0,0 +1,185 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.model_serving_endpoints._models.ai_gateway_config import ( + AiGatewayConfig, + AiGatewayConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.email_notifications import ( + EmailNotifications, + EmailNotificationsParam, +) +from databricks.bundles.model_serving_endpoints._models.endpoint_core_config_input import ( + EndpointCoreConfigInput, + EndpointCoreConfigInputParam, +) +from databricks.bundles.model_serving_endpoints._models.endpoint_tag import ( + EndpointTag, + EndpointTagParam, +) +from databricks.bundles.model_serving_endpoints._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint_permission import ( + ModelServingEndpointPermission, + ModelServingEndpointPermissionParam, +) +from databricks.bundles.model_serving_endpoints._models.rate_limit import ( + RateLimit, + RateLimitParam, +) +from databricks.bundles.model_serving_endpoints._models.telemetry_config import ( + TelemetryConfig, + TelemetryConfigParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ModelServingEndpoint(Resource): + """""" + + name: VariableOr[str] + """ + The name of the serving endpoint. This field is required and must be unique across a Databricks workspace. + An endpoint name can consist of alphanumeric characters, dashes, and underscores. + """ + + ai_gateway: VariableOrOptional[AiGatewayConfig] = None + """ + The AI Gateway configuration for the serving endpoint. NOTE: External model, provisioned throughput, and pay-per-token endpoints are fully supported; agent endpoints currently only support inference tables. + """ + + budget_policy_id: VariableOrOptional[str] = None + """ + The budget policy to be applied to the serving endpoint. + """ + + config: VariableOrOptional[EndpointCoreConfigInput] = None + """ + The core config of the serving endpoint. + """ + + description: VariableOrOptional[str] = None + + email_notifications: VariableOrOptional[EmailNotifications] = None + """ + Email notification settings. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[ModelServingEndpointPermission] = field( + default_factory=list + ) + """ + The permissions to apply to this resource. + """ + + rate_limits: VariableOrList[RateLimit] = field(default_factory=list) + """ + [DEPRECATED] Rate limits to be applied to the serving endpoint. NOTE: this field is deprecated, please use AI Gateway to manage rate limits. + """ + + route_optimized: VariableOrOptional[bool] = None + """ + Enable route optimization for the serving endpoint. + """ + + tags: VariableOrList[EndpointTag] = field(default_factory=list) + """ + Tags to be attached to the serving endpoint and automatically propagated to billing logs. + """ + + telemetry_config: VariableOrOptional[TelemetryConfig] = None + """ + [Public Preview] Configuration for persisting endpoint telemetry (logs, traces, and metrics) to Unity Catalog tables. + """ + + @classmethod + def from_dict(cls, value: "ModelServingEndpointDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ModelServingEndpointDict": + return _transform_to_json_value(self) # type:ignore + + +class ModelServingEndpointDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + The name of the serving endpoint. This field is required and must be unique across a Databricks workspace. + An endpoint name can consist of alphanumeric characters, dashes, and underscores. + """ + + ai_gateway: VariableOrOptional[AiGatewayConfigParam] + """ + The AI Gateway configuration for the serving endpoint. NOTE: External model, provisioned throughput, and pay-per-token endpoints are fully supported; agent endpoints currently only support inference tables. + """ + + budget_policy_id: VariableOrOptional[str] + """ + The budget policy to be applied to the serving endpoint. + """ + + config: VariableOrOptional[EndpointCoreConfigInputParam] + """ + The core config of the serving endpoint. + """ + + description: VariableOrOptional[str] + + email_notifications: VariableOrOptional[EmailNotificationsParam] + """ + Email notification settings. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[ModelServingEndpointPermissionParam] + """ + The permissions to apply to this resource. + """ + + rate_limits: VariableOrList[RateLimitParam] + """ + [DEPRECATED] Rate limits to be applied to the serving endpoint. NOTE: this field is deprecated, please use AI Gateway to manage rate limits. + """ + + route_optimized: VariableOrOptional[bool] + """ + Enable route optimization for the serving endpoint. + """ + + tags: VariableOrList[EndpointTagParam] + """ + Tags to be attached to the serving endpoint and automatically propagated to billing logs. + """ + + telemetry_config: VariableOrOptional[TelemetryConfigParam] + """ + [Public Preview] Configuration for persisting endpoint telemetry (logs, traces, and metrics) to Unity Catalog tables. + """ + + +ModelServingEndpointParam = ModelServingEndpointDict | ModelServingEndpoint diff --git a/python/databricks/bundles/model_serving_endpoints/_models/model_serving_endpoint_permission.py b/python/databricks/bundles/model_serving_endpoints/_models/model_serving_endpoint_permission.py new file mode 100644 index 00000000000..82e2fdc054a --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/model_serving_endpoint_permission.py @@ -0,0 +1,76 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.serving_endpoint_permission_level import ( + ServingEndpointPermissionLevel, + ServingEndpointPermissionLevelParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ModelServingEndpointPermission: + """""" + + level: VariableOr[ServingEndpointPermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. + """ + + @classmethod + def from_dict(cls, value: "ModelServingEndpointPermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ModelServingEndpointPermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class ModelServingEndpointPermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[ServingEndpointPermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. + """ + + +ModelServingEndpointPermissionParam = ( + ModelServingEndpointPermissionDict | ModelServingEndpointPermission +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/open_ai_config.py b/python/databricks/bundles/model_serving_endpoints/_models/open_ai_config.py new file mode 100644 index 00000000000..e19a4eac665 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/open_ai_config.py @@ -0,0 +1,200 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class OpenAiConfig: + """ + Configs needed to create an OpenAI model route. + """ + + microsoft_entra_client_id: VariableOrOptional[str] = None + """ + This field is only required for Azure AD OpenAI and is the Microsoft + Entra Client ID. + """ + + microsoft_entra_client_secret: VariableOrOptional[str] = None + """ + The Databricks secret key reference for a client secret used for + Microsoft Entra ID authentication. If you prefer to paste your client + secret directly, see `microsoft_entra_client_secret_plaintext`. You must + provide an API key using one of the following fields: + `microsoft_entra_client_secret` or + `microsoft_entra_client_secret_plaintext`. + """ + + microsoft_entra_client_secret_plaintext: VariableOrOptional[str] = None + """ + The client secret used for Microsoft Entra ID authentication provided as + a plaintext string. If you prefer to reference your key using Databricks + Secrets, see `microsoft_entra_client_secret`. You must provide an API key + using one of the following fields: `microsoft_entra_client_secret` or + `microsoft_entra_client_secret_plaintext`. + """ + + microsoft_entra_tenant_id: VariableOrOptional[str] = None + """ + This field is only required for Azure AD OpenAI and is the Microsoft + Entra Tenant ID. + """ + + openai_api_base: VariableOrOptional[str] = None + """ + This is a field to provide a customized base URl for the OpenAI API. For + Azure OpenAI, this field is required, and is the base URL for the Azure + OpenAI API service provided by Azure. For other OpenAI API types, this + field is optional, and if left unspecified, the standard OpenAI base URL + is used. + """ + + openai_api_key: VariableOrOptional[str] = None + """ + The Databricks secret key reference for an OpenAI API key using the + OpenAI or Azure service. If you prefer to paste your API key directly, + see `openai_api_key_plaintext`. You must provide an API key using one of + the following fields: `openai_api_key` or `openai_api_key_plaintext`. + """ + + openai_api_key_plaintext: VariableOrOptional[str] = None + """ + The OpenAI API key using the OpenAI or Azure service provided as a + plaintext string. If you prefer to reference your key using Databricks + Secrets, see `openai_api_key`. You must provide an API key using one of + the following fields: `openai_api_key` or `openai_api_key_plaintext`. + """ + + openai_api_type: VariableOrOptional[str] = None + """ + This is an optional field to specify the type of OpenAI API to use. For + Azure OpenAI, this field is required, and adjust this parameter to + represent the preferred security access validation protocol. For access + token validation, use azure. For authentication using Azure Active + Directory (Azure AD) use, azuread. + """ + + openai_api_version: VariableOrOptional[str] = None + """ + This is an optional field to specify the OpenAI API version. For Azure + OpenAI, this field is required, and is the version of the Azure OpenAI + service to utilize, specified by a date. + """ + + openai_deployment_name: VariableOrOptional[str] = None + """ + This field is only required for Azure OpenAI and is the name of the + deployment resource for the Azure OpenAI service. + """ + + openai_organization: VariableOrOptional[str] = None + """ + This is an optional field to specify the organization in OpenAI or Azure + OpenAI. + """ + + @classmethod + def from_dict(cls, value: "OpenAiConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "OpenAiConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class OpenAiConfigDict(TypedDict, total=False): + """""" + + microsoft_entra_client_id: VariableOrOptional[str] + """ + This field is only required for Azure AD OpenAI and is the Microsoft + Entra Client ID. + """ + + microsoft_entra_client_secret: VariableOrOptional[str] + """ + The Databricks secret key reference for a client secret used for + Microsoft Entra ID authentication. If you prefer to paste your client + secret directly, see `microsoft_entra_client_secret_plaintext`. You must + provide an API key using one of the following fields: + `microsoft_entra_client_secret` or + `microsoft_entra_client_secret_plaintext`. + """ + + microsoft_entra_client_secret_plaintext: VariableOrOptional[str] + """ + The client secret used for Microsoft Entra ID authentication provided as + a plaintext string. If you prefer to reference your key using Databricks + Secrets, see `microsoft_entra_client_secret`. You must provide an API key + using one of the following fields: `microsoft_entra_client_secret` or + `microsoft_entra_client_secret_plaintext`. + """ + + microsoft_entra_tenant_id: VariableOrOptional[str] + """ + This field is only required for Azure AD OpenAI and is the Microsoft + Entra Tenant ID. + """ + + openai_api_base: VariableOrOptional[str] + """ + This is a field to provide a customized base URl for the OpenAI API. For + Azure OpenAI, this field is required, and is the base URL for the Azure + OpenAI API service provided by Azure. For other OpenAI API types, this + field is optional, and if left unspecified, the standard OpenAI base URL + is used. + """ + + openai_api_key: VariableOrOptional[str] + """ + The Databricks secret key reference for an OpenAI API key using the + OpenAI or Azure service. If you prefer to paste your API key directly, + see `openai_api_key_plaintext`. You must provide an API key using one of + the following fields: `openai_api_key` or `openai_api_key_plaintext`. + """ + + openai_api_key_plaintext: VariableOrOptional[str] + """ + The OpenAI API key using the OpenAI or Azure service provided as a + plaintext string. If you prefer to reference your key using Databricks + Secrets, see `openai_api_key`. You must provide an API key using one of + the following fields: `openai_api_key` or `openai_api_key_plaintext`. + """ + + openai_api_type: VariableOrOptional[str] + """ + This is an optional field to specify the type of OpenAI API to use. For + Azure OpenAI, this field is required, and adjust this parameter to + represent the preferred security access validation protocol. For access + token validation, use azure. For authentication using Azure Active + Directory (Azure AD) use, azuread. + """ + + openai_api_version: VariableOrOptional[str] + """ + This is an optional field to specify the OpenAI API version. For Azure + OpenAI, this field is required, and is the version of the Azure OpenAI + service to utilize, specified by a date. + """ + + openai_deployment_name: VariableOrOptional[str] + """ + This field is only required for Azure OpenAI and is the name of the + deployment resource for the Azure OpenAI service. + """ + + openai_organization: VariableOrOptional[str] + """ + This is an optional field to specify the organization in OpenAI or Azure + OpenAI. + """ + + +OpenAiConfigParam = OpenAiConfigDict | OpenAiConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/pa_lm_config.py b/python/databricks/bundles/model_serving_endpoints/_models/pa_lm_config.py new file mode 100644 index 00000000000..98e5c572687 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/pa_lm_config.py @@ -0,0 +1,62 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class PaLmConfig: + """""" + + palm_api_key: VariableOrOptional[str] = None + """ + The Databricks secret key reference for a PaLM API key. If you prefer to + paste your API key directly, see `palm_api_key_plaintext`. You must + provide an API key using one of the following fields: `palm_api_key` or + `palm_api_key_plaintext`. + """ + + palm_api_key_plaintext: VariableOrOptional[str] = None + """ + The PaLM API key provided as a plaintext string. If you prefer to + reference your key using Databricks Secrets, see `palm_api_key`. You must + provide an API key using one of the following fields: `palm_api_key` or + `palm_api_key_plaintext`. + """ + + @classmethod + def from_dict(cls, value: "PaLmConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "PaLmConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class PaLmConfigDict(TypedDict, total=False): + """""" + + palm_api_key: VariableOrOptional[str] + """ + The Databricks secret key reference for a PaLM API key. If you prefer to + paste your API key directly, see `palm_api_key_plaintext`. You must + provide an API key using one of the following fields: `palm_api_key` or + `palm_api_key_plaintext`. + """ + + palm_api_key_plaintext: VariableOrOptional[str] + """ + The PaLM API key provided as a plaintext string. If you prefer to + reference your key using Databricks Secrets, see `palm_api_key`. You must + provide an API key using one of the following fields: `palm_api_key` or + `palm_api_key_plaintext`. + """ + + +PaLmConfigParam = PaLmConfigDict | PaLmConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/rate_limit.py b/python/databricks/bundles/model_serving_endpoints/_models/rate_limit.py new file mode 100644 index 00000000000..5a0192df8ce --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/rate_limit.py @@ -0,0 +1,70 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.rate_limit_key import ( + RateLimitKey, + RateLimitKeyParam, +) +from databricks.bundles.model_serving_endpoints._models.rate_limit_renewal_period import ( + RateLimitRenewalPeriod, + RateLimitRenewalPeriodParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class RateLimit: + """ + [DEPRECATED] + """ + + calls: VariableOr[int] + """ + Used to specify how many calls are allowed for a key within the renewal_period. + """ + + renewal_period: VariableOr[RateLimitRenewalPeriod] + """ + Renewal period field for a serving endpoint rate limit. Currently, only 'minute' is supported. + """ + + key: VariableOrOptional[RateLimitKey] = None + """ + Key field for a serving endpoint rate limit. Currently, only 'user' and 'endpoint' are supported, with 'endpoint' being the default if not specified. + """ + + @classmethod + def from_dict(cls, value: "RateLimitDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "RateLimitDict": + return _transform_to_json_value(self) # type:ignore + + +class RateLimitDict(TypedDict, total=False): + """""" + + calls: VariableOr[int] + """ + Used to specify how many calls are allowed for a key within the renewal_period. + """ + + renewal_period: VariableOr[RateLimitRenewalPeriodParam] + """ + Renewal period field for a serving endpoint rate limit. Currently, only 'minute' is supported. + """ + + key: VariableOrOptional[RateLimitKeyParam] + """ + Key field for a serving endpoint rate limit. Currently, only 'user' and 'endpoint' are supported, with 'endpoint' being the default if not specified. + """ + + +RateLimitParam = RateLimitDict | RateLimit diff --git a/python/databricks/bundles/model_serving_endpoints/_models/rate_limit_key.py b/python/databricks/bundles/model_serving_endpoints/_models/rate_limit_key.py new file mode 100644 index 00000000000..b6ebe9db1c4 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/rate_limit_key.py @@ -0,0 +1,16 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class RateLimitKey(Enum): + """ + [DEPRECATED] + """ + + USER = "user" + ENDPOINT = "endpoint" + + +RateLimitKeyParam = Literal["user", "endpoint"] | RateLimitKey diff --git a/python/databricks/bundles/model_serving_endpoints/_models/rate_limit_renewal_period.py b/python/databricks/bundles/model_serving_endpoints/_models/rate_limit_renewal_period.py new file mode 100644 index 00000000000..81f900bf39f --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/rate_limit_renewal_period.py @@ -0,0 +1,15 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class RateLimitRenewalPeriod(Enum): + """ + [DEPRECATED] + """ + + MINUTE = "minute" + + +RateLimitRenewalPeriodParam = Literal["minute"] | RateLimitRenewalPeriod diff --git a/python/databricks/bundles/model_serving_endpoints/_models/route.py b/python/databricks/bundles/model_serving_endpoints/_models/route.py new file mode 100644 index 00000000000..eba4336b0fc --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/route.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Route: + """""" + + traffic_percentage: VariableOr[int] + """ + The percentage of endpoint traffic to send to this route. It must be an integer between 0 and 100 inclusive. + """ + + served_entity_name: VariableOrOptional[str] = None + + served_model_name: VariableOrOptional[str] = None + """ + The name of the served model this route configures traffic for. + """ + + @classmethod + def from_dict(cls, value: "RouteDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "RouteDict": + return _transform_to_json_value(self) # type:ignore + + +class RouteDict(TypedDict, total=False): + """""" + + traffic_percentage: VariableOr[int] + """ + The percentage of endpoint traffic to send to this route. It must be an integer between 0 and 100 inclusive. + """ + + served_entity_name: VariableOrOptional[str] + + served_model_name: VariableOrOptional[str] + """ + The name of the served model this route configures traffic for. + """ + + +RouteParam = RouteDict | Route diff --git a/python/databricks/bundles/model_serving_endpoints/_models/served_entity_input.py b/python/databricks/bundles/model_serving_endpoints/_models/served_entity_input.py new file mode 100644 index 00000000000..e40050ca3e6 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/served_entity_input.py @@ -0,0 +1,186 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrDict, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.external_model import ( + ExternalModel, + ExternalModelParam, +) +from databricks.bundles.model_serving_endpoints._models.serving_model_workload_type import ( + ServingModelWorkloadType, + ServingModelWorkloadTypeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ServedEntityInput: + """""" + + burst_scaling_enabled: VariableOrOptional[bool] = None + """ + [Public Preview] Whether burst scaling is enabled. When enabled (default), the endpoint can automatically + scale up beyond provisioned capacity to handle traffic spikes. When disabled, the endpoint + maintains fixed capacity at provisioned_model_units. + """ + + entity_name: VariableOrOptional[str] = None + """ + The name of the entity to be served. The entity may be a model in the Databricks Model Registry, a model in the Unity Catalog (UC), or a function of type FEATURE_SPEC in the UC. If it is a UC object, the full name of the object should be given in the form of **catalog_name.schema_name.model_name**. + """ + + entity_version: VariableOrOptional[str] = None + + environment_vars: VariableOrDict[str] = field(default_factory=dict) + """ + An object containing a set of optional, user-specified environment variable key-value pairs used for serving this entity. Note: this is an experimental feature and subject to change. Example entity environment variables that refer to Databricks secrets: `{"OPENAI_API_KEY": "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": "{{secrets/my_scope2/my_key2}}"}` + """ + + external_model: VariableOrOptional[ExternalModel] = None + """ + The external model to be served. NOTE: Only one of external_model and (entity_name, entity_version, workload_size, workload_type, and scale_to_zero_enabled) can be specified with the latter set being used for custom model serving for a Databricks registered model. For an existing endpoint with external_model, it cannot be updated to an endpoint without external_model. If the endpoint is created without external_model, users cannot update it to add external_model later. The task type of all external models within an endpoint must be the same. + """ + + instance_profile_arn: VariableOrOptional[str] = None + """ + [Public Preview] ARN of the instance profile that the served entity uses to access AWS resources. + """ + + max_provisioned_concurrency: VariableOrOptional[int] = None + """ + The maximum provisioned concurrency that the endpoint can scale up to. Do not use if workload_size is specified. + """ + + max_provisioned_throughput: VariableOrOptional[int] = None + """ + The maximum tokens per second that the endpoint can scale up to. + """ + + min_provisioned_concurrency: VariableOrOptional[int] = None + """ + The minimum provisioned concurrency that the endpoint can scale down to. Do not use if workload_size is specified. + """ + + min_provisioned_throughput: VariableOrOptional[int] = None + """ + The minimum tokens per second that the endpoint can scale down to. + """ + + name: VariableOrOptional[str] = None + """ + The name of a served entity. It must be unique across an endpoint. A served entity name can consist of alphanumeric characters, dashes, and underscores. If not specified for an external model, this field defaults to external_model.name, with '.' and ':' replaced with '-', and if not specified for other entities, it defaults to entity_name-entity_version. + """ + + provisioned_model_units: VariableOrOptional[int] = None + """ + [Public Preview] The number of model units provisioned. + """ + + scale_to_zero_enabled: VariableOrOptional[bool] = None + """ + Whether the compute resources for the served entity should scale down to zero. + """ + + workload_size: VariableOrOptional[str] = None + """ + The workload size of the served entity. The workload size corresponds to a range of provisioned concurrency that the compute autoscales between. A single unit of provisioned concurrency can process one request at a time. Valid workload sizes are "Small" (4 - 4 provisioned concurrency), "Medium" (8 - 16 provisioned concurrency), and "Large" (16 - 64 provisioned concurrency). Additional custom workload sizes can also be used when available in the workspace. If scale-to-zero is enabled, the lower bound of the provisioned concurrency for each workload size is 0. Do not use if min_provisioned_concurrency and max_provisioned_concurrency are specified. + """ + + workload_type: VariableOrOptional[ServingModelWorkloadType] = None + """ + The workload type of the served entity. The workload type selects which type of compute to use in the endpoint. The default value for this parameter is "CPU". For deep learning workloads, GPU acceleration is available by selecting workload types like GPU_SMALL and others. See the available [GPU types](https://docs.databricks.com/en/machine-learning/model-serving/create-manage-serving-endpoints.html#gpu-workload-types). + """ + + @classmethod + def from_dict(cls, value: "ServedEntityInputDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ServedEntityInputDict": + return _transform_to_json_value(self) # type:ignore + + +class ServedEntityInputDict(TypedDict, total=False): + """""" + + burst_scaling_enabled: VariableOrOptional[bool] + """ + [Public Preview] Whether burst scaling is enabled. When enabled (default), the endpoint can automatically + scale up beyond provisioned capacity to handle traffic spikes. When disabled, the endpoint + maintains fixed capacity at provisioned_model_units. + """ + + entity_name: VariableOrOptional[str] + """ + The name of the entity to be served. The entity may be a model in the Databricks Model Registry, a model in the Unity Catalog (UC), or a function of type FEATURE_SPEC in the UC. If it is a UC object, the full name of the object should be given in the form of **catalog_name.schema_name.model_name**. + """ + + entity_version: VariableOrOptional[str] + + environment_vars: VariableOrDict[str] + """ + An object containing a set of optional, user-specified environment variable key-value pairs used for serving this entity. Note: this is an experimental feature and subject to change. Example entity environment variables that refer to Databricks secrets: `{"OPENAI_API_KEY": "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": "{{secrets/my_scope2/my_key2}}"}` + """ + + external_model: VariableOrOptional[ExternalModelParam] + """ + The external model to be served. NOTE: Only one of external_model and (entity_name, entity_version, workload_size, workload_type, and scale_to_zero_enabled) can be specified with the latter set being used for custom model serving for a Databricks registered model. For an existing endpoint with external_model, it cannot be updated to an endpoint without external_model. If the endpoint is created without external_model, users cannot update it to add external_model later. The task type of all external models within an endpoint must be the same. + """ + + instance_profile_arn: VariableOrOptional[str] + """ + [Public Preview] ARN of the instance profile that the served entity uses to access AWS resources. + """ + + max_provisioned_concurrency: VariableOrOptional[int] + """ + The maximum provisioned concurrency that the endpoint can scale up to. Do not use if workload_size is specified. + """ + + max_provisioned_throughput: VariableOrOptional[int] + """ + The maximum tokens per second that the endpoint can scale up to. + """ + + min_provisioned_concurrency: VariableOrOptional[int] + """ + The minimum provisioned concurrency that the endpoint can scale down to. Do not use if workload_size is specified. + """ + + min_provisioned_throughput: VariableOrOptional[int] + """ + The minimum tokens per second that the endpoint can scale down to. + """ + + name: VariableOrOptional[str] + """ + The name of a served entity. It must be unique across an endpoint. A served entity name can consist of alphanumeric characters, dashes, and underscores. If not specified for an external model, this field defaults to external_model.name, with '.' and ':' replaced with '-', and if not specified for other entities, it defaults to entity_name-entity_version. + """ + + provisioned_model_units: VariableOrOptional[int] + """ + [Public Preview] The number of model units provisioned. + """ + + scale_to_zero_enabled: VariableOrOptional[bool] + """ + Whether the compute resources for the served entity should scale down to zero. + """ + + workload_size: VariableOrOptional[str] + """ + The workload size of the served entity. The workload size corresponds to a range of provisioned concurrency that the compute autoscales between. A single unit of provisioned concurrency can process one request at a time. Valid workload sizes are "Small" (4 - 4 provisioned concurrency), "Medium" (8 - 16 provisioned concurrency), and "Large" (16 - 64 provisioned concurrency). Additional custom workload sizes can also be used when available in the workspace. If scale-to-zero is enabled, the lower bound of the provisioned concurrency for each workload size is 0. Do not use if min_provisioned_concurrency and max_provisioned_concurrency are specified. + """ + + workload_type: VariableOrOptional[ServingModelWorkloadTypeParam] + """ + The workload type of the served entity. The workload type selects which type of compute to use in the endpoint. The default value for this parameter is "CPU". For deep learning workloads, GPU acceleration is available by selecting workload types like GPU_SMALL and others. See the available [GPU types](https://docs.databricks.com/en/machine-learning/model-serving/create-manage-serving-endpoints.html#gpu-workload-types). + """ + + +ServedEntityInputParam = ServedEntityInputDict | ServedEntityInput diff --git a/python/databricks/bundles/model_serving_endpoints/_models/served_model_input.py b/python/databricks/bundles/model_serving_endpoints/_models/served_model_input.py new file mode 100644 index 00000000000..90c98757af5 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/served_model_input.py @@ -0,0 +1,170 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrOptional, +) +from databricks.bundles.model_serving_endpoints._models.served_model_input_workload_type import ( + ServedModelInputWorkloadType, + ServedModelInputWorkloadTypeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ServedModelInput: + """""" + + model_name: VariableOr[str] + + model_version: VariableOr[str] + + scale_to_zero_enabled: VariableOr[bool] + """ + Whether the compute resources for the served entity should scale down to zero. + """ + + burst_scaling_enabled: VariableOrOptional[bool] = None + """ + [Public Preview] Whether burst scaling is enabled. When enabled (default), the endpoint can automatically + scale up beyond provisioned capacity to handle traffic spikes. When disabled, the endpoint + maintains fixed capacity at provisioned_model_units. + """ + + environment_vars: VariableOrDict[str] = field(default_factory=dict) + """ + An object containing a set of optional, user-specified environment variable key-value pairs used for serving this entity. Note: this is an experimental feature and subject to change. Example entity environment variables that refer to Databricks secrets: `{"OPENAI_API_KEY": "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": "{{secrets/my_scope2/my_key2}}"}` + """ + + instance_profile_arn: VariableOrOptional[str] = None + """ + [Public Preview] ARN of the instance profile that the served entity uses to access AWS resources. + """ + + max_provisioned_concurrency: VariableOrOptional[int] = None + """ + The maximum provisioned concurrency that the endpoint can scale up to. Do not use if workload_size is specified. + """ + + max_provisioned_throughput: VariableOrOptional[int] = None + """ + The maximum tokens per second that the endpoint can scale up to. + """ + + min_provisioned_concurrency: VariableOrOptional[int] = None + """ + The minimum provisioned concurrency that the endpoint can scale down to. Do not use if workload_size is specified. + """ + + min_provisioned_throughput: VariableOrOptional[int] = None + """ + The minimum tokens per second that the endpoint can scale down to. + """ + + name: VariableOrOptional[str] = None + """ + The name of a served entity. It must be unique across an endpoint. A served entity name can consist of alphanumeric characters, dashes, and underscores. If not specified for an external model, this field defaults to external_model.name, with '.' and ':' replaced with '-', and if not specified for other entities, it defaults to entity_name-entity_version. + """ + + provisioned_model_units: VariableOrOptional[int] = None + """ + [Public Preview] The number of model units provisioned. + """ + + workload_size: VariableOrOptional[str] = None + """ + The workload size of the served entity. The workload size corresponds to a range of provisioned concurrency that the compute autoscales between. A single unit of provisioned concurrency can process one request at a time. Valid workload sizes are "Small" (4 - 4 provisioned concurrency), "Medium" (8 - 16 provisioned concurrency), and "Large" (16 - 64 provisioned concurrency). Additional custom workload sizes can also be used when available in the workspace. If scale-to-zero is enabled, the lower bound of the provisioned concurrency for each workload size is 0. Do not use if min_provisioned_concurrency and max_provisioned_concurrency are specified. + """ + + workload_type: VariableOrOptional[ServedModelInputWorkloadType] = None + """ + The workload type of the served entity. The workload type selects which type of compute to use in the endpoint. The default value for this parameter is "CPU". For deep learning workloads, GPU acceleration is available by selecting workload types like GPU_SMALL and others. See the available [GPU types](https://docs.databricks.com/en/machine-learning/model-serving/create-manage-serving-endpoints.html#gpu-workload-types). + """ + + @classmethod + def from_dict(cls, value: "ServedModelInputDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ServedModelInputDict": + return _transform_to_json_value(self) # type:ignore + + +class ServedModelInputDict(TypedDict, total=False): + """""" + + model_name: VariableOr[str] + + model_version: VariableOr[str] + + scale_to_zero_enabled: VariableOr[bool] + """ + Whether the compute resources for the served entity should scale down to zero. + """ + + burst_scaling_enabled: VariableOrOptional[bool] + """ + [Public Preview] Whether burst scaling is enabled. When enabled (default), the endpoint can automatically + scale up beyond provisioned capacity to handle traffic spikes. When disabled, the endpoint + maintains fixed capacity at provisioned_model_units. + """ + + environment_vars: VariableOrDict[str] + """ + An object containing a set of optional, user-specified environment variable key-value pairs used for serving this entity. Note: this is an experimental feature and subject to change. Example entity environment variables that refer to Databricks secrets: `{"OPENAI_API_KEY": "{{secrets/my_scope/my_key}}", "DATABRICKS_TOKEN": "{{secrets/my_scope2/my_key2}}"}` + """ + + instance_profile_arn: VariableOrOptional[str] + """ + [Public Preview] ARN of the instance profile that the served entity uses to access AWS resources. + """ + + max_provisioned_concurrency: VariableOrOptional[int] + """ + The maximum provisioned concurrency that the endpoint can scale up to. Do not use if workload_size is specified. + """ + + max_provisioned_throughput: VariableOrOptional[int] + """ + The maximum tokens per second that the endpoint can scale up to. + """ + + min_provisioned_concurrency: VariableOrOptional[int] + """ + The minimum provisioned concurrency that the endpoint can scale down to. Do not use if workload_size is specified. + """ + + min_provisioned_throughput: VariableOrOptional[int] + """ + The minimum tokens per second that the endpoint can scale down to. + """ + + name: VariableOrOptional[str] + """ + The name of a served entity. It must be unique across an endpoint. A served entity name can consist of alphanumeric characters, dashes, and underscores. If not specified for an external model, this field defaults to external_model.name, with '.' and ':' replaced with '-', and if not specified for other entities, it defaults to entity_name-entity_version. + """ + + provisioned_model_units: VariableOrOptional[int] + """ + [Public Preview] The number of model units provisioned. + """ + + workload_size: VariableOrOptional[str] + """ + The workload size of the served entity. The workload size corresponds to a range of provisioned concurrency that the compute autoscales between. A single unit of provisioned concurrency can process one request at a time. Valid workload sizes are "Small" (4 - 4 provisioned concurrency), "Medium" (8 - 16 provisioned concurrency), and "Large" (16 - 64 provisioned concurrency). Additional custom workload sizes can also be used when available in the workspace. If scale-to-zero is enabled, the lower bound of the provisioned concurrency for each workload size is 0. Do not use if min_provisioned_concurrency and max_provisioned_concurrency are specified. + """ + + workload_type: VariableOrOptional[ServedModelInputWorkloadTypeParam] + """ + The workload type of the served entity. The workload type selects which type of compute to use in the endpoint. The default value for this parameter is "CPU". For deep learning workloads, GPU acceleration is available by selecting workload types like GPU_SMALL and others. See the available [GPU types](https://docs.databricks.com/en/machine-learning/model-serving/create-manage-serving-endpoints.html#gpu-workload-types). + """ + + +ServedModelInputParam = ServedModelInputDict | ServedModelInput diff --git a/python/databricks/bundles/model_serving_endpoints/_models/served_model_input_workload_type.py b/python/databricks/bundles/model_serving_endpoints/_models/served_model_input_workload_type.py new file mode 100644 index 00000000000..87f62c41e34 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/served_model_input_workload_type.py @@ -0,0 +1,36 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ServedModelInputWorkloadType(Enum): + """ + Please keep this in sync with workload types in InferenceEndpointEntities.scala. + """ + + CPU = "CPU" + GPU_MEDIUM = "GPU_MEDIUM" + GPU_SMALL = "GPU_SMALL" + GPU_LARGE = "GPU_LARGE" + MULTIGPU_MEDIUM = "MULTIGPU_MEDIUM" + CPU_LARGE = "CPU_LARGE" + GPU_XLARGE_8 = "GPU_XLARGE_8" + GPU_XLARGE = "GPU_XLARGE" + CPU_MEDIUM = "CPU_MEDIUM" + + +ServedModelInputWorkloadTypeParam = ( + Literal[ + "CPU", + "GPU_MEDIUM", + "GPU_SMALL", + "GPU_LARGE", + "MULTIGPU_MEDIUM", + "CPU_LARGE", + "GPU_XLARGE_8", + "GPU_XLARGE", + "CPU_MEDIUM", + ] + | ServedModelInputWorkloadType +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/serving_endpoint_permission_level.py b/python/databricks/bundles/model_serving_endpoints/_models/serving_endpoint_permission_level.py new file mode 100644 index 00000000000..d9d75992c54 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/serving_endpoint_permission_level.py @@ -0,0 +1,19 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ServingEndpointPermissionLevel(Enum): + """ + Permission level + """ + + CAN_MANAGE = "CAN_MANAGE" + CAN_QUERY = "CAN_QUERY" + CAN_VIEW = "CAN_VIEW" + + +ServingEndpointPermissionLevelParam = ( + Literal["CAN_MANAGE", "CAN_QUERY", "CAN_VIEW"] | ServingEndpointPermissionLevel +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/serving_model_workload_type.py b/python/databricks/bundles/model_serving_endpoints/_models/serving_model_workload_type.py new file mode 100644 index 00000000000..04b513e77a7 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/serving_model_workload_type.py @@ -0,0 +1,36 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ServingModelWorkloadType(Enum): + """ + Please keep this in sync with workload types in InferenceEndpointEntities.scala. + """ + + CPU = "CPU" + GPU_MEDIUM = "GPU_MEDIUM" + GPU_SMALL = "GPU_SMALL" + GPU_LARGE = "GPU_LARGE" + MULTIGPU_MEDIUM = "MULTIGPU_MEDIUM" + CPU_LARGE = "CPU_LARGE" + GPU_XLARGE_8 = "GPU_XLARGE_8" + GPU_XLARGE = "GPU_XLARGE" + CPU_MEDIUM = "CPU_MEDIUM" + + +ServingModelWorkloadTypeParam = ( + Literal[ + "CPU", + "GPU_MEDIUM", + "GPU_SMALL", + "GPU_LARGE", + "MULTIGPU_MEDIUM", + "CPU_LARGE", + "GPU_XLARGE_8", + "GPU_XLARGE", + "CPU_MEDIUM", + ] + | ServingModelWorkloadType +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/telemetry_config.py b/python/databricks/bundles/model_serving_endpoints/_models/telemetry_config.py new file mode 100644 index 00000000000..cffb10c2642 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/telemetry_config.py @@ -0,0 +1,90 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.model_serving_endpoints._models.telemetry_feature import ( + TelemetryFeature, + TelemetryFeatureParam, +) +from databricks.bundles.model_serving_endpoints._models.telemetry_inference_table_config import ( + TelemetryInferenceTableConfig, + TelemetryInferenceTableConfigParam, +) +from databricks.bundles.model_serving_endpoints._models.unity_catalog_table_names import ( + UnityCatalogTableNames, + UnityCatalogTableNamesParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class TelemetryConfig: + """""" + + enabled_telemetry_features: VariableOrList[TelemetryFeature] = field( + default_factory=list + ) + """ + [Public Preview] The telemetry signals to enable for this endpoint. If empty or omitted, all signals are + enabled; otherwise only the listed signals are enabled. + """ + + inference_table_config: VariableOrOptional[TelemetryInferenceTableConfig] = None + """ + [Public Preview] Configuration for inference table payload logging, including sampling. + """ + + table_names: VariableOrOptional[UnityCatalogTableNames] = None + """ + [Public Preview] The Unity Catalog tables to which endpoint telemetry (logs, traces, and metrics) is exported. + Provide this to create a new telemetry profile for the endpoint from the given tables. + """ + + telemetry_profile_id: VariableOrOptional[str] = None + """ + [Public Preview] The ID of an existing telemetry profile to apply to this endpoint. Provide this to reuse a + telemetry profile that has already been created, instead of specifying table_names. + """ + + @classmethod + def from_dict(cls, value: "TelemetryConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "TelemetryConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class TelemetryConfigDict(TypedDict, total=False): + """""" + + enabled_telemetry_features: VariableOrList[TelemetryFeatureParam] + """ + [Public Preview] The telemetry signals to enable for this endpoint. If empty or omitted, all signals are + enabled; otherwise only the listed signals are enabled. + """ + + inference_table_config: VariableOrOptional[TelemetryInferenceTableConfigParam] + """ + [Public Preview] Configuration for inference table payload logging, including sampling. + """ + + table_names: VariableOrOptional[UnityCatalogTableNamesParam] + """ + [Public Preview] The Unity Catalog tables to which endpoint telemetry (logs, traces, and metrics) is exported. + Provide this to create a new telemetry profile for the endpoint from the given tables. + """ + + telemetry_profile_id: VariableOrOptional[str] + """ + [Public Preview] The ID of an existing telemetry profile to apply to this endpoint. Provide this to reuse a + telemetry profile that has already been created, instead of specifying table_names. + """ + + +TelemetryConfigParam = TelemetryConfigDict | TelemetryConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/telemetry_feature.py b/python/databricks/bundles/model_serving_endpoints/_models/telemetry_feature.py new file mode 100644 index 00000000000..2d74f666c07 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/telemetry_feature.py @@ -0,0 +1,27 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class TelemetryFeature(Enum): + """ + A telemetry signal that a serving endpoint can export to Unity Catalog. Use these values to + select which signals the endpoint exports. + """ + + TELEMETRY_FEATURE_LOGS = "TELEMETRY_FEATURE_LOGS" + TELEMETRY_FEATURE_TRACES = "TELEMETRY_FEATURE_TRACES" + TELEMETRY_FEATURE_METRICS = "TELEMETRY_FEATURE_METRICS" + TELEMETRY_FEATURE_INFERENCE_TABLE = "TELEMETRY_FEATURE_INFERENCE_TABLE" + + +TelemetryFeatureParam = ( + Literal[ + "TELEMETRY_FEATURE_LOGS", + "TELEMETRY_FEATURE_TRACES", + "TELEMETRY_FEATURE_METRICS", + "TELEMETRY_FEATURE_INFERENCE_TABLE", + ] + | TelemetryFeature +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/telemetry_inference_table_config.py b/python/databricks/bundles/model_serving_endpoints/_models/telemetry_inference_table_config.py new file mode 100644 index 00000000000..9153a4c49ac --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/telemetry_inference_table_config.py @@ -0,0 +1,44 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class TelemetryInferenceTableConfig: + """ + Inference table payload logging configuration + """ + + sampling_fraction: VariableOrOptional[float] = None + """ + [Public Preview] Fraction of requests sampled for payload logging, in the range [0.0, 1.0], where 1.0 logs all requests. + """ + + @classmethod + def from_dict(cls, value: "TelemetryInferenceTableConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "TelemetryInferenceTableConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class TelemetryInferenceTableConfigDict(TypedDict, total=False): + """""" + + sampling_fraction: VariableOrOptional[float] + """ + [Public Preview] Fraction of requests sampled for payload logging, in the range [0.0, 1.0], where 1.0 logs all requests. + """ + + +TelemetryInferenceTableConfigParam = ( + TelemetryInferenceTableConfigDict | TelemetryInferenceTableConfig +) diff --git a/python/databricks/bundles/model_serving_endpoints/_models/traffic_config.py b/python/databricks/bundles/model_serving_endpoints/_models/traffic_config.py new file mode 100644 index 00000000000..d25a5c87fef --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/traffic_config.py @@ -0,0 +1,44 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList +from databricks.bundles.model_serving_endpoints._models.route import ( + Route, + RouteParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class TrafficConfig: + """""" + + routes: VariableOrList[Route] = field(default_factory=list) + """ + The list of routes that define traffic to each served entity. + """ + + @classmethod + def from_dict(cls, value: "TrafficConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "TrafficConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class TrafficConfigDict(TypedDict, total=False): + """""" + + routes: VariableOrList[RouteParam] + """ + The list of routes that define traffic to each served entity. + """ + + +TrafficConfigParam = TrafficConfigDict | TrafficConfig diff --git a/python/databricks/bundles/model_serving_endpoints/_models/unity_catalog_table_names.py b/python/databricks/bundles/model_serving_endpoints/_models/unity_catalog_table_names.py new file mode 100644 index 00000000000..5cf8a32d821 --- /dev/null +++ b/python/databricks/bundles/model_serving_endpoints/_models/unity_catalog_table_names.py @@ -0,0 +1,78 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class UnityCatalogTableNames: + """""" + + annotations_table: VariableOrOptional[str] = None + """ + [Public Preview] The full three-level Unity Catalog name (catalog.schema.table) of the table that receives + exported annotations. + """ + + logs_table: VariableOrOptional[str] = None + """ + [Public Preview] The full three-level Unity Catalog name (catalog.schema.table) of the table that receives + exported logs. + """ + + metrics_table: VariableOrOptional[str] = None + """ + [Public Preview] The full three-level Unity Catalog name (catalog.schema.table) of the table that receives + exported metrics. + """ + + traces_table: VariableOrOptional[str] = None + """ + [Public Preview] The full three-level Unity Catalog name (catalog.schema.table) of the table that receives + exported traces (spans). + """ + + @classmethod + def from_dict(cls, value: "UnityCatalogTableNamesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "UnityCatalogTableNamesDict": + return _transform_to_json_value(self) # type:ignore + + +class UnityCatalogTableNamesDict(TypedDict, total=False): + """""" + + annotations_table: VariableOrOptional[str] + """ + [Public Preview] The full three-level Unity Catalog name (catalog.schema.table) of the table that receives + exported annotations. + """ + + logs_table: VariableOrOptional[str] + """ + [Public Preview] The full three-level Unity Catalog name (catalog.schema.table) of the table that receives + exported logs. + """ + + metrics_table: VariableOrOptional[str] + """ + [Public Preview] The full three-level Unity Catalog name (catalog.schema.table) of the table that receives + exported metrics. + """ + + traces_table: VariableOrOptional[str] + """ + [Public Preview] The full three-level Unity Catalog name (catalog.schema.table) of the table that receives + exported traces (spans). + """ + + +UnityCatalogTableNamesParam = UnityCatalogTableNamesDict | UnityCatalogTableNames diff --git a/python/databricks/bundles/models/__init__.py b/python/databricks/bundles/models/__init__.py new file mode 100644 index 00000000000..a3469f1689e --- /dev/null +++ b/python/databricks/bundles/models/__init__.py @@ -0,0 +1,44 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "MlflowModel", + "MlflowModelDict", + "MlflowModelParam", + "MlflowModelPermission", + "MlflowModelPermissionDict", + "MlflowModelPermissionParam", + "ModelTag", + "ModelTagDict", + "ModelTagParam", + "RegisteredModelPermissionLevel", + "RegisteredModelPermissionLevelParam", +] + + +from databricks.bundles.models._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.models._models.mlflow_model import ( + MlflowModel, + MlflowModelDict, + MlflowModelParam, +) +from databricks.bundles.models._models.mlflow_model_permission import ( + MlflowModelPermission, + MlflowModelPermissionDict, + MlflowModelPermissionParam, +) +from databricks.bundles.models._models.model_tag import ( + ModelTag, + ModelTagDict, + ModelTagParam, +) +from databricks.bundles.models._models.registered_model_permission_level import ( + RegisteredModelPermissionLevel, + RegisteredModelPermissionLevelParam, +) diff --git a/python/databricks/bundles/models/_models/lifecycle.py b/python/databricks/bundles/models/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/models/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/models/_models/mlflow_model.py b/python/databricks/bundles/models/_models/mlflow_model.py new file mode 100644 index 00000000000..390f1155f2c --- /dev/null +++ b/python/databricks/bundles/models/_models/mlflow_model.py @@ -0,0 +1,91 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.models._models.lifecycle import Lifecycle, LifecycleParam +from databricks.bundles.models._models.mlflow_model_permission import ( + MlflowModelPermission, + MlflowModelPermissionParam, +) +from databricks.bundles.models._models.model_tag import ModelTag, ModelTagParam + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MlflowModel(Resource): + """""" + + name: VariableOr[str] + """ + Register models under this name + """ + + description: VariableOrOptional[str] = None + """ + Optional description for registered model. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[MlflowModelPermission] = field(default_factory=list) + """ + The permissions to apply to this resource. + """ + + tags: VariableOrList[ModelTag] = field(default_factory=list) + """ + Additional metadata for registered model. + """ + + @classmethod + def from_dict(cls, value: "MlflowModelDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MlflowModelDict": + return _transform_to_json_value(self) # type:ignore + + +class MlflowModelDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + Register models under this name + """ + + description: VariableOrOptional[str] + """ + Optional description for registered model. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[MlflowModelPermissionParam] + """ + The permissions to apply to this resource. + """ + + tags: VariableOrList[ModelTagParam] + """ + Additional metadata for registered model. + """ + + +MlflowModelParam = MlflowModelDict | MlflowModel diff --git a/python/databricks/bundles/models/_models/mlflow_model_permission.py b/python/databricks/bundles/models/_models/mlflow_model_permission.py new file mode 100644 index 00000000000..367cbfd4a3a --- /dev/null +++ b/python/databricks/bundles/models/_models/mlflow_model_permission.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.models._models.registered_model_permission_level import ( + RegisteredModelPermissionLevel, + RegisteredModelPermissionLevelParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MlflowModelPermission: + """""" + + level: VariableOr[RegisteredModelPermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. + """ + + @classmethod + def from_dict(cls, value: "MlflowModelPermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MlflowModelPermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class MlflowModelPermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[RegisteredModelPermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. + """ + + +MlflowModelPermissionParam = MlflowModelPermissionDict | MlflowModelPermission diff --git a/python/databricks/bundles/models/_models/model_tag.py b/python/databricks/bundles/models/_models/model_tag.py new file mode 100644 index 00000000000..b434ad05552 --- /dev/null +++ b/python/databricks/bundles/models/_models/model_tag.py @@ -0,0 +1,52 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class ModelTag: + """ + Tag for a registered model + """ + + key: VariableOrOptional[str] = None + """ + The tag key. + """ + + value: VariableOrOptional[str] = None + """ + The tag value. + """ + + @classmethod + def from_dict(cls, value: "ModelTagDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ModelTagDict": + return _transform_to_json_value(self) # type:ignore + + +class ModelTagDict(TypedDict, total=False): + """""" + + key: VariableOrOptional[str] + """ + The tag key. + """ + + value: VariableOrOptional[str] + """ + The tag value. + """ + + +ModelTagParam = ModelTagDict | ModelTag diff --git a/python/databricks/bundles/models/_models/registered_model_permission_level.py b/python/databricks/bundles/models/_models/registered_model_permission_level.py new file mode 100644 index 00000000000..1344b5d5e48 --- /dev/null +++ b/python/databricks/bundles/models/_models/registered_model_permission_level.py @@ -0,0 +1,28 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class RegisteredModelPermissionLevel(Enum): + """ + Permission level + """ + + CAN_MANAGE = "CAN_MANAGE" + CAN_MANAGE_PRODUCTION_VERSIONS = "CAN_MANAGE_PRODUCTION_VERSIONS" + CAN_MANAGE_STAGING_VERSIONS = "CAN_MANAGE_STAGING_VERSIONS" + CAN_EDIT = "CAN_EDIT" + CAN_READ = "CAN_READ" + + +RegisteredModelPermissionLevelParam = ( + Literal[ + "CAN_MANAGE", + "CAN_MANAGE_PRODUCTION_VERSIONS", + "CAN_MANAGE_STAGING_VERSIONS", + "CAN_EDIT", + "CAN_READ", + ] + | RegisteredModelPermissionLevel +) diff --git a/python/databricks/bundles/pipelines/_models/connector_options.py b/python/databricks/bundles/pipelines/_models/connector_options.py index 5fc9bfce6cc..21b18203a54 100644 --- a/python/databricks/bundles/pipelines/_models/connector_options.py +++ b/python/databricks/bundles/pipelines/_models/connector_options.py @@ -107,11 +107,15 @@ class ConnectorOptions: jira_options: VariableOrOptional[JiraConnectorOptions] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Jira specific options for ingestion """ kafka_options: VariableOrOptional[KafkaOptions] = None """ + :meta private: [EXPERIMENTAL] + [Beta] """ @@ -134,6 +138,8 @@ class ConnectorOptions: meta_ads_options: VariableOrOptional[MetaMarketingOptions] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Meta Marketing (Meta Ads) specific options for ingestion """ @@ -218,11 +224,15 @@ class ConnectorOptionsDict(TypedDict, total=False): jira_options: VariableOrOptional[JiraConnectorOptionsParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Jira specific options for ingestion """ kafka_options: VariableOrOptional[KafkaOptionsParam] """ + :meta private: [EXPERIMENTAL] + [Beta] """ @@ -245,6 +255,8 @@ class ConnectorOptionsDict(TypedDict, total=False): meta_ads_options: VariableOrOptional[MetaMarketingOptionsParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Meta Marketing (Meta Ads) specific options for ingestion """ diff --git a/python/databricks/bundles/pipelines/_models/ingestion_pipeline_definition_fanout_options.py b/python/databricks/bundles/pipelines/_models/ingestion_pipeline_definition_fanout_options.py index d2e17ce0c9d..092b91581ed 100644 --- a/python/databricks/bundles/pipelines/_models/ingestion_pipeline_definition_fanout_options.py +++ b/python/databricks/bundles/pipelines/_models/ingestion_pipeline_definition_fanout_options.py @@ -26,6 +26,8 @@ class IngestionPipelineDefinitionFanoutOptions: fanout_by: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Column path or SQL expression whose value determines the destination table. Supports dotted paths (e.g. "value.event_name") and expressions (e.g. "value:event_name::string"). @@ -33,6 +35,8 @@ class IngestionPipelineDefinitionFanoutOptions: transforms: VariableOrList[Transformer] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] Optional transforms applied to each route's DataFrame before writing to the destination table. """ @@ -50,6 +54,8 @@ class IngestionPipelineDefinitionFanoutOptionsDict(TypedDict, total=False): fanout_by: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Column path or SQL expression whose value determines the destination table. Supports dotted paths (e.g. "value.event_name") and expressions (e.g. "value:event_name::string"). @@ -57,6 +63,8 @@ class IngestionPipelineDefinitionFanoutOptionsDict(TypedDict, total=False): transforms: VariableOrList[TransformerParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Optional transforms applied to each route's DataFrame before writing to the destination table. """ diff --git a/python/databricks/bundles/pipelines/_models/ingestion_pipeline_definition_table_specific_config_query_based_connector_config.py b/python/databricks/bundles/pipelines/_models/ingestion_pipeline_definition_table_specific_config_query_based_connector_config.py index 2ef994bb09e..a784bb6e8b4 100644 --- a/python/databricks/bundles/pipelines/_models/ingestion_pipeline_definition_table_specific_config_query_based_connector_config.py +++ b/python/databricks/bundles/pipelines/_models/ingestion_pipeline_definition_table_specific_config_query_based_connector_config.py @@ -40,6 +40,8 @@ class IngestionPipelineDefinitionTableSpecificConfigQueryBasedConnectorConfig: hard_deletion_sync_min_interval_in_seconds: VariableOrOptional[int] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Specifies the minimum interval (in seconds) between snapshots on primary keys for detecting and synchronizing hard deletions—i.e., rows that have been physically removed from the source table. @@ -91,6 +93,8 @@ class IngestionPipelineDefinitionTableSpecificConfigQueryBasedConnectorConfigDic hard_deletion_sync_min_interval_in_seconds: VariableOrOptional[int] """ + :meta private: [EXPERIMENTAL] + [Beta] Specifies the minimum interval (in seconds) between snapshots on primary keys for detecting and synchronizing hard deletions—i.e., rows that have been physically removed from the source table. diff --git a/python/databricks/bundles/pipelines/_models/jira_connector_options.py b/python/databricks/bundles/pipelines/_models/jira_connector_options.py index beb6f273455..ef7ba677587 100644 --- a/python/databricks/bundles/pipelines/_models/jira_connector_options.py +++ b/python/databricks/bundles/pipelines/_models/jira_connector_options.py @@ -19,6 +19,8 @@ class JiraConnectorOptions: include_jira_spaces: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Projects to filter Jira data on """ @@ -35,6 +37,8 @@ class JiraConnectorOptionsDict(TypedDict, total=False): include_jira_spaces: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Projects to filter Jira data on """ diff --git a/python/databricks/bundles/pipelines/_models/json_transformer_options.py b/python/databricks/bundles/pipelines/_models/json_transformer_options.py index ef2b9592efc..8359f564eb2 100644 --- a/python/databricks/bundles/pipelines/_models/json_transformer_options.py +++ b/python/databricks/bundles/pipelines/_models/json_transformer_options.py @@ -21,11 +21,15 @@ class JsonTransformerOptions: as_variant: VariableOrOptional[bool] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Parse the entire value as a single Variant column. """ schema: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Inline schema string for JSON parsing (Spark DDL format). """ @@ -33,16 +37,22 @@ class JsonTransformerOptions: FileIngestionOptionsSchemaEvolutionMode ] = None """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Schema evolution mode for schema inference. """ schema_file_path: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Path to a schema file (.ddl). """ schema_hints: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Schema hints as a comma-separated string of "column_name type" pairs. """ @@ -59,11 +69,15 @@ class JsonTransformerOptionsDict(TypedDict, total=False): as_variant: VariableOrOptional[bool] """ + :meta private: [EXPERIMENTAL] + [Beta] Parse the entire value as a single Variant column. """ schema: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Inline schema string for JSON parsing (Spark DDL format). """ @@ -71,16 +85,22 @@ class JsonTransformerOptionsDict(TypedDict, total=False): FileIngestionOptionsSchemaEvolutionModeParam ] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Schema evolution mode for schema inference. """ schema_file_path: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Path to a schema file (.ddl). """ schema_hints: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Schema hints as a comma-separated string of "column_name type" pairs. """ diff --git a/python/databricks/bundles/pipelines/_models/kafka_options.py b/python/databricks/bundles/pipelines/_models/kafka_options.py index 3277d532b86..d42b585624d 100644 --- a/python/databricks/bundles/pipelines/_models/kafka_options.py +++ b/python/databricks/bundles/pipelines/_models/kafka_options.py @@ -34,6 +34,8 @@ class KafkaOptions: key_transformer: VariableOrOptional[Transformer] = None """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Transformer for the message key. If not specified, the key is left as raw bytes. """ @@ -47,24 +49,32 @@ class KafkaOptions: starting_offset: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Where to begin reading when no checkpoint exists. Valid values: "latest" and "earliest". Defaults to "latest". """ topic_pattern: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Java regex pattern to subscribe to matching topics. Only one of topics or topic_pattern must be specified. """ topics: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] Topics to subscribe to. Only one of topics or topic_pattern must be specified. """ value_transformer: VariableOrOptional[Transformer] = None """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Transformer for the message value. If not specified, the value is left as raw bytes. """ @@ -91,6 +101,8 @@ class KafkaOptionsDict(TypedDict, total=False): key_transformer: VariableOrOptional[TransformerParam] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Transformer for the message key. If not specified, the key is left as raw bytes. """ @@ -104,24 +116,32 @@ class KafkaOptionsDict(TypedDict, total=False): starting_offset: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Where to begin reading when no checkpoint exists. Valid values: "latest" and "earliest". Defaults to "latest". """ topic_pattern: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Java regex pattern to subscribe to matching topics. Only one of topics or topic_pattern must be specified. """ topics: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Topics to subscribe to. Only one of topics or topic_pattern must be specified. """ value_transformer: VariableOrOptional[TransformerParam] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Transformer for the message value. If not specified, the value is left as raw bytes. """ diff --git a/python/databricks/bundles/pipelines/_models/meta_marketing_options.py b/python/databricks/bundles/pipelines/_models/meta_marketing_options.py index 4a3a244183f..9a9f657bf5f 100644 --- a/python/databricks/bundles/pipelines/_models/meta_marketing_options.py +++ b/python/databricks/bundles/pipelines/_models/meta_marketing_options.py @@ -23,28 +23,38 @@ class MetaMarketingOptions: action_attribution_windows: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.action_attribution_windows) Action attribution windows for insights reporting (e.g. "28d_click", "1d_view") """ action_breakdowns: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.action_breakdowns) Action breakdowns """ action_report_time: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.action_report_time) Timing used to report action statistics (impression, conversion, mixed, or lifetime) """ breakdowns: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.breakdowns) Breakdowns to configure """ custom_insights_lookback_window: VariableOrOptional[int] = None """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Window in days to revisit data during sync to capture updated conversion data from the API, shared by prebuilt and custom reports. """ @@ -62,18 +72,24 @@ class MetaMarketingOptions: level: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.level) Granularity of data to pull (account, ad, adset, campaign) """ start_date: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Start date in yyyy-MM-dd format (e.g. 2025-01-15). Data added after this date will be ingested, shared by prebuilt and custom reports. """ time_increment: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.time_increment) Value in string by which to aggregate statistics (can take all_days, monthly or number of days) """ @@ -91,28 +107,38 @@ class MetaMarketingOptionsDict(TypedDict, total=False): action_attribution_windows: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.action_attribution_windows) Action attribution windows for insights reporting (e.g. "28d_click", "1d_view") """ action_breakdowns: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.action_breakdowns) Action breakdowns """ action_report_time: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.action_report_time) Timing used to report action statistics (impression, conversion, mixed, or lifetime) """ breakdowns: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.breakdowns) Breakdowns to configure """ custom_insights_lookback_window: VariableOrOptional[int] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Window in days to revisit data during sync to capture updated conversion data from the API, shared by prebuilt and custom reports. """ @@ -130,18 +156,24 @@ class MetaMarketingOptionsDict(TypedDict, total=False): level: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.level) Granularity of data to pull (account, ad, adset, campaign) """ start_date: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Start date in yyyy-MM-dd format (e.g. 2025-01-15). Data added after this date will be ingested, shared by prebuilt and custom reports. """ time_increment: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [DEPRECATED] [Beta] (Optional, DEPRECATED — use custom_report_options.time_increment) Value in string by which to aggregate statistics (can take all_days, monthly or number of days) """ diff --git a/python/databricks/bundles/pipelines/_models/pipeline.py b/python/databricks/bundles/pipelines/_models/pipeline.py index 9f179f7c7a9..3e8a25086a6 100644 --- a/python/databricks/bundles/pipelines/_models/pipeline.py +++ b/python/databricks/bundles/pipelines/_models/pipeline.py @@ -169,6 +169,8 @@ class Pipeline(Resource): parameters: VariableOrDict[str] = field(default_factory=dict) """ + :meta private: [EXPERIMENTAL] + [Beta] Key/value map of default parameters to use for pipeline execution. Maximum total size: 10k characters (JSON format) """ @@ -360,6 +362,8 @@ class PipelineDict(TypedDict, total=False): parameters: VariableOrDict[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Key/value map of default parameters to use for pipeline execution. Maximum total size: 10k characters (JSON format) """ diff --git a/python/databricks/bundles/pipelines/_models/pipelines_environment.py b/python/databricks/bundles/pipelines/_models/pipelines_environment.py index 095104bf8a2..28e9f089094 100644 --- a/python/databricks/bundles/pipelines/_models/pipelines_environment.py +++ b/python/databricks/bundles/pipelines/_models/pipelines_environment.py @@ -27,6 +27,8 @@ class PipelinesEnvironment: environment_version: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] The environment version of the serverless Python environment used to execute customer Python code. Each environment version includes a specific Python version and a curated set of pre-installed libraries with defined versions, @@ -59,6 +61,8 @@ class PipelinesEnvironmentDict(TypedDict, total=False): environment_version: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] The environment version of the serverless Python environment used to execute customer Python code. Each environment version includes a specific Python version and a curated set of pre-installed libraries with defined versions, diff --git a/python/databricks/bundles/pipelines/_models/schema_spec.py b/python/databricks/bundles/pipelines/_models/schema_spec.py index b3dd638c455..ca2ff08bdc7 100644 --- a/python/databricks/bundles/pipelines/_models/schema_spec.py +++ b/python/databricks/bundles/pipelines/_models/schema_spec.py @@ -53,6 +53,8 @@ class SchemaSpec: fanout_options: VariableOrOptional[IngestionPipelineDefinitionFanoutOptions] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Fanout options for multi-table routing from streaming sources. When set, records are routed to destination tables based on a per-record routing key. The key value becomes the table name: @@ -106,6 +108,8 @@ class SchemaSpecDict(TypedDict, total=False): fanout_options: VariableOrOptional[IngestionPipelineDefinitionFanoutOptionsParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Fanout options for multi-table routing from streaming sources. When set, records are routed to destination tables based on a per-record routing key. The key value becomes the table name: diff --git a/python/databricks/bundles/pipelines/_models/table_specific_config.py b/python/databricks/bundles/pipelines/_models/table_specific_config.py index 1b4c26a748e..42773ae759e 100644 --- a/python/databricks/bundles/pipelines/_models/table_specific_config.py +++ b/python/databricks/bundles/pipelines/_models/table_specific_config.py @@ -52,6 +52,8 @@ class TableSpecificConfig: clustering_columns: VariableOrList[str] = field(default_factory=list) """ + :meta private: [EXPERIMENTAL] + [Beta] List of column names to use for clustering the destination table. When specified, the destination Delta table will be clustered by these columns. This can improve query performance when filtering on these columns. @@ -62,6 +64,8 @@ class TableSpecificConfig: enable_auto_clustering: VariableOrOptional[bool] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Whether to enable auto clustering on the destination table. When enabled, Delta will automatically optimize the data layout based on the clustering columns for improved query performance. @@ -125,12 +129,16 @@ class TableSpecificConfig: source_metadata_column: VariableOrOptional[str] = None """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Name of the struct column added to each ingested record to hold per row source metadata. """ table_properties: VariableOrDict[str] = field(default_factory=dict) """ + :meta private: [EXPERIMENTAL] + [Beta] Table properties to set on the destination table. These are key-value pairs that configure various Delta table behaviors or any user defined properties. Example: {"delta.feature.variantType": "supported", "delta.enableTypeWidening": "true"} @@ -174,6 +182,8 @@ class TableSpecificConfigDict(TypedDict, total=False): clustering_columns: VariableOrList[str] """ + :meta private: [EXPERIMENTAL] + [Beta] List of column names to use for clustering the destination table. When specified, the destination Delta table will be clustered by these columns. This can improve query performance when filtering on these columns. @@ -184,6 +194,8 @@ class TableSpecificConfigDict(TypedDict, total=False): enable_auto_clustering: VariableOrOptional[bool] """ + :meta private: [EXPERIMENTAL] + [Beta] Whether to enable auto clustering on the destination table. When enabled, Delta will automatically optimize the data layout based on the clustering columns for improved query performance. @@ -247,12 +259,16 @@ class TableSpecificConfigDict(TypedDict, total=False): source_metadata_column: VariableOrOptional[str] """ + :meta private: [EXPERIMENTAL] + [Beta] (Optional) Name of the struct column added to each ingested record to hold per row source metadata. """ table_properties: VariableOrDict[str] """ + :meta private: [EXPERIMENTAL] + [Beta] Table properties to set on the destination table. These are key-value pairs that configure various Delta table behaviors or any user defined properties. Example: {"delta.feature.variantType": "supported", "delta.enableTypeWidening": "true"} diff --git a/python/databricks/bundles/pipelines/_models/transformer.py b/python/databricks/bundles/pipelines/_models/transformer.py index b7823c623bb..861e50c096d 100644 --- a/python/databricks/bundles/pipelines/_models/transformer.py +++ b/python/databricks/bundles/pipelines/_models/transformer.py @@ -27,6 +27,8 @@ class Transformer: format: VariableOrOptional[TransformerFormat] = None """ + :meta private: [EXPERIMENTAL] + [Beta] Required: the wire format of the data. """ @@ -40,6 +42,8 @@ class Transformer: json_options: VariableOrOptional[JsonTransformerOptions] = None """ + :meta private: [EXPERIMENTAL] + [Beta] """ @@ -64,6 +68,8 @@ class TransformerDict(TypedDict, total=False): format: VariableOrOptional[TransformerFormatParam] """ + :meta private: [EXPERIMENTAL] + [Beta] Required: the wire format of the data. """ @@ -77,6 +83,8 @@ class TransformerDict(TypedDict, total=False): json_options: VariableOrOptional[JsonTransformerOptionsParam] """ + :meta private: [EXPERIMENTAL] + [Beta] """ diff --git a/python/databricks/bundles/quality_monitors/__init__.py b/python/databricks/bundles/quality_monitors/__init__.py new file mode 100644 index 00000000000..ad0902bfcf6 --- /dev/null +++ b/python/databricks/bundles/quality_monitors/__init__.py @@ -0,0 +1,104 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "MonitorCronSchedule", + "MonitorCronScheduleDict", + "MonitorCronScheduleParam", + "MonitorCronSchedulePauseStatus", + "MonitorCronSchedulePauseStatusParam", + "MonitorDataClassificationConfig", + "MonitorDataClassificationConfigDict", + "MonitorDataClassificationConfigParam", + "MonitorDestination", + "MonitorDestinationDict", + "MonitorDestinationParam", + "MonitorInferenceLog", + "MonitorInferenceLogDict", + "MonitorInferenceLogParam", + "MonitorInferenceLogProblemType", + "MonitorInferenceLogProblemTypeParam", + "MonitorMetric", + "MonitorMetricDict", + "MonitorMetricParam", + "MonitorMetricType", + "MonitorMetricTypeParam", + "MonitorNotifications", + "MonitorNotificationsDict", + "MonitorNotificationsParam", + "MonitorSnapshot", + "MonitorSnapshotDict", + "MonitorSnapshotParam", + "MonitorTimeSeries", + "MonitorTimeSeriesDict", + "MonitorTimeSeriesParam", + "QualityMonitor", + "QualityMonitorDict", + "QualityMonitorParam", +] + + +from databricks.bundles.quality_monitors._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.quality_monitors._models.monitor_cron_schedule import ( + MonitorCronSchedule, + MonitorCronScheduleDict, + MonitorCronScheduleParam, +) +from databricks.bundles.quality_monitors._models.monitor_cron_schedule_pause_status import ( + MonitorCronSchedulePauseStatus, + MonitorCronSchedulePauseStatusParam, +) +from databricks.bundles.quality_monitors._models.monitor_data_classification_config import ( + MonitorDataClassificationConfig, + MonitorDataClassificationConfigDict, + MonitorDataClassificationConfigParam, +) +from databricks.bundles.quality_monitors._models.monitor_destination import ( + MonitorDestination, + MonitorDestinationDict, + MonitorDestinationParam, +) +from databricks.bundles.quality_monitors._models.monitor_inference_log import ( + MonitorInferenceLog, + MonitorInferenceLogDict, + MonitorInferenceLogParam, +) +from databricks.bundles.quality_monitors._models.monitor_inference_log_problem_type import ( + MonitorInferenceLogProblemType, + MonitorInferenceLogProblemTypeParam, +) +from databricks.bundles.quality_monitors._models.monitor_metric import ( + MonitorMetric, + MonitorMetricDict, + MonitorMetricParam, +) +from databricks.bundles.quality_monitors._models.monitor_metric_type import ( + MonitorMetricType, + MonitorMetricTypeParam, +) +from databricks.bundles.quality_monitors._models.monitor_notifications import ( + MonitorNotifications, + MonitorNotificationsDict, + MonitorNotificationsParam, +) +from databricks.bundles.quality_monitors._models.monitor_snapshot import ( + MonitorSnapshot, + MonitorSnapshotDict, + MonitorSnapshotParam, +) +from databricks.bundles.quality_monitors._models.monitor_time_series import ( + MonitorTimeSeries, + MonitorTimeSeriesDict, + MonitorTimeSeriesParam, +) +from databricks.bundles.quality_monitors._models.quality_monitor import ( + QualityMonitor, + QualityMonitorDict, + QualityMonitorParam, +) diff --git a/python/databricks/bundles/quality_monitors/_models/lifecycle.py b/python/databricks/bundles/quality_monitors/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_cron_schedule.py b/python/databricks/bundles/quality_monitors/_models/monitor_cron_schedule.py new file mode 100644 index 00000000000..02a8de80077 --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_cron_schedule.py @@ -0,0 +1,64 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.quality_monitors._models.monitor_cron_schedule_pause_status import ( + MonitorCronSchedulePauseStatus, + MonitorCronSchedulePauseStatusParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MonitorCronSchedule: + """""" + + quartz_cron_expression: VariableOr[str] + """ + The expression that determines when to run the monitor. See [examples](https://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html). + """ + + timezone_id: VariableOr[str] + """ + The timezone id (e.g., ``PST``) in which to evaluate the quartz expression. + """ + + pause_status: VariableOrOptional[MonitorCronSchedulePauseStatus] = None + """ + Read only field that indicates whether a schedule is paused or not. + """ + + @classmethod + def from_dict(cls, value: "MonitorCronScheduleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MonitorCronScheduleDict": + return _transform_to_json_value(self) # type:ignore + + +class MonitorCronScheduleDict(TypedDict, total=False): + """""" + + quartz_cron_expression: VariableOr[str] + """ + The expression that determines when to run the monitor. See [examples](https://www.quartz-scheduler.org/documentation/quartz-2.3.0/tutorials/crontrigger.html). + """ + + timezone_id: VariableOr[str] + """ + The timezone id (e.g., ``PST``) in which to evaluate the quartz expression. + """ + + pause_status: VariableOrOptional[MonitorCronSchedulePauseStatusParam] + """ + Read only field that indicates whether a schedule is paused or not. + """ + + +MonitorCronScheduleParam = MonitorCronScheduleDict | MonitorCronSchedule diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_cron_schedule_pause_status.py b/python/databricks/bundles/quality_monitors/_models/monitor_cron_schedule_pause_status.py new file mode 100644 index 00000000000..69b5dd3666b --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_cron_schedule_pause_status.py @@ -0,0 +1,20 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class MonitorCronSchedulePauseStatus(Enum): + """ + Source link: https://src.dev.databricks.com/databricks/universe/-/blob/elastic-spark-common/api/messages/schedule.proto + Monitoring workflow schedule pause status. + """ + + UNSPECIFIED = "UNSPECIFIED" + UNPAUSED = "UNPAUSED" + PAUSED = "PAUSED" + + +MonitorCronSchedulePauseStatusParam = ( + Literal["UNSPECIFIED", "UNPAUSED", "PAUSED"] | MonitorCronSchedulePauseStatus +) diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_data_classification_config.py b/python/databricks/bundles/quality_monitors/_models/monitor_data_classification_config.py new file mode 100644 index 00000000000..cda4e643683 --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_data_classification_config.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MonitorDataClassificationConfig: + """ + :meta private: [EXPERIMENTAL] + + Data classification related configuration. + """ + + enabled: VariableOrOptional[bool] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Whether to enable data classification. + """ + + @classmethod + def from_dict(cls, value: "MonitorDataClassificationConfigDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MonitorDataClassificationConfigDict": + return _transform_to_json_value(self) # type:ignore + + +class MonitorDataClassificationConfigDict(TypedDict, total=False): + """""" + + enabled: VariableOrOptional[bool] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Whether to enable data classification. + """ + + +MonitorDataClassificationConfigParam = ( + MonitorDataClassificationConfigDict | MonitorDataClassificationConfig +) diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_destination.py b/python/databricks/bundles/quality_monitors/_models/monitor_destination.py new file mode 100644 index 00000000000..2f4f5b1d37f --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_destination.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MonitorDestination: + """""" + + email_addresses: VariableOrList[str] = field(default_factory=list) + """ + The list of email addresses to send the notification to. A maximum of 5 email addresses is supported. + """ + + @classmethod + def from_dict(cls, value: "MonitorDestinationDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MonitorDestinationDict": + return _transform_to_json_value(self) # type:ignore + + +class MonitorDestinationDict(TypedDict, total=False): + """""" + + email_addresses: VariableOrList[str] + """ + The list of email addresses to send the notification to. A maximum of 5 email addresses is supported. + """ + + +MonitorDestinationParam = MonitorDestinationDict | MonitorDestination diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_inference_log.py b/python/databricks/bundles/quality_monitors/_models/monitor_inference_log.py new file mode 100644 index 00000000000..24b6ea70e87 --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_inference_log.py @@ -0,0 +1,108 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.quality_monitors._models.monitor_inference_log_problem_type import ( + MonitorInferenceLogProblemType, + MonitorInferenceLogProblemTypeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MonitorInferenceLog: + """""" + + model_id_col: VariableOr[str] + """ + Column for the model identifier. + """ + + prediction_col: VariableOr[str] + """ + Column for the prediction. + """ + + problem_type: VariableOr[MonitorInferenceLogProblemType] + """ + Problem type the model aims to solve. + """ + + timestamp_col: VariableOr[str] + """ + Column for the timestamp. + """ + + granularities: VariableOrList[str] = field(default_factory=list) + """ + Granularities for aggregating data into time windows based on their timestamp. Valid values are 5 minutes, 30 minutes, 1 hour, 1 day, n weeks, 1 month, or 1 year. + """ + + label_col: VariableOrOptional[str] = None + """ + Column for the label. + """ + + prediction_proba_col: VariableOrOptional[str] = None + """ + Column for prediction probabilities + """ + + @classmethod + def from_dict(cls, value: "MonitorInferenceLogDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MonitorInferenceLogDict": + return _transform_to_json_value(self) # type:ignore + + +class MonitorInferenceLogDict(TypedDict, total=False): + """""" + + model_id_col: VariableOr[str] + """ + Column for the model identifier. + """ + + prediction_col: VariableOr[str] + """ + Column for the prediction. + """ + + problem_type: VariableOr[MonitorInferenceLogProblemTypeParam] + """ + Problem type the model aims to solve. + """ + + timestamp_col: VariableOr[str] + """ + Column for the timestamp. + """ + + granularities: VariableOrList[str] + """ + Granularities for aggregating data into time windows based on their timestamp. Valid values are 5 minutes, 30 minutes, 1 hour, 1 day, n weeks, 1 month, or 1 year. + """ + + label_col: VariableOrOptional[str] + """ + Column for the label. + """ + + prediction_proba_col: VariableOrOptional[str] + """ + Column for prediction probabilities + """ + + +MonitorInferenceLogParam = MonitorInferenceLogDict | MonitorInferenceLog diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_inference_log_problem_type.py b/python/databricks/bundles/quality_monitors/_models/monitor_inference_log_problem_type.py new file mode 100644 index 00000000000..42d8569619b --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_inference_log_problem_type.py @@ -0,0 +1,15 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class MonitorInferenceLogProblemType(Enum): + PROBLEM_TYPE_CLASSIFICATION = "PROBLEM_TYPE_CLASSIFICATION" + PROBLEM_TYPE_REGRESSION = "PROBLEM_TYPE_REGRESSION" + + +MonitorInferenceLogProblemTypeParam = ( + Literal["PROBLEM_TYPE_CLASSIFICATION", "PROBLEM_TYPE_REGRESSION"] + | MonitorInferenceLogProblemType +) diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_metric.py b/python/databricks/bundles/quality_monitors/_models/monitor_metric.py new file mode 100644 index 00000000000..cb7f876dae8 --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_metric.py @@ -0,0 +1,100 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrList +from databricks.bundles.quality_monitors._models.monitor_metric_type import ( + MonitorMetricType, + MonitorMetricTypeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MonitorMetric: + """ + Custom metric definition. + """ + + definition: VariableOr[str] + """ + Jinja template for a SQL expression that specifies how to compute the metric. See [create metric definition](https://docs.databricks.com/en/lakehouse-monitoring/custom-metrics.html#create-definition). + """ + + name: VariableOr[str] + """ + Name of the metric in the output tables. + """ + + output_data_type: VariableOr[str] + """ + The output type of the custom metric. + """ + + type: VariableOr[MonitorMetricType] + """ + Can only be one of ``"CUSTOM_METRIC_TYPE_AGGREGATE"``, ``"CUSTOM_METRIC_TYPE_DERIVED"``, or ``"CUSTOM_METRIC_TYPE_DRIFT"``. + The ``"CUSTOM_METRIC_TYPE_AGGREGATE"`` and ``"CUSTOM_METRIC_TYPE_DERIVED"`` metrics + are computed on a single table, whereas the ``"CUSTOM_METRIC_TYPE_DRIFT"`` compare metrics across + baseline and input table, or across the two consecutive time windows. + - CUSTOM_METRIC_TYPE_AGGREGATE: only depend on the existing columns in your table + - CUSTOM_METRIC_TYPE_DERIVED: depend on previously computed aggregate metrics + - CUSTOM_METRIC_TYPE_DRIFT: depend on previously computed aggregate or derived metrics + """ + + input_columns: VariableOrList[str] = field(default_factory=list) + """ + A list of column names in the input table the metric should be computed for. + Can use ``":table"`` to indicate that the metric needs information from multiple columns. + """ + + @classmethod + def from_dict(cls, value: "MonitorMetricDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MonitorMetricDict": + return _transform_to_json_value(self) # type:ignore + + +class MonitorMetricDict(TypedDict, total=False): + """""" + + definition: VariableOr[str] + """ + Jinja template for a SQL expression that specifies how to compute the metric. See [create metric definition](https://docs.databricks.com/en/lakehouse-monitoring/custom-metrics.html#create-definition). + """ + + name: VariableOr[str] + """ + Name of the metric in the output tables. + """ + + output_data_type: VariableOr[str] + """ + The output type of the custom metric. + """ + + type: VariableOr[MonitorMetricTypeParam] + """ + Can only be one of ``"CUSTOM_METRIC_TYPE_AGGREGATE"``, ``"CUSTOM_METRIC_TYPE_DERIVED"``, or ``"CUSTOM_METRIC_TYPE_DRIFT"``. + The ``"CUSTOM_METRIC_TYPE_AGGREGATE"`` and ``"CUSTOM_METRIC_TYPE_DERIVED"`` metrics + are computed on a single table, whereas the ``"CUSTOM_METRIC_TYPE_DRIFT"`` compare metrics across + baseline and input table, or across the two consecutive time windows. + - CUSTOM_METRIC_TYPE_AGGREGATE: only depend on the existing columns in your table + - CUSTOM_METRIC_TYPE_DERIVED: depend on previously computed aggregate metrics + - CUSTOM_METRIC_TYPE_DRIFT: depend on previously computed aggregate or derived metrics + """ + + input_columns: VariableOrList[str] + """ + A list of column names in the input table the metric should be computed for. + Can use ``":table"`` to indicate that the metric needs information from multiple columns. + """ + + +MonitorMetricParam = MonitorMetricDict | MonitorMetric diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_metric_type.py b/python/databricks/bundles/quality_monitors/_models/monitor_metric_type.py new file mode 100644 index 00000000000..4c70c089a0f --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_metric_type.py @@ -0,0 +1,30 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class MonitorMetricType(Enum): + """ + Can only be one of ``\"CUSTOM_METRIC_TYPE_AGGREGATE\"``, ``\"CUSTOM_METRIC_TYPE_DERIVED\"``, or ``\"CUSTOM_METRIC_TYPE_DRIFT\"``. + The ``\"CUSTOM_METRIC_TYPE_AGGREGATE\"`` and ``\"CUSTOM_METRIC_TYPE_DERIVED\"`` metrics + are computed on a single table, whereas the ``\"CUSTOM_METRIC_TYPE_DRIFT\"`` compare metrics across + baseline and input table, or across the two consecutive time windows. + - CUSTOM_METRIC_TYPE_AGGREGATE: only depend on the existing columns in your table + - CUSTOM_METRIC_TYPE_DERIVED: depend on previously computed aggregate metrics + - CUSTOM_METRIC_TYPE_DRIFT: depend on previously computed aggregate or derived metrics + """ + + CUSTOM_METRIC_TYPE_AGGREGATE = "CUSTOM_METRIC_TYPE_AGGREGATE" + CUSTOM_METRIC_TYPE_DERIVED = "CUSTOM_METRIC_TYPE_DERIVED" + CUSTOM_METRIC_TYPE_DRIFT = "CUSTOM_METRIC_TYPE_DRIFT" + + +MonitorMetricTypeParam = ( + Literal[ + "CUSTOM_METRIC_TYPE_AGGREGATE", + "CUSTOM_METRIC_TYPE_DERIVED", + "CUSTOM_METRIC_TYPE_DRIFT", + ] + | MonitorMetricType +) diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_notifications.py b/python/databricks/bundles/quality_monitors/_models/monitor_notifications.py new file mode 100644 index 00000000000..007b3ae64e4 --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_notifications.py @@ -0,0 +1,58 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.quality_monitors._models.monitor_destination import ( + MonitorDestination, + MonitorDestinationParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MonitorNotifications: + """""" + + on_failure: VariableOrOptional[MonitorDestination] = None + """ + Destinations to send notifications on failure/timeout. + """ + + on_new_classification_tag_detected: VariableOrOptional[MonitorDestination] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Destinations to send notifications on new classification tag detected. + """ + + @classmethod + def from_dict(cls, value: "MonitorNotificationsDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MonitorNotificationsDict": + return _transform_to_json_value(self) # type:ignore + + +class MonitorNotificationsDict(TypedDict, total=False): + """""" + + on_failure: VariableOrOptional[MonitorDestinationParam] + """ + Destinations to send notifications on failure/timeout. + """ + + on_new_classification_tag_detected: VariableOrOptional[MonitorDestinationParam] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Destinations to send notifications on new classification tag detected. + """ + + +MonitorNotificationsParam = MonitorNotificationsDict | MonitorNotifications diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_snapshot.py b/python/databricks/bundles/quality_monitors/_models/monitor_snapshot.py new file mode 100644 index 00000000000..4cc39dcb9d0 --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_snapshot.py @@ -0,0 +1,31 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +from databricks.bundles.core._transform import _transform +from databricks.bundles.core._transform_to_json import _transform_to_json_value + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MonitorSnapshot: + """ + Snapshot analysis configuration + """ + + @classmethod + def from_dict(cls, value: "MonitorSnapshotDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MonitorSnapshotDict": + return _transform_to_json_value(self) # type:ignore + + +class MonitorSnapshotDict(TypedDict, total=False): + """""" + + +MonitorSnapshotParam = MonitorSnapshotDict | MonitorSnapshot diff --git a/python/databricks/bundles/quality_monitors/_models/monitor_time_series.py b/python/databricks/bundles/quality_monitors/_models/monitor_time_series.py new file mode 100644 index 00000000000..29f3b950a0e --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/monitor_time_series.py @@ -0,0 +1,52 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrList + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class MonitorTimeSeries: + """ + Time series analysis configuration. + """ + + timestamp_col: VariableOr[str] + """ + Column for the timestamp. + """ + + granularities: VariableOrList[str] = field(default_factory=list) + """ + Granularities for aggregating data into time windows based on their timestamp. Valid values are 5 minutes, 30 minutes, 1 hour, 1 day, n weeks, 1 month, or 1 year. + """ + + @classmethod + def from_dict(cls, value: "MonitorTimeSeriesDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "MonitorTimeSeriesDict": + return _transform_to_json_value(self) # type:ignore + + +class MonitorTimeSeriesDict(TypedDict, total=False): + """""" + + timestamp_col: VariableOr[str] + """ + Column for the timestamp. + """ + + granularities: VariableOrList[str] + """ + Granularities for aggregating data into time windows based on their timestamp. Valid values are 5 minutes, 30 minutes, 1 hour, 1 day, n weeks, 1 month, or 1 year. + """ + + +MonitorTimeSeriesParam = MonitorTimeSeriesDict | MonitorTimeSeries diff --git a/python/databricks/bundles/quality_monitors/_models/quality_monitor.py b/python/databricks/bundles/quality_monitors/_models/quality_monitor.py new file mode 100644 index 00000000000..d2c22518503 --- /dev/null +++ b/python/databricks/bundles/quality_monitors/_models/quality_monitor.py @@ -0,0 +1,239 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.quality_monitors._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.quality_monitors._models.monitor_cron_schedule import ( + MonitorCronSchedule, + MonitorCronScheduleParam, +) +from databricks.bundles.quality_monitors._models.monitor_data_classification_config import ( + MonitorDataClassificationConfig, + MonitorDataClassificationConfigParam, +) +from databricks.bundles.quality_monitors._models.monitor_inference_log import ( + MonitorInferenceLog, + MonitorInferenceLogParam, +) +from databricks.bundles.quality_monitors._models.monitor_metric import ( + MonitorMetric, + MonitorMetricParam, +) +from databricks.bundles.quality_monitors._models.monitor_notifications import ( + MonitorNotifications, + MonitorNotificationsParam, +) +from databricks.bundles.quality_monitors._models.monitor_snapshot import ( + MonitorSnapshot, + MonitorSnapshotParam, +) +from databricks.bundles.quality_monitors._models.monitor_time_series import ( + MonitorTimeSeries, + MonitorTimeSeriesParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class QualityMonitor(Resource): + """""" + + assets_dir: VariableOr[str] + """ + [Create:REQ Update:IGN] Field for specifying the absolute path to a custom directory to store data-monitoring + assets. Normally prepopulated to a default user location via UI and Python APIs. + """ + + output_schema_name: VariableOr[str] + """ + [Create:REQ Update:REQ] Schema where output tables are created. Needs to be in 2-level format {catalog}.{schema} + """ + + table_name: VariableOr[str] + + baseline_table_name: VariableOrOptional[str] = None + """ + [Create:OPT Update:OPT] Baseline table name. + Baseline data is used to compute drift from the data in the monitored `table_name`. + The baseline table and the monitored table shall have the same schema. + """ + + custom_metrics: VariableOrList[MonitorMetric] = field(default_factory=list) + """ + [Create:OPT Update:OPT] Custom metrics. + """ + + data_classification_config: VariableOrOptional[MonitorDataClassificationConfig] = ( + None + ) + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] [Create:OPT Update:OPT] Data classification related config. + """ + + inference_log: VariableOrOptional[MonitorInferenceLog] = None + + latest_monitor_failure_msg: VariableOrOptional[str] = None + """ + [Create:ERR Update:IGN] The latest error message for a monitor failure. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + notifications: VariableOrOptional[MonitorNotifications] = None + """ + [Create:OPT Update:OPT] Field for specifying notification settings. + """ + + schedule: VariableOrOptional[MonitorCronSchedule] = None + """ + [Create:OPT Update:OPT] The monitor schedule. + """ + + skip_builtin_dashboard: VariableOrOptional[bool] = None + """ + Whether to skip creating a default dashboard summarizing data quality metrics. + """ + + slicing_exprs: VariableOrList[str] = field(default_factory=list) + """ + [Create:OPT Update:OPT] List of column expressions to slice data with for targeted analysis. The data is grouped by + each expression independently, resulting in a separate slice for each predicate and its + complements. For example `slicing_exprs=[“col_1”, “col_2 > 10”]` will generate the following + slices: two slices for `col_2 > 10` (True and False), and one slice per unique value in + `col1`. For high-cardinality columns, only the top 100 unique values by frequency will + generate slices. + """ + + snapshot: VariableOrOptional[MonitorSnapshot] = None + """ + Configuration for monitoring snapshot tables. + """ + + time_series: VariableOrOptional[MonitorTimeSeries] = None + """ + Configuration for monitoring time series tables. + """ + + warehouse_id: VariableOrOptional[str] = None + """ + Optional argument to specify the warehouse for dashboard creation. If not specified, the first running + warehouse will be used. + """ + + @classmethod + def from_dict(cls, value: "QualityMonitorDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "QualityMonitorDict": + return _transform_to_json_value(self) # type:ignore + + +class QualityMonitorDict(TypedDict, total=False): + """""" + + assets_dir: VariableOr[str] + """ + [Create:REQ Update:IGN] Field for specifying the absolute path to a custom directory to store data-monitoring + assets. Normally prepopulated to a default user location via UI and Python APIs. + """ + + output_schema_name: VariableOr[str] + """ + [Create:REQ Update:REQ] Schema where output tables are created. Needs to be in 2-level format {catalog}.{schema} + """ + + table_name: VariableOr[str] + + baseline_table_name: VariableOrOptional[str] + """ + [Create:OPT Update:OPT] Baseline table name. + Baseline data is used to compute drift from the data in the monitored `table_name`. + The baseline table and the monitored table shall have the same schema. + """ + + custom_metrics: VariableOrList[MonitorMetricParam] + """ + [Create:OPT Update:OPT] Custom metrics. + """ + + data_classification_config: VariableOrOptional[MonitorDataClassificationConfigParam] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] [Create:OPT Update:OPT] Data classification related config. + """ + + inference_log: VariableOrOptional[MonitorInferenceLogParam] + + latest_monitor_failure_msg: VariableOrOptional[str] + """ + [Create:ERR Update:IGN] The latest error message for a monitor failure. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + notifications: VariableOrOptional[MonitorNotificationsParam] + """ + [Create:OPT Update:OPT] Field for specifying notification settings. + """ + + schedule: VariableOrOptional[MonitorCronScheduleParam] + """ + [Create:OPT Update:OPT] The monitor schedule. + """ + + skip_builtin_dashboard: VariableOrOptional[bool] + """ + Whether to skip creating a default dashboard summarizing data quality metrics. + """ + + slicing_exprs: VariableOrList[str] + """ + [Create:OPT Update:OPT] List of column expressions to slice data with for targeted analysis. The data is grouped by + each expression independently, resulting in a separate slice for each predicate and its + complements. For example `slicing_exprs=[“col_1”, “col_2 > 10”]` will generate the following + slices: two slices for `col_2 > 10` (True and False), and one slice per unique value in + `col1`. For high-cardinality columns, only the top 100 unique values by frequency will + generate slices. + """ + + snapshot: VariableOrOptional[MonitorSnapshotParam] + """ + Configuration for monitoring snapshot tables. + """ + + time_series: VariableOrOptional[MonitorTimeSeriesParam] + """ + Configuration for monitoring time series tables. + """ + + warehouse_id: VariableOrOptional[str] + """ + Optional argument to specify the warehouse for dashboard creation. If not specified, the first running + warehouse will be used. + """ + + +QualityMonitorParam = QualityMonitorDict | QualityMonitor diff --git a/python/databricks/bundles/registered_models/__init__.py b/python/databricks/bundles/registered_models/__init__.py new file mode 100644 index 00000000000..a7ae3ba9ef3 --- /dev/null +++ b/python/databricks/bundles/registered_models/__init__.py @@ -0,0 +1,44 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "Privilege", + "PrivilegeAssignment", + "PrivilegeAssignmentDict", + "PrivilegeAssignmentParam", + "PrivilegeParam", + "RegisteredModel", + "RegisteredModelAlias", + "RegisteredModelAliasDict", + "RegisteredModelAliasParam", + "RegisteredModelDict", + "RegisteredModelParam", +] + + +from databricks.bundles.registered_models._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.registered_models._models.privilege import ( + Privilege, + PrivilegeParam, +) +from databricks.bundles.registered_models._models.privilege_assignment import ( + PrivilegeAssignment, + PrivilegeAssignmentDict, + PrivilegeAssignmentParam, +) +from databricks.bundles.registered_models._models.registered_model import ( + RegisteredModel, + RegisteredModelDict, + RegisteredModelParam, +) +from databricks.bundles.registered_models._models.registered_model_alias import ( + RegisteredModelAlias, + RegisteredModelAliasDict, + RegisteredModelAliasParam, +) diff --git a/python/databricks/bundles/registered_models/_models/lifecycle.py b/python/databricks/bundles/registered_models/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/registered_models/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/registered_models/_models/privilege.py b/python/databricks/bundles/registered_models/_models/privilege.py new file mode 100644 index 00000000000..21a52a2f112 --- /dev/null +++ b/python/databricks/bundles/registered_models/_models/privilege.py @@ -0,0 +1,116 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class Privilege(Enum): + SELECT = "SELECT" + READ_PRIVATE_FILES = "READ_PRIVATE_FILES" + WRITE_PRIVATE_FILES = "WRITE_PRIVATE_FILES" + CREATE = "CREATE" + USAGE = "USAGE" + USE_CATALOG = "USE_CATALOG" + USE_SCHEMA = "USE_SCHEMA" + CREATE_SCHEMA = "CREATE_SCHEMA" + CREATE_VIEW = "CREATE_VIEW" + CREATE_EXTERNAL_TABLE = "CREATE_EXTERNAL_TABLE" + CREATE_MATERIALIZED_VIEW = "CREATE_MATERIALIZED_VIEW" + CREATE_FUNCTION = "CREATE_FUNCTION" + CREATE_MODEL = "CREATE_MODEL" + CREATE_CATALOG = "CREATE_CATALOG" + CREATE_MANAGED_STORAGE = "CREATE_MANAGED_STORAGE" + CREATE_EXTERNAL_LOCATION = "CREATE_EXTERNAL_LOCATION" + CREATE_STORAGE_CREDENTIAL = "CREATE_STORAGE_CREDENTIAL" + CREATE_SERVICE_CREDENTIAL = "CREATE_SERVICE_CREDENTIAL" + ACCESS = "ACCESS" + CREATE_SHARE = "CREATE_SHARE" + CREATE_RECIPIENT = "CREATE_RECIPIENT" + CREATE_PROVIDER = "CREATE_PROVIDER" + USE_SHARE = "USE_SHARE" + USE_RECIPIENT = "USE_RECIPIENT" + USE_PROVIDER = "USE_PROVIDER" + USE_MARKETPLACE_ASSETS = "USE_MARKETPLACE_ASSETS" + SET_SHARE_PERMISSION = "SET_SHARE_PERMISSION" + MODIFY = "MODIFY" + REFRESH = "REFRESH" + EXECUTE = "EXECUTE" + READ_FILES = "READ_FILES" + WRITE_FILES = "WRITE_FILES" + CREATE_TABLE = "CREATE_TABLE" + ALL_PRIVILEGES = "ALL_PRIVILEGES" + CREATE_CONNECTION = "CREATE_CONNECTION" + USE_CONNECTION = "USE_CONNECTION" + APPLY_TAG = "APPLY_TAG" + CREATE_FOREIGN_CATALOG = "CREATE_FOREIGN_CATALOG" + CREATE_FOREIGN_SECURABLE = "CREATE_FOREIGN_SECURABLE" + MANAGE_ALLOWLIST = "MANAGE_ALLOWLIST" + CREATE_VOLUME = "CREATE_VOLUME" + CREATE_EXTERNAL_VOLUME = "CREATE_EXTERNAL_VOLUME" + READ_VOLUME = "READ_VOLUME" + WRITE_VOLUME = "WRITE_VOLUME" + MANAGE = "MANAGE" + BROWSE = "BROWSE" + CREATE_CLEAN_ROOM = "CREATE_CLEAN_ROOM" + MODIFY_CLEAN_ROOM = "MODIFY_CLEAN_ROOM" + EXECUTE_CLEAN_ROOM_TASK = "EXECUTE_CLEAN_ROOM_TASK" + EXTERNAL_USE_SCHEMA = "EXTERNAL_USE_SCHEMA" + READ_METADATA = "READ_METADATA" + + +PrivilegeParam = ( + Literal[ + "SELECT", + "READ_PRIVATE_FILES", + "WRITE_PRIVATE_FILES", + "CREATE", + "USAGE", + "USE_CATALOG", + "USE_SCHEMA", + "CREATE_SCHEMA", + "CREATE_VIEW", + "CREATE_EXTERNAL_TABLE", + "CREATE_MATERIALIZED_VIEW", + "CREATE_FUNCTION", + "CREATE_MODEL", + "CREATE_CATALOG", + "CREATE_MANAGED_STORAGE", + "CREATE_EXTERNAL_LOCATION", + "CREATE_STORAGE_CREDENTIAL", + "CREATE_SERVICE_CREDENTIAL", + "ACCESS", + "CREATE_SHARE", + "CREATE_RECIPIENT", + "CREATE_PROVIDER", + "USE_SHARE", + "USE_RECIPIENT", + "USE_PROVIDER", + "USE_MARKETPLACE_ASSETS", + "SET_SHARE_PERMISSION", + "MODIFY", + "REFRESH", + "EXECUTE", + "READ_FILES", + "WRITE_FILES", + "CREATE_TABLE", + "ALL_PRIVILEGES", + "CREATE_CONNECTION", + "USE_CONNECTION", + "APPLY_TAG", + "CREATE_FOREIGN_CATALOG", + "CREATE_FOREIGN_SECURABLE", + "MANAGE_ALLOWLIST", + "CREATE_VOLUME", + "CREATE_EXTERNAL_VOLUME", + "READ_VOLUME", + "WRITE_VOLUME", + "MANAGE", + "BROWSE", + "CREATE_CLEAN_ROOM", + "MODIFY_CLEAN_ROOM", + "EXECUTE_CLEAN_ROOM_TASK", + "EXTERNAL_USE_SCHEMA", + "READ_METADATA", + ] + | Privilege +) diff --git a/python/databricks/bundles/registered_models/_models/privilege_assignment.py b/python/databricks/bundles/registered_models/_models/privilege_assignment.py new file mode 100644 index 00000000000..10ef2d094f8 --- /dev/null +++ b/python/databricks/bundles/registered_models/_models/privilege_assignment.py @@ -0,0 +1,56 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.registered_models._models.privilege import ( + Privilege, + PrivilegeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class PrivilegeAssignment: + """""" + + principal: VariableOrOptional[str] = None + """ + The principal (user email address or group name). + For deleted principals, `principal` is empty while `principal_id` is populated. + """ + + privileges: VariableOrList[Privilege] = field(default_factory=list) + """ + The privileges assigned to the principal. + """ + + @classmethod + def from_dict(cls, value: "PrivilegeAssignmentDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "PrivilegeAssignmentDict": + return _transform_to_json_value(self) # type:ignore + + +class PrivilegeAssignmentDict(TypedDict, total=False): + """""" + + principal: VariableOrOptional[str] + """ + The principal (user email address or group name). + For deleted principals, `principal` is empty while `principal_id` is populated. + """ + + privileges: VariableOrList[PrivilegeParam] + """ + The privileges assigned to the principal. + """ + + +PrivilegeAssignmentParam = PrivilegeAssignmentDict | PrivilegeAssignment diff --git a/python/databricks/bundles/registered_models/_models/registered_model.py b/python/databricks/bundles/registered_models/_models/registered_model.py new file mode 100644 index 00000000000..08cf2ea45ae --- /dev/null +++ b/python/databricks/bundles/registered_models/_models/registered_model.py @@ -0,0 +1,193 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.registered_models._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.registered_models._models.privilege_assignment import ( + PrivilegeAssignment, + PrivilegeAssignmentParam, +) +from databricks.bundles.registered_models._models.registered_model_alias import ( + RegisteredModelAlias, + RegisteredModelAliasParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class RegisteredModel(Resource): + """""" + + aliases: VariableOrList[RegisteredModelAlias] = field(default_factory=list) + """ + List of aliases associated with the registered model + """ + + catalog_name: VariableOrOptional[str] = None + """ + The name of the catalog where the schema and the registered model reside + """ + + comment: VariableOrOptional[str] = None + """ + The comment attached to the registered model + """ + + created_at: VariableOrOptional[int] = None + """ + Creation timestamp of the registered model in milliseconds since the Unix epoch + """ + + created_by: VariableOrOptional[str] = None + """ + The identifier of the user who created the registered model + """ + + full_name: VariableOrOptional[str] = None + """ + The three-level (fully qualified) name of the registered model + """ + + grants: VariableOrList[PrivilegeAssignment] = field(default_factory=list) + """ + The Unity Catalog privileges to grant to principals on this securable. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + metastore_id: VariableOrOptional[str] = None + """ + The unique identifier of the metastore + """ + + name: VariableOrOptional[str] = None + """ + The name of the registered model + """ + + owner: VariableOrOptional[str] = None + """ + The identifier of the user who owns the registered model + """ + + schema_name: VariableOrOptional[str] = None + """ + The name of the schema where the registered model resides + """ + + storage_location: VariableOrOptional[str] = None + """ + The storage location on the cloud under which model version data files are stored + """ + + updated_at: VariableOrOptional[int] = None + """ + Last-update timestamp of the registered model in milliseconds since the Unix epoch + """ + + updated_by: VariableOrOptional[str] = None + """ + The identifier of the user who updated the registered model last time + """ + + @classmethod + def from_dict(cls, value: "RegisteredModelDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "RegisteredModelDict": + return _transform_to_json_value(self) # type:ignore + + +class RegisteredModelDict(TypedDict, total=False): + """""" + + aliases: VariableOrList[RegisteredModelAliasParam] + """ + List of aliases associated with the registered model + """ + + catalog_name: VariableOrOptional[str] + """ + The name of the catalog where the schema and the registered model reside + """ + + comment: VariableOrOptional[str] + """ + The comment attached to the registered model + """ + + created_at: VariableOrOptional[int] + """ + Creation timestamp of the registered model in milliseconds since the Unix epoch + """ + + created_by: VariableOrOptional[str] + """ + The identifier of the user who created the registered model + """ + + full_name: VariableOrOptional[str] + """ + The three-level (fully qualified) name of the registered model + """ + + grants: VariableOrList[PrivilegeAssignmentParam] + """ + The Unity Catalog privileges to grant to principals on this securable. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + metastore_id: VariableOrOptional[str] + """ + The unique identifier of the metastore + """ + + name: VariableOrOptional[str] + """ + The name of the registered model + """ + + owner: VariableOrOptional[str] + """ + The identifier of the user who owns the registered model + """ + + schema_name: VariableOrOptional[str] + """ + The name of the schema where the registered model resides + """ + + storage_location: VariableOrOptional[str] + """ + The storage location on the cloud under which model version data files are stored + """ + + updated_at: VariableOrOptional[int] + """ + Last-update timestamp of the registered model in milliseconds since the Unix epoch + """ + + updated_by: VariableOrOptional[str] + """ + The identifier of the user who updated the registered model last time + """ + + +RegisteredModelParam = RegisteredModelDict | RegisteredModel diff --git a/python/databricks/bundles/registered_models/_models/registered_model_alias.py b/python/databricks/bundles/registered_models/_models/registered_model_alias.py new file mode 100644 index 00000000000..f4ea570a9a6 --- /dev/null +++ b/python/databricks/bundles/registered_models/_models/registered_model_alias.py @@ -0,0 +1,90 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class RegisteredModelAlias: + """""" + + alias_name: VariableOrOptional[str] = None + """ + Name of the alias, e.g. 'champion' or 'latest_stable' + """ + + catalog_name: VariableOrOptional[str] = None + """ + The name of the catalog containing the model version + """ + + id: VariableOrOptional[str] = None + """ + The unique identifier of the alias + """ + + model_name: VariableOrOptional[str] = None + """ + The name of the parent registered model of the model version, relative to parent schema + """ + + schema_name: VariableOrOptional[str] = None + """ + The name of the schema containing the model version, relative to parent catalog + """ + + version_num: VariableOrOptional[int] = None + """ + Integer version number of the model version to which this alias points. + """ + + @classmethod + def from_dict(cls, value: "RegisteredModelAliasDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "RegisteredModelAliasDict": + return _transform_to_json_value(self) # type:ignore + + +class RegisteredModelAliasDict(TypedDict, total=False): + """""" + + alias_name: VariableOrOptional[str] + """ + Name of the alias, e.g. 'champion' or 'latest_stable' + """ + + catalog_name: VariableOrOptional[str] + """ + The name of the catalog containing the model version + """ + + id: VariableOrOptional[str] + """ + The unique identifier of the alias + """ + + model_name: VariableOrOptional[str] + """ + The name of the parent registered model of the model version, relative to parent schema + """ + + schema_name: VariableOrOptional[str] + """ + The name of the schema containing the model version, relative to parent catalog + """ + + version_num: VariableOrOptional[int] + """ + Integer version number of the model version to which this alias points. + """ + + +RegisteredModelAliasParam = RegisteredModelAliasDict | RegisteredModelAlias diff --git a/python/databricks/bundles/secret_scopes/__init__.py b/python/databricks/bundles/secret_scopes/__init__.py new file mode 100644 index 00000000000..1f3d9c9555d --- /dev/null +++ b/python/databricks/bundles/secret_scopes/__init__.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "AzureKeyVaultSecretScopeMetadata", + "AzureKeyVaultSecretScopeMetadataDict", + "AzureKeyVaultSecretScopeMetadataParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "ScopeBackendType", + "ScopeBackendTypeParam", + "SecretScope", + "SecretScopeDict", + "SecretScopeParam", + "SecretScopePermission", + "SecretScopePermissionDict", + "SecretScopePermissionLevel", + "SecretScopePermissionLevelParam", + "SecretScopePermissionParam", +] + + +from databricks.bundles.secret_scopes._models.azure_key_vault_secret_scope_metadata import ( + AzureKeyVaultSecretScopeMetadata, + AzureKeyVaultSecretScopeMetadataDict, + AzureKeyVaultSecretScopeMetadataParam, +) +from databricks.bundles.secret_scopes._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.secret_scopes._models.scope_backend_type import ( + ScopeBackendType, + ScopeBackendTypeParam, +) +from databricks.bundles.secret_scopes._models.secret_scope import ( + SecretScope, + SecretScopeDict, + SecretScopeParam, +) +from databricks.bundles.secret_scopes._models.secret_scope_permission import ( + SecretScopePermission, + SecretScopePermissionDict, + SecretScopePermissionParam, +) +from databricks.bundles.secret_scopes._models.secret_scope_permission_level import ( + SecretScopePermissionLevel, + SecretScopePermissionLevelParam, +) diff --git a/python/databricks/bundles/secret_scopes/_models/azure_key_vault_secret_scope_metadata.py b/python/databricks/bundles/secret_scopes/_models/azure_key_vault_secret_scope_metadata.py new file mode 100644 index 00000000000..ceedb8b2ec4 --- /dev/null +++ b/python/databricks/bundles/secret_scopes/_models/azure_key_vault_secret_scope_metadata.py @@ -0,0 +1,54 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class AzureKeyVaultSecretScopeMetadata: + """ + The metadata of the Azure KeyVault for a secret scope of type `AZURE_KEYVAULT` + """ + + dns_name: VariableOr[str] + """ + The DNS of the KeyVault + """ + + resource_id: VariableOr[str] + """ + The resource id of the azure KeyVault that user wants to associate the scope with. + """ + + @classmethod + def from_dict(cls, value: "AzureKeyVaultSecretScopeMetadataDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "AzureKeyVaultSecretScopeMetadataDict": + return _transform_to_json_value(self) # type:ignore + + +class AzureKeyVaultSecretScopeMetadataDict(TypedDict, total=False): + """""" + + dns_name: VariableOr[str] + """ + The DNS of the KeyVault + """ + + resource_id: VariableOr[str] + """ + The resource id of the azure KeyVault that user wants to associate the scope with. + """ + + +AzureKeyVaultSecretScopeMetadataParam = ( + AzureKeyVaultSecretScopeMetadataDict | AzureKeyVaultSecretScopeMetadata +) diff --git a/python/databricks/bundles/secret_scopes/_models/lifecycle.py b/python/databricks/bundles/secret_scopes/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/secret_scopes/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/secret_scopes/_models/scope_backend_type.py b/python/databricks/bundles/secret_scopes/_models/scope_backend_type.py new file mode 100644 index 00000000000..d95f7022d33 --- /dev/null +++ b/python/databricks/bundles/secret_scopes/_models/scope_backend_type.py @@ -0,0 +1,17 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ScopeBackendType(Enum): + """ + The types of secret scope backends in the Secret Manager. Azure KeyVault backed secret scopes + will be supported in a later release. + """ + + DATABRICKS = "DATABRICKS" + AZURE_KEYVAULT = "AZURE_KEYVAULT" + + +ScopeBackendTypeParam = Literal["DATABRICKS", "AZURE_KEYVAULT"] | ScopeBackendType diff --git a/python/databricks/bundles/secret_scopes/_models/secret_scope.py b/python/databricks/bundles/secret_scopes/_models/secret_scope.py new file mode 100644 index 00000000000..5e436f1d247 --- /dev/null +++ b/python/databricks/bundles/secret_scopes/_models/secret_scope.py @@ -0,0 +1,98 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.secret_scopes._models.azure_key_vault_secret_scope_metadata import ( + AzureKeyVaultSecretScopeMetadata, + AzureKeyVaultSecretScopeMetadataParam, +) +from databricks.bundles.secret_scopes._models.lifecycle import Lifecycle, LifecycleParam +from databricks.bundles.secret_scopes._models.scope_backend_type import ( + ScopeBackendType, + ScopeBackendTypeParam, +) +from databricks.bundles.secret_scopes._models.secret_scope_permission import ( + SecretScopePermission, + SecretScopePermissionParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class SecretScope(Resource): + """""" + + name: VariableOr[str] + """ + Scope name requested by the user. Scope names are unique. + """ + + backend_type: VariableOrOptional[ScopeBackendType] = None + """ + The backend type the scope will be created with. If not specified, will default to `DATABRICKS` + """ + + keyvault_metadata: VariableOrOptional[AzureKeyVaultSecretScopeMetadata] = None + """ + The metadata for the secret scope if the `backend_type` is `AZURE_KEYVAULT` + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[SecretScopePermission] = field(default_factory=list) + """ + The permissions to apply to the secret scope. Permissions are managed via secret scope ACLs. + """ + + @classmethod + def from_dict(cls, value: "SecretScopeDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "SecretScopeDict": + return _transform_to_json_value(self) # type:ignore + + +class SecretScopeDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + Scope name requested by the user. Scope names are unique. + """ + + backend_type: VariableOrOptional[ScopeBackendTypeParam] + """ + The backend type the scope will be created with. If not specified, will default to `DATABRICKS` + """ + + keyvault_metadata: VariableOrOptional[AzureKeyVaultSecretScopeMetadataParam] + """ + The metadata for the secret scope if the `backend_type` is `AZURE_KEYVAULT` + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[SecretScopePermissionParam] + """ + The permissions to apply to the secret scope. Permissions are managed via secret scope ACLs. + """ + + +SecretScopeParam = SecretScopeDict | SecretScope diff --git a/python/databricks/bundles/secret_scopes/_models/secret_scope_permission.py b/python/databricks/bundles/secret_scopes/_models/secret_scope_permission.py new file mode 100644 index 00000000000..3715039c411 --- /dev/null +++ b/python/databricks/bundles/secret_scopes/_models/secret_scope_permission.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.secret_scopes._models.secret_scope_permission_level import ( + SecretScopePermissionLevel, + SecretScopePermissionLevelParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class SecretScopePermission: + """""" + + level: VariableOr[SecretScopePermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. This field translates to a `principal` field in secret scope ACL. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The application ID of an active service principal. This field translates to a `principal` field in secret scope ACL. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. This field translates to a `principal` field in secret scope ACL. + """ + + @classmethod + def from_dict(cls, value: "SecretScopePermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "SecretScopePermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class SecretScopePermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[SecretScopePermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. This field translates to a `principal` field in secret scope ACL. + """ + + service_principal_name: VariableOrOptional[str] + """ + The application ID of an active service principal. This field translates to a `principal` field in secret scope ACL. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. This field translates to a `principal` field in secret scope ACL. + """ + + +SecretScopePermissionParam = SecretScopePermissionDict | SecretScopePermission diff --git a/python/databricks/bundles/secret_scopes/_models/secret_scope_permission_level.py b/python/databricks/bundles/secret_scopes/_models/secret_scope_permission_level.py new file mode 100644 index 00000000000..d7d84cd5854 --- /dev/null +++ b/python/databricks/bundles/secret_scopes/_models/secret_scope_permission_level.py @@ -0,0 +1,15 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class SecretScopePermissionLevel(Enum): + READ = "READ" + WRITE = "WRITE" + MANAGE = "MANAGE" + + +SecretScopePermissionLevelParam = ( + Literal["READ", "WRITE", "MANAGE"] | SecretScopePermissionLevel +) diff --git a/python/databricks/bundles/sql_warehouses/__init__.py b/python/databricks/bundles/sql_warehouses/__init__.py new file mode 100644 index 00000000000..4866d2ca86e --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/__init__.py @@ -0,0 +1,78 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "Channel", + "ChannelDict", + "ChannelName", + "ChannelNameParam", + "ChannelParam", + "CreateWarehouseRequestWarehouseType", + "CreateWarehouseRequestWarehouseTypeParam", + "EndpointTagPair", + "EndpointTagPairDict", + "EndpointTagPairParam", + "EndpointTags", + "EndpointTagsDict", + "EndpointTagsParam", + "LifecycleWithStarted", + "LifecycleWithStartedDict", + "LifecycleWithStartedParam", + "SpotInstancePolicy", + "SpotInstancePolicyParam", + "SqlWarehouse", + "SqlWarehouseDict", + "SqlWarehouseParam", + "SqlWarehousePermission", + "SqlWarehousePermissionDict", + "SqlWarehousePermissionParam", + "WarehousePermissionLevel", + "WarehousePermissionLevelParam", +] + + +from databricks.bundles.sql_warehouses._models.channel import ( + Channel, + ChannelDict, + ChannelParam, +) +from databricks.bundles.sql_warehouses._models.channel_name import ( + ChannelName, + ChannelNameParam, +) +from databricks.bundles.sql_warehouses._models.create_warehouse_request_warehouse_type import ( + CreateWarehouseRequestWarehouseType, + CreateWarehouseRequestWarehouseTypeParam, +) +from databricks.bundles.sql_warehouses._models.endpoint_tag_pair import ( + EndpointTagPair, + EndpointTagPairDict, + EndpointTagPairParam, +) +from databricks.bundles.sql_warehouses._models.endpoint_tags import ( + EndpointTags, + EndpointTagsDict, + EndpointTagsParam, +) +from databricks.bundles.sql_warehouses._models.lifecycle_with_started import ( + LifecycleWithStarted, + LifecycleWithStartedDict, + LifecycleWithStartedParam, +) +from databricks.bundles.sql_warehouses._models.spot_instance_policy import ( + SpotInstancePolicy, + SpotInstancePolicyParam, +) +from databricks.bundles.sql_warehouses._models.sql_warehouse import ( + SqlWarehouse, + SqlWarehouseDict, + SqlWarehouseParam, +) +from databricks.bundles.sql_warehouses._models.sql_warehouse_permission import ( + SqlWarehousePermission, + SqlWarehousePermissionDict, + SqlWarehousePermissionParam, +) +from databricks.bundles.sql_warehouses._models.warehouse_permission_level import ( + WarehousePermissionLevel, + WarehousePermissionLevelParam, +) diff --git a/python/databricks/bundles/sql_warehouses/_models/channel.py b/python/databricks/bundles/sql_warehouses/_models/channel.py new file mode 100644 index 00000000000..f5893d7273f --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/channel.py @@ -0,0 +1,44 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional +from databricks.bundles.sql_warehouses._models.channel_name import ( + ChannelName, + ChannelNameParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Channel: + """ + Configures the channel name and DBSQL version of the warehouse. CHANNEL_NAME_CUSTOM should be chosen only when `dbsql_version` is specified. + """ + + dbsql_version: VariableOrOptional[str] = None + + name: VariableOrOptional[ChannelName] = None + + @classmethod + def from_dict(cls, value: "ChannelDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "ChannelDict": + return _transform_to_json_value(self) # type:ignore + + +class ChannelDict(TypedDict, total=False): + """""" + + dbsql_version: VariableOrOptional[str] + + name: VariableOrOptional[ChannelNameParam] + + +ChannelParam = ChannelDict | Channel diff --git a/python/databricks/bundles/sql_warehouses/_models/channel_name.py b/python/databricks/bundles/sql_warehouses/_models/channel_name.py new file mode 100644 index 00000000000..a47e1c890f4 --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/channel_name.py @@ -0,0 +1,22 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class ChannelName(Enum): + CHANNEL_NAME_PREVIEW = "CHANNEL_NAME_PREVIEW" + CHANNEL_NAME_CURRENT = "CHANNEL_NAME_CURRENT" + CHANNEL_NAME_PREVIOUS = "CHANNEL_NAME_PREVIOUS" + CHANNEL_NAME_CUSTOM = "CHANNEL_NAME_CUSTOM" + + +ChannelNameParam = ( + Literal[ + "CHANNEL_NAME_PREVIEW", + "CHANNEL_NAME_CURRENT", + "CHANNEL_NAME_PREVIOUS", + "CHANNEL_NAME_CUSTOM", + ] + | ChannelName +) diff --git a/python/databricks/bundles/sql_warehouses/_models/create_warehouse_request_warehouse_type.py b/python/databricks/bundles/sql_warehouses/_models/create_warehouse_request_warehouse_type.py new file mode 100644 index 00000000000..d80c701b807 --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/create_warehouse_request_warehouse_type.py @@ -0,0 +1,15 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class CreateWarehouseRequestWarehouseType(Enum): + TYPE_UNSPECIFIED = "TYPE_UNSPECIFIED" + CLASSIC = "CLASSIC" + PRO = "PRO" + + +CreateWarehouseRequestWarehouseTypeParam = ( + Literal["TYPE_UNSPECIFIED", "CLASSIC", "PRO"] | CreateWarehouseRequestWarehouseType +) diff --git a/python/databricks/bundles/sql_warehouses/_models/endpoint_tag_pair.py b/python/databricks/bundles/sql_warehouses/_models/endpoint_tag_pair.py new file mode 100644 index 00000000000..45f4d904d1e --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/endpoint_tag_pair.py @@ -0,0 +1,38 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class EndpointTagPair: + """""" + + key: VariableOrOptional[str] = None + + value: VariableOrOptional[str] = None + + @classmethod + def from_dict(cls, value: "EndpointTagPairDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "EndpointTagPairDict": + return _transform_to_json_value(self) # type:ignore + + +class EndpointTagPairDict(TypedDict, total=False): + """""" + + key: VariableOrOptional[str] + + value: VariableOrOptional[str] + + +EndpointTagPairParam = EndpointTagPairDict | EndpointTagPair diff --git a/python/databricks/bundles/sql_warehouses/_models/endpoint_tags.py b/python/databricks/bundles/sql_warehouses/_models/endpoint_tags.py new file mode 100644 index 00000000000..7d70c86199d --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/endpoint_tags.py @@ -0,0 +1,38 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList +from databricks.bundles.sql_warehouses._models.endpoint_tag_pair import ( + EndpointTagPair, + EndpointTagPairParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class EndpointTags: + """""" + + custom_tags: VariableOrList[EndpointTagPair] = field(default_factory=list) + + @classmethod + def from_dict(cls, value: "EndpointTagsDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "EndpointTagsDict": + return _transform_to_json_value(self) # type:ignore + + +class EndpointTagsDict(TypedDict, total=False): + """""" + + custom_tags: VariableOrList[EndpointTagPairParam] + + +EndpointTagsParam = EndpointTagsDict | EndpointTags diff --git a/python/databricks/bundles/sql_warehouses/_models/lifecycle_with_started.py b/python/databricks/bundles/sql_warehouses/_models/lifecycle_with_started.py new file mode 100644 index 00000000000..3ee1d2a01b3 --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/lifecycle_with_started.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class LifecycleWithStarted: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + started: VariableOrOptional[bool] = None + """ + Lifecycle setting to deploy the resource in started mode. Only supported for apps, clusters, and sql_warehouses in direct deployment mode. + """ + + @classmethod + def from_dict(cls, value: "LifecycleWithStartedDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleWithStartedDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleWithStartedDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + started: VariableOrOptional[bool] + """ + Lifecycle setting to deploy the resource in started mode. Only supported for apps, clusters, and sql_warehouses in direct deployment mode. + """ + + +LifecycleWithStartedParam = LifecycleWithStartedDict | LifecycleWithStarted diff --git a/python/databricks/bundles/sql_warehouses/_models/spot_instance_policy.py b/python/databricks/bundles/sql_warehouses/_models/spot_instance_policy.py new file mode 100644 index 00000000000..d44908ae895 --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/spot_instance_policy.py @@ -0,0 +1,32 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class SpotInstancePolicy(Enum): + """ + EndpointSpotInstancePolicy configures whether the endpoint should use spot + instances. + + The breakdown of how the EndpointSpotInstancePolicy converts to per cloud + configurations is: + + +-------+--------------------------------------+--------------------------------+ + | Cloud | COST_OPTIMIZED | RELIABILITY_OPTIMIZED | + +-------+--------------------------------------+--------------------------------+ + | AWS | On Demand Driver with Spot Executors | On Demand Driver and + Executors | | AZURE | On Demand Driver and Executors | On Demand Driver + and Executors | + +-------+--------------------------------------+--------------------------------+ + """ + + POLICY_UNSPECIFIED = "POLICY_UNSPECIFIED" + COST_OPTIMIZED = "COST_OPTIMIZED" + RELIABILITY_OPTIMIZED = "RELIABILITY_OPTIMIZED" + + +SpotInstancePolicyParam = ( + Literal["POLICY_UNSPECIFIED", "COST_OPTIMIZED", "RELIABILITY_OPTIMIZED"] + | SpotInstancePolicy +) diff --git a/python/databricks/bundles/sql_warehouses/_models/sql_warehouse.py b/python/databricks/bundles/sql_warehouses/_models/sql_warehouse.py new file mode 100644 index 00000000000..40f4e607615 --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/sql_warehouse.py @@ -0,0 +1,304 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.sql_warehouses._models.channel import Channel, ChannelParam +from databricks.bundles.sql_warehouses._models.create_warehouse_request_warehouse_type import ( + CreateWarehouseRequestWarehouseType, + CreateWarehouseRequestWarehouseTypeParam, +) +from databricks.bundles.sql_warehouses._models.endpoint_tags import ( + EndpointTags, + EndpointTagsParam, +) +from databricks.bundles.sql_warehouses._models.lifecycle_with_started import ( + LifecycleWithStarted, + LifecycleWithStartedParam, +) +from databricks.bundles.sql_warehouses._models.spot_instance_policy import ( + SpotInstancePolicy, + SpotInstancePolicyParam, +) +from databricks.bundles.sql_warehouses._models.sql_warehouse_permission import ( + SqlWarehousePermission, + SqlWarehousePermissionParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class SqlWarehouse(Resource): + """ + Creates a new SQL warehouse. + """ + + auto_stop_mins: VariableOrOptional[int] = None + """ + The amount of time in minutes that a SQL warehouse must be idle (i.e., no + RUNNING queries) before it is automatically stopped. + + Supported values: + - Must be == 0 or >= 10 mins + - 0 indicates no autostop. + + Defaults to 120 mins + """ + + channel: VariableOrOptional[Channel] = None + """ + Channel Details + """ + + cluster_size: VariableOrOptional[str] = None + """ + Size of the clusters allocated for this warehouse. + Increasing the size of a spark cluster allows you to run larger queries on + it. If you want to increase the number of concurrent queries, please tune + max_num_clusters. + + Supported values: + - 2X-Small + - X-Small + - Small + - Medium + - Large + - X-Large + - 2X-Large + - 3X-Large + - 4X-Large + - 5X-Large + """ + + creator_name: VariableOrOptional[str] = None + """ + warehouse creator name + """ + + enable_photon: VariableOrOptional[bool] = None + """ + Configures whether the warehouse should use Photon optimized clusters. + + Defaults to true. + """ + + enable_serverless_compute: VariableOrOptional[bool] = None + """ + Configures whether the warehouse should use serverless compute + """ + + instance_profile_arn: VariableOrOptional[str] = None + """ + [DEPRECATED] Deprecated. Instance profile used to pass IAM role to the cluster + """ + + lifecycle: VariableOrOptional[LifecycleWithStarted] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + max_num_clusters: VariableOrOptional[int] = None + """ + Maximum number of clusters that the autoscaler will create to handle + concurrent queries. + + Supported values: + - Must be >= min_num_clusters + - Must be <= 40. + + Defaults to min_clusters if unset. + """ + + min_num_clusters: VariableOrOptional[int] = None + """ + Minimum number of available clusters that will be maintained for this SQL + warehouse. Increasing this will ensure that a larger number of clusters are + always running and therefore may reduce the cold start time for new + queries. This is similar to reserved vs. revocable cores in a resource + manager. + + Supported values: + - Must be > 0 + - Must be <= min(max_num_clusters, 30) + + Defaults to 1 + """ + + name: VariableOrOptional[str] = None + """ + Logical name for the cluster. + + Supported values: + - Must be unique within an org. + - Must be less than 100 characters. + """ + + permissions: VariableOrList[SqlWarehousePermission] = field(default_factory=list) + """ + The permissions to apply to this resource. + """ + + spot_instance_policy: VariableOrOptional[SpotInstancePolicy] = None + """ + Configurations whether the endpoint should use spot instances. + """ + + tags: VariableOrOptional[EndpointTags] = None + """ + A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS volumes) associated + with this SQL warehouse. + + Supported values: + - Number of tags < 45. + """ + + warehouse_type: VariableOrOptional[CreateWarehouseRequestWarehouseType] = None + """ + Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, + you must set to `PRO` and also set the field `enable_serverless_compute` to `true`. + """ + + @classmethod + def from_dict(cls, value: "SqlWarehouseDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "SqlWarehouseDict": + return _transform_to_json_value(self) # type:ignore + + +class SqlWarehouseDict(TypedDict, total=False): + """""" + + auto_stop_mins: VariableOrOptional[int] + """ + The amount of time in minutes that a SQL warehouse must be idle (i.e., no + RUNNING queries) before it is automatically stopped. + + Supported values: + - Must be == 0 or >= 10 mins + - 0 indicates no autostop. + + Defaults to 120 mins + """ + + channel: VariableOrOptional[ChannelParam] + """ + Channel Details + """ + + cluster_size: VariableOrOptional[str] + """ + Size of the clusters allocated for this warehouse. + Increasing the size of a spark cluster allows you to run larger queries on + it. If you want to increase the number of concurrent queries, please tune + max_num_clusters. + + Supported values: + - 2X-Small + - X-Small + - Small + - Medium + - Large + - X-Large + - 2X-Large + - 3X-Large + - 4X-Large + - 5X-Large + """ + + creator_name: VariableOrOptional[str] + """ + warehouse creator name + """ + + enable_photon: VariableOrOptional[bool] + """ + Configures whether the warehouse should use Photon optimized clusters. + + Defaults to true. + """ + + enable_serverless_compute: VariableOrOptional[bool] + """ + Configures whether the warehouse should use serverless compute + """ + + instance_profile_arn: VariableOrOptional[str] + """ + [DEPRECATED] Deprecated. Instance profile used to pass IAM role to the cluster + """ + + lifecycle: VariableOrOptional[LifecycleWithStartedParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + max_num_clusters: VariableOrOptional[int] + """ + Maximum number of clusters that the autoscaler will create to handle + concurrent queries. + + Supported values: + - Must be >= min_num_clusters + - Must be <= 40. + + Defaults to min_clusters if unset. + """ + + min_num_clusters: VariableOrOptional[int] + """ + Minimum number of available clusters that will be maintained for this SQL + warehouse. Increasing this will ensure that a larger number of clusters are + always running and therefore may reduce the cold start time for new + queries. This is similar to reserved vs. revocable cores in a resource + manager. + + Supported values: + - Must be > 0 + - Must be <= min(max_num_clusters, 30) + + Defaults to 1 + """ + + name: VariableOrOptional[str] + """ + Logical name for the cluster. + + Supported values: + - Must be unique within an org. + - Must be less than 100 characters. + """ + + permissions: VariableOrList[SqlWarehousePermissionParam] + """ + The permissions to apply to this resource. + """ + + spot_instance_policy: VariableOrOptional[SpotInstancePolicyParam] + """ + Configurations whether the endpoint should use spot instances. + """ + + tags: VariableOrOptional[EndpointTagsParam] + """ + A set of key-value pairs that will be tagged on all resources (e.g., AWS instances and EBS volumes) associated + with this SQL warehouse. + + Supported values: + - Number of tags < 45. + """ + + warehouse_type: VariableOrOptional[CreateWarehouseRequestWarehouseTypeParam] + """ + Warehouse type: `PRO` or `CLASSIC`. If you want to use serverless compute, + you must set to `PRO` and also set the field `enable_serverless_compute` to `true`. + """ + + +SqlWarehouseParam = SqlWarehouseDict | SqlWarehouse diff --git a/python/databricks/bundles/sql_warehouses/_models/sql_warehouse_permission.py b/python/databricks/bundles/sql_warehouses/_models/sql_warehouse_permission.py new file mode 100644 index 00000000000..2c9f284a2c0 --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/sql_warehouse_permission.py @@ -0,0 +1,74 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.sql_warehouses._models.warehouse_permission_level import ( + WarehousePermissionLevel, + WarehousePermissionLevelParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class SqlWarehousePermission: + """""" + + level: VariableOr[WarehousePermissionLevel] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] = None + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] = None + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] = None + """ + The name of the user granted the permission level. + """ + + @classmethod + def from_dict(cls, value: "SqlWarehousePermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "SqlWarehousePermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class SqlWarehousePermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[WarehousePermissionLevelParam] + """ + The permission level to apply. The allowed levels depend on the resource type. + """ + + group_name: VariableOrOptional[str] + """ + The name of the group granted the permission level. + """ + + service_principal_name: VariableOrOptional[str] + """ + The name of the service principal granted the permission level. + """ + + user_name: VariableOrOptional[str] + """ + The name of the user granted the permission level. + """ + + +SqlWarehousePermissionParam = SqlWarehousePermissionDict | SqlWarehousePermission diff --git a/python/databricks/bundles/sql_warehouses/_models/warehouse_permission_level.py b/python/databricks/bundles/sql_warehouses/_models/warehouse_permission_level.py new file mode 100644 index 00000000000..5728daa0d12 --- /dev/null +++ b/python/databricks/bundles/sql_warehouses/_models/warehouse_permission_level.py @@ -0,0 +1,22 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class WarehousePermissionLevel(Enum): + """ + Permission level + """ + + CAN_MANAGE = "CAN_MANAGE" + IS_OWNER = "IS_OWNER" + CAN_USE = "CAN_USE" + CAN_MONITOR = "CAN_MONITOR" + CAN_VIEW = "CAN_VIEW" + + +WarehousePermissionLevelParam = ( + Literal["CAN_MANAGE", "IS_OWNER", "CAN_USE", "CAN_MONITOR", "CAN_VIEW"] + | WarehousePermissionLevel +) diff --git a/python/databricks/bundles/synced_database_tables/__init__.py b/python/databricks/bundles/synced_database_tables/__init__.py new file mode 100644 index 00000000000..0b3a240e460 --- /dev/null +++ b/python/databricks/bundles/synced_database_tables/__init__.py @@ -0,0 +1,58 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "NewPipelineSpec", + "NewPipelineSpecDict", + "NewPipelineSpecParam", + "SyncedDatabaseTable", + "SyncedDatabaseTableDict", + "SyncedDatabaseTableParam", + "SyncedTableSchedulingPolicy", + "SyncedTableSchedulingPolicyParam", + "SyncedTableSpec", + "SyncedTableSpecDict", + "SyncedTableSpecParam", + "SyncedTableSpecPgSpecificType", + "SyncedTableSpecPgSpecificTypeParam", + "SyncedTableSpecTypeOverride", + "SyncedTableSpecTypeOverrideDict", + "SyncedTableSpecTypeOverrideParam", +] + + +from databricks.bundles.synced_database_tables._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.synced_database_tables._models.new_pipeline_spec import ( + NewPipelineSpec, + NewPipelineSpecDict, + NewPipelineSpecParam, +) +from databricks.bundles.synced_database_tables._models.synced_database_table import ( + SyncedDatabaseTable, + SyncedDatabaseTableDict, + SyncedDatabaseTableParam, +) +from databricks.bundles.synced_database_tables._models.synced_table_scheduling_policy import ( + SyncedTableSchedulingPolicy, + SyncedTableSchedulingPolicyParam, +) +from databricks.bundles.synced_database_tables._models.synced_table_spec import ( + SyncedTableSpec, + SyncedTableSpecDict, + SyncedTableSpecParam, +) +from databricks.bundles.synced_database_tables._models.synced_table_spec_pg_specific_type import ( + SyncedTableSpecPgSpecificType, + SyncedTableSpecPgSpecificTypeParam, +) +from databricks.bundles.synced_database_tables._models.synced_table_spec_type_override import ( + SyncedTableSpecTypeOverride, + SyncedTableSpecTypeOverrideDict, + SyncedTableSpecTypeOverrideParam, +) diff --git a/python/databricks/bundles/synced_database_tables/_models/lifecycle.py b/python/databricks/bundles/synced_database_tables/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/synced_database_tables/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/synced_database_tables/_models/new_pipeline_spec.py b/python/databricks/bundles/synced_database_tables/_models/new_pipeline_spec.py new file mode 100644 index 00000000000..9a47da58441 --- /dev/null +++ b/python/databricks/bundles/synced_database_tables/_models/new_pipeline_spec.py @@ -0,0 +1,79 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class NewPipelineSpec: + """ + Custom fields that user can set for pipeline while creating SyncedDatabaseTable. + Note that other fields of pipeline are still inferred by table def internally + """ + + budget_policy_id: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] Budget policy to set on the newly created pipeline. + """ + + storage_catalog: VariableOrOptional[str] = None + """ + [Public Preview] This field needs to be specified if the destination catalog is a managed postgres catalog. + + UC catalog for the pipeline to store intermediate files (checkpoints, event logs etc). + This needs to be a standard catalog where the user has permissions to create Delta tables. + """ + + storage_schema: VariableOrOptional[str] = None + """ + [Public Preview] This field needs to be specified if the destination catalog is a managed postgres catalog. + + UC schema for the pipeline to store intermediate files (checkpoints, event logs etc). + This needs to be in the standard catalog where the user has permissions to create Delta tables. + """ + + @classmethod + def from_dict(cls, value: "NewPipelineSpecDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "NewPipelineSpecDict": + return _transform_to_json_value(self) # type:ignore + + +class NewPipelineSpecDict(TypedDict, total=False): + """""" + + budget_policy_id: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Beta] Budget policy to set on the newly created pipeline. + """ + + storage_catalog: VariableOrOptional[str] + """ + [Public Preview] This field needs to be specified if the destination catalog is a managed postgres catalog. + + UC catalog for the pipeline to store intermediate files (checkpoints, event logs etc). + This needs to be a standard catalog where the user has permissions to create Delta tables. + """ + + storage_schema: VariableOrOptional[str] + """ + [Public Preview] This field needs to be specified if the destination catalog is a managed postgres catalog. + + UC schema for the pipeline to store intermediate files (checkpoints, event logs etc). + This needs to be in the standard catalog where the user has permissions to create Delta tables. + """ + + +NewPipelineSpecParam = NewPipelineSpecDict | NewPipelineSpec diff --git a/python/databricks/bundles/synced_database_tables/_models/synced_database_table.py b/python/databricks/bundles/synced_database_tables/_models/synced_database_table.py new file mode 100644 index 00000000000..c98b869b76e --- /dev/null +++ b/python/databricks/bundles/synced_database_tables/_models/synced_database_table.py @@ -0,0 +1,113 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.synced_database_tables._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.synced_database_tables._models.synced_table_spec import ( + SyncedTableSpec, + SyncedTableSpecParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class SyncedDatabaseTable(Resource): + """""" + + name: VariableOr[str] + """ + [Public Preview] Full three-part (catalog, schema, table) name of the table. + """ + + database_instance_name: VariableOrOptional[str] = None + """ + [Public Preview] Name of the target database instance. This is required when creating synced database tables in standard catalogs. + This is optional when creating synced database tables in registered catalogs. If this field is specified + when creating synced database tables in registered catalogs, the database instance name MUST + match that of the registered catalog (or the request will be rejected). + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + logical_database_name: VariableOrOptional[str] = None + """ + [Public Preview] Target Postgres database object (logical database) name for this table. + + When creating a synced table in a registered Postgres catalog, the + target Postgres database name is inferred to be that of the registered catalog. + If this field is specified in this scenario, the Postgres database name MUST + match that of the registered catalog (or the request will be rejected). + + When creating a synced table in a standard catalog, this field is required. + In this scenario, specifying this field will allow targeting an arbitrary postgres database. + Note that this has implications for the `create_database_objects_is_missing` field in `spec`. + """ + + spec: VariableOrOptional[SyncedTableSpec] = None + """ + [Public Preview] Specification of a synced database table. + """ + + @classmethod + def from_dict(cls, value: "SyncedDatabaseTableDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "SyncedDatabaseTableDict": + return _transform_to_json_value(self) # type:ignore + + +class SyncedDatabaseTableDict(TypedDict, total=False): + """""" + + name: VariableOr[str] + """ + [Public Preview] Full three-part (catalog, schema, table) name of the table. + """ + + database_instance_name: VariableOrOptional[str] + """ + [Public Preview] Name of the target database instance. This is required when creating synced database tables in standard catalogs. + This is optional when creating synced database tables in registered catalogs. If this field is specified + when creating synced database tables in registered catalogs, the database instance name MUST + match that of the registered catalog (or the request will be rejected). + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + logical_database_name: VariableOrOptional[str] + """ + [Public Preview] Target Postgres database object (logical database) name for this table. + + When creating a synced table in a registered Postgres catalog, the + target Postgres database name is inferred to be that of the registered catalog. + If this field is specified in this scenario, the Postgres database name MUST + match that of the registered catalog (or the request will be rejected). + + When creating a synced table in a standard catalog, this field is required. + In this scenario, specifying this field will allow targeting an arbitrary postgres database. + Note that this has implications for the `create_database_objects_is_missing` field in `spec`. + """ + + spec: VariableOrOptional[SyncedTableSpecParam] + """ + [Public Preview] Specification of a synced database table. + """ + + +SyncedDatabaseTableParam = SyncedDatabaseTableDict | SyncedDatabaseTable diff --git a/python/databricks/bundles/synced_database_tables/_models/synced_table_scheduling_policy.py b/python/databricks/bundles/synced_database_tables/_models/synced_table_scheduling_policy.py new file mode 100644 index 00000000000..379d61c2c17 --- /dev/null +++ b/python/databricks/bundles/synced_database_tables/_models/synced_table_scheduling_policy.py @@ -0,0 +1,15 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class SyncedTableSchedulingPolicy(Enum): + CONTINUOUS = "CONTINUOUS" + TRIGGERED = "TRIGGERED" + SNAPSHOT = "SNAPSHOT" + + +SyncedTableSchedulingPolicyParam = ( + Literal["CONTINUOUS", "TRIGGERED", "SNAPSHOT"] | SyncedTableSchedulingPolicy +) diff --git a/python/databricks/bundles/synced_database_tables/_models/synced_table_spec.py b/python/databricks/bundles/synced_database_tables/_models/synced_table_spec.py new file mode 100644 index 00000000000..c6be97882ae --- /dev/null +++ b/python/databricks/bundles/synced_database_tables/_models/synced_table_spec.py @@ -0,0 +1,170 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.synced_database_tables._models.new_pipeline_spec import ( + NewPipelineSpec, + NewPipelineSpecParam, +) +from databricks.bundles.synced_database_tables._models.synced_table_scheduling_policy import ( + SyncedTableSchedulingPolicy, + SyncedTableSchedulingPolicyParam, +) +from databricks.bundles.synced_database_tables._models.synced_table_spec_type_override import ( + SyncedTableSpecTypeOverride, + SyncedTableSpecTypeOverrideParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class SyncedTableSpec: + """ + Specification of a synced database table. + """ + + accelerated_sync: VariableOrOptional[bool] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] When true, enables accelerated sync mode for the initial data load. + This significantly improves performance for large tables. + Requires workspace-level enablement. + """ + + create_database_objects_if_missing: VariableOrOptional[bool] = None + """ + [Public Preview] If true, the synced table's logical database and schema resources in PG + will be created if they do not already exist. + """ + + existing_pipeline_id: VariableOrOptional[str] = None + """ + [Public Preview] At most one of existing_pipeline_id and new_pipeline_spec should be defined. + + If existing_pipeline_id is defined, the synced table will be bin packed into the existing pipeline + referenced. This avoids creating a new pipeline and allows sharing existing compute. + In this case, the scheduling_policy of this synced table must match the scheduling policy of the existing pipeline. + """ + + new_pipeline_spec: VariableOrOptional[NewPipelineSpec] = None + """ + [Public Preview] At most one of existing_pipeline_id and new_pipeline_spec should be defined. + + If new_pipeline_spec is defined, a new pipeline is created for this synced table. The location pointed to is used + to store intermediate files (checkpoints, event logs etc). The caller must have write permissions to create Delta + tables in the specified catalog and schema. Again, note this requires write permissions, whereas the source table + only requires read permissions. + """ + + primary_key_columns: VariableOrList[str] = field(default_factory=list) + """ + [Public Preview] Primary Key columns to be used for data insert/update in the destination. + """ + + scheduling_policy: VariableOrOptional[SyncedTableSchedulingPolicy] = None + """ + [Public Preview] Scheduling policy of the underlying pipeline. + """ + + source_table_full_name: VariableOrOptional[str] = None + """ + [Public Preview] Three-part (catalog, schema, table) name of the source Delta table. + """ + + timeseries_key: VariableOrOptional[str] = None + """ + [Public Preview] Time series key to deduplicate (tie-break) rows with the same primary key. + """ + + type_overrides: VariableOrList[SyncedTableSpecTypeOverride] = field( + default_factory=list + ) + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Override the default Delta->PG type mapping for specific columns. + A TypeOverride with PG_SPECIFIC_TYPE_UNSPECIFIED is rejected; a valid pg_type must be set. + """ + + @classmethod + def from_dict(cls, value: "SyncedTableSpecDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "SyncedTableSpecDict": + return _transform_to_json_value(self) # type:ignore + + +class SyncedTableSpecDict(TypedDict, total=False): + """""" + + accelerated_sync: VariableOrOptional[bool] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] When true, enables accelerated sync mode for the initial data load. + This significantly improves performance for large tables. + Requires workspace-level enablement. + """ + + create_database_objects_if_missing: VariableOrOptional[bool] + """ + [Public Preview] If true, the synced table's logical database and schema resources in PG + will be created if they do not already exist. + """ + + existing_pipeline_id: VariableOrOptional[str] + """ + [Public Preview] At most one of existing_pipeline_id and new_pipeline_spec should be defined. + + If existing_pipeline_id is defined, the synced table will be bin packed into the existing pipeline + referenced. This avoids creating a new pipeline and allows sharing existing compute. + In this case, the scheduling_policy of this synced table must match the scheduling policy of the existing pipeline. + """ + + new_pipeline_spec: VariableOrOptional[NewPipelineSpecParam] + """ + [Public Preview] At most one of existing_pipeline_id and new_pipeline_spec should be defined. + + If new_pipeline_spec is defined, a new pipeline is created for this synced table. The location pointed to is used + to store intermediate files (checkpoints, event logs etc). The caller must have write permissions to create Delta + tables in the specified catalog and schema. Again, note this requires write permissions, whereas the source table + only requires read permissions. + """ + + primary_key_columns: VariableOrList[str] + """ + [Public Preview] Primary Key columns to be used for data insert/update in the destination. + """ + + scheduling_policy: VariableOrOptional[SyncedTableSchedulingPolicyParam] + """ + [Public Preview] Scheduling policy of the underlying pipeline. + """ + + source_table_full_name: VariableOrOptional[str] + """ + [Public Preview] Three-part (catalog, schema, table) name of the source Delta table. + """ + + timeseries_key: VariableOrOptional[str] + """ + [Public Preview] Time series key to deduplicate (tie-break) rows with the same primary key. + """ + + type_overrides: VariableOrList[SyncedTableSpecTypeOverrideParam] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Override the default Delta->PG type mapping for specific columns. + A TypeOverride with PG_SPECIFIC_TYPE_UNSPECIFIED is rejected; a valid pg_type must be set. + """ + + +SyncedTableSpecParam = SyncedTableSpecDict | SyncedTableSpec diff --git a/python/databricks/bundles/synced_database_tables/_models/synced_table_spec_pg_specific_type.py b/python/databricks/bundles/synced_database_tables/_models/synced_table_spec_pg_specific_type.py new file mode 100644 index 00000000000..52c3b8dbe9a --- /dev/null +++ b/python/databricks/bundles/synced_database_tables/_models/synced_table_spec_pg_specific_type.py @@ -0,0 +1,26 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class SyncedTableSpecPgSpecificType(Enum): + """ + :meta private: [EXPERIMENTAL] + + PostgreSQL-specific target types that can override the default Delta-to-PG mapping. + """ + + PG_SPECIFIC_TYPE_VECTOR = "PG_SPECIFIC_TYPE_VECTOR" + PG_SPECIFIC_TYPE_HALFVEC = "PG_SPECIFIC_TYPE_HALFVEC" + PG_SPECIFIC_TYPE_VARCHAR = "PG_SPECIFIC_TYPE_VARCHAR" + + +SyncedTableSpecPgSpecificTypeParam = ( + Literal[ + "PG_SPECIFIC_TYPE_VECTOR", + "PG_SPECIFIC_TYPE_HALFVEC", + "PG_SPECIFIC_TYPE_VARCHAR", + ] + | SyncedTableSpecPgSpecificType +) diff --git a/python/databricks/bundles/synced_database_tables/_models/synced_table_spec_type_override.py b/python/databricks/bundles/synced_database_tables/_models/synced_table_spec_type_override.py new file mode 100644 index 00000000000..5cc3fa72720 --- /dev/null +++ b/python/databricks/bundles/synced_database_tables/_models/synced_table_spec_type_override.py @@ -0,0 +1,84 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.synced_database_tables._models.synced_table_spec_pg_specific_type import ( + SyncedTableSpecPgSpecificType, + SyncedTableSpecPgSpecificTypeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class SyncedTableSpecTypeOverride: + """ + :meta private: [EXPERIMENTAL] + + Overrides the default Delta-to-PostgreSQL type mapping for a single column. + """ + + column_name: VariableOr[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Name of the source column whose target PostgreSQL type should be overridden. + """ + + pg_type: VariableOr[SyncedTableSpecPgSpecificType] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] PostgreSQL-specific target type to use for the column. + """ + + size: VariableOrOptional[int] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Size parameter for the target type, for types that take one (e.g. vector + dimension, varchar length). Required when the chosen pg_type needs a size. + """ + + @classmethod + def from_dict(cls, value: "SyncedTableSpecTypeOverrideDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "SyncedTableSpecTypeOverrideDict": + return _transform_to_json_value(self) # type:ignore + + +class SyncedTableSpecTypeOverrideDict(TypedDict, total=False): + """""" + + column_name: VariableOr[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Name of the source column whose target PostgreSQL type should be overridden. + """ + + pg_type: VariableOr[SyncedTableSpecPgSpecificTypeParam] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] PostgreSQL-specific target type to use for the column. + """ + + size: VariableOrOptional[int] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] Size parameter for the target type, for types that take one (e.g. vector + dimension, varchar length). Required when the chosen pg_type needs a size. + """ + + +SyncedTableSpecTypeOverrideParam = ( + SyncedTableSpecTypeOverrideDict | SyncedTableSpecTypeOverride +) diff --git a/python/databricks/bundles/vector_search_endpoints/__init__.py b/python/databricks/bundles/vector_search_endpoints/__init__.py new file mode 100644 index 00000000000..aabc0081f5d --- /dev/null +++ b/python/databricks/bundles/vector_search_endpoints/__init__.py @@ -0,0 +1,42 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "EndpointType", + "EndpointTypeParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "VectorSearchEndpoint", + "VectorSearchEndpointDict", + "VectorSearchEndpointParam", + "VectorSearchEndpointPermission", + "VectorSearchEndpointPermissionDict", + "VectorSearchEndpointPermissionLevel", + "VectorSearchEndpointPermissionLevelParam", + "VectorSearchEndpointPermissionParam", +] + + +from databricks.bundles.vector_search_endpoints._models.endpoint_type import ( + EndpointType, + EndpointTypeParam, +) +from databricks.bundles.vector_search_endpoints._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint import ( + VectorSearchEndpoint, + VectorSearchEndpointDict, + VectorSearchEndpointParam, +) +from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint_permission import ( + VectorSearchEndpointPermission, + VectorSearchEndpointPermissionDict, + VectorSearchEndpointPermissionParam, +) +from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint_permission_level import ( + VectorSearchEndpointPermissionLevel, + VectorSearchEndpointPermissionLevelParam, +) diff --git a/python/databricks/bundles/vector_search_endpoints/_models/endpoint_type.py b/python/databricks/bundles/vector_search_endpoints/_models/endpoint_type.py new file mode 100644 index 00000000000..476295df34b --- /dev/null +++ b/python/databricks/bundles/vector_search_endpoints/_models/endpoint_type.py @@ -0,0 +1,16 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class EndpointType(Enum): + """ + Type of endpoint. + """ + + STORAGE_OPTIMIZED = "STORAGE_OPTIMIZED" + STANDARD = "STANDARD" + + +EndpointTypeParam = Literal["STORAGE_OPTIMIZED", "STANDARD"] | EndpointType diff --git a/python/databricks/bundles/vector_search_endpoints/_models/lifecycle.py b/python/databricks/bundles/vector_search_endpoints/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/vector_search_endpoints/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint.py b/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint.py new file mode 100644 index 00000000000..8072329f47b --- /dev/null +++ b/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint.py @@ -0,0 +1,127 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.vector_search_endpoints._models.endpoint_type import ( + EndpointType, + EndpointTypeParam, +) +from databricks.bundles.vector_search_endpoints._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint_permission import ( + VectorSearchEndpointPermission, + VectorSearchEndpointPermissionParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class VectorSearchEndpoint(Resource): + """""" + + endpoint_type: VariableOr[EndpointType] + """ + Type of endpoint + """ + + name: VariableOr[str] + """ + Name of the AI Search endpoint + """ + + budget_policy_id: VariableOrOptional[str] = None + """ + [Public Preview] The budget policy id to be applied + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[VectorSearchEndpointPermission] = field( + default_factory=list + ) + """ + The permissions to apply to this resource. + """ + + target_qps: VariableOrOptional[int] = None + """ + Target QPS for the endpoint. Mutually exclusive with num_replicas. + The actual replica count is calculated at index creation/sync time based on this value. + Best-effort target; the system does not guarantee this QPS will be achieved. + """ + + usage_policy_id: VariableOrOptional[str] = None + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The usage policy id to be applied once we've migrated to usage policies + """ + + @classmethod + def from_dict(cls, value: "VectorSearchEndpointDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "VectorSearchEndpointDict": + return _transform_to_json_value(self) # type:ignore + + +class VectorSearchEndpointDict(TypedDict, total=False): + """""" + + endpoint_type: VariableOr[EndpointTypeParam] + """ + Type of endpoint + """ + + name: VariableOr[str] + """ + Name of the AI Search endpoint + """ + + budget_policy_id: VariableOrOptional[str] + """ + [Public Preview] The budget policy id to be applied + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + permissions: VariableOrList[VectorSearchEndpointPermissionParam] + """ + The permissions to apply to this resource. + """ + + target_qps: VariableOrOptional[int] + """ + Target QPS for the endpoint. Mutually exclusive with num_replicas. + The actual replica count is calculated at index creation/sync time based on this value. + Best-effort target; the system does not guarantee this QPS will be achieved. + """ + + usage_policy_id: VariableOrOptional[str] + """ + :meta private: [EXPERIMENTAL] + + [Private Preview] The usage policy id to be applied once we've migrated to usage policies + """ + + +VectorSearchEndpointParam = VectorSearchEndpointDict | VectorSearchEndpoint diff --git a/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint_permission.py b/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint_permission.py new file mode 100644 index 00000000000..cfbdc1e31d6 --- /dev/null +++ b/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint_permission.py @@ -0,0 +1,52 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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, VariableOrOptional +from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint_permission_level import ( + VectorSearchEndpointPermissionLevel, + VectorSearchEndpointPermissionLevelParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class VectorSearchEndpointPermission: + """""" + + level: VariableOr[VectorSearchEndpointPermissionLevel] + + group_name: VariableOrOptional[str] = None + + service_principal_name: VariableOrOptional[str] = None + + user_name: VariableOrOptional[str] = None + + @classmethod + def from_dict(cls, value: "VectorSearchEndpointPermissionDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "VectorSearchEndpointPermissionDict": + return _transform_to_json_value(self) # type:ignore + + +class VectorSearchEndpointPermissionDict(TypedDict, total=False): + """""" + + level: VariableOr[VectorSearchEndpointPermissionLevelParam] + + group_name: VariableOrOptional[str] + + service_principal_name: VariableOrOptional[str] + + user_name: VariableOrOptional[str] + + +VectorSearchEndpointPermissionParam = ( + VectorSearchEndpointPermissionDict | VectorSearchEndpointPermission +) diff --git a/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint_permission_level.py b/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint_permission_level.py new file mode 100644 index 00000000000..d2618d39126 --- /dev/null +++ b/python/databricks/bundles/vector_search_endpoints/_models/vector_search_endpoint_permission_level.py @@ -0,0 +1,19 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class VectorSearchEndpointPermissionLevel(Enum): + """ + Permission level + """ + + CAN_CREATE = "CAN_CREATE" + CAN_MANAGE = "CAN_MANAGE" + CAN_USE = "CAN_USE" + + +VectorSearchEndpointPermissionLevelParam = ( + Literal["CAN_CREATE", "CAN_MANAGE", "CAN_USE"] | VectorSearchEndpointPermissionLevel +) diff --git a/python/databricks/bundles/vector_search_indexes/__init__.py b/python/databricks/bundles/vector_search_indexes/__init__.py new file mode 100644 index 00000000000..8e3c88eb018 --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/__init__.py @@ -0,0 +1,86 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +__all__ = [ + "DeltaSyncVectorIndexSpecRequest", + "DeltaSyncVectorIndexSpecRequestDict", + "DeltaSyncVectorIndexSpecRequestParam", + "DirectAccessVectorIndexSpec", + "DirectAccessVectorIndexSpecDict", + "DirectAccessVectorIndexSpecParam", + "EmbeddingSourceColumn", + "EmbeddingSourceColumnDict", + "EmbeddingSourceColumnParam", + "EmbeddingVectorColumn", + "EmbeddingVectorColumnDict", + "EmbeddingVectorColumnParam", + "IndexSubtype", + "IndexSubtypeParam", + "Lifecycle", + "LifecycleDict", + "LifecycleParam", + "PipelineType", + "PipelineTypeParam", + "Privilege", + "PrivilegeAssignment", + "PrivilegeAssignmentDict", + "PrivilegeAssignmentParam", + "PrivilegeParam", + "VectorIndexType", + "VectorIndexTypeParam", + "VectorSearchIndex", + "VectorSearchIndexDict", + "VectorSearchIndexParam", +] + + +from databricks.bundles.vector_search_indexes._models.delta_sync_vector_index_spec_request import ( + DeltaSyncVectorIndexSpecRequest, + DeltaSyncVectorIndexSpecRequestDict, + DeltaSyncVectorIndexSpecRequestParam, +) +from databricks.bundles.vector_search_indexes._models.direct_access_vector_index_spec import ( + DirectAccessVectorIndexSpec, + DirectAccessVectorIndexSpecDict, + DirectAccessVectorIndexSpecParam, +) +from databricks.bundles.vector_search_indexes._models.embedding_source_column import ( + EmbeddingSourceColumn, + EmbeddingSourceColumnDict, + EmbeddingSourceColumnParam, +) +from databricks.bundles.vector_search_indexes._models.embedding_vector_column import ( + EmbeddingVectorColumn, + EmbeddingVectorColumnDict, + EmbeddingVectorColumnParam, +) +from databricks.bundles.vector_search_indexes._models.index_subtype import ( + IndexSubtype, + IndexSubtypeParam, +) +from databricks.bundles.vector_search_indexes._models.lifecycle import ( + Lifecycle, + LifecycleDict, + LifecycleParam, +) +from databricks.bundles.vector_search_indexes._models.pipeline_type import ( + PipelineType, + PipelineTypeParam, +) +from databricks.bundles.vector_search_indexes._models.privilege import ( + Privilege, + PrivilegeParam, +) +from databricks.bundles.vector_search_indexes._models.privilege_assignment import ( + PrivilegeAssignment, + PrivilegeAssignmentDict, + PrivilegeAssignmentParam, +) +from databricks.bundles.vector_search_indexes._models.vector_index_type import ( + VectorIndexType, + VectorIndexTypeParam, +) +from databricks.bundles.vector_search_indexes._models.vector_search_index import ( + VectorSearchIndex, + VectorSearchIndexDict, + VectorSearchIndexParam, +) diff --git a/python/databricks/bundles/vector_search_indexes/_models/delta_sync_vector_index_spec_request.py b/python/databricks/bundles/vector_search_indexes/_models/delta_sync_vector_index_spec_request.py new file mode 100644 index 00000000000..b7af851711b --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/delta_sync_vector_index_spec_request.py @@ -0,0 +1,132 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.vector_search_indexes._models.embedding_source_column import ( + EmbeddingSourceColumn, + EmbeddingSourceColumnParam, +) +from databricks.bundles.vector_search_indexes._models.embedding_vector_column import ( + EmbeddingVectorColumn, + EmbeddingVectorColumnParam, +) +from databricks.bundles.vector_search_indexes._models.pipeline_type import ( + PipelineType, + PipelineTypeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DeltaSyncVectorIndexSpecRequest: + """""" + + columns_to_index: VariableOrList[str] = field(default_factory=list) + """ + [Optional] Alias for columns_to_sync. Select the columns to include in the vector index. + If you leave this field blank, all columns from the source table are included. + The primary key column and embedding source column or embedding vector column are always included. + Only one of columns_to_sync or columns_to_index may be specified. + """ + + columns_to_sync: VariableOrList[str] = field(default_factory=list) + """ + [Optional] Select the columns to sync with the vector index. If you leave this field blank, all columns + from the source table are synced with the index. The primary key column and embedding source column or + embedding vector column are always synced. + """ + + embedding_source_columns: VariableOrList[EmbeddingSourceColumn] = field( + default_factory=list + ) + """ + The columns that contain the embedding source. + """ + + embedding_vector_columns: VariableOrList[EmbeddingVectorColumn] = field( + default_factory=list + ) + """ + The columns that contain the embedding vectors. + """ + + embedding_writeback_table: VariableOrOptional[str] = None + """ + [Optional] Name of the Delta table to sync the vector index contents and computed embeddings to. + """ + + pipeline_type: VariableOrOptional[PipelineType] = None + """ + Pipeline execution mode. + - `TRIGGERED`: If the pipeline uses the triggered execution mode, the system stops processing after successfully refreshing the source table in the pipeline once, ensuring the table is updated based on the data available when the update started. + - `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline processes new data as it arrives in the source table to keep vector index fresh. + """ + + source_table: VariableOrOptional[str] = None + """ + The name of the source table. + """ + + @classmethod + def from_dict(cls, value: "DeltaSyncVectorIndexSpecRequestDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DeltaSyncVectorIndexSpecRequestDict": + return _transform_to_json_value(self) # type:ignore + + +class DeltaSyncVectorIndexSpecRequestDict(TypedDict, total=False): + """""" + + columns_to_index: VariableOrList[str] + """ + [Optional] Alias for columns_to_sync. Select the columns to include in the vector index. + If you leave this field blank, all columns from the source table are included. + The primary key column and embedding source column or embedding vector column are always included. + Only one of columns_to_sync or columns_to_index may be specified. + """ + + columns_to_sync: VariableOrList[str] + """ + [Optional] Select the columns to sync with the vector index. If you leave this field blank, all columns + from the source table are synced with the index. The primary key column and embedding source column or + embedding vector column are always synced. + """ + + embedding_source_columns: VariableOrList[EmbeddingSourceColumnParam] + """ + The columns that contain the embedding source. + """ + + embedding_vector_columns: VariableOrList[EmbeddingVectorColumnParam] + """ + The columns that contain the embedding vectors. + """ + + embedding_writeback_table: VariableOrOptional[str] + """ + [Optional] Name of the Delta table to sync the vector index contents and computed embeddings to. + """ + + pipeline_type: VariableOrOptional[PipelineTypeParam] + """ + Pipeline execution mode. + - `TRIGGERED`: If the pipeline uses the triggered execution mode, the system stops processing after successfully refreshing the source table in the pipeline once, ensuring the table is updated based on the data available when the update started. + - `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline processes new data as it arrives in the source table to keep vector index fresh. + """ + + source_table: VariableOrOptional[str] + """ + The name of the source table. + """ + + +DeltaSyncVectorIndexSpecRequestParam = ( + DeltaSyncVectorIndexSpecRequestDict | DeltaSyncVectorIndexSpecRequest +) diff --git a/python/databricks/bundles/vector_search_indexes/_models/direct_access_vector_index_spec.py b/python/databricks/bundles/vector_search_indexes/_models/direct_access_vector_index_spec.py new file mode 100644 index 00000000000..76ef31b4b30 --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/direct_access_vector_index_spec.py @@ -0,0 +1,78 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.vector_search_indexes._models.embedding_source_column import ( + EmbeddingSourceColumn, + EmbeddingSourceColumnParam, +) +from databricks.bundles.vector_search_indexes._models.embedding_vector_column import ( + EmbeddingVectorColumn, + EmbeddingVectorColumnParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class DirectAccessVectorIndexSpec: + """""" + + embedding_source_columns: VariableOrList[EmbeddingSourceColumn] = field( + default_factory=list + ) + """ + The columns that contain the embedding source. The format should be array[double]. + """ + + embedding_vector_columns: VariableOrList[EmbeddingVectorColumn] = field( + default_factory=list + ) + """ + The columns that contain the embedding vectors. The format should be array[double]. + """ + + schema_json: VariableOrOptional[str] = None + """ + The schema of the index in JSON format. + Supported types are `integer`, `long`, `float`, `double`, `boolean`, `string`, `date`, `timestamp`. + Supported types for vector column: `array`, `array`,`. + """ + + @classmethod + def from_dict(cls, value: "DirectAccessVectorIndexSpecDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "DirectAccessVectorIndexSpecDict": + return _transform_to_json_value(self) # type:ignore + + +class DirectAccessVectorIndexSpecDict(TypedDict, total=False): + """""" + + embedding_source_columns: VariableOrList[EmbeddingSourceColumnParam] + """ + The columns that contain the embedding source. The format should be array[double]. + """ + + embedding_vector_columns: VariableOrList[EmbeddingVectorColumnParam] + """ + The columns that contain the embedding vectors. The format should be array[double]. + """ + + schema_json: VariableOrOptional[str] + """ + The schema of the index in JSON format. + Supported types are `integer`, `long`, `float`, `double`, `boolean`, `string`, `date`, `timestamp`. + Supported types for vector column: `array`, `array`,`. + """ + + +DirectAccessVectorIndexSpecParam = ( + DirectAccessVectorIndexSpecDict | DirectAccessVectorIndexSpec +) diff --git a/python/databricks/bundles/vector_search_indexes/_models/embedding_source_column.py b/python/databricks/bundles/vector_search_indexes/_models/embedding_source_column.py new file mode 100644 index 00000000000..7debdc3f104 --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/embedding_source_column.py @@ -0,0 +1,60 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class EmbeddingSourceColumn: + """""" + + embedding_model_endpoint_name: VariableOrOptional[str] = None + """ + Name of the embedding model endpoint, used by default for both ingestion and querying. + """ + + model_endpoint_name_for_query: VariableOrOptional[str] = None + """ + Name of the embedding model endpoint which, if specified, is used for querying (not ingestion). + """ + + name: VariableOrOptional[str] = None + """ + Name of the column + """ + + @classmethod + def from_dict(cls, value: "EmbeddingSourceColumnDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "EmbeddingSourceColumnDict": + return _transform_to_json_value(self) # type:ignore + + +class EmbeddingSourceColumnDict(TypedDict, total=False): + """""" + + embedding_model_endpoint_name: VariableOrOptional[str] + """ + Name of the embedding model endpoint, used by default for both ingestion and querying. + """ + + model_endpoint_name_for_query: VariableOrOptional[str] + """ + Name of the embedding model endpoint which, if specified, is used for querying (not ingestion). + """ + + name: VariableOrOptional[str] + """ + Name of the column + """ + + +EmbeddingSourceColumnParam = EmbeddingSourceColumnDict | EmbeddingSourceColumn diff --git a/python/databricks/bundles/vector_search_indexes/_models/embedding_vector_column.py b/python/databricks/bundles/vector_search_indexes/_models/embedding_vector_column.py new file mode 100644 index 00000000000..b8efd6b4f0c --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/embedding_vector_column.py @@ -0,0 +1,50 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class EmbeddingVectorColumn: + """""" + + embedding_dimension: VariableOrOptional[int] = None + """ + Dimension of the embedding vector + """ + + name: VariableOrOptional[str] = None + """ + Name of the column + """ + + @classmethod + def from_dict(cls, value: "EmbeddingVectorColumnDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "EmbeddingVectorColumnDict": + return _transform_to_json_value(self) # type:ignore + + +class EmbeddingVectorColumnDict(TypedDict, total=False): + """""" + + embedding_dimension: VariableOrOptional[int] + """ + Dimension of the embedding vector + """ + + name: VariableOrOptional[str] + """ + Name of the column + """ + + +EmbeddingVectorColumnParam = EmbeddingVectorColumnDict | EmbeddingVectorColumn diff --git a/python/databricks/bundles/vector_search_indexes/_models/index_subtype.py b/python/databricks/bundles/vector_search_indexes/_models/index_subtype.py new file mode 100644 index 00000000000..5485754d1e6 --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/index_subtype.py @@ -0,0 +1,20 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class IndexSubtype(Enum): + """ + The subtype of the AI Search index, determining the indexing and retrieval strategy. + - `VECTOR`: Not supported. Use `HYBRID` instead. + - `FULL_TEXT`: An index that uses full-text search without vector embeddings. + - `HYBRID`: An index that uses vector embeddings for similarity search and hybrid search. + """ + + VECTOR = "VECTOR" + FULL_TEXT = "FULL_TEXT" + HYBRID = "HYBRID" + + +IndexSubtypeParam = Literal["VECTOR", "FULL_TEXT", "HYBRID"] | IndexSubtype diff --git a/python/databricks/bundles/vector_search_indexes/_models/lifecycle.py b/python/databricks/bundles/vector_search_indexes/_models/lifecycle.py new file mode 100644 index 00000000000..697776a198e --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/lifecycle.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrOptional + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class Lifecycle: + """""" + + prevent_destroy: VariableOrOptional[bool] = None + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "LifecycleDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "LifecycleDict": + return _transform_to_json_value(self) # type:ignore + + +class LifecycleDict(TypedDict, total=False): + """""" + + prevent_destroy: VariableOrOptional[bool] + """ + Lifecycle setting to prevent the resource from being destroyed. + """ + + +LifecycleParam = LifecycleDict | Lifecycle diff --git a/python/databricks/bundles/vector_search_indexes/_models/pipeline_type.py b/python/databricks/bundles/vector_search_indexes/_models/pipeline_type.py new file mode 100644 index 00000000000..6821dec812e --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/pipeline_type.py @@ -0,0 +1,18 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class PipelineType(Enum): + """ + Pipeline execution mode. + - `TRIGGERED`: If the pipeline uses the triggered execution mode, the system stops processing after successfully refreshing the source table in the pipeline once, ensuring the table is updated based on the data available when the update started. + - `CONTINUOUS`: If the pipeline uses continuous execution, the pipeline processes new data as it arrives in the source table to keep vector index fresh. + """ + + TRIGGERED = "TRIGGERED" + CONTINUOUS = "CONTINUOUS" + + +PipelineTypeParam = Literal["TRIGGERED", "CONTINUOUS"] | PipelineType diff --git a/python/databricks/bundles/vector_search_indexes/_models/privilege.py b/python/databricks/bundles/vector_search_indexes/_models/privilege.py new file mode 100644 index 00000000000..21a52a2f112 --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/privilege.py @@ -0,0 +1,116 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class Privilege(Enum): + SELECT = "SELECT" + READ_PRIVATE_FILES = "READ_PRIVATE_FILES" + WRITE_PRIVATE_FILES = "WRITE_PRIVATE_FILES" + CREATE = "CREATE" + USAGE = "USAGE" + USE_CATALOG = "USE_CATALOG" + USE_SCHEMA = "USE_SCHEMA" + CREATE_SCHEMA = "CREATE_SCHEMA" + CREATE_VIEW = "CREATE_VIEW" + CREATE_EXTERNAL_TABLE = "CREATE_EXTERNAL_TABLE" + CREATE_MATERIALIZED_VIEW = "CREATE_MATERIALIZED_VIEW" + CREATE_FUNCTION = "CREATE_FUNCTION" + CREATE_MODEL = "CREATE_MODEL" + CREATE_CATALOG = "CREATE_CATALOG" + CREATE_MANAGED_STORAGE = "CREATE_MANAGED_STORAGE" + CREATE_EXTERNAL_LOCATION = "CREATE_EXTERNAL_LOCATION" + CREATE_STORAGE_CREDENTIAL = "CREATE_STORAGE_CREDENTIAL" + CREATE_SERVICE_CREDENTIAL = "CREATE_SERVICE_CREDENTIAL" + ACCESS = "ACCESS" + CREATE_SHARE = "CREATE_SHARE" + CREATE_RECIPIENT = "CREATE_RECIPIENT" + CREATE_PROVIDER = "CREATE_PROVIDER" + USE_SHARE = "USE_SHARE" + USE_RECIPIENT = "USE_RECIPIENT" + USE_PROVIDER = "USE_PROVIDER" + USE_MARKETPLACE_ASSETS = "USE_MARKETPLACE_ASSETS" + SET_SHARE_PERMISSION = "SET_SHARE_PERMISSION" + MODIFY = "MODIFY" + REFRESH = "REFRESH" + EXECUTE = "EXECUTE" + READ_FILES = "READ_FILES" + WRITE_FILES = "WRITE_FILES" + CREATE_TABLE = "CREATE_TABLE" + ALL_PRIVILEGES = "ALL_PRIVILEGES" + CREATE_CONNECTION = "CREATE_CONNECTION" + USE_CONNECTION = "USE_CONNECTION" + APPLY_TAG = "APPLY_TAG" + CREATE_FOREIGN_CATALOG = "CREATE_FOREIGN_CATALOG" + CREATE_FOREIGN_SECURABLE = "CREATE_FOREIGN_SECURABLE" + MANAGE_ALLOWLIST = "MANAGE_ALLOWLIST" + CREATE_VOLUME = "CREATE_VOLUME" + CREATE_EXTERNAL_VOLUME = "CREATE_EXTERNAL_VOLUME" + READ_VOLUME = "READ_VOLUME" + WRITE_VOLUME = "WRITE_VOLUME" + MANAGE = "MANAGE" + BROWSE = "BROWSE" + CREATE_CLEAN_ROOM = "CREATE_CLEAN_ROOM" + MODIFY_CLEAN_ROOM = "MODIFY_CLEAN_ROOM" + EXECUTE_CLEAN_ROOM_TASK = "EXECUTE_CLEAN_ROOM_TASK" + EXTERNAL_USE_SCHEMA = "EXTERNAL_USE_SCHEMA" + READ_METADATA = "READ_METADATA" + + +PrivilegeParam = ( + Literal[ + "SELECT", + "READ_PRIVATE_FILES", + "WRITE_PRIVATE_FILES", + "CREATE", + "USAGE", + "USE_CATALOG", + "USE_SCHEMA", + "CREATE_SCHEMA", + "CREATE_VIEW", + "CREATE_EXTERNAL_TABLE", + "CREATE_MATERIALIZED_VIEW", + "CREATE_FUNCTION", + "CREATE_MODEL", + "CREATE_CATALOG", + "CREATE_MANAGED_STORAGE", + "CREATE_EXTERNAL_LOCATION", + "CREATE_STORAGE_CREDENTIAL", + "CREATE_SERVICE_CREDENTIAL", + "ACCESS", + "CREATE_SHARE", + "CREATE_RECIPIENT", + "CREATE_PROVIDER", + "USE_SHARE", + "USE_RECIPIENT", + "USE_PROVIDER", + "USE_MARKETPLACE_ASSETS", + "SET_SHARE_PERMISSION", + "MODIFY", + "REFRESH", + "EXECUTE", + "READ_FILES", + "WRITE_FILES", + "CREATE_TABLE", + "ALL_PRIVILEGES", + "CREATE_CONNECTION", + "USE_CONNECTION", + "APPLY_TAG", + "CREATE_FOREIGN_CATALOG", + "CREATE_FOREIGN_SECURABLE", + "MANAGE_ALLOWLIST", + "CREATE_VOLUME", + "CREATE_EXTERNAL_VOLUME", + "READ_VOLUME", + "WRITE_VOLUME", + "MANAGE", + "BROWSE", + "CREATE_CLEAN_ROOM", + "MODIFY_CLEAN_ROOM", + "EXECUTE_CLEAN_ROOM_TASK", + "EXTERNAL_USE_SCHEMA", + "READ_METADATA", + ] + | Privilege +) diff --git a/python/databricks/bundles/vector_search_indexes/_models/privilege_assignment.py b/python/databricks/bundles/vector_search_indexes/_models/privilege_assignment.py new file mode 100644 index 00000000000..55100240cc4 --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/privilege_assignment.py @@ -0,0 +1,56 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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 VariableOrList, VariableOrOptional +from databricks.bundles.vector_search_indexes._models.privilege import ( + Privilege, + PrivilegeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class PrivilegeAssignment: + """""" + + principal: VariableOrOptional[str] = None + """ + The principal (user email address or group name). + For deleted principals, `principal` is empty while `principal_id` is populated. + """ + + privileges: VariableOrList[Privilege] = field(default_factory=list) + """ + The privileges assigned to the principal. + """ + + @classmethod + def from_dict(cls, value: "PrivilegeAssignmentDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "PrivilegeAssignmentDict": + return _transform_to_json_value(self) # type:ignore + + +class PrivilegeAssignmentDict(TypedDict, total=False): + """""" + + principal: VariableOrOptional[str] + """ + The principal (user email address or group name). + For deleted principals, `principal` is empty while `principal_id` is populated. + """ + + privileges: VariableOrList[PrivilegeParam] + """ + The privileges assigned to the principal. + """ + + +PrivilegeAssignmentParam = PrivilegeAssignmentDict | PrivilegeAssignment diff --git a/python/databricks/bundles/vector_search_indexes/_models/vector_index_type.py b/python/databricks/bundles/vector_search_indexes/_models/vector_index_type.py new file mode 100644 index 00000000000..43b8550c8b2 --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/vector_index_type.py @@ -0,0 +1,18 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from enum import Enum +from typing import Literal + + +class VectorIndexType(Enum): + """ + There are 2 types of AI Search indexes: + - `DELTA_SYNC`: An index that automatically syncs with a source Delta Table, automatically and incrementally updating the index as the underlying data in the Delta Table changes. + - `DIRECT_ACCESS`: An index that supports direct read and write of vectors and metadata through our REST and SDK APIs. With this model, the user manages index updates. + """ + + DELTA_SYNC = "DELTA_SYNC" + DIRECT_ACCESS = "DIRECT_ACCESS" + + +VectorIndexTypeParam = Literal["DELTA_SYNC", "DIRECT_ACCESS"] | VectorIndexType diff --git a/python/databricks/bundles/vector_search_indexes/_models/vector_search_index.py b/python/databricks/bundles/vector_search_indexes/_models/vector_search_index.py new file mode 100644 index 00000000000..dba21478b1f --- /dev/null +++ b/python/databricks/bundles/vector_search_indexes/_models/vector_search_index.py @@ -0,0 +1,157 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from dataclasses import dataclass, field +from typing import TYPE_CHECKING, TypedDict + +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, + VariableOrList, + VariableOrOptional, +) +from databricks.bundles.vector_search_indexes._models.delta_sync_vector_index_spec_request import ( + DeltaSyncVectorIndexSpecRequest, + DeltaSyncVectorIndexSpecRequestParam, +) +from databricks.bundles.vector_search_indexes._models.direct_access_vector_index_spec import ( + DirectAccessVectorIndexSpec, + DirectAccessVectorIndexSpecParam, +) +from databricks.bundles.vector_search_indexes._models.index_subtype import ( + IndexSubtype, + IndexSubtypeParam, +) +from databricks.bundles.vector_search_indexes._models.lifecycle import ( + Lifecycle, + LifecycleParam, +) +from databricks.bundles.vector_search_indexes._models.privilege_assignment import ( + PrivilegeAssignment, + PrivilegeAssignmentParam, +) +from databricks.bundles.vector_search_indexes._models.vector_index_type import ( + VectorIndexType, + VectorIndexTypeParam, +) + +if TYPE_CHECKING: + from typing_extensions import Self + + +@dataclass(kw_only=True) +class VectorSearchIndex(Resource): + """""" + + endpoint_name: VariableOr[str] + """ + Name of the endpoint to be used for serving the index + """ + + index_type: VariableOr[VectorIndexType] + """ + There are 2 types of AI Search indexes: + - `DELTA_SYNC`: An index that automatically syncs with a source Delta Table, automatically and incrementally updating the index as the underlying data in the Delta Table changes. + - `DIRECT_ACCESS`: An index that supports direct read and write of vectors and metadata through our REST and SDK APIs. With this model, the user manages index updates. + """ + + name: VariableOr[str] + """ + Name of the index + """ + + primary_key: VariableOr[str] + """ + Primary key of the index + """ + + delta_sync_index_spec: VariableOrOptional[DeltaSyncVectorIndexSpecRequest] = None + """ + Specification for Delta Sync Index. Required if `index_type` is `DELTA_SYNC`. + """ + + direct_access_index_spec: VariableOrOptional[DirectAccessVectorIndexSpec] = None + """ + Specification for Direct Vector Access Index. Required if `index_type` is `DIRECT_ACCESS`. + """ + + grants: VariableOrList[PrivilegeAssignment] = field(default_factory=list) + """ + The Unity Catalog privileges to grant to principals on this securable. + """ + + index_subtype: VariableOrOptional[IndexSubtype] = None + """ + :meta private: [EXPERIMENTAL] + + [Beta] The subtype of the index. Use `HYBRID` or `FULL_TEXT`. `VECTOR` is not supported. + """ + + lifecycle: VariableOrOptional[Lifecycle] = None + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + @classmethod + def from_dict(cls, value: "VectorSearchIndexDict") -> "Self": + return _transform(cls, value) + + def as_dict(self) -> "VectorSearchIndexDict": + return _transform_to_json_value(self) # type:ignore + + +class VectorSearchIndexDict(TypedDict, total=False): + """""" + + endpoint_name: VariableOr[str] + """ + Name of the endpoint to be used for serving the index + """ + + index_type: VariableOr[VectorIndexTypeParam] + """ + There are 2 types of AI Search indexes: + - `DELTA_SYNC`: An index that automatically syncs with a source Delta Table, automatically and incrementally updating the index as the underlying data in the Delta Table changes. + - `DIRECT_ACCESS`: An index that supports direct read and write of vectors and metadata through our REST and SDK APIs. With this model, the user manages index updates. + """ + + name: VariableOr[str] + """ + Name of the index + """ + + primary_key: VariableOr[str] + """ + Primary key of the index + """ + + delta_sync_index_spec: VariableOrOptional[DeltaSyncVectorIndexSpecRequestParam] + """ + Specification for Delta Sync Index. Required if `index_type` is `DELTA_SYNC`. + """ + + direct_access_index_spec: VariableOrOptional[DirectAccessVectorIndexSpecParam] + """ + Specification for Direct Vector Access Index. Required if `index_type` is `DIRECT_ACCESS`. + """ + + grants: VariableOrList[PrivilegeAssignmentParam] + """ + The Unity Catalog privileges to grant to principals on this securable. + """ + + index_subtype: VariableOrOptional[IndexSubtypeParam] + """ + :meta private: [EXPERIMENTAL] + + [Beta] The subtype of the index. Use `HYBRID` or `FULL_TEXT`. `VECTOR` is not supported. + """ + + lifecycle: VariableOrOptional[LifecycleParam] + """ + Settings that control the deployment lifecycle of the resource, such as preventing it from being destroyed. + """ + + +VectorSearchIndexParam = VectorSearchIndexDict | VectorSearchIndex diff --git a/python/databricks_tests/core/_generated/__init__.py b/python/databricks_tests/core/_generated/__init__.py index 9cf2cc18cee..7b2632a44b0 100644 --- a/python/databricks_tests/core/_generated/__init__.py +++ b/python/databricks_tests/core/_generated/__init__.py @@ -2,10 +2,27 @@ from databricks_tests.core._generated import ( alerts, + apps, catalogs, + clusters, + database_catalogs, + database_instances, + experiments, + external_locations, + instance_pools, + job_runs, jobs, + model_serving_endpoints, + models, pipelines, + quality_monitors, + registered_models, schemas, + secret_scopes, + sql_warehouses, + synced_database_tables, + vector_search_endpoints, + vector_search_indexes, volumes, ) @@ -13,9 +30,26 @@ test_cases = [ alerts._test_case(), + apps._test_case(), catalogs._test_case(), + clusters._test_case(), + database_catalogs._test_case(), + database_instances._test_case(), + experiments._test_case(), + external_locations._test_case(), + instance_pools._test_case(), + job_runs._test_case(), jobs._test_case(), + model_serving_endpoints._test_case(), + models._test_case(), pipelines._test_case(), + quality_monitors._test_case(), + registered_models._test_case(), schemas._test_case(), + secret_scopes._test_case(), + sql_warehouses._test_case(), + synced_database_tables._test_case(), + vector_search_endpoints._test_case(), + vector_search_indexes._test_case(), volumes._test_case(), ] diff --git a/python/databricks_tests/core/_generated/apps.py b/python/databricks_tests/core/_generated/apps.py new file mode 100644 index 00000000000..c16a7512893 --- /dev/null +++ b/python/databricks_tests/core/_generated/apps.py @@ -0,0 +1,48 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.apps._models.app import App +from databricks.bundles.apps._models.app_config import AppConfig +from databricks.bundles.apps._models.app_permission import AppPermission +from databricks.bundles.apps._models.app_permission_level import AppPermissionLevel +from databricks.bundles.apps._models.app_resource import AppResource +from databricks.bundles.apps._models.compute_size import ComputeSize +from databricks.bundles.apps._models.git_repository import GitRepository +from databricks.bundles.apps._models.lifecycle_with_started import LifecycleWithStarted +from databricks.bundles.apps._models.telemetry_export_destination import ( + TelemetryExportDestination, +) +from databricks.bundles.core import Resources, app_mutator +from databricks.bundles.core._generated.apps import _resource_type +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_app, + dict_example={ + "compute_size": "MEDIUM", + "config": {}, + "git_repository": {"provider": "provider", "url": "url"}, + "lifecycle": {}, + "name": "name", + "permissions": [{"level": "CAN_MANAGE"}], + "resources": [{"name": "name"}], + "telemetry_export_destinations": [{}], + "user_api_scopes": ["user_api_scopes"], + }, + dataclass_example=App( + compute_size=ComputeSize.MEDIUM, + config=AppConfig(), + git_repository=GitRepository(provider="provider", url="url"), + lifecycle=LifecycleWithStarted(), + name="name", + permissions=[AppPermission(level=AppPermissionLevel.CAN_MANAGE)], + resources=[AppResource(name="name")], + telemetry_export_destinations=[TelemetryExportDestination()], + user_api_scopes=["user_api_scopes"], + ), + mutator=app_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/clusters.py b/python/databricks_tests/core/_generated/clusters.py new file mode 100644 index 00000000000..d843f6c8f5d --- /dev/null +++ b/python/databricks_tests/core/_generated/clusters.py @@ -0,0 +1,82 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.clusters._models.auto_scale import AutoScale +from databricks.bundles.clusters._models.aws_attributes import AwsAttributes +from databricks.bundles.clusters._models.azure_attributes import AzureAttributes +from databricks.bundles.clusters._models.clients_types import ClientsTypes +from databricks.bundles.clusters._models.cluster import Cluster +from databricks.bundles.clusters._models.cluster_log_conf import ClusterLogConf +from databricks.bundles.clusters._models.cluster_permission import ClusterPermission +from databricks.bundles.clusters._models.cluster_permission_level import ( + ClusterPermissionLevel, +) +from databricks.bundles.clusters._models.data_security_mode import DataSecurityMode +from databricks.bundles.clusters._models.docker_image import DockerImage +from databricks.bundles.clusters._models.gcp_attributes import GcpAttributes +from databricks.bundles.clusters._models.init_script_info import InitScriptInfo +from databricks.bundles.clusters._models.kind import Kind +from databricks.bundles.clusters._models.lifecycle_with_started import ( + LifecycleWithStarted, +) +from databricks.bundles.clusters._models.node_type_flexibility import ( + NodeTypeFlexibility, +) +from databricks.bundles.clusters._models.runtime_engine import RuntimeEngine +from databricks.bundles.clusters._models.workload_type import WorkloadType +from databricks.bundles.core import Resources, cluster_mutator +from databricks.bundles.core._generated.clusters import _resource_type +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_cluster, + dict_example={ + "autoscale": {}, + "aws_attributes": {}, + "azure_attributes": {}, + "cluster_log_conf": {}, + "custom_tags": {"key": "value"}, + "data_security_mode": "NONE", + "docker_image": {}, + "driver_node_type_flexibility": {}, + "gcp_attributes": {}, + "init_scripts": [{}], + "kind": "CLASSIC_PREVIEW", + "lifecycle": {}, + "permissions": [{"level": "CAN_MANAGE"}], + "runtime_engine": "NULL", + "spark_conf": {"key": "value"}, + "spark_env_vars": {"key": "value"}, + "ssh_public_keys": ["ssh_public_keys"], + "worker_node_type_flexibility": {}, + "workload_type": {"clients": {}}, + }, + dataclass_example=Cluster( + autoscale=AutoScale(), + aws_attributes=AwsAttributes(), + azure_attributes=AzureAttributes(), + cluster_log_conf=ClusterLogConf(), + custom_tags={"key": "value"}, + data_security_mode=DataSecurityMode.NONE, + docker_image=DockerImage(), + driver_node_type_flexibility=NodeTypeFlexibility(), + gcp_attributes=GcpAttributes(), + init_scripts=[InitScriptInfo()], + kind=Kind.CLASSIC_PREVIEW, + lifecycle=LifecycleWithStarted(), + permissions=[ + ClusterPermission(level=ClusterPermissionLevel.CAN_MANAGE) + ], + runtime_engine=RuntimeEngine.NULL, + spark_conf={"key": "value"}, + spark_env_vars={"key": "value"}, + ssh_public_keys=["ssh_public_keys"], + worker_node_type_flexibility=NodeTypeFlexibility(), + workload_type=WorkloadType(clients=ClientsTypes()), + ), + mutator=cluster_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/database_catalogs.py b/python/databricks_tests/core/_generated/database_catalogs.py new file mode 100644 index 00000000000..0d774e87268 --- /dev/null +++ b/python/databricks_tests/core/_generated/database_catalogs.py @@ -0,0 +1,31 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, database_catalog_mutator +from databricks.bundles.core._generated.database_catalogs import _resource_type +from databricks.bundles.database_catalogs._models.database_catalog import ( + DatabaseCatalog, +) +from databricks.bundles.database_catalogs._models.lifecycle import Lifecycle +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_database_catalog, + dict_example={ + "database_instance_name": "database_instance_name", + "database_name": "database_name", + "lifecycle": {}, + "name": "name", + }, + dataclass_example=DatabaseCatalog( + database_instance_name="database_instance_name", + database_name="database_name", + lifecycle=Lifecycle(), + name="name", + ), + mutator=database_catalog_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/database_instances.py b/python/databricks_tests/core/_generated/database_instances.py new file mode 100644 index 00000000000..62a5c1c8f21 --- /dev/null +++ b/python/databricks_tests/core/_generated/database_instances.py @@ -0,0 +1,38 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, database_instance_mutator +from databricks.bundles.core._generated.database_instances import _resource_type +from databricks.bundles.database_instances._models.database_instance import ( + DatabaseInstance, +) +from databricks.bundles.database_instances._models.database_instance_ref import ( + DatabaseInstanceRef, +) +from databricks.bundles.database_instances._models.lifecycle import Lifecycle +from databricks.bundles.database_instances._models.permission import Permission +from databricks.bundles.database_instances._models.permission_level import ( + PermissionLevel, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_database_instance, + dict_example={ + "lifecycle": {}, + "name": "name", + "parent_instance_ref": {}, + "permissions": [{"level": "CAN_MANAGE"}], + }, + dataclass_example=DatabaseInstance( + lifecycle=Lifecycle(), + name="name", + parent_instance_ref=DatabaseInstanceRef(), + permissions=[Permission(level=PermissionLevel.CAN_MANAGE)], + ), + mutator=database_instance_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/experiments.py b/python/databricks_tests/core/_generated/experiments.py new file mode 100644 index 00000000000..8a95f46dc28 --- /dev/null +++ b/python/databricks_tests/core/_generated/experiments.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, mlflow_experiment_mutator +from databricks.bundles.core._generated.experiments import _resource_type +from databricks.bundles.experiments._models.experiment_permission_level import ( + ExperimentPermissionLevel, +) +from databricks.bundles.experiments._models.experiment_tag import ExperimentTag +from databricks.bundles.experiments._models.lifecycle import Lifecycle +from databricks.bundles.experiments._models.mlflow_experiment import MlflowExperiment +from databricks.bundles.experiments._models.mlflow_experiment_permission import ( + MlflowExperimentPermission, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_mlflow_experiment, + dict_example={ + "lifecycle": {}, + "name": "name", + "permissions": [{"level": "CAN_MANAGE"}], + "tags": [{}], + }, + dataclass_example=MlflowExperiment( + lifecycle=Lifecycle(), + name="name", + permissions=[ + MlflowExperimentPermission( + level=ExperimentPermissionLevel.CAN_MANAGE + ) + ], + tags=[ExperimentTag()], + ), + mutator=mlflow_experiment_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/external_locations.py b/python/databricks_tests/core/_generated/external_locations.py new file mode 100644 index 00000000000..9891fe648f6 --- /dev/null +++ b/python/databricks_tests/core/_generated/external_locations.py @@ -0,0 +1,46 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, external_location_mutator +from databricks.bundles.core._generated.external_locations import _resource_type +from databricks.bundles.external_locations._models.encryption_details import ( + EncryptionDetails, +) +from databricks.bundles.external_locations._models.external_location import ( + ExternalLocation, +) +from databricks.bundles.external_locations._models.file_event_queue import ( + FileEventQueue, +) +from databricks.bundles.external_locations._models.lifecycle import Lifecycle +from databricks.bundles.external_locations._models.privilege_assignment import ( + PrivilegeAssignment, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_external_location, + dict_example={ + "credential_name": "credential_name", + "encryption_details": {}, + "file_event_queue": {}, + "grants": [{}], + "lifecycle": {}, + "name": "name", + "url": "url", + }, + dataclass_example=ExternalLocation( + credential_name="credential_name", + encryption_details=EncryptionDetails(), + file_event_queue=FileEventQueue(), + grants=[PrivilegeAssignment()], + lifecycle=Lifecycle(), + name="name", + url="url", + ), + mutator=external_location_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/instance_pools.py b/python/databricks_tests/core/_generated/instance_pools.py new file mode 100644 index 00000000000..e5328d96ad8 --- /dev/null +++ b/python/databricks_tests/core/_generated/instance_pools.py @@ -0,0 +1,67 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, instance_pool_mutator +from databricks.bundles.core._generated.instance_pools import _resource_type +from databricks.bundles.instance_pools._models.disk_spec import DiskSpec +from databricks.bundles.instance_pools._models.docker_image import DockerImage +from databricks.bundles.instance_pools._models.instance_pool import InstancePool +from databricks.bundles.instance_pools._models.instance_pool_aws_attributes import ( + InstancePoolAwsAttributes, +) +from databricks.bundles.instance_pools._models.instance_pool_azure_attributes import ( + InstancePoolAzureAttributes, +) +from databricks.bundles.instance_pools._models.instance_pool_gcp_attributes import ( + InstancePoolGcpAttributes, +) +from databricks.bundles.instance_pools._models.instance_pool_permission import ( + InstancePoolPermission, +) +from databricks.bundles.instance_pools._models.instance_pool_permission_level import ( + InstancePoolPermissionLevel, +) +from databricks.bundles.instance_pools._models.lifecycle import Lifecycle +from databricks.bundles.instance_pools._models.node_type_flexibility import ( + NodeTypeFlexibility, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_instance_pool, + dict_example={ + "aws_attributes": {}, + "azure_attributes": {}, + "custom_tags": {"key": "value"}, + "disk_spec": {}, + "gcp_attributes": {}, + "instance_pool_name": "instance_pool_name", + "lifecycle": {}, + "node_type_flexibility": {}, + "node_type_id": "node_type_id", + "permissions": [{"level": "CAN_MANAGE"}], + "preloaded_docker_images": [{}], + "preloaded_spark_versions": ["preloaded_spark_versions"], + }, + dataclass_example=InstancePool( + aws_attributes=InstancePoolAwsAttributes(), + azure_attributes=InstancePoolAzureAttributes(), + custom_tags={"key": "value"}, + disk_spec=DiskSpec(), + gcp_attributes=InstancePoolGcpAttributes(), + instance_pool_name="instance_pool_name", + lifecycle=Lifecycle(), + node_type_flexibility=NodeTypeFlexibility(), + node_type_id="node_type_id", + permissions=[ + InstancePoolPermission(level=InstancePoolPermissionLevel.CAN_MANAGE) + ], + preloaded_docker_images=[DockerImage()], + preloaded_spark_versions=["preloaded_spark_versions"], + ), + mutator=instance_pool_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/job_runs.py b/python/databricks_tests/core/_generated/job_runs.py new file mode 100644 index 00000000000..e575d69b963 --- /dev/null +++ b/python/databricks_tests/core/_generated/job_runs.py @@ -0,0 +1,38 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, job_run_mutator +from databricks.bundles.core._generated.job_runs import _resource_type +from databricks.bundles.job_runs._models.job_run import JobRun +from databricks.bundles.job_runs._models.job_run_lifecycle import JobRunLifecycle +from databricks.bundles.job_runs._models.performance_target import PerformanceTarget +from databricks.bundles.job_runs._models.pipeline_params import PipelineParams +from databricks.bundles.job_runs._models.queue_settings import QueueSettings +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_job_run, + dict_example={ + "job_id": 0, + "job_parameters": {"key": "value"}, + "lifecycle": {}, + "only": ["only"], + "performance_target": "PERFORMANCE_OPTIMIZED", + "pipeline_params": {}, + "queue": {"enabled": True}, + }, + dataclass_example=JobRun( + job_id=0, + job_parameters={"key": "value"}, + lifecycle=JobRunLifecycle(), + only=["only"], + performance_target=PerformanceTarget.PERFORMANCE_OPTIMIZED, + pipeline_params=PipelineParams(), + queue=QueueSettings(enabled=True), + ), + mutator=job_run_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/model_serving_endpoints.py b/python/databricks_tests/core/_generated/model_serving_endpoints.py new file mode 100644 index 00000000000..1e21d8bde7a --- /dev/null +++ b/python/databricks_tests/core/_generated/model_serving_endpoints.py @@ -0,0 +1,62 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, model_serving_endpoint_mutator +from databricks.bundles.core._generated.model_serving_endpoints import _resource_type +from databricks.bundles.model_serving_endpoints._models.ai_gateway_config import ( + AiGatewayConfig, +) +from databricks.bundles.model_serving_endpoints._models.email_notifications import ( + EmailNotifications, +) +from databricks.bundles.model_serving_endpoints._models.endpoint_core_config_input import ( + EndpointCoreConfigInput, +) +from databricks.bundles.model_serving_endpoints._models.endpoint_tag import EndpointTag +from databricks.bundles.model_serving_endpoints._models.lifecycle import Lifecycle +from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint import ( + ModelServingEndpoint, +) +from databricks.bundles.model_serving_endpoints._models.model_serving_endpoint_permission import ( + ModelServingEndpointPermission, +) +from databricks.bundles.model_serving_endpoints._models.serving_endpoint_permission_level import ( + ServingEndpointPermissionLevel, +) +from databricks.bundles.model_serving_endpoints._models.telemetry_config import ( + TelemetryConfig, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_model_serving_endpoint, + dict_example={ + "ai_gateway": {}, + "config": {}, + "email_notifications": {}, + "lifecycle": {}, + "name": "name", + "permissions": [{"level": "CAN_MANAGE"}], + "tags": [{"key": "key"}], + "telemetry_config": {}, + }, + dataclass_example=ModelServingEndpoint( + ai_gateway=AiGatewayConfig(), + config=EndpointCoreConfigInput(), + email_notifications=EmailNotifications(), + lifecycle=Lifecycle(), + name="name", + permissions=[ + ModelServingEndpointPermission( + level=ServingEndpointPermissionLevel.CAN_MANAGE + ) + ], + tags=[EndpointTag(key="key")], + telemetry_config=TelemetryConfig(), + ), + mutator=model_serving_endpoint_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/models.py b/python/databricks_tests/core/_generated/models.py new file mode 100644 index 00000000000..f5a90c5604f --- /dev/null +++ b/python/databricks_tests/core/_generated/models.py @@ -0,0 +1,40 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, mlflow_model_mutator +from databricks.bundles.core._generated.models import _resource_type +from databricks.bundles.models._models.lifecycle import Lifecycle +from databricks.bundles.models._models.mlflow_model import MlflowModel +from databricks.bundles.models._models.mlflow_model_permission import ( + MlflowModelPermission, +) +from databricks.bundles.models._models.model_tag import ModelTag +from databricks.bundles.models._models.registered_model_permission_level import ( + RegisteredModelPermissionLevel, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_mlflow_model, + dict_example={ + "lifecycle": {}, + "name": "name", + "permissions": [{"level": "CAN_MANAGE"}], + "tags": [{}], + }, + dataclass_example=MlflowModel( + lifecycle=Lifecycle(), + name="name", + permissions=[ + MlflowModelPermission( + level=RegisteredModelPermissionLevel.CAN_MANAGE + ) + ], + tags=[ModelTag()], + ), + mutator=mlflow_model_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/quality_monitors.py b/python/databricks_tests/core/_generated/quality_monitors.py new file mode 100644 index 00000000000..e0688dedaed --- /dev/null +++ b/python/databricks_tests/core/_generated/quality_monitors.py @@ -0,0 +1,102 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, quality_monitor_mutator +from databricks.bundles.core._generated.quality_monitors import _resource_type +from databricks.bundles.quality_monitors._models.lifecycle import Lifecycle +from databricks.bundles.quality_monitors._models.monitor_cron_schedule import ( + MonitorCronSchedule, +) +from databricks.bundles.quality_monitors._models.monitor_inference_log import ( + MonitorInferenceLog, +) +from databricks.bundles.quality_monitors._models.monitor_inference_log_problem_type import ( + MonitorInferenceLogProblemType, +) +from databricks.bundles.quality_monitors._models.monitor_metric import MonitorMetric +from databricks.bundles.quality_monitors._models.monitor_metric_type import ( + MonitorMetricType, +) +from databricks.bundles.quality_monitors._models.monitor_notifications import ( + MonitorNotifications, +) +from databricks.bundles.quality_monitors._models.monitor_snapshot import MonitorSnapshot +from databricks.bundles.quality_monitors._models.monitor_time_series import ( + MonitorTimeSeries, +) +from databricks.bundles.quality_monitors._models.quality_monitor import QualityMonitor +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_quality_monitor, + dict_example={ + "assets_dir": "assets_dir", + "custom_metrics": [ + { + "definition": "definition", + "input_columns": ["input_columns"], + "name": "name", + "output_data_type": "output_data_type", + "type": "CUSTOM_METRIC_TYPE_AGGREGATE", + } + ], + "inference_log": { + "granularities": ["granularities"], + "model_id_col": "model_id_col", + "prediction_col": "prediction_col", + "problem_type": "PROBLEM_TYPE_CLASSIFICATION", + "timestamp_col": "timestamp_col", + }, + "lifecycle": {}, + "notifications": {}, + "output_schema_name": "output_schema_name", + "schedule": { + "quartz_cron_expression": "quartz_cron_expression", + "timezone_id": "timezone_id", + }, + "slicing_exprs": ["slicing_exprs"], + "snapshot": {}, + "table_name": "table_name", + "time_series": { + "granularities": ["granularities"], + "timestamp_col": "timestamp_col", + }, + }, + dataclass_example=QualityMonitor( + assets_dir="assets_dir", + custom_metrics=[ + MonitorMetric( + definition="definition", + input_columns=["input_columns"], + name="name", + output_data_type="output_data_type", + type=MonitorMetricType.CUSTOM_METRIC_TYPE_AGGREGATE, + ) + ], + inference_log=MonitorInferenceLog( + granularities=["granularities"], + model_id_col="model_id_col", + prediction_col="prediction_col", + problem_type=MonitorInferenceLogProblemType.PROBLEM_TYPE_CLASSIFICATION, + timestamp_col="timestamp_col", + ), + lifecycle=Lifecycle(), + notifications=MonitorNotifications(), + output_schema_name="output_schema_name", + schedule=MonitorCronSchedule( + quartz_cron_expression="quartz_cron_expression", + timezone_id="timezone_id", + ), + slicing_exprs=["slicing_exprs"], + snapshot=MonitorSnapshot(), + table_name="table_name", + time_series=MonitorTimeSeries( + granularities=["granularities"], timestamp_col="timestamp_col" + ), + ), + mutator=quality_monitor_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/registered_models.py b/python/databricks_tests/core/_generated/registered_models.py new file mode 100644 index 00000000000..07a59c43f84 --- /dev/null +++ b/python/databricks_tests/core/_generated/registered_models.py @@ -0,0 +1,31 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, registered_model_mutator +from databricks.bundles.core._generated.registered_models import _resource_type +from databricks.bundles.registered_models._models.lifecycle import Lifecycle +from databricks.bundles.registered_models._models.privilege_assignment import ( + PrivilegeAssignment, +) +from databricks.bundles.registered_models._models.registered_model import ( + RegisteredModel, +) +from databricks.bundles.registered_models._models.registered_model_alias import ( + RegisteredModelAlias, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_registered_model, + dict_example={"aliases": [{}], "grants": [{}], "lifecycle": {}}, + dataclass_example=RegisteredModel( + aliases=[RegisteredModelAlias()], + grants=[PrivilegeAssignment()], + lifecycle=Lifecycle(), + ), + mutator=registered_model_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/secret_scopes.py b/python/databricks_tests/core/_generated/secret_scopes.py new file mode 100644 index 00000000000..eb299900bcf --- /dev/null +++ b/python/databricks_tests/core/_generated/secret_scopes.py @@ -0,0 +1,48 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, secret_scope_mutator +from databricks.bundles.core._generated.secret_scopes import _resource_type +from databricks.bundles.secret_scopes._models.azure_key_vault_secret_scope_metadata import ( + AzureKeyVaultSecretScopeMetadata, +) +from databricks.bundles.secret_scopes._models.lifecycle import Lifecycle +from databricks.bundles.secret_scopes._models.scope_backend_type import ScopeBackendType +from databricks.bundles.secret_scopes._models.secret_scope import SecretScope +from databricks.bundles.secret_scopes._models.secret_scope_permission import ( + SecretScopePermission, +) +from databricks.bundles.secret_scopes._models.secret_scope_permission_level import ( + SecretScopePermissionLevel, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_secret_scope, + dict_example={ + "backend_type": "DATABRICKS", + "keyvault_metadata": { + "dns_name": "dns_name", + "resource_id": "resource_id", + }, + "lifecycle": {}, + "name": "name", + "permissions": [{"level": "READ"}], + }, + dataclass_example=SecretScope( + backend_type=ScopeBackendType.DATABRICKS, + keyvault_metadata=AzureKeyVaultSecretScopeMetadata( + dns_name="dns_name", resource_id="resource_id" + ), + lifecycle=Lifecycle(), + name="name", + permissions=[ + SecretScopePermission(level=SecretScopePermissionLevel.READ) + ], + ), + mutator=secret_scope_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/sql_warehouses.py b/python/databricks_tests/core/_generated/sql_warehouses.py new file mode 100644 index 00000000000..42556c6d3c7 --- /dev/null +++ b/python/databricks_tests/core/_generated/sql_warehouses.py @@ -0,0 +1,51 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, sql_warehouse_mutator +from databricks.bundles.core._generated.sql_warehouses import _resource_type +from databricks.bundles.sql_warehouses._models.channel import Channel +from databricks.bundles.sql_warehouses._models.create_warehouse_request_warehouse_type import ( + CreateWarehouseRequestWarehouseType, +) +from databricks.bundles.sql_warehouses._models.endpoint_tags import EndpointTags +from databricks.bundles.sql_warehouses._models.lifecycle_with_started import ( + LifecycleWithStarted, +) +from databricks.bundles.sql_warehouses._models.spot_instance_policy import ( + SpotInstancePolicy, +) +from databricks.bundles.sql_warehouses._models.sql_warehouse import SqlWarehouse +from databricks.bundles.sql_warehouses._models.sql_warehouse_permission import ( + SqlWarehousePermission, +) +from databricks.bundles.sql_warehouses._models.warehouse_permission_level import ( + WarehousePermissionLevel, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_sql_warehouse, + dict_example={ + "channel": {}, + "lifecycle": {}, + "permissions": [{"level": "CAN_MANAGE"}], + "spot_instance_policy": "POLICY_UNSPECIFIED", + "tags": {}, + "warehouse_type": "TYPE_UNSPECIFIED", + }, + dataclass_example=SqlWarehouse( + channel=Channel(), + lifecycle=LifecycleWithStarted(), + permissions=[ + SqlWarehousePermission(level=WarehousePermissionLevel.CAN_MANAGE) + ], + spot_instance_policy=SpotInstancePolicy.POLICY_UNSPECIFIED, + tags=EndpointTags(), + warehouse_type=CreateWarehouseRequestWarehouseType.TYPE_UNSPECIFIED, + ), + mutator=sql_warehouse_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/synced_database_tables.py b/python/databricks_tests/core/_generated/synced_database_tables.py new file mode 100644 index 00000000000..e1effc640a8 --- /dev/null +++ b/python/databricks_tests/core/_generated/synced_database_tables.py @@ -0,0 +1,26 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, synced_database_table_mutator +from databricks.bundles.core._generated.synced_database_tables import _resource_type +from databricks.bundles.synced_database_tables._models.lifecycle import Lifecycle +from databricks.bundles.synced_database_tables._models.synced_database_table import ( + SyncedDatabaseTable, +) +from databricks.bundles.synced_database_tables._models.synced_table_spec import ( + SyncedTableSpec, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_synced_database_table, + dict_example={"lifecycle": {}, "name": "name", "spec": {}}, + dataclass_example=SyncedDatabaseTable( + lifecycle=Lifecycle(), name="name", spec=SyncedTableSpec() + ), + mutator=synced_database_table_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/vector_search_endpoints.py b/python/databricks_tests/core/_generated/vector_search_endpoints.py new file mode 100644 index 00000000000..b01089ed806 --- /dev/null +++ b/python/databricks_tests/core/_generated/vector_search_endpoints.py @@ -0,0 +1,44 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, vector_search_endpoint_mutator +from databricks.bundles.core._generated.vector_search_endpoints import _resource_type +from databricks.bundles.vector_search_endpoints._models.endpoint_type import ( + EndpointType, +) +from databricks.bundles.vector_search_endpoints._models.lifecycle import Lifecycle +from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint import ( + VectorSearchEndpoint, +) +from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint_permission import ( + VectorSearchEndpointPermission, +) +from databricks.bundles.vector_search_endpoints._models.vector_search_endpoint_permission_level import ( + VectorSearchEndpointPermissionLevel, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_vector_search_endpoint, + dict_example={ + "endpoint_type": "STORAGE_OPTIMIZED", + "lifecycle": {}, + "name": "name", + "permissions": [{"level": "CAN_CREATE"}], + }, + dataclass_example=VectorSearchEndpoint( + endpoint_type=EndpointType.STORAGE_OPTIMIZED, + lifecycle=Lifecycle(), + name="name", + permissions=[ + VectorSearchEndpointPermission( + level=VectorSearchEndpointPermissionLevel.CAN_CREATE + ) + ], + ), + mutator=vector_search_endpoint_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/_generated/vector_search_indexes.py b/python/databricks_tests/core/_generated/vector_search_indexes.py new file mode 100644 index 00000000000..677cf14303d --- /dev/null +++ b/python/databricks_tests/core/_generated/vector_search_indexes.py @@ -0,0 +1,51 @@ +# Code generated by pydabs-codegen. DO NOT EDIT. + +from databricks.bundles.core import Resources, vector_search_index_mutator +from databricks.bundles.core._generated.vector_search_indexes import _resource_type +from databricks.bundles.vector_search_indexes._models.delta_sync_vector_index_spec_request import ( + DeltaSyncVectorIndexSpecRequest, +) +from databricks.bundles.vector_search_indexes._models.direct_access_vector_index_spec import ( + DirectAccessVectorIndexSpec, +) +from databricks.bundles.vector_search_indexes._models.lifecycle import Lifecycle +from databricks.bundles.vector_search_indexes._models.privilege_assignment import ( + PrivilegeAssignment, +) +from databricks.bundles.vector_search_indexes._models.vector_index_type import ( + VectorIndexType, +) +from databricks.bundles.vector_search_indexes._models.vector_search_index import ( + VectorSearchIndex, +) +from databricks_tests.core._resource_test_case import TestCase + + +def _test_case(): + return ( + TestCase( + add_resource=Resources.add_vector_search_index, + dict_example={ + "delta_sync_index_spec": {}, + "direct_access_index_spec": {}, + "endpoint_name": "endpoint_name", + "grants": [{}], + "index_type": "DELTA_SYNC", + "lifecycle": {}, + "name": "name", + "primary_key": "primary_key", + }, + dataclass_example=VectorSearchIndex( + delta_sync_index_spec=DeltaSyncVectorIndexSpecRequest(), + direct_access_index_spec=DirectAccessVectorIndexSpec(), + endpoint_name="endpoint_name", + grants=[PrivilegeAssignment()], + index_type=VectorIndexType.DELTA_SYNC, + lifecycle=Lifecycle(), + name="name", + primary_key="primary_key", + ), + mutator=vector_search_index_mutator, + ), + _resource_type(), + ) diff --git a/python/databricks_tests/core/public_api.txt b/python/databricks_tests/core/public_api.txt index 222665796df..679ec523a9f 100644 --- a/python/databricks_tests/core/public_api.txt +++ b/python/databricks_tests/core/public_api.txt @@ -14,15 +14,32 @@ __all__ = [ VariableOrList, VariableOrOptional, alert_mutator, + app_mutator, catalog_mutator, + cluster_mutator, + database_catalog_mutator, + database_instance_mutator, + external_location_mutator, + instance_pool_mutator, job_mutator, + job_run_mutator, load_resources_from_current_package_module, load_resources_from_module, load_resources_from_modules, load_resources_from_package_module, + mlflow_experiment_mutator, + mlflow_model_mutator, + model_serving_endpoint_mutator, pipeline_mutator, + quality_monitor_mutator, + registered_model_mutator, schema_mutator, + secret_scope_mutator, + sql_warehouse_mutator, + synced_database_table_mutator, variables, + vector_search_endpoint_mutator, + vector_search_index_mutator, volume_mutator, ] @@ -66,23 +83,57 @@ class ResourceMutator(Generic): class Resources: def add_alert(self, resource_name: str, alert: AlertParam, *, location: Union[Location, None] = None) -> None + def add_app(self, resource_name: str, app: AppParam, *, location: Union[Location, None] = None) -> None def add_catalog(self, resource_name: str, catalog: CatalogParam, *, location: Union[Location, None] = None) -> None + def add_cluster(self, resource_name: str, cluster: ClusterParam, *, location: Union[Location, None] = None) -> None + def add_database_catalog(self, resource_name: str, database_catalog: DatabaseCatalogParam, *, location: Union[Location, None] = None) -> None + def add_database_instance(self, resource_name: str, database_instance: DatabaseInstanceParam, *, location: Union[Location, None] = None) -> None def add_diagnostic_error(self, msg: str, *, detail: Union[str, None] = None, path: Union[tuple[str, ...], None] = None, location: Union[Location, None] = None) -> None def add_diagnostic_warning(self, msg: str, *, detail: Union[str, None] = None, path: Union[tuple[str, ...], None] = None, location: Union[Location, None] = None) -> None def add_diagnostics(self, other: Diagnostics) -> None + def add_external_location(self, resource_name: str, external_location: ExternalLocationParam, *, location: Union[Location, None] = None) -> None + def add_instance_pool(self, resource_name: str, instance_pool: InstancePoolParam, *, location: Union[Location, None] = None) -> None def add_job(self, resource_name: str, job: JobParam, *, location: Union[Location, None] = None) -> None + def add_job_run(self, resource_name: str, job_run: JobRunParam, *, location: Union[Location, None] = None) -> None def add_location(self, path: tuple[str, ...], location: Location) -> None + def add_mlflow_experiment(self, resource_name: str, mlflow_experiment: MlflowExperimentParam, *, location: Union[Location, None] = None) -> None + def add_mlflow_model(self, resource_name: str, mlflow_model: MlflowModelParam, *, location: Union[Location, None] = None) -> None + def add_model_serving_endpoint(self, resource_name: str, model_serving_endpoint: ModelServingEndpointParam, *, location: Union[Location, None] = None) -> None def add_pipeline(self, resource_name: str, pipeline: PipelineParam, *, location: Union[Location, None] = None) -> None + def add_quality_monitor(self, resource_name: str, quality_monitor: QualityMonitorParam, *, location: Union[Location, None] = None) -> None + def add_registered_model(self, resource_name: str, registered_model: RegisteredModelParam, *, location: Union[Location, None] = None) -> None def add_resource(self, resource_name: str, resource: Resource, *, location: Union[Location, None] = None) -> None def add_resources(self, other: Resources) -> None def add_schema(self, resource_name: str, schema: SchemaParam, *, location: Union[Location, None] = None) -> None + def add_secret_scope(self, resource_name: str, secret_scope: SecretScopeParam, *, location: Union[Location, None] = None) -> None + def add_sql_warehouse(self, resource_name: str, sql_warehouse: SqlWarehouseParam, *, location: Union[Location, None] = None) -> None + def add_synced_database_table(self, resource_name: str, synced_database_table: SyncedDatabaseTableParam, *, location: Union[Location, None] = None) -> None + def add_vector_search_endpoint(self, resource_name: str, vector_search_endpoint: VectorSearchEndpointParam, *, location: Union[Location, None] = None) -> None + def add_vector_search_index(self, resource_name: str, vector_search_index: VectorSearchIndexParam, *, location: Union[Location, None] = None) -> None def add_volume(self, resource_name: str, volume: VolumeParam, *, location: Union[Location, None] = None) -> None @property alerts -> dict[str, Alert] + @property apps -> dict[str, App] @property catalogs -> dict[str, Catalog] + @property clusters -> dict[str, Cluster] + @property database_catalogs -> dict[str, DatabaseCatalog] + @property database_instances -> dict[str, DatabaseInstance] @property diagnostics -> Diagnostics + @property experiments -> dict[str, MlflowExperiment] + @property external_locations -> dict[str, ExternalLocation] + @property instance_pools -> dict[str, InstancePool] + @property job_runs -> dict[str, JobRun] @property jobs -> dict[str, Job] + @property model_serving_endpoints -> dict[str, ModelServingEndpoint] + @property models -> dict[str, MlflowModel] @property pipelines -> dict[str, Pipeline] + @property quality_monitors -> dict[str, QualityMonitor] + @property registered_models -> dict[str, RegisteredModel] @property schemas -> dict[str, Schema] + @property secret_scopes -> dict[str, SecretScope] + @property sql_warehouses -> dict[str, SqlWarehouse] + @property synced_database_tables -> dict[str, SyncedDatabaseTable] + @property vector_search_endpoints -> dict[str, VectorSearchEndpoint] + @property vector_search_indexes -> dict[str, VectorSearchIndex] @property volumes -> dict[str, Volume] class Severity(Enum): @@ -106,14 +157,42 @@ VariableOrOptional = Union[Variable[_T], _T, None] @overload def alert_mutator(function: Callable[[Alert], Alert]) -> ResourceMutator[Alert] def alert_mutator(function: Callable) -> ResourceMutator[Alert] +@overload def app_mutator(function: Callable[[Bundle, App], App]) -> ResourceMutator[App] +@overload def app_mutator(function: Callable[[App], App]) -> ResourceMutator[App] +def app_mutator(function: Callable) -> ResourceMutator[App] + @overload def catalog_mutator(function: Callable[[Bundle, Catalog], Catalog]) -> ResourceMutator[Catalog] @overload def catalog_mutator(function: Callable[[Catalog], Catalog]) -> ResourceMutator[Catalog] def catalog_mutator(function: Callable) -> ResourceMutator[Catalog] +@overload def cluster_mutator(function: Callable[[Bundle, Cluster], Cluster]) -> ResourceMutator[Cluster] +@overload def cluster_mutator(function: Callable[[Cluster], Cluster]) -> ResourceMutator[Cluster] +def cluster_mutator(function: Callable) -> ResourceMutator[Cluster] + +@overload def database_catalog_mutator(function: Callable[[Bundle, DatabaseCatalog], DatabaseCatalog]) -> ResourceMutator[DatabaseCatalog] +@overload def database_catalog_mutator(function: Callable[[DatabaseCatalog], DatabaseCatalog]) -> ResourceMutator[DatabaseCatalog] +def database_catalog_mutator(function: Callable) -> ResourceMutator[DatabaseCatalog] + +@overload def database_instance_mutator(function: Callable[[Bundle, DatabaseInstance], DatabaseInstance]) -> ResourceMutator[DatabaseInstance] +@overload def database_instance_mutator(function: Callable[[DatabaseInstance], DatabaseInstance]) -> ResourceMutator[DatabaseInstance] +def database_instance_mutator(function: Callable) -> ResourceMutator[DatabaseInstance] + +@overload def external_location_mutator(function: Callable[[Bundle, ExternalLocation], ExternalLocation]) -> ResourceMutator[ExternalLocation] +@overload def external_location_mutator(function: Callable[[ExternalLocation], ExternalLocation]) -> ResourceMutator[ExternalLocation] +def external_location_mutator(function: Callable) -> ResourceMutator[ExternalLocation] + +@overload def instance_pool_mutator(function: Callable[[Bundle, InstancePool], InstancePool]) -> ResourceMutator[InstancePool] +@overload def instance_pool_mutator(function: Callable[[InstancePool], InstancePool]) -> ResourceMutator[InstancePool] +def instance_pool_mutator(function: Callable) -> ResourceMutator[InstancePool] + @overload def job_mutator(function: Callable[[Bundle, Job], Job]) -> ResourceMutator[Job] @overload def job_mutator(function: Callable[[Job], Job]) -> ResourceMutator[Job] def job_mutator(function: Callable) -> ResourceMutator[Job] +@overload def job_run_mutator(function: Callable[[Bundle, JobRun], JobRun]) -> ResourceMutator[JobRun] +@overload def job_run_mutator(function: Callable[[JobRun], JobRun]) -> ResourceMutator[JobRun] +def job_run_mutator(function: Callable) -> ResourceMutator[JobRun] + def load_resources_from_current_package_module() -> Resources def load_resources_from_module(module: module) -> Resources @@ -122,24 +201,81 @@ def load_resources_from_modules(modules: Iterable[module]) -> Resources def load_resources_from_package_module(package_module: module) -> Resources +@overload def mlflow_experiment_mutator(function: Callable[[Bundle, MlflowExperiment], MlflowExperiment]) -> ResourceMutator[MlflowExperiment] +@overload def mlflow_experiment_mutator(function: Callable[[MlflowExperiment], MlflowExperiment]) -> ResourceMutator[MlflowExperiment] +def mlflow_experiment_mutator(function: Callable) -> ResourceMutator[MlflowExperiment] + +@overload def mlflow_model_mutator(function: Callable[[Bundle, MlflowModel], MlflowModel]) -> ResourceMutator[MlflowModel] +@overload def mlflow_model_mutator(function: Callable[[MlflowModel], MlflowModel]) -> ResourceMutator[MlflowModel] +def mlflow_model_mutator(function: Callable) -> ResourceMutator[MlflowModel] + +@overload def model_serving_endpoint_mutator(function: Callable[[Bundle, ModelServingEndpoint], ModelServingEndpoint]) -> ResourceMutator[ModelServingEndpoint] +@overload def model_serving_endpoint_mutator(function: Callable[[ModelServingEndpoint], ModelServingEndpoint]) -> ResourceMutator[ModelServingEndpoint] +def model_serving_endpoint_mutator(function: Callable) -> ResourceMutator[ModelServingEndpoint] + @overload def pipeline_mutator(function: Callable[[Bundle, Pipeline], Pipeline]) -> ResourceMutator[Pipeline] @overload def pipeline_mutator(function: Callable[[Pipeline], Pipeline]) -> ResourceMutator[Pipeline] def pipeline_mutator(function: Callable) -> ResourceMutator[Pipeline] +@overload def quality_monitor_mutator(function: Callable[[Bundle, QualityMonitor], QualityMonitor]) -> ResourceMutator[QualityMonitor] +@overload def quality_monitor_mutator(function: Callable[[QualityMonitor], QualityMonitor]) -> ResourceMutator[QualityMonitor] +def quality_monitor_mutator(function: Callable) -> ResourceMutator[QualityMonitor] + +@overload def registered_model_mutator(function: Callable[[Bundle, RegisteredModel], RegisteredModel]) -> ResourceMutator[RegisteredModel] +@overload def registered_model_mutator(function: Callable[[RegisteredModel], RegisteredModel]) -> ResourceMutator[RegisteredModel] +def registered_model_mutator(function: Callable) -> ResourceMutator[RegisteredModel] + @overload def schema_mutator(function: Callable[[Bundle, Schema], Schema]) -> ResourceMutator[Schema] @overload def schema_mutator(function: Callable[[Schema], Schema]) -> ResourceMutator[Schema] def schema_mutator(function: Callable) -> ResourceMutator[Schema] +@overload def secret_scope_mutator(function: Callable[[Bundle, SecretScope], SecretScope]) -> ResourceMutator[SecretScope] +@overload def secret_scope_mutator(function: Callable[[SecretScope], SecretScope]) -> ResourceMutator[SecretScope] +def secret_scope_mutator(function: Callable) -> ResourceMutator[SecretScope] + +@overload def sql_warehouse_mutator(function: Callable[[Bundle, SqlWarehouse], SqlWarehouse]) -> ResourceMutator[SqlWarehouse] +@overload def sql_warehouse_mutator(function: Callable[[SqlWarehouse], SqlWarehouse]) -> ResourceMutator[SqlWarehouse] +def sql_warehouse_mutator(function: Callable) -> ResourceMutator[SqlWarehouse] + +@overload def synced_database_table_mutator(function: Callable[[Bundle, SyncedDatabaseTable], SyncedDatabaseTable]) -> ResourceMutator[SyncedDatabaseTable] +@overload def synced_database_table_mutator(function: Callable[[SyncedDatabaseTable], SyncedDatabaseTable]) -> ResourceMutator[SyncedDatabaseTable] +def synced_database_table_mutator(function: Callable) -> ResourceMutator[SyncedDatabaseTable] + def variables(cls: type[_T]) -> type[_T] +@overload def vector_search_endpoint_mutator(function: Callable[[Bundle, VectorSearchEndpoint], VectorSearchEndpoint]) -> ResourceMutator[VectorSearchEndpoint] +@overload def vector_search_endpoint_mutator(function: Callable[[VectorSearchEndpoint], VectorSearchEndpoint]) -> ResourceMutator[VectorSearchEndpoint] +def vector_search_endpoint_mutator(function: Callable) -> ResourceMutator[VectorSearchEndpoint] + +@overload def vector_search_index_mutator(function: Callable[[Bundle, VectorSearchIndex], VectorSearchIndex]) -> ResourceMutator[VectorSearchIndex] +@overload def vector_search_index_mutator(function: Callable[[VectorSearchIndex], VectorSearchIndex]) -> ResourceMutator[VectorSearchIndex] +def vector_search_index_mutator(function: Callable) -> ResourceMutator[VectorSearchIndex] + @overload def volume_mutator(function: Callable[[Bundle, Volume], Volume]) -> ResourceMutator[Volume] @overload def volume_mutator(function: Callable[[Volume], Volume]) -> ResourceMutator[Volume] def volume_mutator(function: Callable) -> ResourceMutator[Volume] == _ResourceType.all() registry == singular_name=alert plural_name=alerts resource_type=Alert +singular_name=app plural_name=apps resource_type=App singular_name=catalog plural_name=catalogs resource_type=Catalog +singular_name=cluster plural_name=clusters resource_type=Cluster +singular_name=database_catalog plural_name=database_catalogs resource_type=DatabaseCatalog +singular_name=database_instance plural_name=database_instances resource_type=DatabaseInstance +singular_name=external_location plural_name=external_locations resource_type=ExternalLocation +singular_name=instance_pool plural_name=instance_pools resource_type=InstancePool singular_name=job plural_name=jobs resource_type=Job +singular_name=job_run plural_name=job_runs resource_type=JobRun +singular_name=mlflow_experiment plural_name=experiments resource_type=MlflowExperiment +singular_name=mlflow_model plural_name=models resource_type=MlflowModel +singular_name=model_serving_endpoint plural_name=model_serving_endpoints resource_type=ModelServingEndpoint singular_name=pipeline plural_name=pipelines resource_type=Pipeline +singular_name=quality_monitor plural_name=quality_monitors resource_type=QualityMonitor +singular_name=registered_model plural_name=registered_models resource_type=RegisteredModel singular_name=schema plural_name=schemas resource_type=Schema +singular_name=secret_scope plural_name=secret_scopes resource_type=SecretScope +singular_name=sql_warehouse plural_name=sql_warehouses resource_type=SqlWarehouse +singular_name=synced_database_table plural_name=synced_database_tables resource_type=SyncedDatabaseTable +singular_name=vector_search_endpoint plural_name=vector_search_endpoints resource_type=VectorSearchEndpoint +singular_name=vector_search_index plural_name=vector_search_indexes resource_type=VectorSearchIndex singular_name=volume plural_name=volumes resource_type=Volume