@@ -57,7 +57,9 @@ class AccessReportLine:
5757
5858class AccessReport (List [AccessReportLine ]):
5959 def __str__ (self ):
60- return "\n " .join (f"{ line .name } \n { line .status } : { line .message } " for line in self )
60+ return "\n " .join (
61+ f"{ line .name } \n { line .status } : { line .message } " for line in self
62+ )
6163
6264 def add_boto_method_call (
6365 self ,
@@ -95,15 +97,15 @@ def __str__(self):
9597
9698
9799class ProjectError (Error ):
98- code : str = Field ( "Project Error" , const = True )
100+ code : str = "Project Error"
99101
100102
101103class RecommendationError (Error ):
102- code : str = Field ( "Recommendation Error" , const = True )
104+ code : str = "Recommendation Error"
103105
104106
105107class SubmissionError (Error ):
106- code : str = Field ( "Submission Error" , const = True )
108+ code : str = "Submission Error"
107109
108110
109111@unique
@@ -139,13 +141,13 @@ class AzureDatabricksClusterReport(DatabricksClusterReport):
139141
140142
141143class DatabricksError (Error ):
142- code : str = Field ( "Databricks Error" , const = True )
144+ code : str = "Databricks Error"
143145
144146
145147class MissingOrIncompleteEventlogError (Error ):
146148 dbfs_eventlog_file_size : Union [int , None ] = None
147- code : str = Field ( "Retryable Databricks Error" , const = True )
148- message : str = Field ( "Event log was missing or incomplete. Please retry." , const = True )
149+ code : str = "Retryable Databricks Error"
150+ message : str = "Event log was missing or incomplete. Please retry."
149151
150152
151153class DatabricksAPIError (Error ):
@@ -162,8 +164,8 @@ def validate_error(cls, values):
162164
163165
164166class Response (GenericModel , Generic [DataType ]):
165- result : Union [DataType , None ]
166- error : Union [Error , None ]
167+ result : Union [DataType , None ] = None
168+ error : Union [Error , None ] = None
167169
168170 @validator ("error" , always = True )
169171 def check_consistency (cls , err , values ):
@@ -265,9 +267,13 @@ class AwsRegionEnum(str, Enum):
265267 "Statement" : [
266268 {
267269 "Effect" : "Allow" ,
268- "Principal" : {"AWS" : "arn:aws:iam::533267411813:role/sync-computing-collector" },
270+ "Principal" : {
271+ "AWS" : "arn:aws:iam::533267411813:role/sync-computing-collector"
272+ },
269273 "Action" : "sts:AssumeRole" ,
270- "Condition" : {"StringEquals" : {"sts:ExternalId" : "PLACEHOLDER_EXTERNAL_ID" }},
274+ "Condition" : {
275+ "StringEquals" : {"sts:ExternalId" : "PLACEHOLDER_EXTERNAL_ID" }
276+ },
271277 }
272278 ],
273279}
@@ -276,15 +282,15 @@ class AwsRegionEnum(str, Enum):
276282class AwsHostedIAMInstructions (BaseModel ):
277283 step_1_prompt : str = "Step 1: Copy the JSON and paste in AWS IAM Permissions page:"
278284 step_1_value : str = json .dumps (IAMRoleRequiredPermissions )
279- step_2_prompt : str = (
280- "Step 2: Copy the JSON and paste in AWS IAM Trust relationships page with External ID:"
281- )
285+ step_2_prompt : str = "Step 2: Copy the JSON and paste in AWS IAM Trust relationships page with External ID:"
282286 external_id : str
283287
284288 @property
285289 def step_2_value (self ) -> str :
286290 policy = copy .deepcopy (IAMRoleTrustPolicy )
287- policy ["Statement" ][0 ]["Condition" ]["StringEquals" ]["sts:ExternalId" ] = self .external_id
291+ policy ["Statement" ][0 ]["Condition" ]["StringEquals" ]["sts:ExternalId" ] = (
292+ self .external_id
293+ )
288294 return json .dumps (policy )
289295
290296
@@ -299,16 +305,26 @@ class ComputeProviderHostedValues(BaseModel):
299305class CreateWorkspaceConfig (BaseModel ):
300306 workspace_id : str = Field (..., description = "Unique identifier for the workspace" )
301307 databricks_host : str = Field (..., description = "Databricks service host URL" )
302- databricks_token : str = Field (..., description = "Authentication token for Databricks service" )
303- sync_api_key_id : str = Field (..., description = "API Key ID for synchronization service" )
304- sync_api_key_secret : str = Field (..., description = "API Key secret for synchronization service" )
305- instance_profile_arn : Optional [str ] = Field (None , description = "AWS instance profile ARN" )
308+ databricks_token : str = Field (
309+ ..., description = "Authentication token for Databricks service"
310+ )
311+ sync_api_key_id : str = Field (
312+ ..., description = "API Key ID for synchronization service"
313+ )
314+ sync_api_key_secret : str = Field (
315+ ..., description = "API Key secret for synchronization service"
316+ )
317+ instance_profile_arn : Optional [str ] = Field (
318+ None , description = "AWS instance profile ARN"
319+ )
306320 webhook_id : Optional [str ] = Field (None , description = "Webhook ID for notifications" )
307321 databricks_plan_type : DatabricksPlanType = Field (
308322 DatabricksPlanType .STANDARD , description = "Plan type for Databricks deployment"
309323 )
310324 aws_region : Optional [str ] = Field (None , description = "AWS region if applicable" )
311- cluster_policy_id : Optional [str ] = Field (None , description = "Cluster policy ID for Databricks" )
325+ cluster_policy_id : Optional [str ] = Field (
326+ None , description = "Cluster policy ID for Databricks"
327+ )
312328 collection_type : WorkspaceCollectionTypeEnum = Field (
313329 ..., description = "Type of hosting for the workspace"
314330 )
@@ -318,10 +334,18 @@ class CreateWorkspaceConfig(BaseModel):
318334 compute_provider : ComputeProvider = Field (
319335 ..., description = "Cloud provider for compute resources"
320336 )
321- external_id : Optional [str ] = Field (None , description = "External ID for AWS configurations" )
322- aws_iam_role_arn : Optional [str ] = Field (None , description = "AWS IAM role ARN if needed" )
323- azure_tenant_id : Optional [str ] = Field (None , description = "Azure tenant ID if using Azure" )
324- azure_client_id : Optional [str ] = Field (None , description = "Azure client ID if using Azure" )
337+ external_id : Optional [str ] = Field (
338+ None , description = "External ID for AWS configurations"
339+ )
340+ aws_iam_role_arn : Optional [str ] = Field (
341+ None , description = "AWS IAM role ARN if needed"
342+ )
343+ azure_tenant_id : Optional [str ] = Field (
344+ None , description = "Azure tenant ID if using Azure"
345+ )
346+ azure_client_id : Optional [str ] = Field (
347+ None , description = "Azure client ID if using Azure"
348+ )
325349 azure_client_secret : Optional [str ] = Field (
326350 None , description = "Azure client secret if using Azure"
327351 )
@@ -352,7 +376,9 @@ def check_aws_iam_role_arn(cls, aws_iam_role_arn, values):
352376 compute_provider = values .get ("compute_provider" )
353377 if values .get ("collection_type" ) == WorkspaceCollectionTypeEnum .HOSTED :
354378 if compute_provider == ComputeProvider .AWS and not aws_iam_role_arn :
355- raise ValueError ("AWS IAM Role ARN is required for AWS compute provider" )
379+ raise ValueError (
380+ "AWS IAM Role ARN is required for AWS compute provider"
381+ )
356382 return aws_iam_role_arn
357383
358384 @validator ("compute_provider" , pre = False )
@@ -367,7 +393,9 @@ def check_azure_hosted_fields(cls, compute_provider, values):
367393 "azure_client_secret" ,
368394 "azure_subscription_id" ,
369395 ]
370- missing_fields = [field for field in required_fields if not values .get (field )]
396+ missing_fields = [
397+ field for field in required_fields if not values .get (field )
398+ ]
371399 if missing_fields :
372400 raise ValueError (
373401 f"Missing required fields for Azure compute provider: "
0 commit comments