Fuzzball Documentation
Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Toggle Dark/Light/Auto mode Back to homepage

SDK Generation using Swagger Codegen

First, we’ll generate the Fuzzball client SDK for Python using Swagger Codegen in an Apptainer container.

Create a directory to store your work and use Apptainer to execute the Swagger Codegen CLI generate subcommand to create the Python SDK.

If you have pulled the Swagger Codegen CLI container previously using Apptainer, the command below will use the cached container, otherwise Apptainer will pull it from Docker Hub.

$ mkdir -p ~/python-fuzzball

$ apptainer run --bind ~/python-fuzzball:/output docker://swaggerapi/swagger-codegen-cli:2.4.41 \
    generate \
    --input-spec https://api.integration.ciq.dev/v2/schema \
    --output /output  \
    --lang python \
    -DpackageName=fuzzball
INFO:    Using cached SIF image
[main] INFO io.swagger.parser.Swagger20Parser - reading from https://api.integration.ciq.dev/v2/schema
[main] WARN io.swagger.codegen.DefaultGenerator - 'host' not defined in the spec. Default to 'localhost'.
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /output/fuzzball/models/access.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /output/test/test_access.py
[main] INFO io.swagger.codegen.AbstractGenerator - writing file /output/docs/Access.md
[snip...]

These commands do the following.

The first command creates a directory at ~/python-fuzzball.

The apptainer run command uses a swagger-codegen-cli container from Docker Hub to create your SDK. The --bind option bind mounts the directory python-fuzzball to the directory /output within the container.

The remaining options and arguments instruct the Swagger Codegen generate command on how the SDK should be created.

  • --input-spec points to a URI that contains the API spec for Swagger to use when creating the SDK. This is of the form https://api.<your fuzzball url>/v2/schema. In the example, the URL integration.ciq.dev is used.
  • --output /output tells Swagger to save the generated SDK in the directory called /output (that was bind mounted in from the host system).
  • --lang python specifies the language to generate the SDK for.
  • -DpackageName=fuzzball sets the name of the generated package to fuzzball.