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
|
# specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import os
|
|
||||||
import os.path
|
import os.path
|
||||||
import sys
|
import sys
|
||||||
from xml.dom import minidom
|
from xml.dom import minidom
|
||||||
from xml.parsers.expat import ExpatError
|
from xml.parsers.expat import ExpatError
|
||||||
|
import difflib
|
||||||
|
|
||||||
|
|
||||||
ROOT_ADMIN = 'r'
|
ROOT_ADMIN = 'r'
|
||||||
@ -51,7 +51,9 @@ known_categories = {
|
|||||||
'VirtualMachine': 'Virtual Machine',
|
'VirtualMachine': 'Virtual Machine',
|
||||||
'VM': 'Virtual Machine',
|
'VM': 'Virtual Machine',
|
||||||
'Vnf': 'Virtual Network Functions',
|
'Vnf': 'Virtual Network Functions',
|
||||||
|
'VnfTemplate': 'Virtual Network Functions',
|
||||||
'GuestSubnet': 'Routing',
|
'GuestSubnet': 'Routing',
|
||||||
|
'HypervisorGuestOsNames': 'Guest OS',
|
||||||
'Domain': 'Domain',
|
'Domain': 'Domain',
|
||||||
'Template': 'Template',
|
'Template': 'Template',
|
||||||
'Iso': 'ISO',
|
'Iso': 'ISO',
|
||||||
@ -63,83 +65,46 @@ known_categories = {
|
|||||||
'StaticNat': 'NAT',
|
'StaticNat': 'NAT',
|
||||||
'IpForwarding': 'NAT',
|
'IpForwarding': 'NAT',
|
||||||
'Host': 'Host',
|
'Host': 'Host',
|
||||||
'OutOfBand': 'Out-of-band Management',
|
'HostTags': 'Host',
|
||||||
|
'OutOfBandManagement': 'Out-of-band Management',
|
||||||
'Cluster': 'Cluster',
|
'Cluster': 'Cluster',
|
||||||
'Account': 'Account',
|
'Account': 'Account',
|
||||||
'Role': 'Role',
|
'Role': 'Role',
|
||||||
'Snapshot': 'Snapshot',
|
'Snapshot': 'Snapshot',
|
||||||
'User': 'User',
|
'User': 'User',
|
||||||
|
'UserData': 'User Data',
|
||||||
'Os': 'Guest OS',
|
'Os': 'Guest OS',
|
||||||
'ServiceOffering': 'Service Offering',
|
'ServiceOffering': 'Service Offering',
|
||||||
'DiskOffering': 'Disk Offering',
|
'DiskOffering': 'Disk Offering',
|
||||||
'LoadBalancer': 'Load Balancer',
|
'LoadBalancer': 'Load Balancer',
|
||||||
'SslCert': 'Load Balancer',
|
'SslCert': 'SSL Certificates',
|
||||||
'Router': 'Router',
|
'Router': 'Router',
|
||||||
'SystemVm': 'System VM',
|
|
||||||
'Configuration': 'Configuration',
|
'Configuration': 'Configuration',
|
||||||
'Capabilities': 'Configuration',
|
'Capabilities': 'Configuration',
|
||||||
'Pod': 'Pod',
|
'Pod': 'Pod',
|
||||||
|
'ManagementNetworkIpRange': 'Pod',
|
||||||
'PublicIpRange': 'Network',
|
'PublicIpRange': 'Network',
|
||||||
'Zone': 'Zone',
|
'Zone': 'Zone',
|
||||||
'Vmware' : 'Zone',
|
'Vmware' : 'Zone',
|
||||||
'NetworkOffering': 'Network Offering',
|
'NetworkOffering': 'Network Offering',
|
||||||
'NetworkACL': 'Network ACL',
|
'NetworkACL': 'Network ACL',
|
||||||
|
'NetworkAclItem': 'Network ACL',
|
||||||
'Network': 'Network',
|
'Network': 'Network',
|
||||||
'CiscoNexus': 'Network',
|
'CiscoNexus': 'Network',
|
||||||
'OpenDaylight': 'Network',
|
'OpenDaylight': 'Network',
|
||||||
'createServiceInstance': 'Network',
|
'createServiceInstance': 'Network',
|
||||||
'addGloboDnsHost': 'Network',
|
'addGloboDnsHost': 'Network',
|
||||||
'createTungstenFabricProvider': 'Tungsten',
|
'TungstenFabric': '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',
|
|
||||||
'listNsxControllers': 'NSX',
|
'listNsxControllers': 'NSX',
|
||||||
'addNsxController': 'NSX',
|
'addNsxController': 'NSX',
|
||||||
'deleteNsxController': 'NSX',
|
'deleteNsxController': 'NSX',
|
||||||
'Vpn': 'VPN',
|
'Vpn': 'VPN',
|
||||||
'Limit': 'Limit',
|
'Limit': 'Resource Limit',
|
||||||
|
'Netscaler': 'Netscaler',
|
||||||
|
'NetscalerControlCenter': 'Netscaler',
|
||||||
|
'NetscalerLoadBalancer': 'Netscaler',
|
||||||
|
'SolidFire': 'SolidFire',
|
||||||
|
'PaloAlto': 'Palo Alto',
|
||||||
'ResourceCount': 'Limit',
|
'ResourceCount': 'Limit',
|
||||||
'CloudIdentifier': 'Cloud Identifier',
|
'CloudIdentifier': 'Cloud Identifier',
|
||||||
'InstanceGroup': 'VM Group',
|
'InstanceGroup': 'VM Group',
|
||||||
@ -150,10 +115,9 @@ known_categories = {
|
|||||||
'updateStorageCapabilities' : 'Storage Pool',
|
'updateStorageCapabilities' : 'Storage Pool',
|
||||||
'SecurityGroup': 'Security Group',
|
'SecurityGroup': 'Security Group',
|
||||||
'SSH': 'SSH',
|
'SSH': 'SSH',
|
||||||
'register': 'Registration',
|
|
||||||
'AsyncJob': 'Async job',
|
'AsyncJob': 'Async job',
|
||||||
'Certificate': 'Certificate',
|
'Certificate': 'Certificate',
|
||||||
'Hypervisor': 'Hypervisor',
|
'Hypervisor': 'Configuration',
|
||||||
'Alert': 'Alert',
|
'Alert': 'Alert',
|
||||||
'Event': 'Event',
|
'Event': 'Event',
|
||||||
'login': 'Authentication',
|
'login': 'Authentication',
|
||||||
@ -175,19 +139,20 @@ known_categories = {
|
|||||||
'ExternalLoadBalancer': 'Ext Load Balancer',
|
'ExternalLoadBalancer': 'Ext Load Balancer',
|
||||||
'ExternalFirewall': 'Ext Firewall',
|
'ExternalFirewall': 'Ext Firewall',
|
||||||
'Usage': 'Usage',
|
'Usage': 'Usage',
|
||||||
'TrafficMonitor': 'Usage',
|
'TrafficMonitor': 'Network',
|
||||||
'TrafficType': 'Usage',
|
'TrafficType': 'Network',
|
||||||
'Product': 'Product',
|
'Product': 'Product',
|
||||||
'LB': 'Load Balancer',
|
'LB': 'Load Balancer',
|
||||||
'ldap': 'LDAP',
|
'ldap': 'LDAP',
|
||||||
'Ldap': 'LDAP',
|
'Ldap': 'LDAP',
|
||||||
'Swift': 'Swift',
|
'Swift': 'Image Store',
|
||||||
'S3' : 'S3',
|
'S3' : 'S3',
|
||||||
'SecondaryStorage': 'Host',
|
'SecondaryStorage': 'Image Store',
|
||||||
'Project': 'Project',
|
'Project': 'Project',
|
||||||
'Lun': 'Storage',
|
'Lun': 'Storage',
|
||||||
'Pool': 'Pool',
|
'Pool': 'Pool',
|
||||||
'VPC': 'VPC',
|
'VPC': 'VPC',
|
||||||
|
'VPCOffering': 'VPC Offering',
|
||||||
'PrivateGateway': 'VPC',
|
'PrivateGateway': 'VPC',
|
||||||
'migrateVpc': 'VPC',
|
'migrateVpc': 'VPC',
|
||||||
'Simulator': 'simulator',
|
'Simulator': 'simulator',
|
||||||
@ -201,13 +166,15 @@ known_categories = {
|
|||||||
'Counter': 'AutoScale',
|
'Counter': 'AutoScale',
|
||||||
'Condition': 'AutoScale',
|
'Condition': 'AutoScale',
|
||||||
'Api': 'API Discovery',
|
'Api': 'API Discovery',
|
||||||
|
'ApiLimit': 'Configuration',
|
||||||
'Region': 'Region',
|
'Region': 'Region',
|
||||||
'Detail': 'Resource metadata',
|
'Detail': 'Resource metadata',
|
||||||
'addIpToNic': 'Nic',
|
'addIpToNic': 'Nic',
|
||||||
'removeIpFromNic': 'Nic',
|
'removeIpFromNic': 'Nic',
|
||||||
'updateVmNicIp': 'Nic',
|
'updateVmNicIp': 'Nic',
|
||||||
'listNics':'Nic',
|
'listNics':'Nic',
|
||||||
'AffinityGroup': 'Affinity Group',
|
'AffinityGroup': 'Affinity Group',
|
||||||
|
'ImageStore': 'Image Store',
|
||||||
'addImageStore': 'Image Store',
|
'addImageStore': 'Image Store',
|
||||||
'listImageStore': 'Image Store',
|
'listImageStore': 'Image Store',
|
||||||
'deleteImageStore': 'Image Store',
|
'deleteImageStore': 'Image Store',
|
||||||
@ -228,15 +195,16 @@ known_categories = {
|
|||||||
'CacheStores' : 'Cache Stores',
|
'CacheStores' : 'Cache Stores',
|
||||||
'CacheStore' : 'Cache Store',
|
'CacheStore' : 'Cache Store',
|
||||||
'OvsElement' : 'Ovs Element',
|
'OvsElement' : 'Ovs Element',
|
||||||
'StratosphereSsp' : ' Stratosphere SSP',
|
'StratosphereSsp' : 'Misc Network Service Providers',
|
||||||
'Metrics' : 'Metrics',
|
'Metrics' : 'Metrics',
|
||||||
|
'listClustersMetrics': 'Cluster',
|
||||||
|
'VpnUser': 'VPN',
|
||||||
|
'listZonesMetrics': 'Metrics',
|
||||||
'Infrastructure' : 'Metrics',
|
'Infrastructure' : 'Metrics',
|
||||||
'listNetscalerControlCenter' : 'Load Balancer',
|
|
||||||
'listRegisteredServicePackages': 'Load Balancer',
|
'listRegisteredServicePackages': 'Load Balancer',
|
||||||
'listNsVpx' : 'Load Balancer',
|
'listNsVpx' : 'Load Balancer',
|
||||||
'destroyNsVPx': 'Load Balancer',
|
'destroyNsVPx': 'Load Balancer',
|
||||||
'deployNetscalerVpx' : 'Load Balancer',
|
'deployNetscalerVpx' : 'Load Balancer',
|
||||||
'deleteNetscalerControlCenter' : 'Load Balancer',
|
|
||||||
'stopNetScalerVpx' : 'Load Balancer',
|
'stopNetScalerVpx' : 'Load Balancer',
|
||||||
'deleteServicePackageOffering' : 'Load Balancer',
|
'deleteServicePackageOffering' : 'Load Balancer',
|
||||||
'destroyNsVpx' : 'Load Balancer',
|
'destroyNsVpx' : 'Load Balancer',
|
||||||
@ -256,17 +224,16 @@ known_categories = {
|
|||||||
'UnmanagedInstance': 'Virtual Machine',
|
'UnmanagedInstance': 'Virtual Machine',
|
||||||
'KubernetesSupportedVersion': 'Kubernetes Service',
|
'KubernetesSupportedVersion': 'Kubernetes Service',
|
||||||
'KubernetesCluster': 'Kubernetes Service',
|
'KubernetesCluster': 'Kubernetes Service',
|
||||||
'UnmanagedInstance': 'Virtual Machine',
|
|
||||||
'Rolling': 'Rolling Maintenance',
|
'Rolling': 'Rolling Maintenance',
|
||||||
'importVsphereStoragePolicies' : 'vSphere storage policies',
|
'importVsphereStoragePolicies' : 'vSphere storage policies',
|
||||||
'listVsphereStoragePolicies' : 'vSphere storage policies',
|
'listVsphereStoragePolicies' : 'vSphere storage policies',
|
||||||
'ConsoleEndpoint': 'Console Endpoint',
|
'ConsoleEndpoint': 'Console Endpoint',
|
||||||
'Shutdown': 'Shutdown',
|
|
||||||
'importVm': 'Virtual Machine',
|
'importVm': 'Virtual Machine',
|
||||||
|
'revertToVMSnapshot': 'Virtual Machine',
|
||||||
'listQuarantinedIp': 'IP Quarantine',
|
'listQuarantinedIp': 'IP Quarantine',
|
||||||
'updateQuarantinedIp': 'IP Quarantine',
|
'updateQuarantinedIp': 'IP Quarantine',
|
||||||
'removeQuarantinedIp': 'IP Quarantine',
|
'removeQuarantinedIp': 'IP Quarantine',
|
||||||
'Shutdown': 'Shutdown',
|
'Shutdown': 'Management',
|
||||||
'addObjectStoragePool': 'Object Store',
|
'addObjectStoragePool': 'Object Store',
|
||||||
'listObjectStoragePools': 'Object Store',
|
'listObjectStoragePools': 'Object Store',
|
||||||
'deleteObjectStoragePool': 'Object Store',
|
'deleteObjectStoragePool': 'Object Store',
|
||||||
@ -276,7 +243,6 @@ known_categories = {
|
|||||||
'deleteBucket': 'Object Store',
|
'deleteBucket': 'Object Store',
|
||||||
'listBuckets': 'Object Store',
|
'listBuckets': 'Object Store',
|
||||||
'listVmsForImport': 'Virtual Machine',
|
'listVmsForImport': 'Virtual Machine',
|
||||||
'importVm': 'Virtual Machine',
|
|
||||||
'SharedFS': 'Shared FileSystem',
|
'SharedFS': 'Shared FileSystem',
|
||||||
'SharedFileSystem': 'Shared FileSystem',
|
'SharedFileSystem': 'Shared FileSystem',
|
||||||
'Webhook': 'Webhook',
|
'Webhook': 'Webhook',
|
||||||
@ -297,12 +263,19 @@ categories = {}
|
|||||||
|
|
||||||
|
|
||||||
def choose_category(fn):
|
def choose_category(fn):
|
||||||
|
possible_known_categories = []
|
||||||
for k, v in known_categories.items():
|
for k, v in known_categories.items():
|
||||||
if k in fn:
|
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' %
|
raise Exception('Need to add a category for %s to %s:known_categories' %
|
||||||
(fn, __file__))
|
(fn, __file__))
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
for f in sys.argv:
|
for f in sys.argv:
|
||||||
@ -353,7 +326,6 @@ def xml_for(command):
|
|||||||
def write_xml(out, user):
|
def write_xml(out, user):
|
||||||
with open(out, 'w') as f:
|
with open(out, 'w') as f:
|
||||||
cat_strings = []
|
cat_strings = []
|
||||||
|
|
||||||
for category in categories.keys():
|
for category in categories.keys():
|
||||||
strings = []
|
strings = []
|
||||||
for command in categories[category]:
|
for command in categories[category]:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user