Skip to main content

Python enabler for Zowe API Mediation Layer

Project description

Onboarding Python enabler for Zowe API Mediation Layer

This is the onboarding Python enabler for Zowe API Mediation Layer (part of Zowe) that allows to register a Python based service to the API Mediation Layer Discovery Service. It uses py-eureka-client.

Installation

Install the package using pip:

    pip install zowe-apiml-onboarding-enabler-python

How to use

  1. Import the Enabler in Your Python Service. Add the following code block to register your service with Eureka:

    Example:

        from fastapi import FastAPI
        from zowe_apiml_onboarding_enabler_python.registration import PythonEnabler
    
        app = FastAPI()
        enabler = PythonEnabler(config_file="service-configuration.yml")
    
        @app.on_event("startup")
        def register_service():
            enabler.register()
    

    To make sure that your application will automatically unregister from Eureka once shut down, you can use the unregister() function, like shown in the example below.

     @app.on_event("shutdown")
        def unregister_service():
            enabler.unregister()
    
  2. Create a yaml file named service-configuration.yml, add the configuration properties and place the yaml file inside a /config directory at the same level of your app.py. Below is an example of the configuration.

    Example:

    eureka:
       ssl: true
       host: localhost
       ipAddress: 127.0.0.1
       port: 10011
       servicePath: '/eureka'
       maxRetries: 30
       requestRetryDelay: 1000
       registryFetchInterval: 5
    
    
    instance:
       app: pythonservice
       scheme: https
       vipAddress: pythonservice
       instanceId: localhost:pythonservice:10018
       homePageUrl: https://localhost:10018/pythonservice
       hostName: 'localhost'
       ipAddr: '127.0.0.1'
       port: 10018
       securePort: 10018
       secureVipAddress: pythonservice
       statusPageUrl: https://localhost:10018/pythonservice/application/info
       healthCheckUrl: https://localhost:10018/pythonservice/application/health
       nonSecurePortEnabled': false
       securePortEnabled: true
    metadata:
       apiml.catalog.tile.id: 'cademoapps'
       apiml.catalog.tile.title: 'Sample Python Hello World'
       apiml.catalog.tile.description: 'Applications Hello'
       apiml.routes.api_v1.gatewayUrl: "api/v1"
       apiml.routes.api_v1.serviceUrl: "/pythonservice"
       apiml.apiInfo.0.apiId: org.zowe.pythonservice
       apiml.apiInfo.0.gatewayUrl: "api/v1"
       apiml.apiInfo.0.swaggerUrl: https://localhost:10018/pythonservice/apidoc
       apiml.apiInfo.0.version: 1.0.0
       apiml.service.title: 'Zowe Sample Python Service'
       apiml.service.description: 'Sample API services to demonstrate Python Onboarding Enabler'
    
    ssl:
       certificate: ../keystore/localhost/localhost.keystore.cer
       keystore: ../keystore/localhost/localhost.keystore.key
       caFile: ../keystore/localhost/localhost.pem
       keyPassword: password
    
  3. Start your Python service and verify that it registers to the Zowe API Mediation Layer.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zowe_apiml_onboarding_enabler_python-3.2.3.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file zowe_apiml_onboarding_enabler_python-3.2.3.tar.gz.

File metadata

File hashes

Hashes for zowe_apiml_onboarding_enabler_python-3.2.3.tar.gz
Algorithm Hash digest
SHA256 766dfe1598c09e401e3ddb976302f211067c630dc89aaffbbaa7edbe76fe7640
MD5 e766c30b5f94a157d71e2be131c75c5c
BLAKE2b-256 2eb20407270fdc814a33db06ad137c8ec625ec16137cdb5a4a1ea83424435e4a

See more details on using hashes here.

File details

Details for the file zowe_apiml_onboarding_enabler_python-3.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for zowe_apiml_onboarding_enabler_python-3.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 af32e4ac73d43eec3f2d268b5bb56c07f50df76266404a207d770633220f924e
MD5 1c695cfd9bfe84678cea3d04143f2867
BLAKE2b-256 c3c87be41b7740c6f15d04675fae8549521e3402f9552f2617b1e11e30bca0f3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page