Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Shchederkin committed Dec 17, 2024
1 parent b0f2679 commit 0c96744
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions aws-lambda/src/databricks_cdk/resources/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import Optional

import cfnresponse
from databricks_cdk.resources.service_principals.secrets import create_or_update_service_principal_secrets, delete_service_principal_secrets
from databricks_cdk.resources.service_principals.service_principal_secrets import ServicePrincipalSecretsProperties, create_or_update_service_principal_secrets, delete_service_principal_secrets
from pydantic import BaseModel, ValidationError

from databricks_cdk.resources.account.credentials import (
Expand Down Expand Up @@ -231,7 +231,7 @@ def create_or_update_resource(event: DatabricksEvent) -> CnfResponse:
return create_or_update_service_principal(ServicePrincipalProperties(**event.ResourceProperties))
elif action == "service-principal-secrets":
return create_or_update_service_principal_secrets(
ServicePrincipalProperties(**event.ResourceProperties), event.PhysicalResourceId,
ServicePrincipalSecretsProperties(**event.ResourceProperties), event.PhysicalResourceId,
)
else:
raise RuntimeError(f"Unknown action: {action}")
Expand Down Expand Up @@ -343,7 +343,7 @@ def delete_resource(event: DatabricksEvent) -> CnfResponse:
)
elif action == "service-principal-secrets":
return delete_service_principal_secrets(
ServicePrincipalProperties(**event.ResourceProperties), event.PhysicalResourceId
ServicePrincipalSecretsProperties(**event.ResourceProperties), event.PhysicalResourceId
)
else:
raise RuntimeError(f"Unknown action: {action}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from databricks.sdk.errors import NotFound
from databricks.sdk.service.oauth2 import SecretInfo, CreateServicePrincipalSecretResponse

from databricks_cdk.resources.service_principals.secrets import (
from databricks_cdk.resources.service_principals.service_principal_secrets import (
ServicePrincipalSecretsCreationError,
ServicePrincipalSecretsProperties,
create_service_principal_secrets,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,12 @@ export class ServicePrincipal extends CustomResource {
}
});
}

public servicePrincipalId(): string {
return this.getAttString("physical_resource_id");
}

public servicePrincipalName(): string {
return this.getAttString("name");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Construct } from "constructs";


export interface ServicePrincipalSecretsProperties {
service_principal_id: number
service_principal_id: string
}

export interface ServicePrincipalSecretsProps extends ServicePrincipalSecretsProperties {
Expand Down

0 comments on commit 0c96744

Please sign in to comment.