Modify doc output of policy and site.
This commit is contained in:
		| @@ -805,7 +805,8 @@ my %URIdef = ( | ||||
|             matcher => '^\/policy$', | ||||
|             GET => { | ||||
|                 desc => "Get all the policies in xCAT.", | ||||
|                 usage => "||An array of policy list.|", | ||||
|                 desc1 => "It will dislplay all the policies defined in policy table.", | ||||
|                 usage => "||$usagemsg{objreturn}|", | ||||
|                 example => "|Get all the policy objects.|GET|/policy|[\n   \"1\",\n   \"1.2\",\n   \"2\",\n   \"4.8\"\n]|", | ||||
|                 cmd => "lsdef", | ||||
|                 fhandler => \&defhdl, | ||||
| @@ -813,7 +814,7 @@ my %URIdef = ( | ||||
|             }, | ||||
|             POST_back => { | ||||
|                 desc => "Create a new policy on xCAT MN.", | ||||
|                 usage => "|?|?|", | ||||
|                 usage => "|$usagemsg{objchparam} DataBody: {attr1:v1,att2:v2,...}.|$usagemsg{non_getreturn}|", | ||||
|                 example => "|Create |?|?|?|", | ||||
|                 cmd => "chdef", | ||||
|                 fhandler => \&defhdl, | ||||
| @@ -824,7 +825,8 @@ my %URIdef = ( | ||||
|             matcher => '^\/policy\/[^\/]*$', | ||||
|             GET => { | ||||
|                 desc => "Get all the attibutes for a policy {policy_priority}.", | ||||
|                 usage => "||An array policy object, each object includes the values for each attribute.|", | ||||
|                 desc1 => "It will display all the policy attributes for one policy entry defined in policy table.", | ||||
|                 usage => "||$usagemsg{objreturn}|", | ||||
|                 example => "|Get all the attribute for policy 1.|GET|/policy/1|[\n   {\n      \"name\":\"root\",\n      \"rule\":\"allow\"\n   }\n]|", | ||||
|                 cmd => "lsdef", | ||||
|                 fhandler => \&defhdl, | ||||
| @@ -832,27 +834,30 @@ my %URIdef = ( | ||||
|             }, | ||||
|             PUT => { | ||||
|                 desc => "Change the attibutes for the policy {policy_priority}.", | ||||
|                 usage => "|Put data: Json formatted attribute:value pairs.|Message indicates the success or failure.|", | ||||
|                 desc1 => "It will change one or more attributes defined in policy table.", | ||||
|                 usage => "|$usagemsg{objchparam} DataBody: {attr1:v1,att2:v2,...}.|$usagemsg{non_getreturn}|", | ||||
|                 example => "|Set the name attribute for policy 3.|PUT|/policy/3 {\"name\":\"root\"}|[\n   \"1 object definitions have been created or modified.\"\n]|", | ||||
|                 cmd => "chdef", | ||||
|                 fhandler => \&defhdl, | ||||
|                 outhdler => \&infoout, | ||||
|                 outhdler => \&noout, | ||||
|             }, | ||||
|             POST => { | ||||
|                 desc => "Create the policy {policyname}. DataBody: {attr1:v1,att2:v2...}.", | ||||
|                 usage => "|POST data: Json formatted attribute:value pairs.|Message indicates the success or failure.|", | ||||
|                 desc1 => "It will creat a new policy entry in policy table.", | ||||
|                 usage => "|$usagemsg{objchparam} DataBody: {attr1:v1,att2:v2,...}.|$usagemsg{non_getreturn}|", | ||||
|                 example => "|Create a new policy 10.|POST|/policy/10 {\"name\":\"root\",\"commands\":\"rpower\"}|[\n   \"1 object definitions have been created or modified.\"\n]|", | ||||
|                 cmd => "chdef", | ||||
|                 fhandler => \&defhdl, | ||||
|                 outhdler => \&infoout, | ||||
|                 outhdler => \&noout, | ||||
|             }, | ||||
|             DELETE => { | ||||
|                 desc => "Remove the policy {policy_priority}.", | ||||
|                 usage => "||Message indicates the success or failure.|", | ||||
|                 desc1 => "Remove one or more policys defined in policy table.", | ||||
|                 usage => "||$usagemsg{non_getreturn}|", | ||||
|                 example => "|Delete the policy 10.|DELETE|/policy/10|[\n   \"1 object definitions have been removed.\"\n]|", | ||||
|                 cmd => "rmdef", | ||||
|                 fhandler => \&defhdl, | ||||
|                 outhdler => \&infoout, | ||||
|                 outhdler => \&noout, | ||||
|             }, | ||||
|         }, | ||||
|         policy_attr => { | ||||
| @@ -860,7 +865,8 @@ my %URIdef = ( | ||||
|             matcher => '^\/policy\/[^\/]*/attrs/\S+$', | ||||
|             GET => { | ||||
|                 desc => "Get the specific attributes for the policy {policy_priority}.", | ||||
|                 usage => "||An array policy object, each object includes the values for each attribute.|", | ||||
|                 desc1 => "It will get one or more attributes defined in policy table.", | ||||
|                 usage => "||$usagemsg{objreturn}|", | ||||
|                 example => "|Get the name and rule attributes for policy 1.|GET|/policy/1/attrs/name;rule|[\n   {\n      \"name\":\"root\",\n      \"rule\":\"allow\"\n   }\n]|", | ||||
|                 cmd => "lsdef", | ||||
|                 fhandler => \&defhdl, | ||||
| @@ -868,11 +874,12 @@ my %URIdef = ( | ||||
|             }, | ||||
|             PUT => { | ||||
|                 desc => "Change the attibutes for the policy {policy_priority}.", | ||||
|                 usage => "|Put data: Json formatted attribute:value pairs.|Message indicates the success or failure.|", | ||||
|                 desc1 => "It will change one or more attributes defined in policy table.", | ||||
|                 usage => "|$usagemsg{objchparam} DataBody: {attr1:v1,att2:v2,...}.|$usagemsg{non_getreturn}|", | ||||
|                 example => "|Set the name attribute for policy 3.|PUT|/policy/3 {\"name\":\"root\"}|[\n   \"1 object definitions have been created or modified.\"\n]|", | ||||
|                 cmd => "chdef", | ||||
|                 fhandler => \&defhdl, | ||||
|                 outhdler => \&infoout, | ||||
|                 outhdler => \&noout, | ||||
|             }, | ||||
|         }, | ||||
|     }, | ||||
| @@ -880,54 +887,63 @@ my %URIdef = ( | ||||
|     globalconf => { | ||||
|         all_site => { | ||||
|             desc => "[URI:/globalconf] - The global configuration resource.", | ||||
|             desc1 => "This resource can be used to display all the global configuration which have been defined in the xCAT database.", | ||||
|             matcher => '^\/globalconf$', | ||||
|             GET => { | ||||
|                 desc => "Get all the xCAT global configuration.", | ||||
|                 usage => "||An array of all the global configuration list.|", | ||||
|                 example => "|Get all the global configuration|GET|/globalconf|[\n   {\n      \"xcatconfdir\":\"/etc/xcat\",\n      \"tftpdir\":\"/tftpboot\",\n      ...\n   }\n]|", | ||||
|                 desc1=> "It will display all the attributes defined in site table.", | ||||
|                 usage => "||$usagemsg{objreturn}|", | ||||
|                 example => "|Get all the global configuration|GET|/globalconf|{\n   \"clustersite\":{\n      \"xcatconfdir\":\"/etc/xcat\",\n      \"tftpdir\":\"/tftpboot\",\n      ...\n   }\n]|", | ||||
|                 cmd => "lsdef", | ||||
|                 fhandler => \&sitehdl, | ||||
|                 outhdler => \&defout, | ||||
|             }, | ||||
|             POST_backup => { | ||||
|                 desc => "Add the site attributes. DataBody: {attr1:v1,att2:v2...}.", | ||||
|                 usage => "|?|?|", | ||||
|                 example => "|?|?|?|?|", | ||||
|                 desc1 => "One or more attributes could be added/modified to site table.", | ||||
|                 usage => "|$usagemsg{objchparam} DataBody: {attr1:v1,att2:v2,...}.|$usagemsg{non_getreturn}|", | ||||
|                 example => "|Add one or more attributes to xCAT database|POST|/globalconf {\"domain\":\"cluster.com\",\"mydomain\":\"mycluster.com\"}||", | ||||
|                 cmd => "chdef", | ||||
|                 fhandler => \&sitehdl, | ||||
|             }, | ||||
|         }, | ||||
|         site => { | ||||
|             desc => "[URI:/globalconf/attrs/{attr1;attr2 ...}] - The specific global configuration resource.", | ||||
|             desc => "[URI:/globalconf/attrs/{attr1,attr2 ...}] - The specific global configuration resource.", | ||||
|             matcher => '^\/globalconf/attrs/\S+$', | ||||
|             GET => { | ||||
|                 desc => "Get the specific configuration in global.", | ||||
|                 usage => "||?|", | ||||
|                 example => "|Get the \'master\' and \'domain\' configuration.|GET|/globalconf/attrs/master;domain|?|", | ||||
|                 desc1 => "It will display one or more global attributes.", | ||||
|                 usage => "||$usagemsg{objreturn}|", | ||||
|                 example => "|Get the \'master\' and \'domain\' configuration.|GET|/globalconf/attrs/master,domain|[\n   {\n      \"master\":\"192.168.1.1\",\n      \"domain\":\"/cluster.com\",\n         }\n|", | ||||
|                 cmd => "lsdef", | ||||
|                 fhandler => \&sitehdl, | ||||
|                 outhdler => \&defout, | ||||
|             }, | ||||
|             PUT => { | ||||
|                 desc => "Change the attributes for the site table. DataBody: {name:value}.", | ||||
|                 usage => "|Put data: Json formatted name:value pairs.|?|", | ||||
|                 example => "|Change the domain attribute.|PUT|/globalconf/attrs/domain|?|", | ||||
|                 desc => "Change the attributes for the site table.", | ||||
|                 desc1 => "It can be used for changing/adding global attributes.", | ||||
|                 usage => "|$usagemsg{objchparam} DataBody: {attr1:v1,att2:v2,...}.|$usagemsg{non_getreturn}|", | ||||
|                 example => "|Change/Add the domain attribute.|PUT|/globalconf/attrs/domain {\"domain\":\"cluster.com\"||", | ||||
|                 cmd => "chdef", | ||||
|                 fhandler => \&sitehdl, | ||||
| 				outhdler => \&noout, | ||||
|             }, | ||||
|             POST => { | ||||
|             POST_backup => { | ||||
|                 desc => "Create the global configuration entry. DataBody: {name:value}.", | ||||
|                 usage => "|Put data: Json formatted name:value pairs.||", | ||||
|                 usage => "||$usagemsg{non_getreturn}|", | ||||
|                 example => "|Create the domain attribute|POST|/globalconf/attrs/domain {\"domain\":\"cluster.com\"}|?|", | ||||
|                 cmd => "chdef", | ||||
|                 fhandler => \&sitehdl, | ||||
| 				outhdler => \&noout, | ||||
|             }, | ||||
|             DELETE => { | ||||
|                 desc => "Remove the site attributes.", | ||||
|                 usage => "||?|", | ||||
|                 example => "|Remove the domain configure.|DELETE|/globalconf/attrs/domain|?|", | ||||
|                 desc1 => "Used for femove one or more global attributes defined in site table.", | ||||
|                 usage => "||$usagemsg{non_getreturn}|", | ||||
|                 example => "|Remove the domain configure.|DELETE|/globalconf/attrs/domain||", | ||||
|                 cmd => "chdef", | ||||
|                 fhandler => \&sitehdl, | ||||
| 				outhdler => \&noout, | ||||
|             }, | ||||
|         }, | ||||
|     }, | ||||
| @@ -1520,7 +1536,7 @@ sub defhdl { | ||||
|      | ||||
|     if ($params->{'resourcename'} eq "allnode") { | ||||
|         push @args, '-s'; | ||||
|     } elsif ($params->{'resourcename'} =~ /(nodeattr|osimage_attr|group_attr)/) { | ||||
|     } elsif ($params->{'resourcename'} =~ /(nodeattr|osimage_attr|group_attr|policy_attr)/) { | ||||
|         # if /nodes/node1/attrs/attr1,att2 is specified, for get request,  | ||||
|         # use 'lsdef -i' to specify the attribute list | ||||
|         my $attrs = $urilayers[3]; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user