com.redhat.rhn.frontend.xmlrpc.activationkey
Class ActivationKeyHandler

java.lang.Object
  extended by com.redhat.rhn.frontend.xmlrpc.BaseHandler
      extended by com.redhat.rhn.frontend.xmlrpc.activationkey.ActivationKeyHandler

public class ActivationKeyHandler
extends BaseHandler

ActivationKeyHandler


Constructor Summary
ActivationKeyHandler()
           
 
Method Summary
 int addChildChannels(java.lang.String sessionKey, java.lang.String key, java.util.List childChannelLabels)
          Add a child channel to an activation key.
 int addConfigChannels(java.lang.String sessionKey, java.util.List<java.lang.String> keys, java.util.List<java.lang.String> configChannelLabels, boolean addToTop)
          Given a list of activation keys and configuration channels, this method inserts the configuration channels to either the top or the bottom (whichever you specify) of an activation key's configuration channels list.
 int addEntitlements(java.lang.String sessionKey, java.lang.String key, java.util.List entitlements)
          Add entitlements to an activation key.
 int addPackageNames(java.lang.String sessionKey, java.lang.String key, java.util.List packageNames)
          Add package names to an activation key.
 int addServerGroups(java.lang.String sessionKey, java.lang.String key, java.util.List serverGroupIds)
          Add server groups to an activation key.
 java.lang.String create(java.lang.String sessionKey, java.lang.String key, java.lang.String description, java.lang.String baseChannelLabel, java.lang.Integer usageLimit, java.util.List entitlements, java.lang.Boolean universalDefault)
          Creates a new activation key.
 java.lang.String create(java.lang.String sessionKey, java.lang.String key, java.lang.String description, java.lang.String baseChannelLabel, java.util.List entitlements, java.lang.Boolean universalDefault)
          Creates a new activation key with unlimited usage..
 int delete(java.lang.String sessionKey, java.lang.String key)
          Deletes an activation key.
 ActivationKey getDetails(java.lang.String sessionKey, java.lang.String key)
          Return a struct of activation key details.
 java.util.List<ActivationKey> listActivationKeys(java.lang.String sessionKey)
          Return a list of activation key structs that are visible to the requesting user.
 java.util.List listConfigChannels(java.lang.String sessionKey, java.lang.String key)
          Returns a list of config channel structs that are associated to a given activation key.
 int removeChildChannels(java.lang.String sessionKey, java.lang.String key, java.util.List childChannelLabels)
          Remove a child channel from an activation key.
 int removeConfigChannels(java.lang.String sessionKey, java.util.List<java.lang.String> keys, java.util.List<java.lang.String> configChannelLabels)
          removes selected channels from list of config channels provided for a given list of activation keys.
 int removeEntitlements(java.lang.String sessionKey, java.lang.String key, java.util.List entitlements)
          Remove entitlements from an activation key.
 int removePackageNames(java.lang.String sessionKey, java.lang.String key, java.util.List packageNames)
          Remove package names from an activation key.
 int removeServerGroups(java.lang.String sessionKey, java.lang.String key, java.util.List serverGroupIds)
          Remove server groups from an activation key.
 int setConfigChannels(java.lang.String sessionKey, java.util.List<java.lang.String> keys, java.util.List<java.lang.String> configChannelLabels)
          replaces the existing set of config channels for a given activation key.
 int setDetails(java.lang.String sessionKey, java.lang.String key, java.util.Map details)
          Set activation key details.
 
Methods inherited from class com.redhat.rhn.frontend.xmlrpc.BaseHandler
ensureConfigAdmin, ensureOrgAdmin, ensureProvisioning, ensureSatellite, ensureSystemGroupAdmin, ensureUserRole, getLoggedInUser, invoke, validateEntitlements
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActivationKeyHandler

public ActivationKeyHandler()
Method Detail

create

