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.4.tar.gz (52.5 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.4.tar.gz.

File metadata

File hashes

Hashes for zowe_apiml_onboarding_enabler_python-3.2.4.tar.gz
Algorithm Hash digest
SHA256 afb914f81e89616163d5ea2ca105df25f2096ec36206b0a8184d51fd598ceed9
MD5 2a7ae43dab6c8b6f1c29992a58fdcbc7
BLAKE2b-256 227d68a576ab1065a20ebc11fa7c4fa4f8c2d94f52187b9000346bb14fb0ead7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for zowe_apiml_onboarding_enabler_python-3.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 853bd8c9d02e78253239df38c830d92d73309cd54aa7a5d5dd5ccad879558360
MD5 144b823db1856cb50a944019df4c24ce
BLAKE2b-256 37d5c8d835954980871ca57859acd74977ddf28fedb41e137b72cebf1a114525

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