databricks-sdk 0.36.0__tar.gz → 0.37.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of databricks-sdk might be problematic. Click here for more details.
- {databricks_sdk-0.36.0/databricks_sdk.egg-info → databricks_sdk-0.37.0}/PKG-INFO +1 -1
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/__init__.py +19 -27
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/apps.py +46 -188
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/catalog.py +788 -45
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/compute.py +23 -20
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/dashboards.py +26 -276
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/iam.py +4 -2
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/jobs.py +76 -68
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/marketplace.py +1 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/ml.py +4 -3
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/oauth2.py +28 -8
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/pipelines.py +14 -7
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/provisioning.py +53 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/serving.py +2 -2
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/settings.py +319 -1
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/sharing.py +0 -618
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/sql.py +7 -7
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/workspace.py +5 -3
- databricks_sdk-0.37.0/databricks/sdk/version.py +1 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0/databricks_sdk.egg-info}/PKG-INFO +1 -1
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_model_serving_auth.py +6 -0
- databricks_sdk-0.36.0/databricks/sdk/version.py +0 -1
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/LICENSE +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/NOTICE +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/README.md +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/__init__.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/_base_client.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/_property.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/_widgets/__init__.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/_widgets/default_widgets_utils.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/_widgets/ipywidgets_utils.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/azure.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/casing.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/clock.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/config.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/core.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/credentials_provider.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/data_plane.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/dbutils.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/environments.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/__init__.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/base.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/customizer.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/deserializer.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/mapper.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/overrides.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/parser.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/platform.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/private_link.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/errors/sdk.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/logger/__init__.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/logger/round_trip_logger.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/mixins/__init__.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/mixins/compute.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/mixins/files.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/mixins/open_ai_client.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/mixins/workspace.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/oauth.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/py.typed +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/retries.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/runtime/__init__.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/runtime/dbutils_stub.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/__init__.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/_internal.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/billing.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/files.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/service/vectorsearch.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks/sdk/useragent.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks_sdk.egg-info/SOURCES.txt +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks_sdk.egg-info/dependency_links.txt +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks_sdk.egg-info/requires.txt +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/databricks_sdk.egg-info/top_level.txt +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/setup.cfg +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/setup.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_auth.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_auth_manual_tests.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_base_client.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_client.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_compute_mixins.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_config.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_core.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_data_plane.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_dbfs_mixins.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_dbutils.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_environments.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_errors.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_init_file.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_internal.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_jobs.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_metadata_service_auth.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_misc.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_oauth.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_open_ai_mixin.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_retries.py +0 -0
- {databricks_sdk-0.36.0 → databricks_sdk-0.37.0}/tests/test_user_agent.py +0 -0
|
@@ -15,7 +15,7 @@ from databricks.sdk.service.catalog import (AccountMetastoreAssignmentsAPI,
|
|
|
15
15
|
AccountMetastoresAPI,
|
|
16
16
|
AccountStorageCredentialsAPI,
|
|
17
17
|
ArtifactAllowlistsAPI, CatalogsAPI,
|
|
18
|
-
ConnectionsAPI,
|
|
18
|
+
ConnectionsAPI, CredentialsAPI,
|
|
19
19
|
ExternalLocationsAPI, FunctionsAPI,
|
|
20
20
|
GrantsAPI, MetastoresAPI,
|
|
21
21
|
ModelVersionsAPI, OnlineTablesAPI,
|
|
@@ -64,26 +64,18 @@ from databricks.sdk.service.provisioning import (CredentialsAPI,
|
|
|
64
64
|
Workspace, WorkspacesAPI)
|
|
65
65
|
from databricks.sdk.service.serving import (ServingEndpointsAPI,
|
|
66
66
|
ServingEndpointsDataPlaneAPI)
|
|
67
|
-
from databricks.sdk.service.settings import (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
IpAccessListsAPI,
|
|
80
|
-
NetworkConnectivityAPI,
|
|
81
|
-
NotificationDestinationsAPI,
|
|
82
|
-
PersonalComputeAPI,
|
|
83
|
-
RestrictWorkspaceAdminsAPI,
|
|
84
|
-
SettingsAPI, TokenManagementAPI,
|
|
85
|
-
TokensAPI, WorkspaceConfAPI)
|
|
86
|
-
from databricks.sdk.service.sharing import (CleanRoomsAPI, ProvidersAPI,
|
|
67
|
+
from databricks.sdk.service.settings import (
|
|
68
|
+
AccountIpAccessListsAPI, AccountSettingsAPI,
|
|
69
|
+
AibiDashboardEmbeddingAccessPolicyAPI,
|
|
70
|
+
AibiDashboardEmbeddingApprovedDomainsAPI, AutomaticClusterUpdateAPI,
|
|
71
|
+
ComplianceSecurityProfileAPI, CredentialsManagerAPI,
|
|
72
|
+
CspEnablementAccountAPI, DefaultNamespaceAPI, DisableLegacyAccessAPI,
|
|
73
|
+
DisableLegacyDbfsAPI, DisableLegacyFeaturesAPI,
|
|
74
|
+
EnhancedSecurityMonitoringAPI, EsmEnablementAccountAPI, IpAccessListsAPI,
|
|
75
|
+
NetworkConnectivityAPI, NotificationDestinationsAPI, PersonalComputeAPI,
|
|
76
|
+
RestrictWorkspaceAdminsAPI, SettingsAPI, TokenManagementAPI, TokensAPI,
|
|
77
|
+
WorkspaceConfAPI)
|
|
78
|
+
from databricks.sdk.service.sharing import (ProvidersAPI,
|
|
87
79
|
RecipientActivationAPI,
|
|
88
80
|
RecipientsAPI, SharesAPI)
|
|
89
81
|
from databricks.sdk.service.sql import (AlertsAPI, AlertsLegacyAPI,
|
|
@@ -183,7 +175,6 @@ class WorkspaceClient:
|
|
|
183
175
|
self._apps = AppsAPI(self._api_client)
|
|
184
176
|
self._artifact_allowlists = ArtifactAllowlistsAPI(self._api_client)
|
|
185
177
|
self._catalogs = CatalogsAPI(self._api_client)
|
|
186
|
-
self._clean_rooms = CleanRoomsAPI(self._api_client)
|
|
187
178
|
self._cluster_policies = ClusterPoliciesAPI(self._api_client)
|
|
188
179
|
self._clusters = ClustersExt(self._api_client)
|
|
189
180
|
self._command_execution = CommandExecutionAPI(self._api_client)
|
|
@@ -193,6 +184,7 @@ class WorkspaceClient:
|
|
|
193
184
|
self._consumer_listings = ConsumerListingsAPI(self._api_client)
|
|
194
185
|
self._consumer_personalization_requests = ConsumerPersonalizationRequestsAPI(self._api_client)
|
|
195
186
|
self._consumer_providers = ConsumerProvidersAPI(self._api_client)
|
|
187
|
+
self._credentials = CredentialsAPI(self._api_client)
|
|
196
188
|
self._credentials_manager = CredentialsManagerAPI(self._api_client)
|
|
197
189
|
self._current_user = CurrentUserAPI(self._api_client)
|
|
198
190
|
self._dashboard_widgets = DashboardWidgetsAPI(self._api_client)
|
|
@@ -312,11 +304,6 @@ class WorkspaceClient:
|
|
|
312
304
|
"""A catalog is the first layer of Unity Catalog’s three-level namespace."""
|
|
313
305
|
return self._catalogs
|
|
314
306
|
|
|
315
|
-
@property
|
|
316
|
-
def clean_rooms(self) -> CleanRoomsAPI:
|
|
317
|
-
"""A clean room is a secure, privacy-protecting environment where two or more parties can share sensitive enterprise data, including customer data, for measurements, insights, activation and other use cases."""
|
|
318
|
-
return self._clean_rooms
|
|
319
|
-
|
|
320
307
|
@property
|
|
321
308
|
def cluster_policies(self) -> ClusterPoliciesAPI:
|
|
322
309
|
"""You can use cluster policies to control users' ability to configure clusters based on a set of rules."""
|
|
@@ -362,6 +349,11 @@ class WorkspaceClient:
|
|
|
362
349
|
"""Providers are the entities that publish listings to the Marketplace."""
|
|
363
350
|
return self._consumer_providers
|
|
364
351
|
|
|
352
|
+
@property
|
|
353
|
+
def credentials(self) -> CredentialsAPI:
|
|
354
|
+
"""A credential represents an authentication and authorization mechanism for accessing services on your cloud tenant."""
|
|
355
|
+
return self._credentials
|
|
356
|
+
|
|
365
357
|
@property
|
|
366
358
|
def credentials_manager(self) -> CredentialsManagerAPI:
|
|
367
359
|
"""Credentials manager interacts with with Identity Providers to to perform token exchanges using stored credentials and refresh tokens."""
|
|
@@ -611,70 +611,6 @@ class ComputeStatus:
|
|
|
611
611
|
return cls(message=d.get('message', None), state=_enum(d, 'state', ComputeState))
|
|
612
612
|
|
|
613
613
|
|
|
614
|
-
@dataclass
|
|
615
|
-
class CreateAppDeploymentRequest:
|
|
616
|
-
app_name: Optional[str] = None
|
|
617
|
-
"""The name of the app."""
|
|
618
|
-
|
|
619
|
-
deployment_id: Optional[str] = None
|
|
620
|
-
"""The unique id of the deployment."""
|
|
621
|
-
|
|
622
|
-
mode: Optional[AppDeploymentMode] = None
|
|
623
|
-
"""The mode of which the deployment will manage the source code."""
|
|
624
|
-
|
|
625
|
-
source_code_path: Optional[str] = None
|
|
626
|
-
"""The workspace file system path of the source code used to create the app deployment. This is
|
|
627
|
-
different from `deployment_artifacts.source_code_path`, which is the path used by the deployed
|
|
628
|
-
app. The former refers to the original source code location of the app in the workspace during
|
|
629
|
-
deployment creation, whereas the latter provides a system generated stable snapshotted source
|
|
630
|
-
code path used by the deployment."""
|
|
631
|
-
|
|
632
|
-
def as_dict(self) -> dict:
|
|
633
|
-
"""Serializes the CreateAppDeploymentRequest into a dictionary suitable for use as a JSON request body."""
|
|
634
|
-
body = {}
|
|
635
|
-
if self.app_name is not None: body['app_name'] = self.app_name
|
|
636
|
-
if self.deployment_id is not None: body['deployment_id'] = self.deployment_id
|
|
637
|
-
if self.mode is not None: body['mode'] = self.mode.value
|
|
638
|
-
if self.source_code_path is not None: body['source_code_path'] = self.source_code_path
|
|
639
|
-
return body
|
|
640
|
-
|
|
641
|
-
@classmethod
|
|
642
|
-
def from_dict(cls, d: Dict[str, any]) -> CreateAppDeploymentRequest:
|
|
643
|
-
"""Deserializes the CreateAppDeploymentRequest from a dictionary."""
|
|
644
|
-
return cls(app_name=d.get('app_name', None),
|
|
645
|
-
deployment_id=d.get('deployment_id', None),
|
|
646
|
-
mode=_enum(d, 'mode', AppDeploymentMode),
|
|
647
|
-
source_code_path=d.get('source_code_path', None))
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
@dataclass
|
|
651
|
-
class CreateAppRequest:
|
|
652
|
-
name: str
|
|
653
|
-
"""The name of the app. The name must contain only lowercase alphanumeric characters and hyphens.
|
|
654
|
-
It must be unique within the workspace."""
|
|
655
|
-
|
|
656
|
-
description: Optional[str] = None
|
|
657
|
-
"""The description of the app."""
|
|
658
|
-
|
|
659
|
-
resources: Optional[List[AppResource]] = None
|
|
660
|
-
"""Resources for the app."""
|
|
661
|
-
|
|
662
|
-
def as_dict(self) -> dict:
|
|
663
|
-
"""Serializes the CreateAppRequest into a dictionary suitable for use as a JSON request body."""
|
|
664
|
-
body = {}
|
|
665
|
-
if self.description is not None: body['description'] = self.description
|
|
666
|
-
if self.name is not None: body['name'] = self.name
|
|
667
|
-
if self.resources: body['resources'] = [v.as_dict() for v in self.resources]
|
|
668
|
-
return body
|
|
669
|
-
|
|
670
|
-
@classmethod
|
|
671
|
-
def from_dict(cls, d: Dict[str, any]) -> CreateAppRequest:
|
|
672
|
-
"""Deserializes the CreateAppRequest from a dictionary."""
|
|
673
|
-
return cls(description=d.get('description', None),
|
|
674
|
-
name=d.get('name', None),
|
|
675
|
-
resources=_repeated_dict(d, 'resources', AppResource))
|
|
676
|
-
|
|
677
|
-
|
|
678
614
|
@dataclass
|
|
679
615
|
class GetAppPermissionLevelsResponse:
|
|
680
616
|
permission_levels: Optional[List[AppPermissionsDescription]] = None
|
|
@@ -746,34 +682,6 @@ class StopAppRequest:
|
|
|
746
682
|
"""The name of the app."""
|
|
747
683
|
|
|
748
684
|
|
|
749
|
-
@dataclass
|
|
750
|
-
class UpdateAppRequest:
|
|
751
|
-
name: str
|
|
752
|
-
"""The name of the app. The name must contain only lowercase alphanumeric characters and hyphens.
|
|
753
|
-
It must be unique within the workspace."""
|
|
754
|
-
|
|
755
|
-
description: Optional[str] = None
|
|
756
|
-
"""The description of the app."""
|
|
757
|
-
|
|
758
|
-
resources: Optional[List[AppResource]] = None
|
|
759
|
-
"""Resources for the app."""
|
|
760
|
-
|
|
761
|
-
def as_dict(self) -> dict:
|
|
762
|
-
"""Serializes the UpdateAppRequest into a dictionary suitable for use as a JSON request body."""
|
|
763
|
-
body = {}
|
|
764
|
-
if self.description is not None: body['description'] = self.description
|
|
765
|
-
if self.name is not None: body['name'] = self.name
|
|
766
|
-
if self.resources: body['resources'] = [v.as_dict() for v in self.resources]
|
|
767
|
-
return body
|
|
768
|
-
|
|
769
|
-
@classmethod
|
|
770
|
-
def from_dict(cls, d: Dict[str, any]) -> UpdateAppRequest:
|
|
771
|
-
"""Deserializes the UpdateAppRequest from a dictionary."""
|
|
772
|
-
return cls(description=d.get('description', None),
|
|
773
|
-
name=d.get('name', None),
|
|
774
|
-
resources=_repeated_dict(d, 'resources', AppResource))
|
|
775
|
-
|
|
776
|
-
|
|
777
685
|
class AppsAPI:
|
|
778
686
|
"""Apps run directly on a customer’s Databricks instance, integrate with their data, use and extend
|
|
779
687
|
Databricks services, and enable users to interact through single sign-on."""
|
|
@@ -813,29 +721,31 @@ class AppsAPI:
|
|
|
813
721
|
attempt += 1
|
|
814
722
|
raise TimeoutError(f'timed out after {timeout}: {status_message}')
|
|
815
723
|
|
|
816
|
-
def
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
724
|
+
def wait_get_deployment_app_succeeded(
|
|
725
|
+
self,
|
|
726
|
+
app_name: str,
|
|
727
|
+
deployment_id: str,
|
|
728
|
+
timeout=timedelta(minutes=20),
|
|
729
|
+
callback: Optional[Callable[[AppDeployment], None]] = None) -> AppDeployment:
|
|
820
730
|
deadline = time.time() + timeout.total_seconds()
|
|
821
|
-
target_states = (
|
|
822
|
-
failure_states = (
|
|
731
|
+
target_states = (AppDeploymentState.SUCCEEDED, )
|
|
732
|
+
failure_states = (AppDeploymentState.FAILED, )
|
|
823
733
|
status_message = 'polling...'
|
|
824
734
|
attempt = 1
|
|
825
735
|
while time.time() < deadline:
|
|
826
|
-
poll = self.
|
|
827
|
-
status = poll.
|
|
736
|
+
poll = self.get_deployment(app_name=app_name, deployment_id=deployment_id)
|
|
737
|
+
status = poll.status.state
|
|
828
738
|
status_message = f'current status: {status}'
|
|
829
|
-
if poll.
|
|
830
|
-
status_message = poll.
|
|
739
|
+
if poll.status:
|
|
740
|
+
status_message = poll.status.message
|
|
831
741
|
if status in target_states:
|
|
832
742
|
return poll
|
|
833
743
|
if callback:
|
|
834
744
|
callback(poll)
|
|
835
745
|
if status in failure_states:
|
|
836
|
-
msg = f'failed to reach
|
|
746
|
+
msg = f'failed to reach SUCCEEDED, got {status}: {status_message}'
|
|
837
747
|
raise OperationFailed(msg)
|
|
838
|
-
prefix = f"
|
|
748
|
+
prefix = f"app_name={app_name}, deployment_id={deployment_id}"
|
|
839
749
|
sleep = attempt
|
|
840
750
|
if sleep > 10:
|
|
841
751
|
# sleep 10s max per attempt
|
|
@@ -845,31 +755,29 @@ class AppsAPI:
|
|
|
845
755
|
attempt += 1
|
|
846
756
|
raise TimeoutError(f'timed out after {timeout}: {status_message}')
|
|
847
757
|
|
|
848
|
-
def
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
timeout=timedelta(minutes=20),
|
|
853
|
-
callback: Optional[Callable[[AppDeployment], None]] = None) -> AppDeployment:
|
|
758
|
+
def wait_get_app_stopped(self,
|
|
759
|
+
name: str,
|
|
760
|
+
timeout=timedelta(minutes=20),
|
|
761
|
+
callback: Optional[Callable[[App], None]] = None) -> App:
|
|
854
762
|
deadline = time.time() + timeout.total_seconds()
|
|
855
|
-
target_states = (
|
|
856
|
-
failure_states = (
|
|
763
|
+
target_states = (ComputeState.STOPPED, )
|
|
764
|
+
failure_states = (ComputeState.ERROR, )
|
|
857
765
|
status_message = 'polling...'
|
|
858
766
|
attempt = 1
|
|
859
767
|
while time.time() < deadline:
|
|
860
|
-
poll = self.
|
|
861
|
-
status = poll.
|
|
768
|
+
poll = self.get(name=name)
|
|
769
|
+
status = poll.compute_status.state
|
|
862
770
|
status_message = f'current status: {status}'
|
|
863
|
-
if poll.
|
|
864
|
-
status_message = poll.
|
|
771
|
+
if poll.compute_status:
|
|
772
|
+
status_message = poll.compute_status.message
|
|
865
773
|
if status in target_states:
|
|
866
774
|
return poll
|
|
867
775
|
if callback:
|
|
868
776
|
callback(poll)
|
|
869
777
|
if status in failure_states:
|
|
870
|
-
msg = f'failed to reach
|
|
778
|
+
msg = f'failed to reach STOPPED, got {status}: {status_message}'
|
|
871
779
|
raise OperationFailed(msg)
|
|
872
|
-
prefix = f"
|
|
780
|
+
prefix = f"name={name}"
|
|
873
781
|
sleep = attempt
|
|
874
782
|
if sleep > 10:
|
|
875
783
|
# sleep 10s max per attempt
|
|
@@ -879,43 +787,25 @@ class AppsAPI:
|
|
|
879
787
|
attempt += 1
|
|
880
788
|
raise TimeoutError(f'timed out after {timeout}: {status_message}')
|
|
881
789
|
|
|
882
|
-
def create(self,
|
|
883
|
-
name: str,
|
|
884
|
-
*,
|
|
885
|
-
description: Optional[str] = None,
|
|
886
|
-
resources: Optional[List[AppResource]] = None) -> Wait[App]:
|
|
790
|
+
def create(self, *, app: Optional[App] = None) -> Wait[App]:
|
|
887
791
|
"""Create an app.
|
|
888
792
|
|
|
889
793
|
Creates a new app.
|
|
890
794
|
|
|
891
|
-
:param
|
|
892
|
-
The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. It
|
|
893
|
-
must be unique within the workspace.
|
|
894
|
-
:param description: str (optional)
|
|
895
|
-
The description of the app.
|
|
896
|
-
:param resources: List[:class:`AppResource`] (optional)
|
|
897
|
-
Resources for the app.
|
|
795
|
+
:param app: :class:`App` (optional)
|
|
898
796
|
|
|
899
797
|
:returns:
|
|
900
798
|
Long-running operation waiter for :class:`App`.
|
|
901
799
|
See :method:wait_get_app_active for more details.
|
|
902
800
|
"""
|
|
903
|
-
body =
|
|
904
|
-
if description is not None: body['description'] = description
|
|
905
|
-
if name is not None: body['name'] = name
|
|
906
|
-
if resources is not None: body['resources'] = [v.as_dict() for v in resources]
|
|
801
|
+
body = app
|
|
907
802
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
908
803
|
|
|
909
804
|
op_response = self._api.do('POST', '/api/2.0/apps', body=body, headers=headers)
|
|
910
805
|
return Wait(self.wait_get_app_active, response=App.from_dict(op_response), name=op_response['name'])
|
|
911
806
|
|
|
912
|
-
def create_and_wait(self,
|
|
913
|
-
|
|
914
|
-
*,
|
|
915
|
-
description: Optional[str] = None,
|
|
916
|
-
resources: Optional[List[AppResource]] = None,
|
|
917
|
-
timeout=timedelta(minutes=20)) -> App:
|
|
918
|
-
return self.create(description=description, name=name, resources=resources).result(timeout=timeout)
|
|
807
|
+
def create_and_wait(self, *, app: Optional[App] = None, timeout=timedelta(minutes=20)) -> App:
|
|
808
|
+
return self.create(app=app).result(timeout=timeout)
|
|
919
809
|
|
|
920
810
|
def delete(self, name: str) -> App:
|
|
921
811
|
"""Delete an app.
|
|
@@ -933,37 +823,20 @@ class AppsAPI:
|
|
|
933
823
|
res = self._api.do('DELETE', f'/api/2.0/apps/{name}', headers=headers)
|
|
934
824
|
return App.from_dict(res)
|
|
935
825
|
|
|
936
|
-
def deploy(self,
|
|
937
|
-
app_name: str,
|
|
938
|
-
*,
|
|
939
|
-
deployment_id: Optional[str] = None,
|
|
940
|
-
mode: Optional[AppDeploymentMode] = None,
|
|
941
|
-
source_code_path: Optional[str] = None) -> Wait[AppDeployment]:
|
|
826
|
+
def deploy(self, app_name: str, *, app_deployment: Optional[AppDeployment] = None) -> Wait[AppDeployment]:
|
|
942
827
|
"""Create an app deployment.
|
|
943
828
|
|
|
944
829
|
Creates an app deployment for the app with the supplied name.
|
|
945
830
|
|
|
946
831
|
:param app_name: str
|
|
947
832
|
The name of the app.
|
|
948
|
-
:param
|
|
949
|
-
The unique id of the deployment.
|
|
950
|
-
:param mode: :class:`AppDeploymentMode` (optional)
|
|
951
|
-
The mode of which the deployment will manage the source code.
|
|
952
|
-
:param source_code_path: str (optional)
|
|
953
|
-
The workspace file system path of the source code used to create the app deployment. This is
|
|
954
|
-
different from `deployment_artifacts.source_code_path`, which is the path used by the deployed app.
|
|
955
|
-
The former refers to the original source code location of the app in the workspace during deployment
|
|
956
|
-
creation, whereas the latter provides a system generated stable snapshotted source code path used by
|
|
957
|
-
the deployment.
|
|
833
|
+
:param app_deployment: :class:`AppDeployment` (optional)
|
|
958
834
|
|
|
959
835
|
:returns:
|
|
960
836
|
Long-running operation waiter for :class:`AppDeployment`.
|
|
961
837
|
See :method:wait_get_deployment_app_succeeded for more details.
|
|
962
838
|
"""
|
|
963
|
-
body =
|
|
964
|
-
if deployment_id is not None: body['deployment_id'] = deployment_id
|
|
965
|
-
if mode is not None: body['mode'] = mode.value
|
|
966
|
-
if source_code_path is not None: body['source_code_path'] = source_code_path
|
|
839
|
+
body = app_deployment
|
|
967
840
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
968
841
|
|
|
969
842
|
op_response = self._api.do('POST',
|
|
@@ -975,18 +848,12 @@ class AppsAPI:
|
|
|
975
848
|
app_name=app_name,
|
|
976
849
|
deployment_id=op_response['deployment_id'])
|
|
977
850
|
|
|
978
|
-
def deploy_and_wait(
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
source_code_path: Optional[str] = None,
|
|
985
|
-
timeout=timedelta(minutes=20)) -> AppDeployment:
|
|
986
|
-
return self.deploy(app_name=app_name,
|
|
987
|
-
deployment_id=deployment_id,
|
|
988
|
-
mode=mode,
|
|
989
|
-
source_code_path=source_code_path).result(timeout=timeout)
|
|
851
|
+
def deploy_and_wait(self,
|
|
852
|
+
app_name: str,
|
|
853
|
+
*,
|
|
854
|
+
app_deployment: Optional[AppDeployment] = None,
|
|
855
|
+
timeout=timedelta(minutes=20)) -> AppDeployment:
|
|
856
|
+
return self.deploy(app_deployment=app_deployment, app_name=app_name).result(timeout=timeout)
|
|
990
857
|
|
|
991
858
|
def get(self, name: str) -> App:
|
|
992
859
|
"""Get an app.
|
|
@@ -1121,7 +988,8 @@ class AppsAPI:
|
|
|
1121
988
|
access_control_list: Optional[List[AppAccessControlRequest]] = None) -> AppPermissions:
|
|
1122
989
|
"""Set app permissions.
|
|
1123
990
|
|
|
1124
|
-
Sets permissions on an
|
|
991
|
+
Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct
|
|
992
|
+
permissions if none are specified. Objects can inherit permissions from their root object.
|
|
1125
993
|
|
|
1126
994
|
:param app_name: str
|
|
1127
995
|
The app for which to get or manage permissions.
|
|
@@ -1179,28 +1047,18 @@ class AppsAPI:
|
|
|
1179
1047
|
def stop_and_wait(self, name: str, timeout=timedelta(minutes=20)) -> App:
|
|
1180
1048
|
return self.stop(name=name).result(timeout=timeout)
|
|
1181
1049
|
|
|
1182
|
-
def update(self,
|
|
1183
|
-
name: str,
|
|
1184
|
-
*,
|
|
1185
|
-
description: Optional[str] = None,
|
|
1186
|
-
resources: Optional[List[AppResource]] = None) -> App:
|
|
1050
|
+
def update(self, name: str, *, app: Optional[App] = None) -> App:
|
|
1187
1051
|
"""Update an app.
|
|
1188
1052
|
|
|
1189
1053
|
Updates the app with the supplied name.
|
|
1190
1054
|
|
|
1191
1055
|
:param name: str
|
|
1192
|
-
The name of the app.
|
|
1193
|
-
|
|
1194
|
-
:param description: str (optional)
|
|
1195
|
-
The description of the app.
|
|
1196
|
-
:param resources: List[:class:`AppResource`] (optional)
|
|
1197
|
-
Resources for the app.
|
|
1056
|
+
The name of the app.
|
|
1057
|
+
:param app: :class:`App` (optional)
|
|
1198
1058
|
|
|
1199
1059
|
:returns: :class:`App`
|
|
1200
1060
|
"""
|
|
1201
|
-
body =
|
|
1202
|
-
if description is not None: body['description'] = description
|
|
1203
|
-
if resources is not None: body['resources'] = [v.as_dict() for v in resources]
|
|
1061
|
+
body = app
|
|
1204
1062
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1205
1063
|
|
|
1206
1064
|
res = self._api.do('PATCH', f'/api/2.0/apps/{name}', body=body, headers=headers)
|