Personal tools
     DOCUMENTATION

rPath Appliance Platform/Entitlement Service:XML-RPC

From rPath Wiki

Jump to: navigation, search

rPath Appliance Platform Entitlement Service has an XML-RPC interface that can be accessed using an entitlement key or user credentials. There are a few functions available through this interface for the purpose of listing, adding, and revoking entitlements.

These calls were originally developed for Python scripts (example included on this page), but they can be used in Java and other scripting languages to make remote procedure calls for entitlement services.

Make use of this XML-RPC interface with the following calls:

EntitledCustomers.addEntitlements(entGroup, entKeys, comment="")
Add one or more entitlements to an entitlement group.
@param entGroup: a string that identifies the entitlement group in which to add the key(s)
@param entKeys: an array of one or more strings that are the keys to add
@param comment: (optional) a comment describing this action (customer ID for example)
@returns: True
EntitledCustomers.deleteEntitlements(entGroup, entKeys)
Delete one or more entitlements from an entitlement group.
@param entGroup: a string that identifies the group to remove the entitlement key(s) from
@param entKeys: an array of one or more keys to remove
@returns: True
EntitledCustomers.listEntitlements(entGroup)
List entitlements in the specified entitlement group.
@param entGroup: a string that identifies the group to obtain a list of the entitlement keys
@returns: array of strings, one for each entitlement key in the entitlement group
EntitledProducts.createProductChannel(<product>, <vendor>)
Create a new channel for "vendor" The new channel name is available in the dictionary returned by this call.
EntitledProducts.enableProductChannel(<channel>)
Enable, or unrevoke, all entitlements in the specified channel.
EntitledProducts.disableProductChannel(<channel>)
Disable, or revoke, all entitlements in the specified channel.

EXAMPLE: The following is an example Python script called testxmlrpc.py that makes use of these XML-RPC calls. These calls are made to the ServerProxy URL https://<user>:<password>@<server>:8003/entwebui/, and sp is the name of your xmlrpclib.ServerProxy object.

#
# Copyright (C) 2006, rPath, Inc.
# All rights reserved.
#

import xmlrpclib
from conary.repository.transport import Transport

# For user/pass authentication:
if userpass:
    host = "https://admin:password@localhost:8003/rAA/entwebui/"
    sp = xmlrpclib.ServerProxy(host)
else:
    host = "https://localhost:8003/rAA/entwebui/"

    entitlement = ('rpath-product-vendor-MANAGE', 'zplbvpve8ecsipm6161oqtswoha2')
    sp = xmlrpclib.ServerProxy(host, transport=Transport(https='https' in host, entitlement=entitlement))

#takes a list of entitlements
sp.EntitledCustomers.addEntitlements('rpath-product-vendor', ['abcdefg', 'hijklmn'])

sp.EntitledCustomers.deleteEntitlements('rpath-product-vendor', ['abcdefg', 'hijklmn'])