Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
567 changes: 567 additions & 0 deletions examples/sdk_examples/msp/login_to_managed_company.py

Large diffs are not rendered by default.

569 changes: 569 additions & 0 deletions examples/sdk_examples/msp/msp_add.py

Large diffs are not rendered by default.

578 changes: 578 additions & 0 deletions examples/sdk_examples/msp/msp_billing_report.py

Large diffs are not rendered by default.

577 changes: 577 additions & 0 deletions examples/sdk_examples/msp/msp_convert_node.py

Large diffs are not rendered by default.

546 changes: 546 additions & 0 deletions examples/sdk_examples/msp/msp_copy_role.py

Large diffs are not rendered by default.

540 changes: 540 additions & 0 deletions examples/sdk_examples/msp/msp_down.py

Large diffs are not rendered by default.

595 changes: 595 additions & 0 deletions examples/sdk_examples/msp/msp_info.py

Large diffs are not rendered by default.

579 changes: 579 additions & 0 deletions examples/sdk_examples/msp/msp_legacy_report.py

Large diffs are not rendered by default.

541 changes: 541 additions & 0 deletions examples/sdk_examples/msp/msp_remove.py

Large diffs are not rendered by default.

575 changes: 575 additions & 0 deletions examples/sdk_examples/msp/msp_update.py

Large diffs are not rendered by default.

32 changes: 12 additions & 20 deletions examples/sdk_examples/secrets_manager/create_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,27 +505,19 @@ def create_secrets_manager_application(keeper_auth_context: keeper_auth.KeeperAu
vault = vault_online.VaultOnline(keeper_auth_context, vault_storage)

try:
app_name = input('Enter name for new Secrets Manager application: ').strip()

if not app_name:
print("Application name cannot be empty")
else:
force_add = input('Allow duplicate names? (y/n): ').strip().lower() == 'y'

print(f"\nCreating Secrets Manager application: {app_name}")

app_uid = ksm_management.create_secrets_manager_app(vault, app_name, force_add=force_add)

print(f"\n✓ Secrets Manager application created successfully!")
print(f"Application Name: {app_name}")
print(f"Application UID: {app_uid}")
print("\nNext steps:")
print(" 1. Share records or folders with this application")
print(" 2. Generate client devices for access")
print(" 3. Use the application in your integrations")
app_name = "<app_name>"
force_add = False
print(f"\nCreating Secrets Manager application: {app_name}")
app_uid = ksm_management.create_secrets_manager_app(vault, app_name, force_add=force_add)

vault.sync_down()

print(f"\n✓ Secrets Manager application created successfully!")
print(f"Application Name: {app_name}")
print(f"Application UID: {app_uid}")
print("\nNext steps:")
print(" 1. Share records or folders with this application")
print(" 2. Generate client devices for access")
print(" 3. Use the application in your integrations")

except ValueError as e:
print(f"Error: {e}")
except Exception as e:
Expand Down
78 changes: 37 additions & 41 deletions examples/sdk_examples/secrets_manager/get_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,53 +506,49 @@ def get_secrets_manager_application(keeper_auth_context: keeper_auth.KeeperAuth)
vault.sync_down()

try:
app_search = input('Enter application name or UID: ').strip()

if not app_search:
print("Application identifier cannot be empty")
else:
app = ksm_management.get_secrets_manager_app(vault, app_search)
app_uid_or_name = "<app_uid_or_name>"
app = ksm_management.get_secrets_manager_app(vault, app_uid_or_name)

print(f"\nSecrets Manager Application Details")
print("=" * 100)
print(f"App Name: {app.name}")
print(f"App UID: {app.uid}")
print(f"Records Shared: {app.records}")
print(f"Folders Shared: {app.folders}")
print(f"Client Devices: {app.count}")
print(f"\nSecrets Manager Application Details")
print("=" * 100)
print(f"App Name: {app.name}")
print(f"App UID: {app.uid}")
print(f"Records Shared: {app.records}")
print(f"Folders Shared: {app.folders}")
print(f"Client Devices: {app.count}")

if app.client_devices:
print(f"\nClient Devices ({len(app.client_devices)}):")
print("-" * 100)
print(f"{'Name':<25} {'Short ID':<15} {'Created':<20} {'Last Access':<20} {'IP Address':<20}")
print("-" * 100)

if app.client_devices:
print(f"\nClient Devices ({len(app.client_devices)}):")
print("-" * 100)
print(f"{'Name':<25} {'Short ID':<15} {'Created':<20} {'Last Access':<20} {'IP Address':<20}")
print("-" * 100)
for client in app.client_devices:
name = client.name[:24] if client.name else 'N/A'
short_id = client.short_id[:14] if client.short_id else 'N/A'
created = client.created_on.strftime('%Y-%m-%d %H:%M') if client.created_on else 'N/A'
last_access = client.last_access.strftime('%Y-%m-%d %H:%M') if client.last_access else 'Never'
ip_address = client.ip_address[:19] if client.ip_address else 'N/A'

for client in app.client_devices:
name = client.name[:24] if client.name else 'N/A'
short_id = client.short_id[:14] if client.short_id else 'N/A'
created = client.created_on.strftime('%Y-%m-%d %H:%M') if client.created_on else 'N/A'
last_access = client.last_access.strftime('%Y-%m-%d %H:%M') if client.last_access else 'Never'
ip_address = client.ip_address[:19] if client.ip_address else 'N/A'

print(f"{name:<25} {short_id:<15} {created:<20} {last_access:<20} {ip_address:<20}")
print(f"{name:<25} {short_id:<15} {created:<20} {last_access:<20} {ip_address:<20}")

if app.shared_secrets:
print(f"\nShared Secrets ({len(app.shared_secrets)}):")
print("-" * 100)
print(f"{'Type':<15} {'Name':<45} {'UID':<40}")
print("-" * 100)

if app.shared_secrets:
print(f"\nShared Secrets ({len(app.shared_secrets)}):")
print("-" * 100)
print(f"{'Type':<15} {'Name':<45} {'UID':<40}")
print("-" * 100)

for secret in app.shared_secrets[:20]:
secret_type = secret.type[:14] if secret.type else 'N/A'
secret_name = secret.name[:44] if secret.name else 'N/A'
secret_uid = secret.uid[:39] if secret.uid else 'N/A'

print(f"{secret_type:<15} {secret_name:<45} {secret_uid:<40}")
for secret in app.shared_secrets[:20]:
secret_type = secret.type[:14] if secret.type else 'N/A'
secret_name = secret.name[:44] if secret.name else 'N/A'
secret_uid = secret.uid[:39] if secret.uid else 'N/A'

if len(app.shared_secrets) > 20:
print(f" ... and {len(app.shared_secrets) - 20} more")
print(f"{secret_type:<15} {secret_name:<45} {secret_uid:<40}")

print("=" * 100)
if len(app.shared_secrets) > 20:
print(f" ... and {len(app.shared_secrets) - 20} more")

print("=" * 100)

except ValueError as e:
print(f"Error: {e}")
Expand Down