mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix toc generation for api docs (#9655)
* Fix toc generation for api docs * Apply suggestions from code review Co-authored-by: dahn <daan.hoogland@gmail.com> --------- Co-authored-by: dahn <daan.hoogland@gmail.com>
This commit is contained in:
parent
5f8077824a
commit
aa6447636e
@ -16,11 +16,11 @@
|
||||
# specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import sys
|
||||
from xml.dom import minidom
|
||||
from xml.parsers.expat import ExpatError
|
||||
import difflib
|
||||
|
||||
|
||||
ROOT_ADMIN = 'r'
|
||||
@ -51,7 +51,9 @@ known_categories = {
|
||||
'VirtualMachine': 'Virtual Machine',
|
||||
'VM': 'Virtual Machine',
|
||||
'Vnf': 'Virtual Network Functions',
|
||||
'VnfTemplate': 'Virtual Network Functions',
|
||||
'GuestSubnet': 'Routing',
|
||||
'HypervisorGuestOsNames': 'Guest OS',
|
||||
'Domain': 'Domain',
|
||||
'Template': 'Template',
|
||||
'Iso': 'ISO',
|
||||
@ -63,83 +65,46 @@ known_categories = {
|
||||
'StaticNat': 'NAT',
|
||||
'IpForwarding': 'NAT',
|
||||
'Host': 'Host',
|
||||
'OutOfBand': 'Out-of-band Management',
|
||||
'HostTags': 'Host',
|
||||
'OutOfBandManagement': 'Out-of-band Management',
|
||||
'Cluster': 'Cluster',
|
||||
'Account': 'Account',
|
||||
'Role': 'Role',
|
||||
'Snapshot': 'Snapshot',
|
||||
'User': 'User',
|
||||
'UserData': 'User Data',
|
||||
'Os': 'Guest OS',
|
||||
'ServiceOffering': 'Service Offering',
|
||||
'DiskOffering': 'Disk Offering',
|
||||
'LoadBalancer': 'Load Balancer',
|
||||
'SslCert': 'Load Balancer',
|
||||
'SslCert': 'SSL Certificates',
|
||||
'Router': 'Router',
|
||||
'SystemVm': 'System VM',
|
||||
'Configuration': 'Configuration',
|
||||
'Capabilities': 'Configuration',
|
||||
'Pod': 'Pod',
|
||||
'ManagementNetworkIpRange': 'Pod',
|
||||
'PublicIpRange': 'Network',
|
||||
'Zone': 'Zone',
|
||||
'Vmware' : 'Zone',
|
||||
'NetworkOffering': 'Network Offering',
|
||||
'NetworkACL': 'Network ACL',
|
||||
'NetworkAclItem': 'Network ACL',
|
||||
'Network': 'Network',
|
||||
'CiscoNexus': 'Network',
|
||||
'OpenDaylight': 'Network',
|
||||
'createServiceInstance': 'Network',
|
||||
'addGloboDnsHost': 'Network',
|
||||
'createTungstenFabricProvider': 'Tungsten',
|
||||
'listTungstenFabricProviders': 'Tungsten',
|
||||
'configTungstenFabricService': 'Tungsten',
|
||||
'createTungstenFabricPublicNetwork': 'Tungsten',
|
||||
'synchronizeTungstenFabricData': 'Tungsten',
|
||||
'addTungstenFabricPolicyRule': 'Tungsten',
|
||||
'createTungstenFabricPolicy': 'Tungsten',
|
||||
'deleteTungstenFabricPolicy': 'Tungsten',
|
||||
'removeTungstenFabricPolicyRule': 'Tungsten',
|
||||
'listTungstenFabricTag': 'Tungsten',
|
||||
'listTungstenFabricTagType': 'Tungsten',
|
||||
'listTungstenFabricPolicy': 'Tungsten',
|
||||
'listTungstenFabricPolicyRule': 'Tungsten',
|
||||
'listTungstenFabricNetwork': 'Tungsten',
|
||||
'listTungstenFabricVm': 'Tungsten',
|
||||
'listTungstenFabricNic': 'Tungsten',
|
||||
'createTungstenFabricTag': 'Tungsten',
|
||||
'createTungstenFabricTagType': 'Tungsten',
|
||||
'deleteTungstenFabricTag': 'Tungsten',
|
||||
'deleteTungstenFabricTagType': 'Tungsten',
|
||||
'applyTungstenFabricPolicy': 'Tungsten',
|
||||
'applyTungstenFabricTag': 'Tungsten',
|
||||
'removeTungstenFabricTag': 'Tungsten',
|
||||
'removeTungstenFabricPolicy': 'Tungsten',
|
||||
'createTungstenFabricApplicationPolicySet': 'Tungsten',
|
||||
'createTungstenFabricFirewallPolicy': 'Tungsten',
|
||||
'createTungstenFabricFirewallRule': 'Tungsten',
|
||||
'createTungstenFabricServiceGroup': 'Tungsten',
|
||||
'createTungstenFabricAddressGroup': 'Tungsten',
|
||||
'createTungstenFabricLogicalRouter': 'Tungsten',
|
||||
'addTungstenFabricNetworkGatewayToLogicalRouter': 'Tungsten',
|
||||
'listTungstenFabricApplicationPolicySet': 'Tungsten',
|
||||
'listTungstenFabricFirewallPolicy': 'Tungsten',
|
||||
'listTungstenFabricFirewallRule': 'Tungsten',
|
||||
'listTungstenFabricServiceGroup': 'Tungsten',
|
||||
'listTungstenFabricAddressGroup': 'Tungsten',
|
||||
'listTungstenFabricLogicalRouter': 'Tungsten',
|
||||
'deleteTungstenFabricApplicationPolicySet': 'Tungsten',
|
||||
'deleteTungstenFabricFirewallPolicy': 'Tungsten',
|
||||
'deleteTungstenFabricFirewallRule': 'Tungsten',
|
||||
'deleteTungstenFabricAddressGroup': 'Tungsten',
|
||||
'deleteTungstenFabricServiceGroup': 'Tungsten',
|
||||
'deleteTungstenFabricLogicalRouter': 'Tungsten',
|
||||
'removeTungstenFabricNetworkGatewayFromLogicalRouter': 'Tungsten',
|
||||
'updateTungstenFabricLBHealthMonitor': 'Tungsten',
|
||||
'listTungstenFabricLBHealthMonitor': 'Tungsten',
|
||||
'TungstenFabric': 'Tungsten',
|
||||
'listNsxControllers': 'NSX',
|
||||
'addNsxController': 'NSX',
|
||||
'deleteNsxController': 'NSX',
|
||||
'Vpn': 'VPN',
|
||||
'Limit': 'Limit',
|
||||
'Limit': 'Resource Limit',
|
||||
'Netscaler': 'Netscaler',
|
||||
'NetscalerControlCenter': 'Netscaler',
|
||||
'NetscalerLoadBalancer': 'Netscaler',
|
||||
'SolidFire': 'SolidFire',
|
||||
'PaloAlto': 'Palo Alto',
|
||||
'ResourceCount': 'Limit',
|
||||
'CloudIdentifier': 'Cloud Identifier',
|
||||
'InstanceGroup': 'VM Group',
|
||||
@ -150,10 +115,9 @@ known_categories = {
|
||||
'updateStorageCapabilities' : 'Storage Pool',
|
||||
'SecurityGroup': 'Security Group',
|
||||
'SSH': 'SSH',
|
||||
'register': 'Registration',
|
||||
'AsyncJob': 'Async job',
|
||||
'Certificate': 'Certificate',
|
||||
'Hypervisor': 'Hypervisor',
|
||||
'Hypervisor': 'Configuration',
|
||||
'Alert': 'Alert',
|
||||
'Event': 'Event',
|
||||
'login': 'Authentication',
|
||||
@ -175,19 +139,20 @@ known_categories = {
|
||||
'ExternalLoadBalancer': 'Ext Load Balancer',
|
||||
'ExternalFirewall': 'Ext Firewall',
|
||||
'Usage': 'Usage',
|
||||
'TrafficMonitor': 'Usage',
|
||||
'TrafficType': 'Usage',
|
||||
'TrafficMonitor': 'Network',
|
||||
'TrafficType': 'Network',
|
||||
'Product': 'Product',
|
||||
'LB': 'Load Balancer',
|
||||
'ldap': 'LDAP',
|
||||
'Ldap': 'LDAP',
|
||||
'Swift': 'Swift',
|
||||
'Swift': 'Image Store',
|
||||
'S3' : 'S3',
|
||||
'SecondaryStorage': 'Host',
|
||||
'SecondaryStorage': 'Image Store',
|
||||
'Project': 'Project',
|
||||
'Lun': 'Storage',
|
||||
'Pool': 'Pool',
|
||||
'VPC': 'VPC',
|
||||
'VPCOffering': 'VPC Offering',
|
||||
'PrivateGateway': 'VPC',
|
||||
'migrateVpc': 'VPC',
|
||||
'Simulator': 'simulator',
|
||||
@ -201,6 +166,7 @@ known_categories = {
|
||||
'Counter': 'AutoScale',
|
||||
'Condition': 'AutoScale',
|
||||
'Api': 'API Discovery',
|
||||
'ApiLimit': 'Configuration',
|
||||
'Region': 'Region',
|
||||
'Detail': 'Resource metadata',
|
||||
'addIpToNic': 'Nic',
|
||||
@ -208,6 +174,7 @@ known_categories = {
|
||||
'updateVmNicIp': 'Nic',
|
||||
'listNics':'Nic',
|
||||
'AffinityGroup': 'Affinity Group',
|
||||
'ImageStore': 'Image Store',
|
||||
'addImageStore': 'Image Store',
|
||||
'listImageStore': 'Image Store',
|
||||
'deleteImageStore': 'Image Store',
|
||||
@ -228,15 +195,16 @@ known_categories = {
|
||||
'CacheStores' : 'Cache Stores',
|
||||
'CacheStore' : 'Cache Store',
|
||||
'OvsElement' : 'Ovs Element',
|
||||
'StratosphereSsp' : ' Stratosphere SSP',
|
||||
'StratosphereSsp' : 'Misc Network Service Providers',
|
||||
'Metrics' : 'Metrics',
|
||||
'listClustersMetrics': 'Cluster',
|
||||
'VpnUser': 'VPN',
|
||||
'listZonesMetrics': 'Metrics',
|
||||
'Infrastructure' : 'Metrics',
|
||||
'listNetscalerControlCenter' : 'Load Balancer',
|
||||
'listRegisteredServicePackages': 'Load Balancer',
|
||||
'listNsVpx' : 'Load Balancer',
|
||||
'destroyNsVPx': 'Load Balancer',
|
||||
'deployNetscalerVpx' : 'Load Balancer',
|
||||
'deleteNetscalerControlCenter' : 'Load Balancer',
|
||||
'stopNetScalerVpx' : 'Load Balancer',
|
||||
'deleteServicePackageOffering' : 'Load Balancer',
|
||||
'destroyNsVpx' : 'Load Balancer',
|
||||
@ -256,17 +224,16 @@ known_categories = {
|
||||
'UnmanagedInstance': 'Virtual Machine',
|
||||
'KubernetesSupportedVersion': 'Kubernetes Service',
|
||||
'KubernetesCluster': 'Kubernetes Service',
|
||||
'UnmanagedInstance': 'Virtual Machine',
|
||||
'Rolling': 'Rolling Maintenance',
|
||||
'importVsphereStoragePolicies' : 'vSphere storage policies',
|
||||
'listVsphereStoragePolicies' : 'vSphere storage policies',
|
||||
'ConsoleEndpoint': 'Console Endpoint',
|
||||
'Shutdown': 'Shutdown',
|
||||
'importVm': 'Virtual Machine',
|
||||
'revertToVMSnapshot': 'Virtual Machine',
|
||||
'listQuarantinedIp': 'IP Quarantine',
|
||||
'updateQuarantinedIp': 'IP Quarantine',
|
||||
'removeQuarantinedIp': 'IP Quarantine',
|
||||
'Shutdown': 'Shutdown',
|
||||
'Shutdown': 'Management',
|
||||
'addObjectStoragePool': 'Object Store',
|
||||
'listObjectStoragePools': 'Object Store',
|
||||
'deleteObjectStoragePool': 'Object Store',
|
||||
@ -276,7 +243,6 @@ known_categories = {
|
||||
'deleteBucket': 'Object Store',
|
||||
'listBuckets': 'Object Store',
|
||||
'listVmsForImport': 'Virtual Machine',
|
||||
'importVm': 'Virtual Machine',
|
||||
'SharedFS': 'Shared FileSystem',
|
||||
'SharedFileSystem': 'Shared FileSystem',
|
||||
'Webhook': 'Webhook',
|
||||
@ -297,12 +263,19 @@ categories = {}
|
||||
|
||||
|
||||
def choose_category(fn):
|
||||
possible_known_categories = []
|
||||
for k, v in known_categories.items():
|
||||
if k in fn:
|
||||
return v
|
||||
possible_known_categories.append(k)
|
||||
|
||||
if len(possible_known_categories) > 0:
|
||||
close_matches = difflib.get_close_matches(fn, possible_known_categories, n=1, cutoff=0.1)
|
||||
if len(close_matches) > 0:
|
||||
return known_categories[close_matches[0]]
|
||||
else:
|
||||
return known_categories[possible_known_categories[0]]
|
||||
raise Exception('Need to add a category for %s to %s:known_categories' %
|
||||
(fn, __file__))
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
for f in sys.argv:
|
||||
@ -353,7 +326,6 @@ def xml_for(command):
|
||||
def write_xml(out, user):
|
||||
with open(out, 'w') as f:
|
||||
cat_strings = []
|
||||
|
||||
for category in categories.keys():
|
||||
strings = []
|
||||
for command in categories[category]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user