From c3d68727ea0f5a9609d9fab87e6ddd8a01e93cb2 Mon Sep 17 00:00:00 2001 From: Ayush Shah Date: Mon, 24 Jun 2024 21:43:54 +0530 Subject: [PATCH] Add Docs around SSL under OpenMetadataConfig (#16774) --- .../content/v1.4.x/sdk/python/index.md | 25 ++++++++++++++++++ .../v1.5.x-SNAPSHOT/sdk/python/index.md | 26 +++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/openmetadata-docs/content/v1.4.x/sdk/python/index.md b/openmetadata-docs/content/v1.4.x/sdk/python/index.md index 34802828938c..3e1b552e4565 100644 --- a/openmetadata-docs/content/v1.4.x/sdk/python/index.md +++ b/openmetadata-docs/content/v1.4.x/sdk/python/index.md @@ -181,6 +181,31 @@ metadata = OpenMetadata(server_config) For local development, we can get a JWT token for the ingestion bot as described [here](/deployment/security/enable-jwt-tokens#generate-token) and use that when we specify the `jwtToken`. For a real-world deployment, we can also use [different authentication methods](/deployment/security) and specify other settings of the connection (such as `sslConfig`). +Below is an example of how the user can configure `sslConfig` using `Python SDK`. + +```python +from metadata.generated.schema.security.ssl.validateSSLClientConfig import ValidateSslClientConfig +from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import ( + AuthProvider, + OpenMetadataConnection +) +from metadata.generated.schema.security.client.openMetadataJWTClientConfig import OpenMetadataJWTClientConfig +from metadata.ingestion.ometa.ometa_api import OpenMetadata + + +server_config = OpenMetadataConnection( + hostPort="http://localhost:8585/api", + authProvider=AuthProvider.openmetadata, + securityConfig=OpenMetadataJWTClientConfig( + jwtToken="", + ), + verifySSL="validate" # ignore, validate or no-ssl, + sslConfig=ValidateSslClientConfig(caCertificate="/path/to/rootCert",sslCertificate="/path/to/cert",sslKey="/path/to/key"), +) + +metadata = OpenMetadata(server_config) +``` + {% note %} The OpenMetadataConnection is defined as a JSON Schema as well. You can check the definition [here](https://github.com/open-metadata/OpenMetadata/blob/main/openmetadata-spec/src/main/resources/json/schema/entity/services/connections/metadata/openMetadataConnection.json) diff --git a/openmetadata-docs/content/v1.5.x-SNAPSHOT/sdk/python/index.md b/openmetadata-docs/content/v1.5.x-SNAPSHOT/sdk/python/index.md index 34802828938c..14704508c023 100644 --- a/openmetadata-docs/content/v1.5.x-SNAPSHOT/sdk/python/index.md +++ b/openmetadata-docs/content/v1.5.x-SNAPSHOT/sdk/python/index.md @@ -181,6 +181,32 @@ metadata = OpenMetadata(server_config) For local development, we can get a JWT token for the ingestion bot as described [here](/deployment/security/enable-jwt-tokens#generate-token) and use that when we specify the `jwtToken`. For a real-world deployment, we can also use [different authentication methods](/deployment/security) and specify other settings of the connection (such as `sslConfig`). +Below is an example of how the user can configure `sslConfig` using `Python SDK`. + +```python +from metadata.generated.schema.security.ssl.validateSSLClientConfig import ValidateSslClientConfig +from metadata.generated.schema.entity.services.connections.metadata.openMetadataConnection import ( + AuthProvider, + OpenMetadataConnection +) +from metadata.generated.schema.security.client.openMetadataJWTClientConfig import OpenMetadataJWTClientConfig +from metadata.ingestion.ometa.ometa_api import OpenMetadata + + +server_config = OpenMetadataConnection( + hostPort="http://localhost:8585/api", + authProvider=AuthProvider.openmetadata, + securityConfig=OpenMetadataJWTClientConfig( + jwtToken="", + ), + verifySSL="validate" # ignore, validate or no-ssl, + sslConfig=ValidateSslClientConfig(caCertificate="/path/to/rootCert",sslCertificate="/path/to/cert",sslKey="/path/to/key"), +) + +metadata = OpenMetadata(server_config) +``` + + {% note %} The OpenMetadataConnection is defined as a JSON Schema as well. You can check the definition [here](https://github.com/open-metadata/OpenMetadata/blob/main/openmetadata-spec/src/main/resources/json/schema/entity/services/connections/metadata/openMetadataConnection.json)