Loading TOC...

admin.appserverCopy

admin.appserverCopy(
   config as element(configuration),
   appserver-id as (Number|String),
   target-group-id as (Number|String)?,
   appserver-name as String,
   port as (Number|String)
) as element(configuration)

Summary

This function creates a new App Server specification with the same settings as the App Server with the specified ID. The new App Server configuration will have the specified name. You can copy the App Server to a new one either in the same group (by specifying $old-group-id and $new-group-id with the same group ID) or in a different group.

Parameters
config A configuration specification, typically as returned from one of the Admin module functions.
appserver-id The ID of the App Server. Typically, this is the result of an admin.appserverGetId call.
target-group-id The optional group ID of the new group to which the App Server is copied. If no ID is provided, the App Server will be copied to the same group it exists in. Typically, this is the result of an admin:group-get-id call.
appserver-name The new name for the App Server.
port The port number for the new App Server.

Required Privileges

This operation requires at least one of the following privileges:

http://marklogic.com/xdmp/privileges/admin/group-security

http://marklogic.com/xdmp/privileges/admin/group-security/{id}

Example

  
  const admin = require('/MarkLogic/admin.xqy');
  const config = admin.getConfiguration()
  const groupId = admin.groupGetId(config, "Default")
  const appserverId = admin.appserverGetId(config, groupId,
                       "myAppServer")
  admin.appserverCopy(config, appserverId, groupId,
                       "myNewAppServer", 8012)

   //returns the new configuration element -- use admin.saveConfiguration
   //to save the changes to the configuration or pass the configuration
   //to other Admin API functions to make other changes.  
  

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.