...
API version: 3.3
Package version: 3.3.0.23
Build package: org.openapitools.codegen.languages.PythonClientCodegen
...
Code Block | ||
---|---|---|
| ||
conda install /some/path/syndeia_cloud_33x_client_sdk-3.3.0.23-py_0.tar.bz2 # ex: for v3.3.0.23, update as appropriate |
conda uninstall
...
UserSecurity
Type: API key
API key parameter name: X-Auth-Token
Location: HTTP header
Quickstart
Please refer to the Quickstart section in the documentation included with the SDK
parameter name: X-Auth-Token
Location: HTTP header
Quickstart
Code Block | ||
---|---|---|
| ||
# - STEP 1. Import libs -------------------------
from __future__ import print_function
import time
import getpass
import uuid
import syndeia_cloud_33x_client_sdk
from syndeia_cloud_33x_client_sdk.rest import ApiException
from pprint import pprint
# - STEP 2. Instantiate Configuration object (this is used to set server & credential details) -------------------------
configuration = syndeia_cloud_33x_client_sdk.Configuration()
# - STEP 3. Set configuration object instance properties --------------------
# Note, if you are unsure of any of the below, contact your Syndeia Cloud server admin
# configuration.host = "http(s)://host.domain.tld:9000(HTTP)|9443(HTTPS)", ex:
configuration.host = "<https://mySyndeiaCloudServer.domain.tld:9443"> # -or- "<http://mySyndeiaCloudServer.domain.tld:9000"> if using HTTP
# configuration.username = "username", for LDAP = LDAP "username", for Basic auth = your email address (usually)
configuration.username = "myUsername"
# configuration.password = getpass.getpass()|"myP4$$wD" (prompt for password) | (specify)
configuration.password = getpass.getpass()
# TLS: uncomment the below if server is using a self-signed cert, or it isn't in the trust store, or you want to skip SSL validation
# configuration.verify_ssl = False
# - STEP 4. Instantiate Syndeia REST ApiClient object with the configuration -----------------------------
api_client_instance = syndeia_cloud_33x_client_sdk.ApiClient(configuration)
# Now, given the api_client_instance, you can instiate any part of the API - AuthAPI, UserAPI, RepositoryAPI, etc.
# - STEP 5. Authenticate ---------------------------------------------
# Instantiate AuthAPI object
auth_api_instance = syndeia_cloud_33x_client_sdk.AuthApi(api_client_instance)
# IF using LDAP, use the below:
sign_in_provider_instance = syndeia_cloud_33x_client_sdk.models.SignInProvider(username = configuration.username, password = configuration.password)
authed_instance = auth_api_instance.authenticate_by_provider('LDAP', sign_in_provider_instance)
# ELSE, uncomment and use the below for Basic auth:
# signin_instance = syndeia_cloud_33x_client_sdk.models.SignIn(username = configuration.username, password = configuration.password, remember_me = False)
# authed_instance = auth_api_instance.sign_in_user(signin_instance)
# grab returned (bearer) token and save in in the configuration object for subsequent requests
configuration.api_key['X-Auth-Token'] = authed_instance.resources.token
# - STEP 6A (optional). Get all repositories ----------------------------
repository_api_instance = syndeia_cloud_33x_client_sdk.RepositoryApi(api_client_instance)
try:
# Get all repositories
repositories_response = repository_api_instance.get_repositories()
pprint(repositories_response)
except ApiException as e:
print("Exception when calling RepositoryApi->get_repositories: %s\n" % e)
# print number of repositories
num_repositories = len(repositories_response.resources)
print(num_repositories)
# for all repositories, print repository name (repository host)
for r in repositories_response.resources:
print(r.name + " ( " + r.host + " ) ")
# - STEP 6B (optional). Create a test repository ----------------------------
repository_api_instance = syndeia_cloud_33x_client_sdk.RepositoryApi(api_client_instance)
repository_create_instance = syndeia_cloud_33x_client_sdk.RepositoryCreate(gid = str(uuid.uuid4())[:11],
name = 'myRepo of Type Foo by ' + configuration.username,
host = '<https://myRepo.domain.com',>
type = {'name': 'Foo Type'}
)
try:
# Create a new repository
repository_create_response = repository_api_instance.create_repository(repository_create_instance)
pprint(repository_create_response)
except ApiException as e:
print("Exception when calling RepositoryApi->create_repository: %s\n" % e)
# - STEP 7 (optional). Get containers --------------------------------------
# Instantiate the ContainerAPI
container_api_instance = syndeia_cloud_33x_client_sdk.ContainerApi(api_client_instance)
try:
container_response = container_api_instance.get_containers()
print(container_response)
except ApiException as e:
print("Exception when calling ContainerApi->get_containers: %s\n" % e)
# print number of containers
num_containers = len(container_response.resources)
print(num_containers)
# print out container name (key)
for c in syndeia_containers:
print(c.name + " (" + c.key + ")")
# - STEP 8 (optional). Get artifacts --------------------------------------
# Instantiate the ArtifactAPI
artifact_api_instance = syndeia_cloud_33x_client_sdk.ArtifactApi(api_client_instance)
try:
artifact_response = artifact_api_instance.get_artifacts()
print(artifact_response)
except ApiException as e:
print("Exception when calling ArtifactApi->get_artifacts: %s\n" % e)
# print number of artifacts
num_artifacts = len(artifact_response.resources)
print(num_artifacts)
# - STEP 9 (optional). Get relations --------------------------------------
# Instantiate the RelationAPI
relation_api_instance = syndeia_cloud_33x_client_sdk.RelationApi(api_client_instance)
try:
relation_response = relation_api_instance.get_relations()
print(relation_response)
except ApiException as e:
print("Exception when calling RelationApi->get_relations: %s\n" % e)
# Number of relations
num_relations = len(relation_response.resources)
print(num_relations)
# Get relations by specific Syndeia projects
# Get the Syndeia container with key UAV_MBEE
uav_relations = relation_api_instance.get_relations_by_container_key("UAV_MBEE")
num_uav_relations = len(uav_relations.resources)
print(num_uav_relations)
for r in uav_relations.resources:
print(r.key + " - " + r.name) |
Documentation for API Endpoints
...
Class | Method | HTTP request | Description | ||
ArtifactApi |
| POST /artifacts | Create a new artifact | ||
ArtifactApi |
| DELETE /artifacts/{key} | Delete an artifact given the artifact key | ||
ArtifactApi |
| POST /artifacts/external/id | Get an artifact given the artifact external id | ||
ArtifactApi |
| GET /artifacts/{key} | Get an artifact given the artifact key | ||
ArtifactApi |
| GET /artifacts/{key}/versions/{version} | Get an artifact given the artifact key and version | ||
ArtifactApi |
| GET /artifacts/{key}/versions | Get all versions of an artifact given the artifact key | ||
ArtifactApi |
| GET /artifacts | Get all artifacts | ||
ArtifactApi |
| PUT /artifacts/{key} | Update artifact given the artifact key | ||
ArtifactTypeApi |
| POST /types/artifact | Create a new Artifact type | ||
ArtifactTypeApi |
| DELETE /types/artifact/{key} | Delete an Artifact type given the Artifact type key | ||
ArtifactTypeApi |
| POST /types/artifact/external/id | Get an artifact type given the artifact type external id | ||
ArtifactTypeApi |
| GET /types/artifact/{key} | Get an Artifact type given the Artifact type key | ||
ArtifactTypeApi |
| GET /types/artifact/{key}/attribdefs/{id} | Get an attribute definition of an artifact type given the artifact type key and attribute definition id | ||
ArtifactTypeApi |
| GET /types/artifact | Get all artifact types | ||
ArtifactTypeApi |
| PUT /types/artifact/{key} | Update an Artifact type given the Artifact key | ||
AuthApi |
| GET /signUp/superuser | Sign-up super user | ||
AuthApi |
| POST /signUp | Create a new user (sign-up) | ||
AuthApi |
| POST /account/disable | Disable internal user | ||
AuthApi |
| POST /account/enable | Enable internal user | ||
AuthApi |
| POST /password/reset | Reset user password | ||
AuthApi |
| POST /signIn | Sign-in a user | ||
AuthApi |
| POST /authenticate/{provider} | Authenticate user through Auth Provider e.g LDAP | ||
AuthApi |
| GET /signOut | Sign-out a user | ||
AuthApi |
| POST /password/change | Change user password | ||
ContainerApi |
| POST /containers | Create a new container | ||
ContainerApi |
| DELETE /containers/{key} | Delete a container given the container key | ||
ContainerApi |
| POST /containers/external/id | Get a container given the container external id | ||
ContainerApi |
| GET /containers/{key} | Get a container given the container key | ||
ContainerApi |
| GET /containers | Get all containers | ||
ContainerApi |
| PUT /containers/{key} | Update a container given the container key | ||
ContainerTypeApi |
| POST /types/container | Create a new Container type | ||
ContainerTypeApi |
| DELETE /types/container/{key} | Delete a Container type given the container type key | ||
ContainerTypeApi |
| POST /types/container/external/id | Get a container type given the container type external id | ||
ContainerTypeApi |
| GET /types/container/{key} | Get a Container type given the Container type key | ||
ContainerTypeApi |
| GET /types/container/{key}/attribdefs/{id} | Get a attribute definition of container type given the container type key and attribute definition id | ||
ContainerTypeApi |
| GET /types/container | Get all container types | ||
ContainerTypeApi |
| PUT /types/container/{key} | Update a Container type given the Container key | ||
GraphApi |
| POST /graph/query/raw | Get result of a graph query | ||
RelationApi |
| POST /relations | Create a new relation | ||
RelationApi |
| DELETE /relations/{key} | Delete a relation given the relation key | ||
RelationApi |
| POST /relations/external/id | Get a relation given the relation external id | ||
RelationApi |
| GET /relations/{key} | Get a relation given the relation key | ||
RelationApi |
| GET /relations/{key}/versions/{version} | Get a relation given the relation key and version | ||
RelationApi |
| GET /relations/{key}/versions | Get all versions of a relation given the relation key | ||
RelationApi |
| GET /relations | Get all relations | ||
RelationApi |
| PUT /relations/{key} | Update relation given the relation key | ||
RelationTypeApi |
| POST /types/relation | Create a new Relation type | ||
RelationTypeApi |
| DELETE /types/relation/{key} | Delete a Relation type given the Relation type key | ||
RelationTypeApi |
| POST /types/relation/external/id | Get a relation type given the relation type external id | ||
RelationTypeApi |
| GET /types/relation/{key} | Get a Relation type given the Relation type key | ||
RelationTypeApi |
| GET /types/relation/{key}/attribdefs/{id} | Get an attribute definition of relation type given the relation type key and attribute definition id | ||
RelationTypeApi |
| GET /types/relation | Get all relation types | ||
RelationTypeApi |
| PUT /types/relation/{key} | Update a Relation type given the Relation key | ||
RepositoryApi |
| POST /repositories | Create a new repository | ||
RepositoryApi |
| DELETE /repositories/{key} | Delete a repository given the repository key | ||
RepositoryApi |
| GET /repositories | Get all repositories | ||
RepositoryApi |
| POST /repositories/external/id | Get a repository given the repository external id | ||
RepositoryApi |
| GET /repositories/{key} | Get a repository given the repository key | ||
RepositoryApi |
| PUT /repositories/{key} | Update a repository given the repository key | ||
RepositoryTypeApi |
| POST /types/repository | Create a new repository type | ||
RepositoryTypeApi |
| DELETE /types/repository/{key} | Delete a repository type given the repository type key | ||
RepositoryTypeApi |
| POST /types/repository/external/id | Get a repository type given the repository type external id | ||
RepositoryTypeApi |
| GET /types/repository/{key} | Get a repository type given the repository type key | ||
RepositoryTypeApi |
| GET /types/repository/{key}/attribdefs/{id} | Get a attribute definition of repository type given the repository type key and attribute definition id | ||
RepositoryTypeApi |
| GET /types/repository | Get all repository types | ||
RepositoryTypeApi |
| PUT /types/repository/{key} | Update a repository type given the repository key | UserApi | delete_user_by_ key |
DELETE /users/{key} | Delete a user given the user key | UserApi |
| GET /users/{key} | Get a user given the user key |
UserApi |
| GET /users/username/{username} | Get a user given the user name | ||
UserApi |
| GET /users | Get all users | ||
UserApi |
| PUT /users/{key} | Update a user given the user key |
...
Intercax DevTeam,
OpenAPI
2020-0408-13T1105T00:0551:51 36 ET, brian