public java.lang.String create(java.lang.String sessionKey,
                               java.lang.String key,
                               java.lang.String description,
                               java.lang.String baseChannelLabel,
                               java.lang.Integer usageLimit,
                               java.util.List entitlements,
                               java.lang.Boolean universalDefault)
                        throws FaultException
Creates a new activation key.

Parameters:
sessionKey - The current user's session key.
key - Key for the activation key, or empty string to have one autogenerated.
description - A note or description.
baseChannelLabel - label of this key's base channel.
usageLimit - Usage limit for this key.
entitlements - List of string entitlement labels for the activation key.
universalDefault - Whether or not this key should be set as the default for the user's organization.
Returns:
Key of the newly created activation key.
Throws:
FaultException - A FaultException is thrown if the loggedInUser doesn't have permissions to create new activation keys.

create

public java.lang.String create(java.lang.String sessionKey,
                               java.lang.String key,
                               java.lang.String description,
                               java.lang.String baseChannelLabel,
                               java.util.List entitlements,
                               java.lang.Boolean universalDefault)
                        throws FaultException
Creates a new activation key with unlimited usage..

Parameters:
sessionKey - The current user's session key.
key - Key for the activation key, or empty string to have one autogenerated.
description - A note or description.
baseChannelLabel - label of this key's base channel.
entitlements - List of string entitlement labels for the activation key.
universalDefault - Whether or not this key should be set as the default for the user's organization.
Returns:
Key of the newly created activation key.
Throws:
FaultException - A FaultException is thrown if the loggedInUser doesn't have permissions to create new activation keys.

delete

public int delete(java.lang.String sessionKey,
                  java.lang.String key)
Deletes an activation key.

Parameters:
sessionKey - The current user's session key.
key - Key for the activation key, or empty string to have one autogenerated.
Returns:
Key of the newly created activation key.
Throws:
java.lang.IllegalArgumentException - if the loggedInUser doesn't have permissions to create new activation keys.

setDetails

public int setDetails(java.lang.String sessionKey,
                      java.lang.String key,
                      java.util.Map details)
               throws FaultException
Set activation key details.

Parameters:
sessionKey - The current user's session key
key - The activation key to be modified
details - Map of new details. (contents optional)
Returns:
1 if edit was successful, exception thrown otherwise.
Throws:
FaultException - Thrown if the user does not have the activation key admin role, if the base channel given does not exist, or if it actually is not a base channel.

getDetails

public ActivationKey getDetails(java.lang.String sessionKey,
                                java.lang.String key)
Return a struct of activation key details.

Parameters:
sessionKey - The current user's session key
key - The activation key to be modified
Returns:
Map representation of the activation key

addEntitlements

public int addEntitlements(java.lang.String sessionKey,
                           java.lang.String key,
                           java.util.List entitlements)
Add entitlements to an activation key. Currently only add-on entitlements are permitted. (monitoring_entitled, provisioning_entitled, virtualization_host, virtualization_host_platform)

Parameters:
sessionKey - The current user's session key.
key - The activation key to act upon.
entitlements - List of string entitlement labels to be added.
Returns:
1 on success, exception thrown otherwise.

removeEntitlements

public int removeEntitlements(java.lang.String sessionKey,
                              java.lang.String key,
                              java.util.List entitlements)
Remove entitlements from an activation key. Currently only add-on entitlements are permitted. (monitoring_entitled, provisioning_entitled, virtualization_host, virtualization_host_platform)

Parameters:
sessionKey - The current user's session key.
key - The activation key to act upon.
entitlements - List of string entitlement labels to be removed.
Returns:
1 on success, exception thrown otherwise.

addChildChannels

public int addChildChannels(java.lang.String sessionKey,
                            java.lang.String key,
                            java.util.List childChannelLabels)
Add a child channel to an activation key.

Parameters:
sessionKey - The current user's session key
key - The activation key to act upon
childChannelLabels - List of child channel labels to be added to this activation key
Returns:
1 on success, exception thrown otherwise

removeChildChannels

