-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update file .gitignore See merge request cpes/european-projects/enershare/tsg-client!64
- Loading branch information
1 parent
0217393
commit a25eef9
Showing
6 changed files
with
217 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
files/* | ||
examples/* | ||
!examples/files/artifacts/default.json | ||
!examples/files/contracts/default.json | ||
# IDE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
Example - Delete an administrative user from your connector | ||
Last update: 2024-04-03 | ||
This request deletes an administrative user from your connector on a custom connector using a connection to the connector. | ||
It uses a pre-established connection from the examples request to our connector. | ||
The following operations are demonstrated: | ||
1. Load environment variables (your connector configs) from a `.env` file. | ||
2. Establish a connection to your TSG connector. | ||
3. Deletes the administrative user from your connector. | ||
Important: | ||
- Ensure that the required environment variables (Your Connector `API_KEY`, `CONNECTOR_ID`, `ACCESS_URL` and `AGENT_ID`) are set in the .env file before using this request. | ||
- The connector `API_KEY` can be retrieved by loging into the TSG connector UI and navigating to the 'API Keys' tab. | ||
Execute the code below to publish a new administrative user on your connector. | ||
Ensure that the required parameters are specified before executing the request: | ||
- id: The id of the user (username). | ||
""" | ||
|
||
|
||
if __name__ == "__main__": | ||
from loguru import logger | ||
from dotenv import dotenv_values | ||
from tsg_client.controllers import TSGController | ||
|
||
# Comment the line below to enable internal logger: | ||
logger.disable("") | ||
|
||
# Load environment variables: | ||
config = dotenv_values('.env') | ||
|
||
# Connect to our TSG connector: | ||
conn = TSGController( | ||
api_key=config['API_KEY'], | ||
connector_id=config['CONNECTOR_ID'], | ||
access_url=config['ACCESS_URL'], | ||
agent_id=config['AGENT_ID'] | ||
) | ||
|
||
# Specify the required parameters: | ||
id = "test_id" | ||
|
||
res = conn.delete_administrative_user(id) | ||
print(res) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
""" | ||
Example: Delete a catalogs from the connector | ||
Last update: 2024-05-16 | ||
This request deletes a catalog from your connector. | ||
The following operations are demonstrated: | ||
1. Load environment variables (your connector configs) from a `.env` file. | ||
2. Establish a connection to your TSG connector. | ||
3. Delete the catalog from the connector | ||
Important: | ||
- Ensure that the required environment variables (Your Connector `API_KEY`, `CONNECTOR_ID`, `ACCESS_URL` and | ||
`AGENT_ID`) are set in the .env file before using this request. | ||
- The connector `API_KEY` can be retrieved by loging into the TSG connector UI and navigating to the 'API Keys' tab. | ||
Execute the code below to get your connector catalogs list. | ||
Ensure that the required parameters are specified before executing the request: | ||
- catalogId: Id of the catalogs to delete. | ||
""" | ||
|
||
|
||
if __name__ == "__main__": | ||
from loguru import logger | ||
from dotenv import dotenv_values | ||
from tsg_client.controllers import TSGController | ||
|
||
# Comment the line below to enable internal logger: | ||
logger.disable("") | ||
|
||
# Load environment variables: | ||
config = dotenv_values('.env') | ||
|
||
catalogId = "urn:ids:enershare:connectors:connector-02:test" | ||
|
||
# Connect to our TSG connector: | ||
conn = TSGController( | ||
api_key=config['API_KEY'], | ||
connector_id=config['CONNECTOR_ID'], | ||
access_url=config['ACCESS_URL'], | ||
agent_id=config['AGENT_ID'] | ||
) | ||
|
||
# Delete catalog (catalog): | ||
conn.delete_catalog(catalogId) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
""" | ||
Example: Get the catalogs from a connector | ||
Last update: 2024-05-16 | ||
This request retrieves and prints information about | ||
the catalogs of your connector. | ||
The following operations are demonstrated: | ||
1. Load environment variables (your connector configs) from a `.env` file. | ||
2. Establish a connection to your TSG connector. | ||
3. Retrieve and print information about the catalogs | ||
Important: | ||
- Ensure that the required environment variables (Your Connector `API_KEY`, `CONNECTOR_ID`, `ACCESS_URL` and | ||
`AGENT_ID`) are set in the .env file before using this request. | ||
- The connector `API_KEY` can be retrieved by loging into the TSG connector UI and navigating to the 'API Keys' tab. | ||
Execute the code below to get your connector catalogs list. | ||
""" | ||
|
||
|
||
if __name__ == "__main__": | ||
from pprint import pprint | ||
from loguru import logger | ||
from dotenv import dotenv_values | ||
from tsg_client.controllers import TSGController | ||
|
||
# Comment the line below to enable internal logger: | ||
logger.disable("") | ||
|
||
# Load environment variables: | ||
config = dotenv_values('.env') | ||
|
||
# Connect to our TSG connector: | ||
conn = TSGController( | ||
api_key=config['API_KEY'], | ||
connector_id=config['CONNECTOR_ID'], | ||
access_url=config['ACCESS_URL'], | ||
agent_id=config['AGENT_ID'] | ||
) | ||
|
||
# Get connector info (catalogs): | ||
catalogs = conn.catalogs() | ||
|
||
pprint(catalogs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
""" | ||
Example - Post a new administrative user to your connector | ||
Last update: 2024-03-28 | ||
This request publishes a new administrative user to your connector on a custom connector using a connection to the connector. | ||
It uses a pre-established connection from the examples request to our connector. | ||
The following operations are demonstrated: | ||
1. Load environment variables (your connector configs) from a `.env` file. | ||
2. Establish a connection to your TSG connector. | ||
3. Publish the administrative user on your connector. | ||
Important: | ||
- Ensure that the required environment variables (Your Connector `API_KEY`, `CONNECTOR_ID`, `ACCESS_URL` and `AGENT_ID`) are set in the .env file before using this request. | ||
- The connector `API_KEY` can be retrieved by loging into the TSG connector UI and navigating to the 'API Keys' tab. | ||
Execute the code below to publish a new administrative user on your connector. | ||
Ensure that the required parameters are specified before executing the request: | ||
- id: The id of the user (username). | ||
- password: The secret and secure password. | ||
- roles: The list of roles this user should have. | ||
""" | ||
|
||
|
||
if __name__ == "__main__": | ||
from loguru import logger | ||
from dotenv import dotenv_values | ||
from tsg_client.controllers import TSGController | ||
|
||
# Comment the line below to enable internal logger: | ||
logger.disable("") | ||
|
||
# Load environment variables: | ||
config = dotenv_values('.env') | ||
|
||
# Connect to our TSG connector: | ||
conn = TSGController( | ||
api_key=config['API_KEY'], | ||
connector_id=config['CONNECTOR_ID'], | ||
access_url=config['ACCESS_URL'], | ||
agent_id=config['AGENT_ID'] | ||
) | ||
|
||
# Specify the required parameters: | ||
id = "test_id" | ||
password = "test_password" | ||
roles = ["ROLE_ADMIN"] | ||
|
||
res = conn.new_administrative_user(id, password, roles) | ||
print(res) |