{"id":19811009,"url":"https://github.com/accenture/morpheus-data-api","last_synced_at":"2025-07-13T08:34:32.354Z","repository":{"id":57443220,"uuid":"388569036","full_name":"Accenture/morpheus-data-api","owner":"Accenture","description":"Python client to Morpheus Data API https://apidocs.morpheusdata.com","archived":false,"fork":false,"pushed_at":"2023-05-23T01:26:12.000Z","size":39,"stargazers_count":2,"open_issues_count":1,"forks_count":2,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-06T11:51:44.069Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Accenture.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-22T19:03:09.000Z","updated_at":"2023-07-01T18:31:00.000Z","dependencies_parsed_at":"2024-11-12T09:37:59.201Z","dependency_job_id":null,"html_url":"https://github.com/Accenture/morpheus-data-api","commit_stats":{"total_commits":12,"total_committers":1,"mean_commits":12.0,"dds":0.0,"last_synced_commit":"8f6feecdbc07b5d981f629c904de92af7566e43d"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Accenture%2Fmorpheus-data-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Accenture%2Fmorpheus-data-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Accenture%2Fmorpheus-data-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Accenture%2Fmorpheus-data-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Accenture","download_url":"https://codeload.github.com/Accenture/morpheus-data-api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251847828,"owners_count":21653582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T09:24:19.307Z","updated_at":"2025-05-01T08:32:22.075Z","avatar_url":"https://github.com/Accenture.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# morpheus-data-client\nPython client to Morpheus Data API\n\nhttps://apidocs.morpheusdata.com/\n\n[![Tests](https://github.com/Accenture/morpheus-data-api/actions/workflows/tests.yml/badge.svg)](https://github.com/Accenture/morpheus-data-api/actions/workflows/tests.yml/)\n[![Codecov](https://codecov.io/gh/Accenture/morpheus-data-api/branch/master/graph/badge.svg)](https://codecov.io/gh/Accenture/morpheus-data-api/branch/master)\n\n## Usage ##\n\n```python\nimport os\nfrom morpheus_data_api import MorpheusDataApi\n\nos.environ['MORPHEUS_HOST'] = 'somehost.com'\nos.environ['MORPHEUS_TOKEN'] = 'foobar'\n\napi = MorpheusDataApi()\ntype_data = {\n    'optionType': {\n        'name': 'foo',\n        'type': 'text',\n        'description': 'foo',\n        'fieldLabel': 'foo',\n        'fieldName': 'foo'\n    }\n}\n\ndef type_names():\n    r = api.call(\n        'library/option-types', transform='optionTypes[].name'\n    )\n    return r\n\nassert 'foo' not in type_names()\n\napi.upsert('library/option-types', 'foo', type_data)\nassert 'foo' in type_names()\n\ntype_data['optionType']['description'] = 'FOO'\nassert api.get('library/option-types', 'foo')['description'] == 'foo'\n\napi.upsert('library/option-types', 'foo', type_data)\nassert api.get('library/option-types', 'foo')['description'] == 'FOO'\n\napi.delete('library/option-types', 'foo')\nassert 'foo' not in type_names()\n\n```\n\n### Deploy/Undeploy Config ###\n\nGiven a yaml config file [tests/data/option_types/foo1.yaml](./tests/data/option_types/foo1.yaml):\n\n```yaml\n$optionType:\n  name: foo1\n  fieldName: foo1\n  type: select\n  description: foo1\n  fieldLabel: foo1\n  optionList:\n    id:\n      $optionTypeList:\n        name: foo1\n        type: manual\n        initialDataset:\n          $dataset:\n            - bar\n            - baz\n```\n\nIt can be deployed/undeployed like so:\n\n```python\nimport os\nfrom morpheus_data_api import MorpheusDataApi\n\nos.environ['MORPHEUS_HOST'] = 'somehost.com'\nos.environ['MORPHEUS_TOKEN'] = 'foobar'\n\napi = MorpheusDataApi()\napi.deploy_files('option_types/foo1.yaml')\napi.deploy_files('option_types/foo1.yaml', undeploy=True)\n```\n\nOr deployed through the `morpheus-data-api` console script\n\n```console\n$ morpheus-data-api deploy tests/data/option_types/foo1.yaml\ncreated optionTypeList foo1 [14]\ncreated optionType foo1 [1766]\n1/1] deployed foo1.yaml\ndeployed 1/1 file(s)\n```\n\nThen undeployed:\n```console\n$ morpheus-data-api undeploy tests/data/option_types/foo1.yaml\ndeleted optionType foo1 [1766]\ndeleted optionTypeList foo1 [14]\n1/1] undeployed foo1.yaml\nundeployed 1/1 file(s)\n```\n\nThis works by upserting or deleting nested entities in the expected order, and linking\nreferential IDs to the parent object\n\nSee [tests/data/catalog_items/item1.yaml](./tests/data/catalog_items/item1.yaml) for larger example\n\n```console\n$ morpheus-data-api deploy tests/data/catalog_items/item1.yaml\ncreated task task1 [9]\ncreated optionType item1 [1767]\ncreated optionTypeList item2 [15]\ncreated optionType item2 [1768]\ncreated taskSet item1 [5]\ncreated catalogItemType item1 [3]\ncreated schedule schedule1 [6]\ncreated job job1 [11]\n1/1] deployed item1.yaml\ndeployed 1/1 file(s)\n```\n\n### Variables ###\n\nThe following variables are supported within the config file\n\n| variable | description | example |\n| --- | --- | --- |\n| `$createPath` | nested below an $api object, override the path used to create entity | `$createPath: /api/library/instance-types/${id:instanceTypes:blueprint1.instanceType1}/layouts` |\n| `$dataset` | convert list of values to json optionType dataset | `$dataset: ['foo', 'bar']` |\n| `$datasetCsv` | convert contents of local csv file to json optionType dataset | `$datasetCsv: data.csv` |\n| `$deleteIds` | delete additional entities during undeploy | `$deleteIds: [${id:optionTypes:foo}]` |\n| `$deletePath` | nested below an $api object, override the path used to delete entity | `$deletePath: /api/library/instance-types/${id:instanceTypes:blueprint1.instanceType1}/layouts` |\n| `$entity` | nested below an $api object, override entity name | `$entity: instanceTypeLayout` |\n| `$entityId` | nested below an $api object, override entity ID | `$entityId: key/128/foobar` |\n| `$fileContent` | read contents of local file | `$fileContent: foo.py` |\n| `$id` | lookup entity ID from ${id:path:name} expression | `id: ${id:optionTypes:foo}` |\n| `$json` | convert value to JSON | `$json: [1,2,3]` |\n| `$setName` | nested below an $api object, don't automatically set entity name if `false` | `$setName: false` |\n| `$updatePath` | nested below an $api object, override the path used to update entity | `$updatePath: /api/library/instance-types/${id:instanceTypes:blueprint1.instanceType1}/layouts` |\n| `$validate` | nested below an $api object, disable validation if `false` | `$validate: false` |\n\n## Console Script ##\n\nThe `morpheus-data-api` console script is installed as part of setup.py\n\n```console\nusage: morpheus-data-api [-h] [--name NAME] [-q Q] [-y]\n                         {deploy,undeploy,get,export} path\n\nQuery Morpheus data API and deploy config to it\n\npositional arguments:\n  {deploy,undeploy,get,export}\n  path                  yaml file, dir of yaml files or api path\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --name NAME           export name\n  -q Q                  jmespath query\n  -y                    output in yaml format\n```\n\n## MockMorpheusDataApi ##\n\nBundled into the package is `mock.MockMorpheusDataApi()` which provides full persistent\nmocking of Morpheus API.  See [tests/test_morpheus_data_api.py](./tests/test_morpheus_data_api.py) for examples how this is used.\n\n## License\nThe license is Apache 2.0, see [LICENSE](./LICENSE) for the details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccenture%2Fmorpheus-data-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faccenture%2Fmorpheus-data-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccenture%2Fmorpheus-data-api/lists"}