catocli 1.0.5__py3-none-any.whl → 1.0.7__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.

Files changed (96) hide show
  1. catocli/Utils/clidriver.py +2 -2
  2. catocli/__init__.py +1 -1
  3. catocli/parsers/custom/README.md +288 -8
  4. catocli/parsers/custom/__init__.py +24 -19
  5. catocli/parsers/custom/customLib.py +1 -1
  6. {catocli-1.0.5.dist-info → catocli-1.0.7.dist-info}/METADATA +1 -1
  7. {catocli-1.0.5.dist-info → catocli-1.0.7.dist-info}/RECORD +12 -96
  8. {catocli-1.0.5.dist-info → catocli-1.0.7.dist-info}/top_level.txt +0 -1
  9. schema/catolib.py +2 -2
  10. build/lib/catocli/Utils/clidriver.py +0 -103
  11. build/lib/catocli/__init__.py +0 -2
  12. build/lib/catocli/__main__.py +0 -12
  13. build/lib/catocli/parsers/custom/__init__.py +0 -42
  14. build/lib/catocli/parsers/custom/customLib.py +0 -71
  15. build/lib/catocli/parsers/mutation_admin/__init__.py +0 -51
  16. build/lib/catocli/parsers/mutation_container/__init__.py +0 -23
  17. build/lib/catocli/parsers/mutation_policy/__init__.py +0 -357
  18. build/lib/catocli/parsers/mutation_site/__init__.py +0 -219
  19. build/lib/catocli/parsers/mutation_sites/__init__.py +0 -219
  20. build/lib/catocli/parsers/parserApiClient.py +0 -312
  21. build/lib/catocli/parsers/query_accountBySubdomain/__init__.py +0 -17
  22. build/lib/catocli/parsers/query_accountMetrics/__init__.py +0 -17
  23. build/lib/catocli/parsers/query_accountRoles/__init__.py +0 -17
  24. build/lib/catocli/parsers/query_accountSnapshot/__init__.py +0 -17
  25. build/lib/catocli/parsers/query_admin/__init__.py +0 -17
  26. build/lib/catocli/parsers/query_admins/__init__.py +0 -17
  27. build/lib/catocli/parsers/query_appStats/__init__.py +0 -17
  28. build/lib/catocli/parsers/query_appStatsTimeSeries/__init__.py +0 -17
  29. build/lib/catocli/parsers/query_auditFeed/__init__.py +0 -17
  30. build/lib/catocli/parsers/query_container/__init__.py +0 -17
  31. build/lib/catocli/parsers/query_entityLookup/__init__.py +0 -17
  32. build/lib/catocli/parsers/query_events/__init__.py +0 -17
  33. build/lib/catocli/parsers/query_eventsFeed/__init__.py +0 -17
  34. build/lib/catocli/parsers/query_eventsTimeSeries/__init__.py +0 -17
  35. build/lib/catocli/parsers/query_hardwareManagement/__init__.py +0 -17
  36. build/lib/catocli/parsers/query_licensing/__init__.py +0 -17
  37. build/lib/catocli/parsers/query_policy/__init__.py +0 -17
  38. build/lib/catocli/parsers/query_siteLocation/__init__.py +0 -17
  39. build/lib/catocli/parsers/query_subDomains/__init__.py +0 -17
  40. build/lib/catocli/parsers/query_xdr/__init__.py +0 -37
  41. build/lib/catocli/parsers/raw/__init__.py +0 -9
  42. build/lib/graphql_client/__init__.py +0 -11
  43. build/lib/graphql_client/api/__init__.py +0 -3
  44. build/lib/graphql_client/api/call_api.py +0 -73
  45. build/lib/graphql_client/api_client.py +0 -192
  46. build/lib/graphql_client/api_client_types.py +0 -404
  47. build/lib/graphql_client/configuration.py +0 -230
  48. build/lib/graphql_client/models/__init__.py +0 -13
  49. build/lib/graphql_client/models/no_schema.py +0 -71
  50. build/lib/schema/catolib.py +0 -1002
  51. build/lib/schema/importSchema.py +0 -60
  52. build/lib/vendor/certifi/__init__.py +0 -4
  53. build/lib/vendor/certifi/__main__.py +0 -12
  54. build/lib/vendor/certifi/core.py +0 -114
  55. build/lib/vendor/certifi/py.typed +0 -0
  56. build/lib/vendor/six.py +0 -998
  57. build/lib/vendor/urllib3/__init__.py +0 -211
  58. build/lib/vendor/urllib3/_base_connection.py +0 -172
  59. build/lib/vendor/urllib3/_collections.py +0 -483
  60. build/lib/vendor/urllib3/_request_methods.py +0 -278
  61. build/lib/vendor/urllib3/_version.py +0 -16
  62. build/lib/vendor/urllib3/connection.py +0 -1033
  63. build/lib/vendor/urllib3/connectionpool.py +0 -1182
  64. build/lib/vendor/urllib3/contrib/__init__.py +0 -0
  65. build/lib/vendor/urllib3/contrib/emscripten/__init__.py +0 -18
  66. build/lib/vendor/urllib3/contrib/emscripten/connection.py +0 -254
  67. build/lib/vendor/urllib3/contrib/emscripten/fetch.py +0 -418
  68. build/lib/vendor/urllib3/contrib/emscripten/request.py +0 -22
  69. build/lib/vendor/urllib3/contrib/emscripten/response.py +0 -285
  70. build/lib/vendor/urllib3/contrib/pyopenssl.py +0 -552
  71. build/lib/vendor/urllib3/contrib/socks.py +0 -228
  72. build/lib/vendor/urllib3/exceptions.py +0 -321
  73. build/lib/vendor/urllib3/fields.py +0 -341
  74. build/lib/vendor/urllib3/filepost.py +0 -89
  75. build/lib/vendor/urllib3/http2/__init__.py +0 -53
  76. build/lib/vendor/urllib3/http2/connection.py +0 -356
  77. build/lib/vendor/urllib3/http2/probe.py +0 -87
  78. build/lib/vendor/urllib3/poolmanager.py +0 -637
  79. build/lib/vendor/urllib3/py.typed +0 -2
  80. build/lib/vendor/urllib3/response.py +0 -1265
  81. build/lib/vendor/urllib3/util/__init__.py +0 -42
  82. build/lib/vendor/urllib3/util/connection.py +0 -137
  83. build/lib/vendor/urllib3/util/proxy.py +0 -43
  84. build/lib/vendor/urllib3/util/request.py +0 -256
  85. build/lib/vendor/urllib3/util/response.py +0 -101
  86. build/lib/vendor/urllib3/util/retry.py +0 -533
  87. build/lib/vendor/urllib3/util/ssl_.py +0 -513
  88. build/lib/vendor/urllib3/util/ssl_match_hostname.py +0 -159
  89. build/lib/vendor/urllib3/util/ssltransport.py +0 -276
  90. build/lib/vendor/urllib3/util/timeout.py +0 -275
  91. build/lib/vendor/urllib3/util/url.py +0 -471
  92. build/lib/vendor/urllib3/util/util.py +0 -42
  93. build/lib/vendor/urllib3/util/wait.py +0 -124
  94. {catocli-1.0.5.dist-info → catocli-1.0.7.dist-info}/LICENSE +0 -0
  95. {catocli-1.0.5.dist-info → catocli-1.0.7.dist-info}/WHEEL +0 -0
  96. {catocli-1.0.5.dist-info → catocli-1.0.7.dist-info}/entry_points.txt +0 -0
@@ -1,17 +0,0 @@
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')
@@ -1,37 +0,0 @@
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')
@@ -1,9 +0,0 @@
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')
@@ -1,11 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- from __future__ import absolute_import
2
-
3
- from graphql_client.api.call_api import CallApi
@@ -1,73 +0,0 @@
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)
@@ -1,192 +0,0 @@
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
-