Example #1
0
 def get():
     # create an instance of the API class
     api, username = get_api()
     api_instance = modelcatalog.SoftwareVersionApi(api)
     try:
         # List all Person entities
         api_response = api_instance.softwareversions_get(username=username)
         return api_response
     except ApiException as e:
         raise e
Example #2
0
 def get():
     # create an instance of the API class
     api, username = get_api()
     api_instance = modelcatalog.SampleResourceApi(api)
     try:
         # List all Person entities
         api_response = api_instance.sampleresources_get(username=username)
         return api_response
     except ApiException as e:
         raise e
Example #3
0
    def get_by_label(self, label):
        api, username = get_api()
        api_instance = modelcatalog.ModelApi(api_client=api)

        try:
            api_response = api_instance.models_get(username=username,
                                                   label=label[0])
            return api_response
        except ApiException as e:
            logging.error("Exception when calling ModelApi->models_get: %s\n" %
                          e)
            raise e
Example #4
0
 def post(self, request):
     api, username = get_api()
     api_instance = modelcatalog.ModelApi(api)
     model = Model(**request)
     try:
         api_response = api_instance.models_post(username, model=model)
         return api_response
     except ApiException as e:
         logging.error(
             "Exception when calling ModelConfigurationSetupApi->modelconfigurationsetups_post: %s\n"
             % e)
         raise e
Example #5
0
    def put(software_version):
        api, username = get_api()
        api_instance = modelcatalog.SoftwareVersionApi(api)

        try:
            version_id = software_version.id.replace(MODEL_CATALOG_URL, '')
            api_response = api_instance.softwareversions_id_put(
                version_id, username, software_version=software_version)
            return api_response
        except ApiException as e:
            logging.error(
                "Exception when calling SoftwareVersionApi->softwareversions_id_put: %s\n"
                % e)
            raise e
        return api_response
Example #6
0
import json
import typing

import modelcatalog
from modelcatalog import Model
from mic._utils import get_api
from modelcatalog import ApiException
api, username = get_api()
api_instance = modelcatalog.ModelApi(api_client=api)


def test_1():
    try:
        # List all Person entities
        api_response = api_instance.models_id_get("CYCLES", username=username)
    except ApiException as e:
        raise e
    response = api_response
    a = api_instance.models_post(username, model=response)
    with open("cycles.json", "w") as f:
        json.dump(a.to_dict(), f)


def read_json():
    with open("test.json", "r") as f:
        data = json.load(f)
    m = Model(**data)
    a = api_instance.models_post(username, model=m)
    return a