Skip to content

Commit

Permalink
Pancloud 2.0 alpha (#135)
Browse files Browse the repository at this point in the history
* Updated LICENSE

* Update HISTORY.rst

* Update example

* Switch from path to endpoint kwarg

* Bump version to alpha2

* Bump package version to alpha2
  • Loading branch information
sserrata authored Jan 9, 2020
1 parent 6353fc9 commit 6fd8be3
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
5 changes: 5 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
History
=======

2.0.0-alpha2 (2020-01-09)
-------------------------

* Fixed invalid use of `HTTPClient` class `path` keyword arg in `Credentials`

2.0.0-alpha1 (2019-11-21)
-------------------------

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

ISC License

Copyright (c) 2018, Palo Alto Networks
Copyright (c) 2020, Palo Alto Networks

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

Expand Down
20 changes: 10 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Installation

From PyPI::

$ pip install pancloud
$ pip install pancloud==2.0.0a2

Install From GitHub
-------------------
Expand Down Expand Up @@ -86,18 +86,18 @@ Example
>>> import pancloud
>>> c = pancloud.Credentials()
>>> ls = pancloud.LoggingService(credentials=c)
>>> query = {
... "query": "SELECT * FROM panw.traffic LIMIT 1",
... "startTime": 1938869090,
... "endTime": 1938869150,
... "maxWaitTime": 10000
>>> qs = pancloud.QueryService(credentials=c)
>>> query_params = {
... "query": "SELECT * FROM `587718190.firewall.traffic` LIMIT 1",
... "language": "bigquery"
... }
>>> q = ls.query(query)
>>> q = qs.create_query(query_params=query_params)
>>> q.status_code
200
201
>>> q.json()
{u'result': {u'esQuery': {u'table': [u'panw.traffic'], u'selections': [], u'params': {}, u'query': {u'aggregations': {}, u'size': 1}}, u'esResult': {u'hits': {u'hits': [{u'_score': 2, u'_type': u'traffic', u'_id': u'117270018_lcaas:0:9379670:1', u'_source': {u'logset': u'LCaaS', u'traffic_flags': 0, u'parent_start_time': 0, u'inbound_if': u'ethernet1/1', u'dstloc': u'10.0.0.0-10.255.255.255', u'natdport': 0, u'time_generated': 1560175638, u'recsize': 1958, u'chunks_sent': 0, u'to': u'l3-untrust', u'non-standard-dport': 0, u'receive_time': 1560175660, u'elapsed': 0, u'seqno': 51422235, u'pbf_s2c': 0, u'vsys': u'vsys1', u'bytes': 196, u'subtype': u'end', u'subcategory-of-app': u'internet-utility', u'vsys_id': 1, u'actionflags': -9223372036854776000L, u'pkts_sent': 1, u'sport': 0, u'is-saas-of-app': 0, u'category': u'any', u'ui-srcloc': u'Singapore', u'bytes_received': 98, u'container': 0, u'dst': u'10.10.0.2', u'customer-id': u'117270018', u'packet_capture': 0, u'srcloc': u'SG', u'natsport': 0, u'parent_session_id': 0, u'proxy': 0, u'ui-dstloc': u'10.0.0.0-10.255.255.255', u'src': u'203.208.197.133', u'config_ver': 2304, u'sanctioned-state-of-app': 0, u'fwd': 1, u'technology-of-app': u'network-protocol', u'bytes_sent': 98, u'chunks_received': 0, u'dg_hier_level_3': 0, u'dg_hier_level_2': 0, u'dg_hier_level_1': 16, u'dg_hier_level_4': 0, u'repeatcnt': 1, u'natsrc': u'0.0.0.0', u'app': u'ping', u'characteristic-of-app': [u'tunnel-other-application', u'prone-to-misuse', u'is-saas'], u'chunks': 0, u'non_std_dport': 1, u'decrypt_mirror': 0, u'action_source': u'from-policy', u'from': u'l3-untrust', u'url_denied': 0, u'assoc_id': 0, u'log_feat_bit1': 0, u'start': 1560175625, u'cloud_hostname': u'ngfw-1', u'pbf_c2s': 0, u'sym_return': 0, u'captive_portal': 0, u'outbound_if': u'ethernet1/1', u'tunnelid_imsi': 0, u'sessionid': 407532, u'category-of-app': u'general-internet', u'tunnel': u'N/A', u'type': u'traffic', u'mptcp_on': 0, u'recon_excluded': 0, u'http2_connection': 0, u'tunnel_inspected': 0, u'risk-of-app': u'2', u'serial': u'007200000046172', u'is_fwaas': 0, u'proto': u'icmp', u'is_phishing': 0, u'is_gpaas': 0, u'nat': 0, u'tunneled-app': u'untunneled', u'natdst': u'0.0.0.0', u'time_received': 1560175638, u'users': u'203.208.197.133', u'rule_uuid': u'd6992de4-5523-4ba8-b9e9-a99fe9dbfda4', u'pkts_received': 1, u'action': u'allow', u'is_dup_log': 0, u'exported': 0, u'session_end_reason': u'aged-out', u'transaction': 0, u'packets': 2, u'flag': 0, u'rule': u'intrazone-default', u'device_name': u'ngfw-1', u'flags': 1048676, u'dport': 0}, u'_index': u'117270018_panw.all_2019060600-2019062600_000000'}], u'total': 22942, u'maxScore': 2}, u'from': 0, u'completed': True, u'took': 185, u'timed_out': False, u'state': u'COMPLETED', u'id': u'e2a685ce-0b21-41d6-a050-4e371e456817', u'size': 1}}, u'sequenceNo': 0, u'queryId': u'e2a685ce-0b21-41d6-a050-4e371e456817', u'clientParameters': {}, u'queryStatus': u'JOB_FINISHED'}
{'jobId': '40fedce6-ddf5-44cf-9af2-7c3d5303f388', 'uri': '/query/v2/jobs/40fedce6-ddf5-44cf-9af2-7c3d5303f388'}
>>> results = qs.get_job_results(job_id='40fedce6-ddf5-44cf-9af2-7c3d5303f388')
>>> results.json()
Contributors
------------
Expand Down
2 changes: 1 addition & 1 deletion pancloud/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""Main package for pancloud."""

__author__ = "Palo Alto Networks"
__version__ = "2.0.0-alpha1"
__version__ = "2.0.0-alpha2"

from .exceptions import ( # noqa: F401
PanCloudError,
Expand Down
10 changes: 5 additions & 5 deletions pancloud/credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def fetch_tokens(
method="POST",
url=self.token_url,
json=data,
path="/api/oauth2/RequestToken",
endpoint="/api/oauth2/RequestToken",
auth=None,
**kwargs
)
Expand Down Expand Up @@ -459,7 +459,7 @@ def refresh(self, access_token=None, **kwargs):
r = self._httpclient.request(
method="POST",
url=self.developer_token_url,
path="/request_token",
endpoint="/request_token",
headers={
"Authorization": "Bearer {}".format(
self.developer_token
Expand All @@ -480,7 +480,7 @@ def refresh(self, access_token=None, **kwargs):
method="POST",
url=self.token_url,
json=data,
path="/api/oauth2/RequestToken",
endpoint="/api/oauth2/RequestToken",
**kwargs
)
else:
Expand Down Expand Up @@ -522,7 +522,7 @@ def revoke_access_token(self, **kwargs):
method="POST",
url=self.token_url,
json=data,
path="/api/oauth2/RevokeToken",
endpoint="/api/oauth2/RevokeToken",
**kwargs
)
if not r.ok:
Expand All @@ -549,7 +549,7 @@ def revoke_refresh_token(self, **kwargs):
method="POST",
url=self.token_url,
json=data,
path="/api/oauth2/RevokeToken",
endpoint="/api/oauth2/RevokeToken",
**kwargs
)
if not r.ok:
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 2.0.0-alpha1
current_version = 2.0.0-alpha2
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

setup(
name="pancloud",
version="2.0.0-alpha1",
version="2.0.0-alpha2",
description="Python idiomatic SDK for Cortex™.",
long_description=readme + "\n\n" + history,
author="Steven Serrata",
Expand Down

0 comments on commit 6fd8be3

Please sign in to comment.