Very lightweight version for quick projects.
Based on ah-echo-py.
Python 3
requests_pkcs12
Download the package and install it using:
python3 -m pip install aclpy-*.whl
Or if you have wagon you can install it along with the dependencies using:
wagon install aclpy-*.wgn
- ArrowheadConnector + ArrowheadClient
- Features
- Register a service
- Unregister a service
- Register a system
- Orchestrate
- Methods
- PKCS#12
- Features
- ArrowheadInterface
- Check validity of interface
- Created at
- Updated at
- Id
- ArrowheadServer
- Set IP address
- Core Systems features
- Change port
- Change endpoint
- Set URL
- Core Systems
- Orchestrator
- ServiceRegistry
- Authorization
- ArrowheadService
- Name
- Version
- Interface
- Security
- URI
- End of Validity
- Metadata
- Created at
- Updated at
- Id
- ArrowheadSystem
- Name
- Address
- Port
- AuthenticationInfo
- Public key
- Token
- Created at
- Updated at
- Id
- Interfaces
from aclpy.server import ArrowheadServer
server = ArrowheadServer()
from aclpy.service import ArrowheadService
service = ArrowheadService(
name = "NAME_OF_THE_SERVICE",
)
from aclpy.interface import ArrowheadInterface
interface = ArrowheadInterface(
name = "NAME_OF_THE_INTERFACE",
)
PKCS#12 version
from aclpy.client.client_pkcs12 import ArrowheadClient
client = ArrowheadClient(
name = "NAME_OF_THE_CLIENT",
address = "IP_ADDRESS_OF_THE_CLIENT",
port = PORT_OF_THE_CLIENT,
# Public key; choose one:
# pubfile = "PATH_TO_THE_PUB_FILE", # Method a)
# pubkey = "....................", # Method b)
# Or skip both to obtain it from p12 # Method c)
p12file = "PATH_TO_THE_P12_FILE",
p12pass = "PASSWORD_TO_P12_FILE",
cafile = "PATH_TO_THE_CA_FILE",
server = server,
)
# Add an interface
client.interfaces.append(interface)
# Register a service
success = client.register_service(service)
# Unregister a service
success = client.unregister_service(service)
# Register the system
success = client.register_system()
# Run the orchestration for service
success, providers = client.orchestrate(service)
# Server configuration
from aclpy.server import ArrowheadServer
# Client / system configuration
from aclpy.client.client_pkcs12 import ArrowheadClient
# Interface configuration
from aclpy.interface import ArrowheadInterface
# Service configuration
from aclpy.service import ArrowheadService
# Define the components
server = ArrowheadServer(
#address = "127.0.0.1", # Localhost is default
)
interface = ArrowheadInterface(
name = "HTTP-INSECURE-JSON",
)
client = ArrowheadClient(
name = "echoclient",
address = "127.0.0.1",
port = 0, # As we are only listening
pubfile = "echoclient.pub", # Path to the public key
p12file = "echoclient.p12", # Path to the private key
p12pass = "1111111", # Password
cafile = "sysop.ca", # Path to .ca file
server = server,
interfaces = [interface],
)
service = ArrowheadService(
name = "echo",
)
# Look for the echo server
success, providers = client.orchestrate(service)
print ("Orchestration was %s." % ("SUCCESSFUL" if success else "NOT SUCCESSFUL"))
print ("Found %d providers." % len(providers))
if len(providers) > 0:
for _i, provider in enumerate(providers):
print ("%d: %s:%d" % (_i, provider.address, provider.port))