catocli 1.0.4__py3-none-any.whl → 1.0.5__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.
- build/lib/catocli/Utils/clidriver.py +103 -0
- build/lib/catocli/__init__.py +2 -0
- build/lib/catocli/__main__.py +12 -0
- build/lib/catocli/parsers/custom/__init__.py +42 -0
- build/lib/catocli/parsers/custom/customLib.py +71 -0
- build/lib/catocli/parsers/mutation_admin/__init__.py +51 -0
- build/lib/catocli/parsers/mutation_container/__init__.py +23 -0
- build/lib/catocli/parsers/mutation_policy/__init__.py +357 -0
- build/lib/catocli/parsers/mutation_site/__init__.py +219 -0
- build/lib/catocli/parsers/mutation_sites/__init__.py +219 -0
- build/lib/catocli/parsers/parserApiClient.py +312 -0
- build/lib/catocli/parsers/query_accountBySubdomain/__init__.py +17 -0
- build/lib/catocli/parsers/query_accountMetrics/__init__.py +17 -0
- build/lib/catocli/parsers/query_accountRoles/__init__.py +17 -0
- build/lib/catocli/parsers/query_accountSnapshot/__init__.py +17 -0
- build/lib/catocli/parsers/query_admin/__init__.py +17 -0
- build/lib/catocli/parsers/query_admins/__init__.py +17 -0
- build/lib/catocli/parsers/query_appStats/__init__.py +17 -0
- build/lib/catocli/parsers/query_appStatsTimeSeries/__init__.py +17 -0
- build/lib/catocli/parsers/query_auditFeed/__init__.py +17 -0
- build/lib/catocli/parsers/query_container/__init__.py +17 -0
- build/lib/catocli/parsers/query_entityLookup/__init__.py +17 -0
- build/lib/catocli/parsers/query_events/__init__.py +17 -0
- build/lib/catocli/parsers/query_eventsFeed/__init__.py +17 -0
- build/lib/catocli/parsers/query_eventsTimeSeries/__init__.py +17 -0
- build/lib/catocli/parsers/query_hardwareManagement/__init__.py +17 -0
- build/lib/catocli/parsers/query_licensing/__init__.py +17 -0
- build/lib/catocli/parsers/query_policy/__init__.py +17 -0
- build/lib/catocli/parsers/query_siteLocation/__init__.py +17 -0
- build/lib/catocli/parsers/query_subDomains/__init__.py +17 -0
- build/lib/catocli/parsers/query_xdr/__init__.py +37 -0
- build/lib/catocli/parsers/raw/__init__.py +9 -0
- build/lib/graphql_client/__init__.py +11 -0
- build/lib/graphql_client/api/__init__.py +3 -0
- build/lib/graphql_client/api/call_api.py +73 -0
- build/lib/graphql_client/api_client.py +192 -0
- build/lib/graphql_client/api_client_types.py +404 -0
- build/lib/graphql_client/configuration.py +230 -0
- build/lib/graphql_client/models/__init__.py +13 -0
- build/lib/graphql_client/models/no_schema.py +71 -0
- build/lib/schema/catolib.py +1002 -0
- build/lib/schema/importSchema.py +60 -0
- build/lib/vendor/certifi/__init__.py +4 -0
- build/lib/vendor/certifi/__main__.py +12 -0
- build/lib/vendor/certifi/core.py +114 -0
- build/lib/vendor/certifi/py.typed +0 -0
- build/lib/vendor/six.py +998 -0
- build/lib/vendor/urllib3/__init__.py +211 -0
- build/lib/vendor/urllib3/_base_connection.py +172 -0
- build/lib/vendor/urllib3/_collections.py +483 -0
- build/lib/vendor/urllib3/_request_methods.py +278 -0
- build/lib/vendor/urllib3/_version.py +16 -0
- build/lib/vendor/urllib3/connection.py +1033 -0
- build/lib/vendor/urllib3/connectionpool.py +1182 -0
- build/lib/vendor/urllib3/contrib/__init__.py +0 -0
- build/lib/vendor/urllib3/contrib/emscripten/__init__.py +18 -0
- build/lib/vendor/urllib3/contrib/emscripten/connection.py +254 -0
- build/lib/vendor/urllib3/contrib/emscripten/fetch.py +418 -0
- build/lib/vendor/urllib3/contrib/emscripten/request.py +22 -0
- build/lib/vendor/urllib3/contrib/emscripten/response.py +285 -0
- build/lib/vendor/urllib3/contrib/pyopenssl.py +552 -0
- build/lib/vendor/urllib3/contrib/socks.py +228 -0
- build/lib/vendor/urllib3/exceptions.py +321 -0
- build/lib/vendor/urllib3/fields.py +341 -0
- build/lib/vendor/urllib3/filepost.py +89 -0
- build/lib/vendor/urllib3/http2/__init__.py +53 -0
- build/lib/vendor/urllib3/http2/connection.py +356 -0
- build/lib/vendor/urllib3/http2/probe.py +87 -0
- build/lib/vendor/urllib3/poolmanager.py +637 -0
- build/lib/vendor/urllib3/py.typed +2 -0
- build/lib/vendor/urllib3/response.py +1265 -0
- build/lib/vendor/urllib3/util/__init__.py +42 -0
- build/lib/vendor/urllib3/util/connection.py +137 -0
- build/lib/vendor/urllib3/util/proxy.py +43 -0
- build/lib/vendor/urllib3/util/request.py +256 -0
- build/lib/vendor/urllib3/util/response.py +101 -0
- build/lib/vendor/urllib3/util/retry.py +533 -0
- build/lib/vendor/urllib3/util/ssl_.py +513 -0
- build/lib/vendor/urllib3/util/ssl_match_hostname.py +159 -0
- build/lib/vendor/urllib3/util/ssltransport.py +276 -0
- build/lib/vendor/urllib3/util/timeout.py +275 -0
- build/lib/vendor/urllib3/util/url.py +471 -0
- build/lib/vendor/urllib3/util/util.py +42 -0
- build/lib/vendor/urllib3/util/wait.py +124 -0
- catocli/__init__.py +1 -1
- catocli/parsers/parserApiClient.py +7 -4
- {catocli-1.0.4.dist-info → catocli-1.0.5.dist-info}/METADATA +1 -1
- {catocli-1.0.4.dist-info → catocli-1.0.5.dist-info}/RECORD +92 -8
- {catocli-1.0.4.dist-info → catocli-1.0.5.dist-info}/top_level.txt +1 -0
- {catocli-1.0.4.dist-info → catocli-1.0.5.dist-info}/LICENSE +0 -0
- {catocli-1.0.4.dist-info → catocli-1.0.5.dist-info}/WHEEL +0 -0
- {catocli-1.0.4.dist-info → catocli-1.0.5.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_appStats_parse(query_subparsers):
|
|
5
|
+
query_appStats_parser = query_subparsers.add_parser('appStats',
|
|
6
|
+
help='appStats() query operation',
|
|
7
|
+
usage=get_help("query_appStats"))
|
|
8
|
+
|
|
9
|
+
query_appStats_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_appStats_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_appStats_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_appStats_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_appStats_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_appStats_parser.set_defaults(func=createRequest,operation_name='query.appStats')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_appStatsTimeSeries_parse(query_subparsers):
|
|
5
|
+
query_appStatsTimeSeries_parser = query_subparsers.add_parser('appStatsTimeSeries',
|
|
6
|
+
help='appStatsTimeSeries() query operation',
|
|
7
|
+
usage=get_help("query_appStatsTimeSeries"))
|
|
8
|
+
|
|
9
|
+
query_appStatsTimeSeries_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_appStatsTimeSeries_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_appStatsTimeSeries_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_appStatsTimeSeries_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_appStatsTimeSeries_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_appStatsTimeSeries_parser.set_defaults(func=createRequest,operation_name='query.appStatsTimeSeries')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_auditFeed_parse(query_subparsers):
|
|
5
|
+
query_auditFeed_parser = query_subparsers.add_parser('auditFeed',
|
|
6
|
+
help='auditFeed() query operation',
|
|
7
|
+
usage=get_help("query_auditFeed"))
|
|
8
|
+
|
|
9
|
+
query_auditFeed_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_auditFeed_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_auditFeed_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_auditFeed_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_auditFeed_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_auditFeed_parser.set_defaults(func=createRequest,operation_name='query.auditFeed')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_container_parse(query_subparsers):
|
|
5
|
+
query_container_parser = query_subparsers.add_parser('container',
|
|
6
|
+
help='container() query operation',
|
|
7
|
+
usage=get_help("query_container"))
|
|
8
|
+
|
|
9
|
+
query_container_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_container_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_container_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_container_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_container_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_container_parser.set_defaults(func=createRequest,operation_name='query.container')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_entityLookup_parse(query_subparsers):
|
|
5
|
+
query_entityLookup_parser = query_subparsers.add_parser('entityLookup',
|
|
6
|
+
help='entityLookup() query operation',
|
|
7
|
+
usage=get_help("query_entityLookup"))
|
|
8
|
+
|
|
9
|
+
query_entityLookup_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_entityLookup_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_entityLookup_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_entityLookup_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_entityLookup_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_entityLookup_parser.set_defaults(func=createRequest,operation_name='query.entityLookup')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_events_parse(query_subparsers):
|
|
5
|
+
query_events_parser = query_subparsers.add_parser('events',
|
|
6
|
+
help='events() query operation',
|
|
7
|
+
usage=get_help("query_events"))
|
|
8
|
+
|
|
9
|
+
query_events_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_events_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_events_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_events_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_events_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_events_parser.set_defaults(func=createRequest,operation_name='query.events')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_eventsFeed_parse(query_subparsers):
|
|
5
|
+
query_eventsFeed_parser = query_subparsers.add_parser('eventsFeed',
|
|
6
|
+
help='eventsFeed() query operation',
|
|
7
|
+
usage=get_help("query_eventsFeed"))
|
|
8
|
+
|
|
9
|
+
query_eventsFeed_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_eventsFeed_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_eventsFeed_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_eventsFeed_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_eventsFeed_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_eventsFeed_parser.set_defaults(func=createRequest,operation_name='query.eventsFeed')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_eventsTimeSeries_parse(query_subparsers):
|
|
5
|
+
query_eventsTimeSeries_parser = query_subparsers.add_parser('eventsTimeSeries',
|
|
6
|
+
help='eventsTimeSeries() query operation',
|
|
7
|
+
usage=get_help("query_eventsTimeSeries"))
|
|
8
|
+
|
|
9
|
+
query_eventsTimeSeries_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_eventsTimeSeries_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_eventsTimeSeries_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_eventsTimeSeries_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_eventsTimeSeries_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_eventsTimeSeries_parser.set_defaults(func=createRequest,operation_name='query.eventsTimeSeries')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_hardwareManagement_parse(query_subparsers):
|
|
5
|
+
query_hardwareManagement_parser = query_subparsers.add_parser('hardwareManagement',
|
|
6
|
+
help='hardwareManagement() query operation',
|
|
7
|
+
usage=get_help("query_hardwareManagement"))
|
|
8
|
+
|
|
9
|
+
query_hardwareManagement_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_hardwareManagement_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_hardwareManagement_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_hardwareManagement_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_hardwareManagement_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_hardwareManagement_parser.set_defaults(func=createRequest,operation_name='query.hardwareManagement')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_licensing_parse(query_subparsers):
|
|
5
|
+
query_licensing_parser = query_subparsers.add_parser('licensing',
|
|
6
|
+
help='licensing() query operation',
|
|
7
|
+
usage=get_help("query_licensing"))
|
|
8
|
+
|
|
9
|
+
query_licensing_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_licensing_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_licensing_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_licensing_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_licensing_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_licensing_parser.set_defaults(func=createRequest,operation_name='query.licensing')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_policy_parse(query_subparsers):
|
|
5
|
+
query_policy_parser = query_subparsers.add_parser('policy',
|
|
6
|
+
help='policy() query operation',
|
|
7
|
+
usage=get_help("query_policy"))
|
|
8
|
+
|
|
9
|
+
query_policy_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_policy_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_policy_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_policy_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_policy_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_policy_parser.set_defaults(func=createRequest,operation_name='query.policy')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import querySiteLocation, get_help
|
|
3
|
+
|
|
4
|
+
def query_siteLocation_parse(query_subparsers):
|
|
5
|
+
query_siteLocation_parser = query_subparsers.add_parser('siteLocation',
|
|
6
|
+
help='siteLocation local cli query',
|
|
7
|
+
usage=get_help("query_siteLocation"))
|
|
8
|
+
|
|
9
|
+
query_siteLocation_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_siteLocation_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_siteLocation_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_siteLocation_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_siteLocation_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_siteLocation_parser.set_defaults(func=querySiteLocation,operation_name='query.siteLocation')
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_subDomains_parse(query_subparsers):
|
|
5
|
+
query_subDomains_parser = query_subparsers.add_parser('subDomains',
|
|
6
|
+
help='subDomains() query operation',
|
|
7
|
+
usage=get_help("query_subDomains"))
|
|
8
|
+
|
|
9
|
+
query_subDomains_parser.add_argument('accountID', help='The Account ID.')
|
|
10
|
+
query_subDomains_parser.add_argument('json', help='Variables in JSON format.')
|
|
11
|
+
query_subDomains_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
12
|
+
help='Print test request preview without sending api call')
|
|
13
|
+
query_subDomains_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
14
|
+
help='Verbose output')
|
|
15
|
+
query_subDomains_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
16
|
+
help='Pretty print')
|
|
17
|
+
query_subDomains_parser.set_defaults(func=createRequest,operation_name='query.subDomains')
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRequest, get_help
|
|
3
|
+
|
|
4
|
+
def query_xdr_parse(query_subparsers):
|
|
5
|
+
query_xdr_parser = query_subparsers.add_parser('xdr',
|
|
6
|
+
help='xdr() query operation',
|
|
7
|
+
usage=get_help("query_xdr"))
|
|
8
|
+
|
|
9
|
+
query_xdr_subparsers = query_xdr_parser.add_subparsers()
|
|
10
|
+
|
|
11
|
+
query_xdr_stories_parser = query_xdr_subparsers.add_parser('stories',
|
|
12
|
+
help='stories() xdr operation',
|
|
13
|
+
usage=get_help("query_xdr_stories"))
|
|
14
|
+
|
|
15
|
+
query_xdr_stories_parser.add_argument('accountID', help='The Account ID.')
|
|
16
|
+
query_xdr_stories_parser.add_argument('json', help='Variables in JSON format.')
|
|
17
|
+
query_xdr_stories_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
18
|
+
help='Print test request preview without sending api call')
|
|
19
|
+
query_xdr_stories_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
20
|
+
help='Verbose output')
|
|
21
|
+
query_xdr_stories_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
22
|
+
help='Pretty print')
|
|
23
|
+
query_xdr_stories_parser.set_defaults(func=createRequest,operation_name='query.xdr.stories')
|
|
24
|
+
|
|
25
|
+
query_xdr_story_parser = query_xdr_subparsers.add_parser('story',
|
|
26
|
+
help='story() xdr operation',
|
|
27
|
+
usage=get_help("query_xdr_story"))
|
|
28
|
+
|
|
29
|
+
query_xdr_story_parser.add_argument('accountID', help='The Account ID.')
|
|
30
|
+
query_xdr_story_parser.add_argument('json', help='Variables in JSON format.')
|
|
31
|
+
query_xdr_story_parser.add_argument('-t', const=True, default=False, nargs='?',
|
|
32
|
+
help='Print test request preview without sending api call')
|
|
33
|
+
query_xdr_story_parser.add_argument('-v', const=True, default=False, nargs='?',
|
|
34
|
+
help='Verbose output')
|
|
35
|
+
query_xdr_story_parser.add_argument('-p', const=True, default=False, nargs='?',
|
|
36
|
+
help='Pretty print')
|
|
37
|
+
query_xdr_story_parser.set_defaults(func=createRequest,operation_name='query.xdr.story')
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
|
|
2
|
+
from ..parserApiClient import createRawRequest, get_help
|
|
3
|
+
|
|
4
|
+
def raw_parse(raw_parser):
|
|
5
|
+
raw_parser.add_argument('json', help='Query, Variables and opertaionName in JSON format.')
|
|
6
|
+
raw_parser.add_argument('-t', const=True, default=False, nargs='?', help='Print test request preview without sending api call')
|
|
7
|
+
raw_parser.add_argument('-v', const=True, default=False, nargs='?', help='Verbose output')
|
|
8
|
+
raw_parser.add_argument('-p', const=True, default=False, nargs='?', help='Pretty print')
|
|
9
|
+
raw_parser.set_defaults(func=createRawRequest,operation_name='raw')
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
from __future__ import absolute_import
|
|
4
|
+
|
|
5
|
+
# # import api into package
|
|
6
|
+
from graphql_client.api.call_api import CallApi
|
|
7
|
+
|
|
8
|
+
# import ApiClient
|
|
9
|
+
from graphql_client.api_client_types import ApiClient
|
|
10
|
+
from graphql_client.configuration import Configuration
|
|
11
|
+
from graphql_client.models.no_schema import NoSchema
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
from __future__ import absolute_import
|
|
4
|
+
import re
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
# python 2 and python 3 compatibility library
|
|
8
|
+
import sys
|
|
9
|
+
sys.path.insert(0, 'vendor')
|
|
10
|
+
import six
|
|
11
|
+
from graphql_client.api_client_types import ApiClient
|
|
12
|
+
|
|
13
|
+
class CallApi(object):
|
|
14
|
+
def __init__(self, api_client=None):
|
|
15
|
+
if api_client is None:
|
|
16
|
+
api_client = ApiClient()
|
|
17
|
+
self.api_client = api_client
|
|
18
|
+
|
|
19
|
+
def call_api(self, body, args, **kwargs): # noqa: E501
|
|
20
|
+
(data) = self.call_api_with_http_info(body, args, **kwargs) # noqa: E501
|
|
21
|
+
return data
|
|
22
|
+
|
|
23
|
+
def call_api_with_http_info(self, body, args, **kwargs): # noqa: E501
|
|
24
|
+
all_params = ['body', 'sync_type'] # noqa: E501
|
|
25
|
+
all_params.append('async_req')
|
|
26
|
+
if args.get("v")==True:
|
|
27
|
+
all_params.append('_return_http_data_only')
|
|
28
|
+
all_params.append('_preload_content')
|
|
29
|
+
all_params.append('_request_timeout')
|
|
30
|
+
|
|
31
|
+
params = locals()
|
|
32
|
+
for key, val in six.iteritems(params['kwargs']):
|
|
33
|
+
if key not in all_params:
|
|
34
|
+
raise TypeError(
|
|
35
|
+
"Got an unexpected keyword argument '%s'"
|
|
36
|
+
" to method create_asset4" % key
|
|
37
|
+
)
|
|
38
|
+
params[key] = val
|
|
39
|
+
del params['kwargs']
|
|
40
|
+
|
|
41
|
+
if ('body' not in params or params['body'] is None):
|
|
42
|
+
raise ValueError("Missing the required parameter `body` when calling `create_asset4`")
|
|
43
|
+
|
|
44
|
+
collection_formats = {}
|
|
45
|
+
|
|
46
|
+
header_params = {}
|
|
47
|
+
|
|
48
|
+
form_params = []
|
|
49
|
+
local_var_files = {}
|
|
50
|
+
|
|
51
|
+
body_params = None
|
|
52
|
+
if 'body' in params:
|
|
53
|
+
body_params = params['body']
|
|
54
|
+
header_params['Accept'] = self.api_client.select_header_accept(['application/json'])
|
|
55
|
+
header_params['Content-Type'] = self.api_client.select_header_content_type(['application/json'])
|
|
56
|
+
header_params['x-api-key'] = self.api_client.configuration.api_key['x-api-key']
|
|
57
|
+
header_params['User-Agent'] = "Cato-CLI-v"+self.api_client.configuration.version
|
|
58
|
+
|
|
59
|
+
if args.get("v")==True:
|
|
60
|
+
print("Host: ",self.api_client.configuration.host)
|
|
61
|
+
print("Request Headers:",json.dumps(header_params,indent=4,sort_keys=True))
|
|
62
|
+
print("Request Data:",json.dumps(body_params,indent=4,sort_keys=True),"\n\n")
|
|
63
|
+
|
|
64
|
+
return self.api_client.call_api(
|
|
65
|
+
header_params,
|
|
66
|
+
body=body_params,
|
|
67
|
+
files=local_var_files,
|
|
68
|
+
response_type="NoSchema", # noqa: E501
|
|
69
|
+
async_req=params.get('async_req'),
|
|
70
|
+
_return_http_data_only=params.get('_return_http_data_only'),
|
|
71
|
+
_preload_content=params.get('_preload_content', True),
|
|
72
|
+
_request_timeout=params.get('_request_timeout'),
|
|
73
|
+
collection_formats=collection_formats)
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
from __future__ import absolute_import
|
|
4
|
+
|
|
5
|
+
import io
|
|
6
|
+
import json
|
|
7
|
+
import logging
|
|
8
|
+
import re
|
|
9
|
+
import ssl
|
|
10
|
+
|
|
11
|
+
# python 2 and python 3 compatibility library
|
|
12
|
+
import sys
|
|
13
|
+
sys.path.insert(0, 'vendor')
|
|
14
|
+
import certifi
|
|
15
|
+
import six
|
|
16
|
+
from six.moves.urllib.parse import urlencode
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
import urllib3
|
|
20
|
+
except ImportError:
|
|
21
|
+
raise ImportError('GraphQL python client requires urllib3.')
|
|
22
|
+
|
|
23
|
+
logger = logging.getLogger(__name__)
|
|
24
|
+
|
|
25
|
+
class QUERYResponse(io.IOBase):
|
|
26
|
+
|
|
27
|
+
def __init__(self, resp):
|
|
28
|
+
self.urllib3_response = resp
|
|
29
|
+
self.status = resp.status
|
|
30
|
+
self.reason = resp.reason
|
|
31
|
+
self.data = resp.data
|
|
32
|
+
|
|
33
|
+
def getheaders(self):
|
|
34
|
+
"""Returns a dictionary of the response headers."""
|
|
35
|
+
return self.urllib3_response.getheaders()
|
|
36
|
+
|
|
37
|
+
def getheader(self, name, default=None):
|
|
38
|
+
"""Returns a given response header."""
|
|
39
|
+
return self.urllib3_response.getheader(name, default)
|
|
40
|
+
|
|
41
|
+
class QUERYClientObject(object):
|
|
42
|
+
|
|
43
|
+
def __init__(self, configuration, pools_size=4, maxsize=None):
|
|
44
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
|
45
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
|
46
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
|
47
|
+
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
|
|
48
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
|
49
|
+
|
|
50
|
+
# cert_reqs
|
|
51
|
+
if configuration.verify_ssl:
|
|
52
|
+
cert_reqs = ssl.CERT_REQUIRED
|
|
53
|
+
else:
|
|
54
|
+
cert_reqs = ssl.CERT_NONE
|
|
55
|
+
|
|
56
|
+
# ca_certs
|
|
57
|
+
if configuration.ssl_ca_cert:
|
|
58
|
+
ca_certs = configuration.ssl_ca_cert
|
|
59
|
+
else:
|
|
60
|
+
# if not set certificate file, use Mozilla's root certificates.
|
|
61
|
+
ca_certs = certifi.where()
|
|
62
|
+
|
|
63
|
+
addition_pool_args = {}
|
|
64
|
+
if configuration.assert_hostname is not None:
|
|
65
|
+
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
|
|
66
|
+
|
|
67
|
+
if maxsize is None:
|
|
68
|
+
if configuration.connection_pool_maxsize is not None:
|
|
69
|
+
maxsize = configuration.connection_pool_maxsize
|
|
70
|
+
else:
|
|
71
|
+
maxsize = 4
|
|
72
|
+
|
|
73
|
+
# https pool manager
|
|
74
|
+
if configuration.proxy:
|
|
75
|
+
self.pool_manager = urllib3.ProxyManager(
|
|
76
|
+
num_pools=pools_size,
|
|
77
|
+
maxsize=maxsize,
|
|
78
|
+
cert_reqs=cert_reqs,
|
|
79
|
+
ca_certs=ca_certs,
|
|
80
|
+
cert_file=configuration.cert_file,
|
|
81
|
+
key_file=configuration.key_file,
|
|
82
|
+
proxy_url=configuration.proxy,
|
|
83
|
+
**addition_pool_args
|
|
84
|
+
)
|
|
85
|
+
else:
|
|
86
|
+
self.pool_manager = urllib3.PoolManager(
|
|
87
|
+
num_pools=pools_size,
|
|
88
|
+
maxsize=maxsize,
|
|
89
|
+
cert_reqs=cert_reqs,
|
|
90
|
+
ca_certs=ca_certs,
|
|
91
|
+
cert_file=configuration.cert_file,
|
|
92
|
+
key_file=configuration.key_file,
|
|
93
|
+
**addition_pool_args
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
def request(self, method, url, headers=None,
|
|
97
|
+
body=None, _preload_content=True,
|
|
98
|
+
_request_timeout=None):
|
|
99
|
+
"""Perform requests.
|
|
100
|
+
:param headers: http request headers
|
|
101
|
+
:param body: request json body, for `application/json`
|
|
102
|
+
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
|
103
|
+
be returned without reading/decoding response
|
|
104
|
+
data. Default is True.
|
|
105
|
+
:param _request_timeout: timeout setting for this request. If one
|
|
106
|
+
number provided, it will be total request
|
|
107
|
+
timeout. It can also be a pair (tuple) of
|
|
108
|
+
(connection, read) timeouts.
|
|
109
|
+
"""
|
|
110
|
+
method = method.upper()
|
|
111
|
+
assert method in ['POST']
|
|
112
|
+
headers = headers or {}
|
|
113
|
+
|
|
114
|
+
timeout = None
|
|
115
|
+
if _request_timeout:
|
|
116
|
+
if isinstance(_request_timeout, (int, ) if six.PY3 else (int, long)): # noqa: E501,F821
|
|
117
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
|
118
|
+
elif (isinstance(_request_timeout, tuple) and
|
|
119
|
+
len(_request_timeout) == 2):
|
|
120
|
+
timeout = urllib3.Timeout(
|
|
121
|
+
connect=_request_timeout[0], read=_request_timeout[1])
|
|
122
|
+
|
|
123
|
+
if 'Content-Type' not in headers:
|
|
124
|
+
headers['Content-Type'] = 'application/json'
|
|
125
|
+
|
|
126
|
+
try:
|
|
127
|
+
if re.search('json', headers['Content-Type'], re.IGNORECASE):
|
|
128
|
+
try:
|
|
129
|
+
r = self.pool_manager.request( method=method, url=url,
|
|
130
|
+
body=json.dumps(body),
|
|
131
|
+
preload_content=_preload_content,
|
|
132
|
+
timeout=timeout,
|
|
133
|
+
headers=headers)
|
|
134
|
+
except Exception as e:
|
|
135
|
+
# remove the restriction for raw
|
|
136
|
+
print("ERROR: ",e)
|
|
137
|
+
exit()
|
|
138
|
+
|
|
139
|
+
else:
|
|
140
|
+
# Cannot generate the request from given parameters
|
|
141
|
+
msg = """Cannot prepare a request message for provided
|
|
142
|
+
arguments. Please check that your arguments match
|
|
143
|
+
declared content type."""
|
|
144
|
+
raise ApiException(status=0, reason=msg)
|
|
145
|
+
|
|
146
|
+
except urllib3.exceptions.SSLError as e:
|
|
147
|
+
msg = "{0}\n{1}".format(type(e).__name__, str(e))
|
|
148
|
+
raise ApiException(status=0, reason=msg)
|
|
149
|
+
|
|
150
|
+
if _preload_content:
|
|
151
|
+
r = QUERYResponse(r)
|
|
152
|
+
|
|
153
|
+
# log response body
|
|
154
|
+
logger.debug("response body: %s", r.data)
|
|
155
|
+
|
|
156
|
+
if not 200 <= r.status <= 299:
|
|
157
|
+
raise ApiException(http_resp=r)
|
|
158
|
+
|
|
159
|
+
return r
|
|
160
|
+
|
|
161
|
+
def POST(self, url, headers=None, body=None, _preload_content=True, _request_timeout=None):
|
|
162
|
+
return self.request("POST", url, headers=headers,
|
|
163
|
+
_preload_content=_preload_content,
|
|
164
|
+
_request_timeout=_request_timeout,
|
|
165
|
+
body=body)
|
|
166
|
+
|
|
167
|
+
class ApiException(Exception):
|
|
168
|
+
|
|
169
|
+
def __init__(self, status=None, reason=None, http_resp=None):
|
|
170
|
+
if http_resp:
|
|
171
|
+
self.status = http_resp.status
|
|
172
|
+
self.reason = http_resp.reason
|
|
173
|
+
self.body = http_resp.data
|
|
174
|
+
self.headers = http_resp.getheaders()
|
|
175
|
+
else:
|
|
176
|
+
self.status = status
|
|
177
|
+
self.reason = reason
|
|
178
|
+
self.body = None
|
|
179
|
+
self.headers = None
|
|
180
|
+
|
|
181
|
+
def __str__(self):
|
|
182
|
+
"""Custom error messages for exception"""
|
|
183
|
+
if self.body:
|
|
184
|
+
# error_message += "HTTP response body:\n{}".format(self.body.decode('utf8'))
|
|
185
|
+
return self.body.decode('utf8')
|
|
186
|
+
else:
|
|
187
|
+
error_message = "({0})\n"\
|
|
188
|
+
"Reason: {1}\n".format(self.status, self.reason)
|
|
189
|
+
if self.headers:
|
|
190
|
+
error_message += "HTTP response headers: {0}\n".format(
|
|
191
|
+
self.headers)
|
|
192
|
+
|