Skip to content

Commit

Permalink
Added schema and app package code client (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-gangl authored Aug 5, 2024
1 parent 9f38273 commit 1a572ee
Show file tree
Hide file tree
Showing 37 changed files with 4,411 additions and 5 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/app-pacakge-build-client-python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Unity-app-package-client Python Build

# Do Run if we push anything changes in /libs/app-package-build-client to the main branch
# Run on an PR if it includes unity-py changes OR if the schema in health are changed.
on:
push:
branches:
- main
paths:
- 'libs/app-package-build-client/**'
pull_request:
branches:
- main
paths:
- 'libs/app-package-build-client/**'

jobs:
build:
defaults:
run:
working-directory: ./libs/app-package-build-client
strategy:
fail-fast: false
max-parallel: 2
matrix:
python-version: [ "3.8", "3.9", "3.10" ]
poetry-version: [ "1.5.1" ]
# os: [ ubuntu-18.04, macos-latest, windows-latest ]
os: [ ubuntu-22.04, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: ${{ matrix.poetry-version }}
#- uses: dorny/paths-filter@v3
# id: changes
# with:
# filters: |
# src:
# - 'libs/unity-py/**'
- name: Software Version Check
if: steps.filter.outputs.src == 'true'
run: |
proposed_version=`poetry version -s`
echo "curl -s -o /dev/null -w \"%{http_code}\" https://pypi.org/project/unity-sds-apgs-client/$proposed_version/"
status_code=`curl -s -o /dev/null -w "%{http_code}" https://pypi.org/project/unity-sds-apgs-client/$proposed_version/`
echo "Received status code of $status_code"
if ((status_code == 200)); then
echo "Version already exists."
exit 1
fi
- name: Install dependencies
run: |
poetry install
# This is good practice, but because these are autogenerated libraries, we will forgo the linting.
#- name: Lint with flake8
# run: |
# # stop the build if there are Python syntax errors or undefined names
# poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
poetry run pytest --cov-report=lcov --cov=unity_sds_apgs_client -o log_cli=true --log-cli-level=DEBUG
- name: Coveralls
uses: coverallsapp/[email protected]
version:
needs: build
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./libs/app-package-build-client
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.UNITY_BUILD_PAT }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install Poetry
uses: abatilo/[email protected]
with:
poetry-version: "1.5.1"
# Commented out the version bump code. Will publish new version to pypi on push to main.
# This means we are always releasing. This will fail if the version already exists in Pypi.
# We must ensure that the version has been updated.
# ADded version check above.
# Future work: set PR test to ensure the version has been updated.

# - name: version-bump
# run: |
# poetry version prerelease
# - name: Commit Version Bump
# run: |
# git config --global user.name 'mdps bot'
# git config --global user.email '[email protected]'
# git commit -am "development version bump. [skip actions]"
# git push
- name: Install dependencies
run: |
poetry install
- name: build
run: |
poetry build
- name: Get version
id: get-version
run: |
echo "::set-output name=current_version::$(poetry version | awk '{print $2}')"
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
packages-dir: ./libs/app-package-build-client/dist
outputs:
publishedVersion: ${{ steps.get-version.outputs.current_version }}
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ repos:
- --allow-missing-credentials
- id: check-toml # Checks toml files for parsable syntax.

- repo: https://github.com/igorshubovych/markdownlint-cli
rev: "v0.39.0"
hooks:
- id: markdownlint
args: ["--config", ".markdownlintrc", "--ignore", "CHANGELOG.md"]
# Ignored because it caused exceptions with no clear indication as to the problem
#- repo: https://github.com/igorshubovych/markdownlint-cli
# rev: "v0.39.0"
# hooks:
# - id: markdownlint
# args: ["--config", ".markdownlintrc", "--ignore", "**/CHANGELOG.md"]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
Expand Down
23 changes: 23 additions & 0 deletions libs/app-package-build-client/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
26 changes: 26 additions & 0 deletions libs/app-package-build-client/.openapi-generator/FILES
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.github/workflows/python.yml
.gitignore
.gitlab-ci.yml
.travis.yml
README.md
docs/AdsAcbMcpCloneGet200Response.md
docs/DefaultApi.md
git_push.sh
pyproject.toml
requirements.txt
setup.cfg
setup.py
test-requirements.txt
test/__init__.py
tox.ini
unity_sds_apgs_client/__init__.py
unity_sds_apgs_client/api/__init__.py
unity_sds_apgs_client/api/default_api.py
unity_sds_apgs_client/api_client.py
unity_sds_apgs_client/api_response.py
unity_sds_apgs_client/configuration.py
unity_sds_apgs_client/exceptions.py
unity_sds_apgs_client/models/__init__.py
unity_sds_apgs_client/models/ads_acb_mcp_clone_get200_response.py
unity_sds_apgs_client/py.typed
unity_sds_apgs_client/rest.py
1 change: 1 addition & 0 deletions libs/app-package-build-client/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7.7.0
16 changes: 16 additions & 0 deletions libs/app-package-build-client/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.0] - 2024-08-05

### Added
- Added Schema and built application client code, including github workflows
### Changed
### Deprecated
### Removed
### Fixed
### Security
116 changes: 116 additions & 0 deletions libs/app-package-build-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
# unity-sds-apgs-client
Service for application package generation

This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:

- API version: 1.0.0
- Package version: 1.0.0
- Generator version: 7.7.0
- Build package: org.openapitools.codegen.languages.PythonClientCodegen

## Requirements.

Python 3.7+

## Installation & Usage
### pip install

If the python package is hosted on a repository, you can install directly using:

```sh
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
```
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)

Then import the package:
```python
import unity_sds_apgs_client
```

### Setuptools

Install via [Setuptools](http://pypi.python.org/pypi/setuptools).

```sh
python setup.py install --user
```
(or `sudo python setup.py install` to install the package for all users)

Then import the package:
```python
import unity_sds_apgs_client
```

### Tests

Execute `pytest` to run the tests.

## Getting Started

Please follow the [installation procedure](#installation--usage) and then run the following:

```python

import unity_sds_apgs_client
from unity_sds_apgs_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://api.dev.mdps.mcp.nasa.gov
# See configuration.py for a list of all supported configuration parameters.
configuration = unity_sds_apgs_client.Configuration(
host = "http://api.dev.mdps.mcp.nasa.gov"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization: bearerAuth
configuration = unity_sds_apgs_client.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)


# Enter a context with an instance of the API client
with unity_sds_apgs_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = unity_sds_apgs_client.DefaultApi(api_client)
clone_url = 'clone_url_example' # str |

try:
# Begins the MCP Clone process
api_response = api_instance.ads_acb_mcp_clone_get(clone_url)
print("The response of DefaultApi->ads_acb_mcp_clone_get:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling DefaultApi->ads_acb_mcp_clone_get: %s\n" % e)

```

## Documentation for API Endpoints

All URIs are relative to *http://api.dev.mdps.mcp.nasa.gov*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultApi* | [**ads_acb_mcp_clone_get**](docs/DefaultApi.md#ads_acb_mcp_clone_get) | **GET** /ads-acb/mcp-clone | Begins the MCP Clone process


## Documentation For Models

- [AdsAcbMcpCloneGet200Response](docs/AdsAcbMcpCloneGet200Response.md)


<a id="documentation-for-authorization"></a>
## Documentation For Authorization


Authentication schemes defined for the API:
<a id="bearerAuth"></a>
### bearerAuth

- **Type**: Bearer authentication


## Author
Loading

0 comments on commit 1a572ee

Please sign in to comment.