public int removeChildChannels(java.lang.String sessionKey,
                               java.lang.String key,
                               java.util.List childChannelLabels)
Remove a child channel from an activation key.

Parameters:
sessionKey - The current user's session key
key - The activation key to act upon
childChannelLabels - List of child channel labels to be removed from this activation key
Returns:
1 on success, exception thrown otherwise

addServerGroups

public int addServerGroups(java.lang.String sessionKey,
                           java.lang.String key,
                           java.util.List serverGroupIds)
Add server groups to an activation key.

Parameters:
sessionKey - The current user's session key.
key - The activation key to act upon.
serverGroupIds - List of server group IDs to be added to this activation key.
Returns:
1 on success, exception thrown otherwise.

removeServerGroups

public int removeServerGroups(java.lang.String sessionKey,
                              java.lang.String key,
                              java.util.List serverGroupIds)
Remove server groups from an activation key.

Parameters:
sessionKey - The current user's session key
key - The activation key to act upon
serverGroupIds - List of server group IDs to be removed from this activation key
Returns:
1 on success, exception thrown otherwise

addPackageNames

public int addPackageNames(java.lang.String sessionKey,
                           java.lang.String key,
                           java.util.List packageNames)
Add package names to an activation key.

Parameters:
sessionKey - The current user's session key
key - The activation key to act upon
packageNames - List of package names to be added to this activation key
Returns:
1 on success, exception thrown otherwise.

removePackageNames

public int removePackageNames(java.lang.String sessionKey,
                              java.lang.String key,
                              java.util.List packageNames)
Remove package names from an activation key.

Parameters:
sessionKey - The current user's session key
key - The activation key to act upon
packageNames - List of package names to be removed from this activation key
Returns:
1 on success, exception thrown otherwise

listActivationKeys

public java.util.List<ActivationKey> listActivationKeys(java.lang.String sessionKey)
Return a list of activation key structs that are visible to the requesting user.

Parameters:
sessionKey - The current user's session key
Returns:
List of map representations of activation keys

listConfigChannels

public java.util.List listConfigChannels(java.lang.String sessionKey,
                                         java.lang.String key)
Returns a list of config channel structs that are associated to a given activation key.

Parameters:
sessionKey - the sessionkey needed for authentication
key - the activation key
Returns:
list of config channel strutcs

setConfigChannels

public int setConfigChannels(java.lang.String sessionKey,
                             java.util.List<java.lang.String> keys,
                             java.util.List<java.lang.String> configChannelLabels)
replaces the existing set of config channels for a given activation key. Note: it ranks these channels according to the array order of configChannelIds method parameter

Parameters:
sessionKey - the sessionkey needed for authentication
keys - a lsit of activation keys.
configChannelLabels - sets channels labels
Returns:
1 on success 0 on failure

addConfigChannels

public int addConfigChannels(java.lang.String sessionKey,
                             java.util.List<java.lang.String> keys,
                             java.util.List<java.lang.String> configChannelLabels,
                             boolean addToTop)
Given a list of activation keys and configuration channels, this method inserts the configuration channels to either the top or the bottom (whichever you specify) of an activation key's configuration channels list. The ordering of the configuration channels provided in the add list is maintained while adding. If one of the configuration channels in the 'add' list already exists in an activation key, the configuration channel will be re-ranked to the appropriate place.

Parameters:
sessionKey - the sessionkey needed for authentication
keys - the list of activation keys.
configChannelLabels - set of configuration channels labels
addToTop - if true inserts the configuration channels list to the top of the configuration channels list of a server
Returns:
1 on success 0 on failure

removeConfigChannels

public int removeConfigChannels(java.lang.String sessionKey,
                                java.util.List<java.lang.String> keys,
                                java.util.List<java.lang.String> configChannelLabels)
removes selected channels from list of config channels provided for a given list of activation keys.

Parameters:
sessionKey - the sessionkey
keys - the list of activation key values.
configChannelLabels - sets channels labels
Returns:
1 on success 0 on failure