catocli 2.0.5__py3-none-any.whl → 2.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of catocli might be problematic. Click here for more details.
- catocli/Utils/clidriver.py +10 -0
- catocli/__init__.py +1 -1
- catocli/parsers/custom/export_sites/export_sites.py +18 -1
- catocli/parsers/custom/import_sites_to_tf/__init__.py +3 -1
- catocli/parsers/custom/import_sites_to_tf/import_sites_to_tf.py +71 -5
- catocli/parsers/mutation_accountManagement/__init__.py +13 -0
- catocli/parsers/mutation_accountManagement_disableAccount/README.md +16 -0
- catocli/parsers/mutation_groups/README.md +7 -0
- catocli/parsers/mutation_groups/__init__.py +48 -0
- catocli/parsers/mutation_groups_createGroup/README.md +18 -0
- catocli/parsers/mutation_groups_deleteGroup/README.md +18 -0
- catocli/parsers/mutation_groups_updateGroup/README.md +18 -0
- catocli/parsers/mutation_site/__init__.py +104 -0
- catocli/parsers/mutation_site_assignSiteBwLicense/README.md +17 -0
- catocli/parsers/mutation_site_removeSecondaryAwsVSocket/README.md +17 -0
- catocli/parsers/mutation_site_removeSecondaryAzureVSocket/README.md +17 -0
- catocli/parsers/mutation_site_removeSiteBwLicense/README.md +17 -0
- catocli/parsers/mutation_site_replaceSiteBwLicense/README.md +17 -0
- catocli/parsers/mutation_site_updateSecondaryAwsVSocket/README.md +17 -0
- catocli/parsers/mutation_site_updateSecondaryAzureVSocket/README.md +17 -0
- catocli/parsers/mutation_site_updateSiteBwLicense/README.md +17 -0
- catocli/parsers/mutation_site_updateSiteGeneralDetails/README.md +1 -1
- catocli/parsers/mutation_sites/__init__.py +104 -0
- catocli/parsers/mutation_sites_assignSiteBwLicense/README.md +17 -0
- catocli/parsers/mutation_sites_removeSecondaryAwsVSocket/README.md +17 -0
- catocli/parsers/mutation_sites_removeSecondaryAzureVSocket/README.md +17 -0
- catocli/parsers/mutation_sites_removeSiteBwLicense/README.md +17 -0
- catocli/parsers/mutation_sites_replaceSiteBwLicense/README.md +17 -0
- catocli/parsers/mutation_sites_updateSecondaryAwsVSocket/README.md +17 -0
- catocli/parsers/mutation_sites_updateSecondaryAzureVSocket/README.md +17 -0
- catocli/parsers/mutation_sites_updateSiteBwLicense/README.md +17 -0
- catocli/parsers/mutation_sites_updateSiteGeneralDetails/README.md +1 -1
- catocli/parsers/parserApiClient.py +17 -8
- catocli/parsers/query_eventsFeed/README.md +1 -1
- catocli/parsers/query_groups/README.md +7 -0
- catocli/parsers/query_groups/__init__.py +54 -0
- catocli/parsers/query_groups_group/README.md +7 -0
- catocli/parsers/query_groups_groupList/README.md +18 -0
- catocli/parsers/query_groups_group_members/README.md +18 -0
- catocli/parsers/query_groups_whereUsed/README.md +17 -0
- catocli/parsers/query_popLocations/README.md +17 -0
- catocli/parsers/query_popLocations/__init__.py +16 -0
- catocli/parsers/query_site/__init__.py +26 -0
- catocli/parsers/query_site_secondaryAwsVSocket/README.md +17 -0
- catocli/parsers/query_site_secondaryAzureVSocket/README.md +17 -0
- catocli/parsers/query_socketPortMetrics/README.md +23 -0
- catocli/parsers/query_socketPortMetrics/__init__.py +16 -0
- catocli/parsers/query_socketPortMetricsTimeSeries/README.md +24 -0
- catocli/parsers/query_socketPortMetricsTimeSeries/__init__.py +16 -0
- {catocli-2.0.5.dist-info → catocli-2.1.0.dist-info}/METADATA +3 -2
- {catocli-2.0.5.dist-info → catocli-2.1.0.dist-info}/RECORD +249 -297
- {catocli-2.0.5.dist-info → catocli-2.1.0.dist-info}/WHEEL +1 -1
- {catocli-2.0.5.dist-info → catocli-2.1.0.dist-info}/top_level.txt +0 -2
- models/mutation.accountManagement.addAccount.json +97 -0
- models/mutation.accountManagement.disableAccount.json +545 -0
- models/mutation.accountManagement.removeAccount.json +102 -3
- models/mutation.accountManagement.updateAccount.json +97 -0
- models/mutation.admin.addAdmin.json +6 -9
- models/mutation.container.delete.json +2 -2
- models/mutation.container.fqdn.addValues.json +3 -3
- models/mutation.container.fqdn.createFromFile.json +3 -3
- models/mutation.container.fqdn.removeValues.json +3 -3
- models/mutation.container.fqdn.updateFromFile.json +3 -3
- models/mutation.container.ipAddressRange.addValues.json +3 -3
- models/mutation.container.ipAddressRange.createFromFile.json +3 -3
- models/mutation.container.ipAddressRange.removeValues.json +3 -3
- models/mutation.container.ipAddressRange.updateFromFile.json +3 -3
- models/mutation.groups.createGroup.json +3178 -0
- models/mutation.groups.deleteGroup.json +2758 -0
- models/mutation.groups.updateGroup.json +4429 -0
- models/mutation.hardware.updateHardwareShipping.json +30 -10
- models/mutation.policy.appTenantRestriction.addRule.json +33 -33
- models/mutation.policy.appTenantRestriction.addSection.json +4 -4
- models/mutation.policy.appTenantRestriction.createPolicyRevision.json +33 -33
- models/mutation.policy.appTenantRestriction.discardPolicyRevision.json +33 -33
- models/mutation.policy.appTenantRestriction.moveRule.json +27 -27
- models/mutation.policy.appTenantRestriction.moveSection.json +4 -4
- models/mutation.policy.appTenantRestriction.publishPolicyRevision.json +33 -33
- models/mutation.policy.appTenantRestriction.removeRule.json +27 -27
- models/mutation.policy.appTenantRestriction.removeSection.json +4 -4
- models/mutation.policy.appTenantRestriction.updatePolicy.json +33 -33
- models/mutation.policy.appTenantRestriction.updateRule.json +33 -33
- models/mutation.policy.appTenantRestriction.updateSection.json +4 -4
- models/mutation.policy.dynamicIpAllocation.addRule.json +12 -12
- models/mutation.policy.dynamicIpAllocation.addSection.json +4 -4
- models/mutation.policy.dynamicIpAllocation.createPolicyRevision.json +18 -18
- models/mutation.policy.dynamicIpAllocation.discardPolicyRevision.json +18 -18
- models/mutation.policy.dynamicIpAllocation.moveRule.json +12 -12
- models/mutation.policy.dynamicIpAllocation.moveSection.json +4 -4
- models/mutation.policy.dynamicIpAllocation.publishPolicyRevision.json +18 -18
- models/mutation.policy.dynamicIpAllocation.removeRule.json +12 -12
- models/mutation.policy.dynamicIpAllocation.removeSection.json +4 -4
- models/mutation.policy.dynamicIpAllocation.updatePolicy.json +18 -18
- models/mutation.policy.dynamicIpAllocation.updateRule.json +12 -12
- models/mutation.policy.dynamicIpAllocation.updateSection.json +4 -4
- models/mutation.policy.internetFirewall.addRule.json +141 -141
- models/mutation.policy.internetFirewall.addSection.json +4 -4
- models/mutation.policy.internetFirewall.createPolicyRevision.json +102 -102
- models/mutation.policy.internetFirewall.discardPolicyRevision.json +102 -102
- models/mutation.policy.internetFirewall.moveRule.json +96 -96
- models/mutation.policy.internetFirewall.moveSection.json +4 -4
- models/mutation.policy.internetFirewall.publishPolicyRevision.json +102 -102
- models/mutation.policy.internetFirewall.removeRule.json +96 -96
- models/mutation.policy.internetFirewall.removeSection.json +4 -4
- models/mutation.policy.internetFirewall.updatePolicy.json +102 -102
- models/mutation.policy.internetFirewall.updateRule.json +141 -141
- models/mutation.policy.internetFirewall.updateSection.json +4 -4
- models/mutation.policy.remotePortFwd.addRule.json +21 -21
- models/mutation.policy.remotePortFwd.addSection.json +4 -4
- models/mutation.policy.remotePortFwd.createPolicyRevision.json +24 -24
- models/mutation.policy.remotePortFwd.discardPolicyRevision.json +24 -24
- models/mutation.policy.remotePortFwd.moveRule.json +18 -18
- models/mutation.policy.remotePortFwd.moveSection.json +4 -4
- models/mutation.policy.remotePortFwd.publishPolicyRevision.json +24 -24
- models/mutation.policy.remotePortFwd.removeRule.json +18 -18
- models/mutation.policy.remotePortFwd.removeSection.json +4 -4
- models/mutation.policy.remotePortFwd.updatePolicy.json +24 -24
- models/mutation.policy.remotePortFwd.updateRule.json +21 -21
- models/mutation.policy.remotePortFwd.updateSection.json +4 -4
- models/mutation.policy.socketLan.addRule.json +97 -97
- models/mutation.policy.socketLan.addSection.json +4 -4
- models/mutation.policy.socketLan.createPolicyRevision.json +91 -91
- models/mutation.policy.socketLan.discardPolicyRevision.json +91 -91
- models/mutation.policy.socketLan.moveRule.json +85 -85
- models/mutation.policy.socketLan.moveSection.json +4 -4
- models/mutation.policy.socketLan.publishPolicyRevision.json +91 -91
- models/mutation.policy.socketLan.removeRule.json +85 -85
- models/mutation.policy.socketLan.removeSection.json +4 -4
- models/mutation.policy.socketLan.updatePolicy.json +91 -91
- models/mutation.policy.socketLan.updateRule.json +97 -97
- models/mutation.policy.socketLan.updateSection.json +4 -4
- models/mutation.policy.terminalServer.addRule.json +7 -7
- models/mutation.policy.terminalServer.addSection.json +4 -4
- models/mutation.policy.terminalServer.createPolicyRevision.json +13 -13
- models/mutation.policy.terminalServer.discardPolicyRevision.json +13 -13
- models/mutation.policy.terminalServer.moveRule.json +7 -7
- models/mutation.policy.terminalServer.moveSection.json +4 -4
- models/mutation.policy.terminalServer.publishPolicyRevision.json +13 -13
- models/mutation.policy.terminalServer.removeRule.json +7 -7
- models/mutation.policy.terminalServer.removeSection.json +4 -4
- models/mutation.policy.terminalServer.updatePolicy.json +13 -13
- models/mutation.policy.terminalServer.updateRule.json +7 -7
- models/mutation.policy.terminalServer.updateSection.json +4 -4
- models/mutation.policy.wanFirewall.addRule.json +157 -157
- models/mutation.policy.wanFirewall.addSection.json +4 -4
- models/mutation.policy.wanFirewall.createPolicyRevision.json +121 -121
- models/mutation.policy.wanFirewall.discardPolicyRevision.json +121 -121
- models/mutation.policy.wanFirewall.moveRule.json +115 -115
- models/mutation.policy.wanFirewall.moveSection.json +4 -4
- models/mutation.policy.wanFirewall.publishPolicyRevision.json +121 -121
- models/mutation.policy.wanFirewall.removeRule.json +115 -115
- models/mutation.policy.wanFirewall.removeSection.json +4 -4
- models/mutation.policy.wanFirewall.updatePolicy.json +121 -121
- models/mutation.policy.wanFirewall.updateRule.json +157 -157
- models/mutation.policy.wanFirewall.updateSection.json +4 -4
- models/mutation.policy.wanNetwork.addRule.json +103 -103
- models/mutation.policy.wanNetwork.addSection.json +4 -4
- models/mutation.policy.wanNetwork.createPolicyRevision.json +97 -97
- models/mutation.policy.wanNetwork.discardPolicyRevision.json +97 -97
- models/mutation.policy.wanNetwork.moveRule.json +91 -91
- models/mutation.policy.wanNetwork.moveSection.json +4 -4
- models/mutation.policy.wanNetwork.publishPolicyRevision.json +97 -97
- models/mutation.policy.wanNetwork.removeRule.json +91 -91
- models/mutation.policy.wanNetwork.removeSection.json +4 -4
- models/mutation.policy.wanNetwork.updatePolicy.json +97 -97
- models/mutation.policy.wanNetwork.updateRule.json +103 -103
- models/mutation.policy.wanNetwork.updateSection.json +4 -4
- models/mutation.site.addBgpPeer.json +10 -10
- models/mutation.site.addIpsecIkeV2SiteTunnels.json +2 -2
- models/mutation.site.addSocketAddOnCard.json +2 -2
- models/mutation.site.assignSiteBwLicense.json +12879 -0
- models/mutation.site.removeBgpPeer.json +10 -10
- models/mutation.site.removeIpsecIkeV2SiteTunnels.json +2 -2
- models/mutation.site.removeSecondaryAwsVSocket.json +375 -0
- models/mutation.site.removeSecondaryAzureVSocket.json +354 -0
- models/mutation.site.removeSiteBwLicense.json +12822 -0
- models/mutation.site.removeSocketAddOnCard.json +2 -2
- models/mutation.site.replaceSiteBwLicense.json +12939 -0
- models/mutation.site.startSiteUpgrade.json +36 -15
- models/mutation.site.updateBgpPeer.json +10 -10
- models/mutation.site.updateIpsecIkeV2SiteTunnels.json +2 -2
- models/mutation.site.updateSecondaryAwsVSocket.json +643 -0
- models/mutation.site.updateSecondaryAzureVSocket.json +565 -0
- models/mutation.site.updateSiteBwLicense.json +12882 -0
- models/mutation.site.updateSiteGeneralDetails.json +724 -1
- models/mutation.sites.addBgpPeer.json +10 -10
- models/mutation.sites.addIpsecIkeV2SiteTunnels.json +2 -2
- models/mutation.sites.addSocketAddOnCard.json +2 -2
- models/mutation.sites.assignSiteBwLicense.json +12879 -0
- models/mutation.sites.removeBgpPeer.json +10 -10
- models/mutation.sites.removeIpsecIkeV2SiteTunnels.json +2 -2
- models/mutation.sites.removeSecondaryAwsVSocket.json +375 -0
- models/mutation.sites.removeSecondaryAzureVSocket.json +354 -0
- models/mutation.sites.removeSiteBwLicense.json +12822 -0
- models/mutation.sites.removeSocketAddOnCard.json +2 -2
- models/mutation.sites.replaceSiteBwLicense.json +12939 -0
- models/mutation.sites.startSiteUpgrade.json +36 -15
- models/mutation.sites.updateBgpPeer.json +10 -10
- models/mutation.sites.updateIpsecIkeV2SiteTunnels.json +2 -2
- models/mutation.sites.updateSecondaryAwsVSocket.json +643 -0
- models/mutation.sites.updateSecondaryAzureVSocket.json +565 -0
- models/mutation.sites.updateSiteBwLicense.json +12882 -0
- models/mutation.sites.updateSiteGeneralDetails.json +724 -1
- models/mutation.xdr.addStoryComment.json +1 -1
- models/mutation.xdr.analystFeedback.json +84 -84
- models/mutation.xdr.deleteStoryComment.json +1 -1
- models/query.accountManagement.json +97 -0
- models/query.accountMetrics.json +45 -45
- models/query.accountSnapshot.json +30 -30
- models/query.admin.json +6 -6
- models/query.admins.json +13 -13
- models/query.appStats.json +915 -867
- models/query.appStatsTimeSeries.json +692 -656
- models/query.auditFeed.json +6 -6
- models/query.catalogs.json +52 -52
- models/query.container.json +16 -16
- models/query.devices.json +20 -93
- models/query.entityLookup.json +2 -2
- models/query.events.json +288 -384
- models/query.eventsFeed.json +73 -97
- models/query.eventsTimeSeries.json +219 -291
- models/query.groups.group.members.json +3058 -0
- models/query.groups.groupList.json +6474 -0
- models/query.groups.whereUsed.json +697 -0
- models/query.hardware.json +27 -7
- models/query.hardwareManagement.json +8 -8
- models/query.licensing.json +3487 -1324
- models/query.policy.appTenantRestriction.policy.json +32 -32
- models/query.policy.dynamicIpAllocation.policy.json +18 -18
- models/query.policy.internetFirewall.policy.json +93 -93
- models/query.policy.remotePortFwd.policy.json +23 -23
- models/query.policy.socketLan.policy.json +88 -88
- models/query.policy.terminalServer.policy.json +13 -13
- models/query.policy.wanFirewall.policy.json +111 -111
- models/query.policy.wanNetwork.policy.json +97 -97
- models/query.popLocations.json +2878 -0
- models/query.sandbox.json +5 -5
- models/query.site.bgpPeer.json +4 -4
- models/query.site.bgpPeerList.json +10 -10
- models/query.site.secondaryAwsVSocket.json +340 -0
- models/query.site.secondaryAzureVSocket.json +319 -0
- models/query.site.siteBgpStatus.json +2 -2
- models/query.socketPortMetrics.json +2410 -0
- models/query.socketPortMetricsTimeSeries.json +2361 -0
- models/query.xdr.stories.json +104 -104
- models/query.xdr.story.json +93 -93
- schema/catolib.py +21 -12
- build/lib/catocli/Utils/clidriver.py +0 -268
- build/lib/catocli/Utils/profile_manager.py +0 -188
- build/lib/catocli/Utils/version_checker.py +0 -192
- build/lib/catocli/__init__.py +0 -2
- build/lib/catocli/__main__.py +0 -12
- build/lib/catocli/parsers/configure/__init__.py +0 -115
- build/lib/catocli/parsers/configure/configure.py +0 -307
- build/lib/catocli/parsers/custom/__init__.py +0 -57
- build/lib/catocli/parsers/custom/customLib.py +0 -561
- build/lib/catocli/parsers/custom/export_rules/__init__.py +0 -42
- build/lib/catocli/parsers/custom/export_rules/export_rules.py +0 -234
- build/lib/catocli/parsers/custom/export_sites/__init__.py +0 -21
- build/lib/catocli/parsers/custom/export_sites/export_sites.py +0 -372
- build/lib/catocli/parsers/custom/import_rules_to_tf/__init__.py +0 -58
- build/lib/catocli/parsers/custom/import_rules_to_tf/import_rules_to_tf.py +0 -451
- build/lib/catocli/parsers/custom/import_sites_to_tf/__init__.py +0 -45
- build/lib/catocli/parsers/custom/import_sites_to_tf/import_sites_to_tf.py +0 -891
- build/lib/catocli/parsers/mutation_accountManagement/__init__.py +0 -48
- build/lib/catocli/parsers/mutation_admin/__init__.py +0 -48
- build/lib/catocli/parsers/mutation_container/__init__.py +0 -138
- build/lib/catocli/parsers/mutation_hardware/__init__.py +0 -22
- build/lib/catocli/parsers/mutation_policy/__init__.py +0 -1305
- build/lib/catocli/parsers/mutation_sandbox/__init__.py +0 -35
- build/lib/catocli/parsers/mutation_site/__init__.py +0 -373
- build/lib/catocli/parsers/mutation_sites/__init__.py +0 -373
- build/lib/catocli/parsers/mutation_xdr/__init__.py +0 -48
- build/lib/catocli/parsers/parserApiClient.py +0 -513
- build/lib/catocli/parsers/query_accountBySubdomain/__init__.py +0 -16
- build/lib/catocli/parsers/query_accountManagement/__init__.py +0 -16
- build/lib/catocli/parsers/query_accountMetrics/__init__.py +0 -16
- build/lib/catocli/parsers/query_accountRoles/__init__.py +0 -16
- build/lib/catocli/parsers/query_accountSnapshot/__init__.py +0 -16
- build/lib/catocli/parsers/query_admin/__init__.py +0 -16
- build/lib/catocli/parsers/query_admins/__init__.py +0 -16
- build/lib/catocli/parsers/query_appStats/__init__.py +0 -16
- build/lib/catocli/parsers/query_appStatsTimeSeries/__init__.py +0 -16
- build/lib/catocli/parsers/query_auditFeed/__init__.py +0 -16
- build/lib/catocli/parsers/query_catalogs/__init__.py +0 -16
- build/lib/catocli/parsers/query_container/__init__.py +0 -16
- build/lib/catocli/parsers/query_devices/__init__.py +0 -16
- build/lib/catocli/parsers/query_entityLookup/__init__.py +0 -16
- build/lib/catocli/parsers/query_events/__init__.py +0 -16
- build/lib/catocli/parsers/query_eventsFeed/__init__.py +0 -16
- build/lib/catocli/parsers/query_eventsTimeSeries/__init__.py +0 -16
- build/lib/catocli/parsers/query_hardware/__init__.py +0 -16
- build/lib/catocli/parsers/query_hardwareManagement/__init__.py +0 -16
- build/lib/catocli/parsers/query_licensing/__init__.py +0 -16
- build/lib/catocli/parsers/query_policy/__init__.py +0 -161
- build/lib/catocli/parsers/query_sandbox/__init__.py +0 -16
- build/lib/catocli/parsers/query_site/__init__.py +0 -100
- build/lib/catocli/parsers/query_siteLocation/__init__.py +0 -13
- build/lib/catocli/parsers/query_subDomains/__init__.py +0 -16
- build/lib/catocli/parsers/query_xdr/__init__.py +0 -35
- build/lib/catocli/parsers/raw/__init__.py +0 -12
- build/lib/graphql_client/__init__.py +0 -11
- build/lib/graphql_client/api/__init__.py +0 -3
- build/lib/graphql_client/api/call_api.py +0 -84
- build/lib/graphql_client/api_client.py +0 -192
- build/lib/graphql_client/api_client_types.py +0 -409
- build/lib/graphql_client/configuration.py +0 -232
- build/lib/graphql_client/models/__init__.py +0 -13
- build/lib/graphql_client/models/no_schema.py +0 -71
- build/lib/schema/catolib.py +0 -1141
- build/lib/schema/importSchema.py +0 -60
- build/lib/schema/remove_policyid.py +0 -89
- build/lib/schema/remove_policyid_mutations.py +0 -89
- build/lib/scripts/catolib.py +0 -62
- build/lib/scripts/export_if_rules_to_json.py +0 -188
- build/lib/scripts/export_wf_rules_to_json.py +0 -111
- build/lib/scripts/import_wf_rules_to_tfstate.py +0 -331
- build/lib/vendor/certifi/__init__.py +0 -4
- build/lib/vendor/certifi/__main__.py +0 -12
- build/lib/vendor/certifi/core.py +0 -114
- build/lib/vendor/certifi/py.typed +0 -0
- build/lib/vendor/six.py +0 -998
- build/lib/vendor/urllib3/__init__.py +0 -211
- build/lib/vendor/urllib3/_base_connection.py +0 -172
- build/lib/vendor/urllib3/_collections.py +0 -483
- build/lib/vendor/urllib3/_request_methods.py +0 -278
- build/lib/vendor/urllib3/_version.py +0 -16
- build/lib/vendor/urllib3/connection.py +0 -1033
- build/lib/vendor/urllib3/connectionpool.py +0 -1182
- build/lib/vendor/urllib3/contrib/__init__.py +0 -0
- build/lib/vendor/urllib3/contrib/emscripten/__init__.py +0 -18
- build/lib/vendor/urllib3/contrib/emscripten/connection.py +0 -254
- build/lib/vendor/urllib3/contrib/emscripten/fetch.py +0 -418
- build/lib/vendor/urllib3/contrib/emscripten/request.py +0 -22
- build/lib/vendor/urllib3/contrib/emscripten/response.py +0 -285
- build/lib/vendor/urllib3/contrib/pyopenssl.py +0 -552
- build/lib/vendor/urllib3/contrib/socks.py +0 -228
- build/lib/vendor/urllib3/exceptions.py +0 -321
- build/lib/vendor/urllib3/fields.py +0 -341
- build/lib/vendor/urllib3/filepost.py +0 -89
- build/lib/vendor/urllib3/http2/__init__.py +0 -53
- build/lib/vendor/urllib3/http2/connection.py +0 -356
- build/lib/vendor/urllib3/http2/probe.py +0 -87
- build/lib/vendor/urllib3/poolmanager.py +0 -637
- build/lib/vendor/urllib3/py.typed +0 -2
- build/lib/vendor/urllib3/response.py +0 -1265
- build/lib/vendor/urllib3/util/__init__.py +0 -42
- build/lib/vendor/urllib3/util/connection.py +0 -137
- build/lib/vendor/urllib3/util/proxy.py +0 -43
- build/lib/vendor/urllib3/util/request.py +0 -256
- build/lib/vendor/urllib3/util/response.py +0 -101
- build/lib/vendor/urllib3/util/retry.py +0 -533
- build/lib/vendor/urllib3/util/ssl_.py +0 -513
- build/lib/vendor/urllib3/util/ssl_match_hostname.py +0 -159
- build/lib/vendor/urllib3/util/ssltransport.py +0 -276
- build/lib/vendor/urllib3/util/timeout.py +0 -275
- build/lib/vendor/urllib3/util/url.py +0 -471
- build/lib/vendor/urllib3/util/util.py +0 -42
- build/lib/vendor/urllib3/util/wait.py +0 -124
- {catocli-2.0.5.dist-info → catocli-2.1.0.dist-info}/entry_points.txt +0 -0
- {catocli-2.0.5.dist-info → catocli-2.1.0.dist-info/licenses}/LICENSE +0 -0
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Version checking utility for Cato CLI
|
|
4
|
-
Checks for newer versions available on GitHub releases and PyPI
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import json
|
|
8
|
-
import urllib.request
|
|
9
|
-
import urllib.error
|
|
10
|
-
import ssl
|
|
11
|
-
import os
|
|
12
|
-
import time
|
|
13
|
-
from .. import __version__
|
|
14
|
-
|
|
15
|
-
# Cache settings
|
|
16
|
-
CACHE_FILE = os.path.expanduser("~/.catocli_version_cache")
|
|
17
|
-
CACHE_DURATION = 3600 * 24 # 24 hours in seconds
|
|
18
|
-
|
|
19
|
-
def get_cached_version_info():
|
|
20
|
-
"""Get cached version information if still valid"""
|
|
21
|
-
try:
|
|
22
|
-
if os.path.exists(CACHE_FILE):
|
|
23
|
-
with open(CACHE_FILE, 'r') as f:
|
|
24
|
-
cache_data = json.load(f)
|
|
25
|
-
|
|
26
|
-
# Check if cache is still valid
|
|
27
|
-
if time.time() - cache_data.get('timestamp', 0) < CACHE_DURATION:
|
|
28
|
-
return cache_data.get('latest_version'), cache_data.get('source')
|
|
29
|
-
except (json.JSONDecodeError, OSError):
|
|
30
|
-
pass
|
|
31
|
-
return None, None
|
|
32
|
-
|
|
33
|
-
def cache_version_info(latest_version, source):
|
|
34
|
-
"""Cache version information"""
|
|
35
|
-
try:
|
|
36
|
-
cache_data = {
|
|
37
|
-
'latest_version': latest_version,
|
|
38
|
-
'source': source,
|
|
39
|
-
'timestamp': time.time()
|
|
40
|
-
}
|
|
41
|
-
with open(CACHE_FILE, 'w') as f:
|
|
42
|
-
json.dump(cache_data, f)
|
|
43
|
-
except OSError:
|
|
44
|
-
pass # Fail silently if we can't write cache
|
|
45
|
-
|
|
46
|
-
def get_latest_github_version():
|
|
47
|
-
"""Get the latest version from GitHub releases"""
|
|
48
|
-
try:
|
|
49
|
-
# Create SSL context that doesn't verify certificates (for corporate networks)
|
|
50
|
-
context = ssl.create_default_context()
|
|
51
|
-
context.check_hostname = False
|
|
52
|
-
context.verify_mode = ssl.CERT_NONE
|
|
53
|
-
|
|
54
|
-
url = "https://api.github.com/repos/catonetworks/cato-cli/releases/latest"
|
|
55
|
-
req = urllib.request.Request(url)
|
|
56
|
-
req.add_header('User-Agent', f'catocli/{__version__}')
|
|
57
|
-
|
|
58
|
-
with urllib.request.urlopen(req, context=context, timeout=5) as response:
|
|
59
|
-
data = json.loads(response.read().decode())
|
|
60
|
-
tag_name = data.get('tag_name', '')
|
|
61
|
-
# Remove 'v' prefix if present
|
|
62
|
-
if tag_name.startswith('v'):
|
|
63
|
-
tag_name = tag_name[1:]
|
|
64
|
-
return tag_name
|
|
65
|
-
except (urllib.error.URLError, urllib.error.HTTPError, json.JSONDecodeError, KeyError):
|
|
66
|
-
return None
|
|
67
|
-
|
|
68
|
-
def get_latest_pypi_version():
|
|
69
|
-
"""Get the latest version from PyPI"""
|
|
70
|
-
try:
|
|
71
|
-
# Create SSL context that doesn't verify certificates (for corporate networks)
|
|
72
|
-
context = ssl.create_default_context()
|
|
73
|
-
context.check_hostname = False
|
|
74
|
-
context.verify_mode = ssl.CERT_NONE
|
|
75
|
-
|
|
76
|
-
url = "https://pypi.org/pypi/catocli/json"
|
|
77
|
-
req = urllib.request.Request(url)
|
|
78
|
-
req.add_header('User-Agent', f'catocli/{__version__}')
|
|
79
|
-
|
|
80
|
-
with urllib.request.urlopen(req, context=context, timeout=5) as response:
|
|
81
|
-
data = json.loads(response.read().decode())
|
|
82
|
-
return data['info']['version']
|
|
83
|
-
except (urllib.error.URLError, urllib.error.HTTPError, json.JSONDecodeError, KeyError):
|
|
84
|
-
return None
|
|
85
|
-
|
|
86
|
-
def get_latest_version():
|
|
87
|
-
"""Get the latest version available from GitHub or PyPI"""
|
|
88
|
-
# Check cache first
|
|
89
|
-
cached_version, cached_source = get_cached_version_info()
|
|
90
|
-
if cached_version:
|
|
91
|
-
return cached_version, cached_source
|
|
92
|
-
|
|
93
|
-
# Try GitHub first (usually more up-to-date for development releases)
|
|
94
|
-
github_version = get_latest_github_version()
|
|
95
|
-
if github_version:
|
|
96
|
-
cache_version_info(github_version, 'GitHub')
|
|
97
|
-
return github_version, 'GitHub'
|
|
98
|
-
|
|
99
|
-
# Fall back to PyPI
|
|
100
|
-
pypi_version = get_latest_pypi_version()
|
|
101
|
-
if pypi_version:
|
|
102
|
-
cache_version_info(pypi_version, 'PyPI')
|
|
103
|
-
return pypi_version, 'PyPI'
|
|
104
|
-
|
|
105
|
-
return None, None
|
|
106
|
-
|
|
107
|
-
def compare_versions(version1, version2):
|
|
108
|
-
"""Compare two version strings. Returns 1 if version1 > version2, -1 if version1 < version2, 0 if equal"""
|
|
109
|
-
def version_tuple(v):
|
|
110
|
-
# Convert version string to tuple of integers for comparison
|
|
111
|
-
# Handle versions like "1.0.20", "1.0.20-beta", etc.
|
|
112
|
-
parts = v.split('-')[0].split('.') # Remove pre-release suffixes
|
|
113
|
-
return tuple(int(x) for x in parts if x.isdigit())
|
|
114
|
-
|
|
115
|
-
try:
|
|
116
|
-
v1_tuple = version_tuple(version1)
|
|
117
|
-
v2_tuple = version_tuple(version2)
|
|
118
|
-
|
|
119
|
-
# Pad shorter version with zeros
|
|
120
|
-
max_len = max(len(v1_tuple), len(v2_tuple))
|
|
121
|
-
v1_tuple += (0,) * (max_len - len(v1_tuple))
|
|
122
|
-
v2_tuple += (0,) * (max_len - len(v2_tuple))
|
|
123
|
-
|
|
124
|
-
if v1_tuple > v2_tuple:
|
|
125
|
-
return 1
|
|
126
|
-
elif v1_tuple < v2_tuple:
|
|
127
|
-
return -1
|
|
128
|
-
else:
|
|
129
|
-
return 0
|
|
130
|
-
except (ValueError, AttributeError):
|
|
131
|
-
return 0 # If we can't parse, assume they're equal
|
|
132
|
-
|
|
133
|
-
def is_newer_version_available():
|
|
134
|
-
"""Check if a newer version is available"""
|
|
135
|
-
try:
|
|
136
|
-
latest_version, source = get_latest_version()
|
|
137
|
-
if latest_version:
|
|
138
|
-
comparison = compare_versions(latest_version, __version__)
|
|
139
|
-
return comparison > 0, latest_version, source
|
|
140
|
-
except Exception:
|
|
141
|
-
pass # Fail silently for any version parsing errors
|
|
142
|
-
|
|
143
|
-
return False, None, None
|
|
144
|
-
|
|
145
|
-
def show_upgrade_message(latest_version, source):
|
|
146
|
-
"""Display upgrade message to user"""
|
|
147
|
-
print()
|
|
148
|
-
print("─" * 60)
|
|
149
|
-
print(f"🚀 A newer version of catocli is available!")
|
|
150
|
-
print(f" Current version: {__version__}")
|
|
151
|
-
print(f" Latest version: {latest_version} (from {source})")
|
|
152
|
-
print()
|
|
153
|
-
if source == 'PyPI':
|
|
154
|
-
print(" To upgrade, run:")
|
|
155
|
-
print(" pip install --upgrade catocli")
|
|
156
|
-
else:
|
|
157
|
-
print(" To upgrade, run:")
|
|
158
|
-
print(" pip install --upgrade catocli")
|
|
159
|
-
print(" (or check GitHub releases for pre-release versions)")
|
|
160
|
-
print("─" * 60)
|
|
161
|
-
print()
|
|
162
|
-
|
|
163
|
-
def check_for_updates(show_if_available=True):
|
|
164
|
-
"""
|
|
165
|
-
Check for updates and optionally show upgrade message
|
|
166
|
-
|
|
167
|
-
Args:
|
|
168
|
-
show_if_available (bool): Whether to show the upgrade message if update is available
|
|
169
|
-
|
|
170
|
-
Returns:
|
|
171
|
-
tuple: (is_newer_available, latest_version, source)
|
|
172
|
-
"""
|
|
173
|
-
try:
|
|
174
|
-
is_newer, latest_version, source = is_newer_version_available()
|
|
175
|
-
|
|
176
|
-
if is_newer and show_if_available:
|
|
177
|
-
show_upgrade_message(latest_version, source)
|
|
178
|
-
|
|
179
|
-
return is_newer, latest_version, source
|
|
180
|
-
except Exception:
|
|
181
|
-
# Fail silently - don't interrupt the user's workflow
|
|
182
|
-
return False, None, None
|
|
183
|
-
|
|
184
|
-
def force_check_updates():
|
|
185
|
-
"""Force check for updates by clearing cache"""
|
|
186
|
-
try:
|
|
187
|
-
if os.path.exists(CACHE_FILE):
|
|
188
|
-
os.remove(CACHE_FILE)
|
|
189
|
-
except OSError:
|
|
190
|
-
pass
|
|
191
|
-
|
|
192
|
-
return check_for_updates(show_if_available=True)
|
build/lib/catocli/__init__.py
DELETED
build/lib/catocli/__main__.py
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Configure command parser for Cato CLI
|
|
4
|
-
Handles profile creation, listing, and switching
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import argparse
|
|
8
|
-
from .configure import (
|
|
9
|
-
configure_profile,
|
|
10
|
-
list_profiles,
|
|
11
|
-
set_profile,
|
|
12
|
-
delete_profile,
|
|
13
|
-
show_profile
|
|
14
|
-
)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def configure_parse(subparsers):
|
|
18
|
-
"""Create configure command parsers"""
|
|
19
|
-
|
|
20
|
-
# Create the main configure parser
|
|
21
|
-
configure_parser = subparsers.add_parser(
|
|
22
|
-
'configure',
|
|
23
|
-
help='Configure Cato CLI credentials and profiles',
|
|
24
|
-
usage='catocli configure <subcommand> [options]'
|
|
25
|
-
)
|
|
26
|
-
configure_subparsers = configure_parser.add_subparsers(
|
|
27
|
-
description='Configure operations',
|
|
28
|
-
help='Profile management operations'
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
# Configure profile command
|
|
32
|
-
config_parser = configure_subparsers.add_parser(
|
|
33
|
-
'set',
|
|
34
|
-
help='Configure a profile with credentials',
|
|
35
|
-
usage='catocli configure set [--profile PROFILE] [options]'
|
|
36
|
-
)
|
|
37
|
-
config_parser.add_argument(
|
|
38
|
-
'--profile',
|
|
39
|
-
default='default',
|
|
40
|
-
help='Profile name to configure (default: default)'
|
|
41
|
-
)
|
|
42
|
-
config_parser.add_argument(
|
|
43
|
-
'--endpoint',
|
|
44
|
-
help='Cato API endpoint URL (default: https://api.catonetworks.com/api/v1/graphql2)'
|
|
45
|
-
)
|
|
46
|
-
config_parser.add_argument(
|
|
47
|
-
'--cato-token',
|
|
48
|
-
help='Cato API token'
|
|
49
|
-
)
|
|
50
|
-
config_parser.add_argument(
|
|
51
|
-
'--account-id',
|
|
52
|
-
help='Cato account ID'
|
|
53
|
-
)
|
|
54
|
-
config_parser.add_argument(
|
|
55
|
-
'--interactive',
|
|
56
|
-
action='store_true',
|
|
57
|
-
help='Interactive configuration mode'
|
|
58
|
-
)
|
|
59
|
-
config_parser.add_argument(
|
|
60
|
-
'--skip-validation',
|
|
61
|
-
action='store_true',
|
|
62
|
-
help='Skip credential validation (save without testing)'
|
|
63
|
-
)
|
|
64
|
-
config_parser.set_defaults(func=configure_profile)
|
|
65
|
-
|
|
66
|
-
# List profiles command
|
|
67
|
-
list_parser = configure_subparsers.add_parser(
|
|
68
|
-
'list',
|
|
69
|
-
help='List all configured profiles',
|
|
70
|
-
usage='catocli configure list'
|
|
71
|
-
)
|
|
72
|
-
list_parser.set_defaults(func=list_profiles)
|
|
73
|
-
|
|
74
|
-
# Use/switch profile command
|
|
75
|
-
use_parser = configure_subparsers.add_parser(
|
|
76
|
-
'use',
|
|
77
|
-
help='Set the active profile',
|
|
78
|
-
usage='catocli configure use <profile>'
|
|
79
|
-
)
|
|
80
|
-
use_parser.add_argument(
|
|
81
|
-
'profile',
|
|
82
|
-
help='Profile name to activate'
|
|
83
|
-
)
|
|
84
|
-
use_parser.set_defaults(func=set_profile)
|
|
85
|
-
|
|
86
|
-
# Show current profile command
|
|
87
|
-
show_parser = configure_subparsers.add_parser(
|
|
88
|
-
'show',
|
|
89
|
-
help='Show current profile configuration',
|
|
90
|
-
usage='catocli configure show [--profile PROFILE]'
|
|
91
|
-
)
|
|
92
|
-
show_parser.add_argument(
|
|
93
|
-
'--profile',
|
|
94
|
-
help='Profile name to show (default: current active profile)'
|
|
95
|
-
)
|
|
96
|
-
show_parser.set_defaults(func=show_profile)
|
|
97
|
-
|
|
98
|
-
# Delete profile command
|
|
99
|
-
delete_parser = configure_subparsers.add_parser(
|
|
100
|
-
'delete',
|
|
101
|
-
help='Delete a profile',
|
|
102
|
-
usage='catocli configure delete <profile>'
|
|
103
|
-
)
|
|
104
|
-
delete_parser.add_argument(
|
|
105
|
-
'profile',
|
|
106
|
-
help='Profile name to delete'
|
|
107
|
-
)
|
|
108
|
-
delete_parser.add_argument(
|
|
109
|
-
'--force',
|
|
110
|
-
action='store_true',
|
|
111
|
-
help='Force deletion without confirmation'
|
|
112
|
-
)
|
|
113
|
-
delete_parser.set_defaults(func=delete_profile)
|
|
114
|
-
|
|
115
|
-
return configure_parser
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Configure command implementation for Cato CLI
|
|
4
|
-
Implements profile creation, listing, switching, and management
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import getpass
|
|
8
|
-
import sys
|
|
9
|
-
import json
|
|
10
|
-
from graphql_client import Configuration
|
|
11
|
-
from graphql_client.api_client import ApiException
|
|
12
|
-
from graphql_client.api.call_api import ApiClient, CallApi
|
|
13
|
-
from ...Utils.profile_manager import get_profile_manager
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def test_credentials(endpoint, cato_token, account_id):
|
|
17
|
-
"""Test credentials by making an entityLookup API call"""
|
|
18
|
-
try:
|
|
19
|
-
print("Testing credentials...")
|
|
20
|
-
|
|
21
|
-
# Create a temporary configuration
|
|
22
|
-
test_config = Configuration()
|
|
23
|
-
test_config.verify_ssl = False
|
|
24
|
-
test_config.debug = False
|
|
25
|
-
test_config.version = "1.0.0" # Required for API client
|
|
26
|
-
test_config.api_key["x-api-key"] = cato_token
|
|
27
|
-
test_config.host = endpoint
|
|
28
|
-
test_config.accountID = account_id
|
|
29
|
-
|
|
30
|
-
# Make a simple entityLookup call to test credentials
|
|
31
|
-
instance = CallApi(ApiClient(test_config))
|
|
32
|
-
response = instance.call_api({
|
|
33
|
-
"query": "query entityLookup($accountID: ID!, $type: EntityType!) { entityLookup(accountID: $accountID, type: $type) { items { entity { id name } } } }",
|
|
34
|
-
"variables": {"accountID": account_id, "type": "country"}
|
|
35
|
-
}, {})
|
|
36
|
-
result = response[0] if response else None
|
|
37
|
-
|
|
38
|
-
# Check if the call was successful
|
|
39
|
-
if result and result.get('data') is not None:
|
|
40
|
-
print("✓ Credentials validated successfully")
|
|
41
|
-
return True, "Credentials are valid"
|
|
42
|
-
elif result and result.get('errors'):
|
|
43
|
-
error_msg = result['errors'][0].get('message', 'Unknown API error')
|
|
44
|
-
return False, f"API error: {error_msg}"
|
|
45
|
-
elif result is None:
|
|
46
|
-
return False, "No response from API"
|
|
47
|
-
else:
|
|
48
|
-
return False, f"Invalid API response: {result}"
|
|
49
|
-
|
|
50
|
-
except ApiException as e:
|
|
51
|
-
if e.status == 401:
|
|
52
|
-
return False, "Invalid API token"
|
|
53
|
-
elif e.status == 403:
|
|
54
|
-
return False, "Access denied - check account ID and permissions"
|
|
55
|
-
else:
|
|
56
|
-
return False, f"API error (status {e.status}): {str(e)}"
|
|
57
|
-
except Exception as e:
|
|
58
|
-
return False, f"Connection error: {str(e)}"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def configure_profile(args, configuration=None):
|
|
62
|
-
"""Configure a profile with credentials"""
|
|
63
|
-
pm = get_profile_manager()
|
|
64
|
-
profile_name = args.profile
|
|
65
|
-
|
|
66
|
-
try:
|
|
67
|
-
# Interactive mode
|
|
68
|
-
if args.interactive or (not args.cato_token and not args.account_id and not args.endpoint):
|
|
69
|
-
print(f"Configuring profile '{profile_name}'")
|
|
70
|
-
print("Leave blank to keep existing values (if any)")
|
|
71
|
-
print()
|
|
72
|
-
|
|
73
|
-
# Get current values if profile exists
|
|
74
|
-
current_config = pm.get_profile_config(profile_name) or {}
|
|
75
|
-
|
|
76
|
-
# Get endpoint
|
|
77
|
-
current_endpoint = current_config.get('endpoint', pm.default_endpoint)
|
|
78
|
-
endpoint_input = input(f"Cato API Endpoint [{current_endpoint}]: ").strip()
|
|
79
|
-
endpoint = endpoint_input if endpoint_input else current_endpoint
|
|
80
|
-
|
|
81
|
-
# Get token
|
|
82
|
-
current_token = current_config.get('cato_token', '')
|
|
83
|
-
if current_token:
|
|
84
|
-
token_prompt = f"Cato API Token [****{current_token[-4:]}]: "
|
|
85
|
-
else:
|
|
86
|
-
token_prompt = "Cato API Token: "
|
|
87
|
-
token_input = getpass.getpass(token_prompt).strip()
|
|
88
|
-
cato_token = token_input if token_input else current_token
|
|
89
|
-
|
|
90
|
-
# Get account ID
|
|
91
|
-
current_account = current_config.get('account_id', '')
|
|
92
|
-
account_input = input(f"Account ID [{current_account}]: ").strip()
|
|
93
|
-
account_id = account_input if account_input else current_account
|
|
94
|
-
|
|
95
|
-
else:
|
|
96
|
-
# Non-interactive mode
|
|
97
|
-
endpoint = args.endpoint
|
|
98
|
-
cato_token = getattr(args, 'cato_token', None)
|
|
99
|
-
account_id = getattr(args, 'account_id', None)
|
|
100
|
-
|
|
101
|
-
# Validate required fields
|
|
102
|
-
if not cato_token or not account_id:
|
|
103
|
-
current_config = pm.get_profile_config(profile_name) or {}
|
|
104
|
-
if not cato_token:
|
|
105
|
-
cato_token = current_config.get('cato_token')
|
|
106
|
-
if not account_id:
|
|
107
|
-
account_id = current_config.get('account_id')
|
|
108
|
-
|
|
109
|
-
if not cato_token:
|
|
110
|
-
print("ERROR: Cato API token is required")
|
|
111
|
-
return [{"success": False, "error": "Missing cato_token"}]
|
|
112
|
-
|
|
113
|
-
if not account_id:
|
|
114
|
-
print("ERROR: Account ID is required")
|
|
115
|
-
return [{"success": False, "error": "Missing account_id"}]
|
|
116
|
-
|
|
117
|
-
# Set default endpoint if not provided
|
|
118
|
-
if not endpoint:
|
|
119
|
-
endpoint = pm.default_endpoint
|
|
120
|
-
|
|
121
|
-
# Test credentials before saving (unless validation is skipped)
|
|
122
|
-
if hasattr(args, 'skip_validation') and args.skip_validation:
|
|
123
|
-
print("⚠️ Skipping credential validation")
|
|
124
|
-
else:
|
|
125
|
-
is_valid, error_message = test_credentials(endpoint, cato_token, account_id)
|
|
126
|
-
if not is_valid:
|
|
127
|
-
print(f"ERROR: {error_message}")
|
|
128
|
-
print("Profile not saved. Please check your credentials and try again.")
|
|
129
|
-
print("(Use --skip-validation to save without testing)")
|
|
130
|
-
return [{"success": False, "error": f"Credential validation failed: {error_message}"}]
|
|
131
|
-
|
|
132
|
-
# Create the profile
|
|
133
|
-
success = pm.create_profile(
|
|
134
|
-
profile_name=profile_name,
|
|
135
|
-
endpoint=endpoint,
|
|
136
|
-
cato_token=cato_token,
|
|
137
|
-
account_id=account_id
|
|
138
|
-
)
|
|
139
|
-
|
|
140
|
-
if success:
|
|
141
|
-
print(f"Profile '{profile_name}' configured successfully!")
|
|
142
|
-
if profile_name == 'default' or len(pm.list_profiles()) == 1:
|
|
143
|
-
pm.set_current_profile(profile_name)
|
|
144
|
-
print(f"Set '{profile_name}' as the active profile")
|
|
145
|
-
else:
|
|
146
|
-
print(f"Failed to configure profile '{profile_name}'")
|
|
147
|
-
return [{"success": False, "error": "Failed to create profile"}]
|
|
148
|
-
|
|
149
|
-
return [{"success": True, "profile": profile_name}]
|
|
150
|
-
|
|
151
|
-
except KeyboardInterrupt:
|
|
152
|
-
print("\nOperation cancelled")
|
|
153
|
-
return [{"success": False, "error": "Operation cancelled by user"}]
|
|
154
|
-
except Exception as e:
|
|
155
|
-
print(f"ERROR: {e}")
|
|
156
|
-
return [{"success": False, "error": str(e)}]
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
def list_profiles(args, configuration=None):
|
|
160
|
-
"""List all configured profiles"""
|
|
161
|
-
pm = get_profile_manager()
|
|
162
|
-
|
|
163
|
-
try:
|
|
164
|
-
profiles = pm.list_profiles()
|
|
165
|
-
current_profile = pm.get_current_profile()
|
|
166
|
-
|
|
167
|
-
if not profiles:
|
|
168
|
-
print("No profiles configured.")
|
|
169
|
-
print("Run 'catocli configure set' to create your first profile.")
|
|
170
|
-
return [{"success": True, "profiles": []}]
|
|
171
|
-
|
|
172
|
-
print("Available profiles:")
|
|
173
|
-
print()
|
|
174
|
-
|
|
175
|
-
for profile in profiles:
|
|
176
|
-
is_current = profile == current_profile
|
|
177
|
-
status = " (current)" if is_current else ""
|
|
178
|
-
|
|
179
|
-
config = pm.get_profile_config(profile)
|
|
180
|
-
endpoint = config.get('endpoint', 'N/A')
|
|
181
|
-
account_id = config.get('account_id', 'N/A')
|
|
182
|
-
|
|
183
|
-
print(f" {profile}{status}")
|
|
184
|
-
print(f" Endpoint: {endpoint}")
|
|
185
|
-
print(f" Account ID: {account_id}")
|
|
186
|
-
print()
|
|
187
|
-
|
|
188
|
-
return [{"success": True, "profiles": profiles, "current": current_profile}]
|
|
189
|
-
|
|
190
|
-
except Exception as e:
|
|
191
|
-
print(f"ERROR: {e}")
|
|
192
|
-
return [{"success": False, "error": str(e)}]
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
def set_profile(args, configuration=None):
|
|
196
|
-
"""Set the active profile"""
|
|
197
|
-
pm = get_profile_manager()
|
|
198
|
-
profile_name = args.profile
|
|
199
|
-
|
|
200
|
-
try:
|
|
201
|
-
# Check if profile exists
|
|
202
|
-
if profile_name not in pm.list_profiles():
|
|
203
|
-
print(f"ERROR: Profile '{profile_name}' does not exist.")
|
|
204
|
-
print("Available profiles:")
|
|
205
|
-
for p in pm.list_profiles():
|
|
206
|
-
print(f" {p}")
|
|
207
|
-
return [{"success": False, "error": "Profile not found"}]
|
|
208
|
-
|
|
209
|
-
# Validate profile has required credentials
|
|
210
|
-
is_valid, message = pm.validate_profile(profile_name)
|
|
211
|
-
if not is_valid:
|
|
212
|
-
print(f"ERROR: {message}")
|
|
213
|
-
print(f"Run 'catocli configure set --profile {profile_name}' to update the profile.")
|
|
214
|
-
return [{"success": False, "error": message}]
|
|
215
|
-
|
|
216
|
-
# Set as current profile
|
|
217
|
-
pm.set_current_profile(profile_name)
|
|
218
|
-
print(f"Switched to profile '{profile_name}'")
|
|
219
|
-
|
|
220
|
-
return [{"success": True, "profile": profile_name}]
|
|
221
|
-
|
|
222
|
-
except Exception as e:
|
|
223
|
-
print(f"ERROR: {e}")
|
|
224
|
-
return [{"success": False, "error": str(e)}]
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
def show_profile(args, configuration=None):
|
|
228
|
-
"""Show current profile configuration"""
|
|
229
|
-
pm = get_profile_manager()
|
|
230
|
-
|
|
231
|
-
try:
|
|
232
|
-
profile_name = args.profile if hasattr(args, 'profile') and args.profile else pm.get_current_profile()
|
|
233
|
-
|
|
234
|
-
# Check if profile exists
|
|
235
|
-
config = pm.get_profile_config(profile_name)
|
|
236
|
-
if not config:
|
|
237
|
-
print(f"Profile '{profile_name}' not found.")
|
|
238
|
-
return [{"success": False, "error": "Profile not found"}]
|
|
239
|
-
|
|
240
|
-
print(f"Profile: {profile_name}")
|
|
241
|
-
print(f"Endpoint: {config.get('endpoint', 'N/A')}")
|
|
242
|
-
print(f"Account ID: {config.get('account_id', 'N/A')}")
|
|
243
|
-
|
|
244
|
-
# Show token status without revealing it
|
|
245
|
-
token = config.get('cato_token', '')
|
|
246
|
-
if token:
|
|
247
|
-
print(f"Token: ****{token[-4:]} (configured)")
|
|
248
|
-
else:
|
|
249
|
-
print("Token: (not configured)")
|
|
250
|
-
|
|
251
|
-
# Show if this is the current profile
|
|
252
|
-
current_profile = pm.get_current_profile()
|
|
253
|
-
if profile_name == current_profile:
|
|
254
|
-
print("Status: Current active profile")
|
|
255
|
-
else:
|
|
256
|
-
print(f"Status: Available (current: {current_profile})")
|
|
257
|
-
|
|
258
|
-
# Create masked config for JSON output
|
|
259
|
-
masked_config = config.copy()
|
|
260
|
-
if masked_config.get('cato_token'):
|
|
261
|
-
masked_config['cato_token'] = f"****{masked_config['cato_token'][-4:]}"
|
|
262
|
-
|
|
263
|
-
return [{"success": True, "profile": profile_name, "config": masked_config}]
|
|
264
|
-
|
|
265
|
-
except Exception as e:
|
|
266
|
-
print(f"ERROR: {e}")
|
|
267
|
-
return [{"success": False, "error": str(e)}]
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
def delete_profile(args, configuration=None):
|
|
271
|
-
"""Delete a profile"""
|
|
272
|
-
pm = get_profile_manager()
|
|
273
|
-
profile_name = args.profile
|
|
274
|
-
|
|
275
|
-
try:
|
|
276
|
-
# Check if profile exists
|
|
277
|
-
if profile_name not in pm.list_profiles():
|
|
278
|
-
print(f"Profile '{profile_name}' does not exist.")
|
|
279
|
-
return [{"success": False, "error": "Profile not found"}]
|
|
280
|
-
|
|
281
|
-
# Check if it's the current profile
|
|
282
|
-
current_profile = pm.get_current_profile()
|
|
283
|
-
if profile_name == current_profile:
|
|
284
|
-
print(f"Cannot delete the current active profile '{profile_name}'.")
|
|
285
|
-
print("Switch to another profile first using 'catocli configure use <profile>'")
|
|
286
|
-
return [{"success": False, "error": "Cannot delete active profile"}]
|
|
287
|
-
|
|
288
|
-
# Confirm deletion unless forced
|
|
289
|
-
if not args.force:
|
|
290
|
-
response = input(f"Are you sure you want to delete profile '{profile_name}'? (y/N): ").strip().lower()
|
|
291
|
-
if response != 'y':
|
|
292
|
-
print("Deletion cancelled.")
|
|
293
|
-
return [{"success": False, "error": "Deletion cancelled by user"}]
|
|
294
|
-
|
|
295
|
-
# Delete the profile
|
|
296
|
-
success = pm.delete_profile(profile_name)
|
|
297
|
-
if success:
|
|
298
|
-
print(f"Profile '{profile_name}' deleted successfully.")
|
|
299
|
-
else:
|
|
300
|
-
print(f"Failed to delete profile '{profile_name}'.")
|
|
301
|
-
return [{"success": False, "error": "Failed to delete profile"}]
|
|
302
|
-
|
|
303
|
-
return [{"success": True, "deleted_profile": profile_name}]
|
|
304
|
-
|
|
305
|
-
except Exception as e:
|
|
306
|
-
print(f"ERROR: {e}")
|
|
307
|
-
return [{"success": False, "error": str(e)}]
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import catocli.parsers.custom.customLib as customLib
|
|
3
|
-
from catocli.parsers.custom.export_rules import export_rules_parse
|
|
4
|
-
from catocli.parsers.custom.import_rules_to_tf import rule_import_parse
|
|
5
|
-
from catocli.parsers.custom.import_sites_to_tf import site_import_parse
|
|
6
|
-
from catocli.parsers.configure import configure_parse
|
|
7
|
-
from catocli.parsers.custom.export_sites import export_sites_parse
|
|
8
|
-
|
|
9
|
-
def custom_parse(subparsers):
|
|
10
|
-
entityTypes = ["account","admin","allocatedIP","any","availablePooledUsage","availableSiteUsage","dhcpRelayGroup","groupSubscription","host","lanFirewall","localRouting","location","mailingListSubscription","networkInterface","portProtocol","simpleService","site","siteRange","timezone","vpnUser","webhookSubscription"]
|
|
11
|
-
entity_parser = subparsers.add_parser('entity', help='Entity Lookup', usage='catocli entity <operationName> [options]')
|
|
12
|
-
entity_subparsers = entity_parser.add_subparsers(description='valid subcommands', help='additional help')
|
|
13
|
-
|
|
14
|
-
for entity in entityTypes:
|
|
15
|
-
item_parser = entity_subparsers.add_parser(entity, help="entityLookup() for type: "+entity, usage='catocli entity '+entity+' <operationName> [options]')
|
|
16
|
-
item_subparsers = item_parser.add_subparsers(description='valid subcommands', help='additional help')
|
|
17
|
-
|
|
18
|
-
item_list_parser = item_subparsers.add_parser('list',
|
|
19
|
-
help='entity'+entity+' list',
|
|
20
|
-
usage=get_help_custom("entity_"+entity+"_list"))
|
|
21
|
-
|
|
22
|
-
item_list_parser.add_argument('-accountID', help='The Account ID.')
|
|
23
|
-
item_list_parser.add_argument('-s', help='Search string', default='', nargs='?')
|
|
24
|
-
item_list_parser.add_argument('-f', default="csv", choices=["json","csv"], nargs='?',
|
|
25
|
-
help='Specify format for output')
|
|
26
|
-
item_list_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
27
|
-
help='Print test request preview without sending api call')
|
|
28
|
-
item_list_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
29
|
-
help='Verbose output')
|
|
30
|
-
item_list_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
31
|
-
help='Pretty print')
|
|
32
|
-
|
|
33
|
-
item_list_parser.set_defaults(func=customLib.entityTypeList,operation_name=entity)
|
|
34
|
-
|
|
35
|
-
# Add additional custom parsers here
|
|
36
|
-
export_rules_parse(subparsers)
|
|
37
|
-
import_parser = rule_import_parse(subparsers)
|
|
38
|
-
site_import_parse(subparsers, import_parser)
|
|
39
|
-
configure_parse(subparsers)
|
|
40
|
-
|
|
41
|
-
def get_help_custom(path):
|
|
42
|
-
matchCmd = "catocli "+path.replace("_"," ")
|
|
43
|
-
import os
|
|
44
|
-
pwd = os.path.dirname(__file__)
|
|
45
|
-
abs_path = os.path.join(pwd, "README.md")
|
|
46
|
-
new_line = "\nEXAMPLES:\n"
|
|
47
|
-
lines = open(abs_path, "r").readlines()
|
|
48
|
-
for line in lines:
|
|
49
|
-
if f"{matchCmd}" in line:
|
|
50
|
-
clean_line = line.replace("<br /><br />", "").replace("`","")
|
|
51
|
-
new_line += f"{clean_line}\n"
|
|
52
|
-
# matchArg = path.replace("_",".")
|
|
53
|
-
# for line in lines:
|
|
54
|
-
# if f"`{matchArg}" in line:
|
|
55
|
-
# clean_line = line.replace("<br /><br />", "").replace("`","")
|
|
56
|
-
# new_line += f"{clean_line}\n"
|
|
57
|
-
return new_line
|