Giter VIP home page Giter VIP logo

pulp-openapi-generator's Introduction

pulp-openapi-generator

This repository provides a script that helps generate Python and Ruby bindings for pulpcore or any of it's plugins.

The first time the script is run, a docker container with openapi-generator-cli is downloaded. All subsequent runs will re-use the container that was downloaded on the initial run.

Requirements

  • Pulp 3 running on localhost:24817
  • Docker

Generating bindings

The generate.sh script takes three positional arguments: module name, language, and version. When the optional version parameter is provided, it is used as the version string. When it is not provided, the version reported by Pulp's status API is used. The following commands should be used to generate Python bindings for pulpcore:

sudo ./generate.sh pulpcore python

This command will generate a python package inside pulpcore-client directory.

Ruby bindings for the RPM plugin can be generated with the following command:

sudo ./generate.sh pulp_rpm ruby

This command will generate a Ruby Gem inside pulp_rpm-client directory.

The packages generated will have the same version as what is reported by the status API.

This command will generate a Ruby Gem with '3.0.0rc1.dev.10' version.

sudo ./generate.sh pulp_rpm ruby 3.0.0rc1.dev.10

Generating Bindings Against Re-Rooted Systems

During bindings generation the openapi schema is fetched. Use the PULP_API_ROOT environment variable to instruct the bindings generator where the root of the API is located. For example, the default export PULP_API_ROOT="/pulp/" is the default root, which then serves the api.json at /pulp/api/v3/docs/api.json.

Generating Bindings Against Remote Systems

During bindings generation the openapi schema is fetched. Use the PULP_API environment variable to instruct the bindings generator to use a Pulp API on a different host and/or port. For example, export PULP_API="http://localhost:24817" are the default host and port, which results in the bindings generator talking to the Pulp API at http://localhost:24817/pulp/api/v3/docs/api.json.

Generating Bindings Using a Local Openapi Schema

If you want to use a locally present openapi schema, you can skip fetching the openapi schema by setting the USE_LOCAL_API_JSON environment variable. Doing so you have to manually provide the api.json file containing the openapi schema in the current working directory.

Generate Bindings Using Docker in Docker (dind)

Bindings are generated using the openapi-generator-cli docker container. If your environment itself runs in a docker container, the openapi-generator-cli container has to be started as a sibling container. For sibling containers, volumes cannot be mounted as usual. They have to be passed through from the parent container. For this to work you have to set the PARENT_CONRAINER_ID environment variable to specify the parent container in a dind environment.

Generating Bindings on a Filesystem Shared With Another Container

When the bindings are being generated so that they can be installed inside another container, it may be necessary to set the MCS label on the openapi-generator-cli container to match the MCS label of the other container. Users can set the $PULP_MCS_LABEL environment variable (e.g. s0:c1,c2). When this variable is present, the container for openapi-generator-cli will be started with this MCS label. This only applies to systems that are using podman and SELinux is Enforcing.

pulp-openapi-generator's People

Contributors

bmbouter avatar daviddavis avatar dkliban avatar dosas avatar dralley avatar ekohl avatar fao89 avatar gerrod3 avatar gmbnomis avatar goarsna avatar jctanner avatar lubosmj avatar mdellweg avatar pedro-psb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.