Skip to content

Commit 906f57b

Browse files
author
Tiberiu Vilcu
committed
Add support for alerts and audits endpoints
1 parent 5574c3a commit 906f57b

18 files changed

+1313
-7
lines changed

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ A log of changes by version and date.
66
======= ========== =====
77
Version Date Notes
88
======= ========== =====
9+
1.0.1 02/27/2019 Added support for alerts and audits endpoints
910
1.0.0 12/04/2018 Initial version
1011
======= ========== =====

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# The short X.Y version
2929
version = u'1.0'
3030
# The full version, including alpha/beta/rc tags
31-
release = u'1.0.0'
31+
release = u'1.0.1'
3232

3333

3434
# -- General configuration ---------------------------------------------------

docs/pure1_reference.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,24 @@ ErrorResponse
5757
Models
5858
------
5959

60+
Alert
61+
~~~~~
62+
63+
.. autoclass:: pypureclient.pure1.models.Alert
64+
:members:
65+
6066
Array
6167
~~~~~
6268

6369
.. autoclass:: pypureclient.pure1.models.Array
6470
:members:
6571

72+
Audit
73+
~~~~~
74+
75+
.. autoclass:: pypureclient.pure1.models.Audit
76+
:members:
77+
6678
FileSystem
6779
~~~~~~~~~~
6880

docs/source/pypureclient.pure1.api.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ pypureclient.pure1.api package
44
Submodules
55
----------
66

7+
pypureclient.pure1.api.alerts\_api module
8+
-----------------------------------------
9+
10+
.. automodule:: pypureclient.pure1.api.alerts_api
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
715
pypureclient.pure1.api.arrays\_api module
816
-----------------------------------------
917

@@ -12,6 +20,14 @@ pypureclient.pure1.api.arrays\_api module
1220
:undoc-members:
1321
:show-inheritance:
1422

23+
pypureclient.pure1.api.audits\_api module
24+
-----------------------------------------
25+
26+
.. automodule:: pypureclient.pure1.api.audits_api
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
1531
pypureclient.pure1.api.authorization\_api module
1632
------------------------------------------------
1733

docs/source/pypureclient.pure1.models.rst

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,30 @@ pypureclient.pure1.models package
44
Submodules
55
----------
66

7+
pypureclient.pure1.models.alert module
8+
--------------------------------------
9+
10+
.. automodule:: pypureclient.pure1.models.alert
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
pypureclient.pure1.models.alerts module
16+
---------------------------------------
17+
18+
.. automodule:: pypureclient.pure1.models.alerts
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
pypureclient.pure1.models.alerts\_get module
24+
--------------------------------------------
25+
26+
.. automodule:: pypureclient.pure1.models.alerts_get
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
731
pypureclient.pure1.models.array module
832
--------------------------------------
933

@@ -52,6 +76,30 @@ pypureclient.pure1.models.arrays\_resource module
5276
:undoc-members:
5377
:show-inheritance:
5478

79+
pypureclient.pure1.models.audit module
80+
--------------------------------------
81+
82+
.. automodule:: pypureclient.pure1.models.audit
83+
:members:
84+
:undoc-members:
85+
:show-inheritance:
86+
87+
pypureclient.pure1.models.audits module
88+
---------------------------------------
89+
90+
.. automodule:: pypureclient.pure1.models.audits
91+
:members:
92+
:undoc-members:
93+
:show-inheritance:
94+
95+
pypureclient.pure1.models.audits\_get module
96+
--------------------------------------------
97+
98+
.. automodule:: pypureclient.pure1.models.audits_get
99+
:members:
100+
:undoc-members:
101+
:show-inheritance:
102+
55103
pypureclient.pure1.models.built\_in\_as\_of module
56104
--------------------------------------------------
57105

pypureclient/pure1/__init__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
from pypureclient.pure1.properties import Property, Filter
1111
from pypureclient.pure1.responses import ValidResponse, ErrorResponse, ApiError, Pure1Headers
1212

13+
from pypureclient.pure1.models.alert import Alert
1314
from pypureclient.pure1.models.array import Array
15+
from pypureclient.pure1.models.audit import Audit
1416
from pypureclient.pure1.models.file_system import FileSystem
1517
from pypureclient.pure1.models.file_system_snapshot import FileSystemSnapshot
1618
from pypureclient.pure1.models.fixed_reference import FixedReference
@@ -32,9 +34,10 @@ def addProperties(model):
3234
for name, value in model.attribute_map.items():
3335
setattr(model, name, Property(value))
3436

35-
CLASSES_TO_ADD_PROPS = [Array, FileSystem, FileSystemSnapshot, Http, Metric,
36-
MetricAvailability, MetricHistory, NetworkInterface, Nfs,
37-
Pod, PodArrayStatus, Smb, Tag, Volume, VolumeSnapshot]
37+
CLASSES_TO_ADD_PROPS = [Alert, Array, Audit, FileSystem, FileSystemSnapshot,
38+
Http, Metric, MetricAvailability, MetricHistory,
39+
NetworkInterface, Nfs, Pod, PodArrayStatus, Smb, Tag,
40+
Volume, VolumeSnapshot]
3841

3942
if os.environ.get('DOCS_GENERATION') is None:
4043
for model in CLASSES_TO_ADD_PROPS:

pypureclient/pure1/api/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
# flake8: noqa
44

55
# import apis into api package
6+
from pypureclient.pure1.api.alerts_api import AlertsApi
67
from pypureclient.pure1.api.arrays_api import ArraysApi
8+
from pypureclient.pure1.api.audits_api import AuditsApi
79
from pypureclient.pure1.api.authorization_api import AuthorizationApi
810
from pypureclient.pure1.api.file_system_snapshots_api import FileSystemSnapshotsApi
911
from pypureclient.pure1.api.file_systems_api import FileSystemsApi
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# coding: utf-8
2+
3+
"""
4+
Pure1 Public REST API
5+
6+
Pure1 Public REST API, developed by [Pure Storage, Inc.](http://www.purestorage.com/) [Knowledge base reference documentation](https://support.purestorage.com/Pure1/Pure1_Manage/Pure1_Manage_-_REST_API/Pure1_Manage_-_REST_API__Reference)
7+
8+
OpenAPI spec version: 1.0
9+
10+
Generated by: https://github.com/swagger-api/swagger-codegen.git
11+
"""
12+
13+
14+
from __future__ import absolute_import
15+
16+
import re
17+
18+
# python 2 and python 3 compatibility library
19+
import six
20+
21+
from pypureclient.pure1.api_client import ApiClient
22+
23+
24+
class AlertsApi(object):
25+
"""NOTE: This class is auto generated by the swagger code generator program.
26+
27+
Do not edit the class manually.
28+
Ref: https://github.com/swagger-api/swagger-codegen
29+
"""
30+
31+
def __init__(self, api_client=None):
32+
if api_client is None:
33+
api_client = ApiClient()
34+
self.api_client = api_client
35+
36+
def api10_alerts_get(self, **kwargs):
37+
"""api10_alerts_get
38+
39+
Get alert objects.
40+
This method makes a synchronous HTTP request by default. To make an
41+
asynchronous HTTP request, please pass async_req=True
42+
>>> thread = api.api10_alerts_get(async_req=True)
43+
>>> result = thread.get()
44+
45+
:param async_req bool
46+
:param str authorization: REQUIRED normally; do not use if authenticating with the \"Try it out\" feature. Access JWT required to use any API endpoint.
47+
:param str x_request_id: Supplied by client during request or generated by server.
48+
:param str continuation_token: An opaque token used to iterate over a collection. The token to use on the next request is returned in the continuation_token field of the result. Single quotes are required around all strings.
49+
:param str filter: Exclude resources that don't match the specified criteria. Single quotes are required around all strings inside the filters.
50+
:param list[str] ids: A comma-separated list of resource IDs. If there is not at least one resource that matches each of the elements of ids, an error is returned. Single quotes are required around all strings.
51+
:param int limit: Limit the size of the response to the specified number of resources. A limit of 0 can be used to get the number of resources without getting all of the resources. It will be returned in the total_item_count field. If a client asks for a page size larger than the maximum number, the request is still valid. In that case the server just returns the maximum number of items, disregarding the client's page size request. If not specified, defaults to 1000.
52+
:param list[str] names: A comma-separated list of resource names. If there is not at least one resource that matches each of the elements of names, an error is returned. Single quotes are required around all strings.
53+
:param int offset: The offset of the first resource to return from a collection.
54+
:param list[str] sort: Sort the response by the specified fields (in descending order if '-' is appended to the field name). If you provide a sort you will not get a continuation token in the response.
55+
:return: AlertsGet
56+
If the method is called asynchronously,
57+
returns the request thread.
58+
"""
59+
kwargs['_return_http_data_only'] = True
60+
if kwargs.get('async_req'):
61+
return self.api10_alerts_get_with_http_info(**kwargs)
62+
else:
63+
(data) = self.api10_alerts_get_with_http_info(**kwargs)
64+
return data
65+
66+
def api10_alerts_get_with_http_info(self, **kwargs):
67+
"""api10_alerts_get
68+
69+
Get alert objects.
70+
This method makes a synchronous HTTP request by default. To make an
71+
asynchronous HTTP request, please pass async_req=True
72+
>>> thread = api.api10_alerts_get_with_http_info(async_req=True)
73+
>>> result = thread.get()
74+
75+
:param async_req bool
76+
:param str authorization: REQUIRED normally; do not use if authenticating with the \"Try it out\" feature. Access JWT required to use any API endpoint.
77+
:param str x_request_id: Supplied by client during request or generated by server.
78+
:param str continuation_token: An opaque token used to iterate over a collection. The token to use on the next request is returned in the continuation_token field of the result. Single quotes are required around all strings.
79+
:param str filter: Exclude resources that don't match the specified criteria. Single quotes are required around all strings inside the filters.
80+
:param list[str] ids: A comma-separated list of resource IDs. If there is not at least one resource that matches each of the elements of ids, an error is returned. Single quotes are required around all strings.
81+
:param int limit: Limit the size of the response to the specified number of resources. A limit of 0 can be used to get the number of resources without getting all of the resources. It will be returned in the total_item_count field. If a client asks for a page size larger than the maximum number, the request is still valid. In that case the server just returns the maximum number of items, disregarding the client's page size request. If not specified, defaults to 1000.
82+
:param list[str] names: A comma-separated list of resource names. If there is not at least one resource that matches each of the elements of names, an error is returned. Single quotes are required around all strings.
83+
:param int offset: The offset of the first resource to return from a collection.
84+
:param list[str] sort: Sort the response by the specified fields (in descending order if '-' is appended to the field name). If you provide a sort you will not get a continuation token in the response.
85+
:return: AlertsGet
86+
If the method is called asynchronously,
87+
returns the request thread.
88+
"""
89+
90+
all_params = ['authorization', 'x_request_id', 'continuation_token', 'filter', 'ids', 'limit', 'names', 'offset', 'sort']
91+
all_params.append('async_req')
92+
all_params.append('_return_http_data_only')
93+
all_params.append('_preload_content')
94+
all_params.append('_request_timeout')
95+
96+
params = locals()
97+
for key, val in six.iteritems(params['kwargs']):
98+
if key not in all_params:
99+
raise TypeError(
100+
"Got an unexpected keyword argument '%s'"
101+
" to method api10_alerts_get" % key
102+
)
103+
params[key] = val
104+
del params['kwargs']
105+
106+
if 'offset' in params and params['offset'] < 0:
107+
raise ValueError("Invalid value for parameter `offset` when calling `api10_alerts_get`, must be a value greater than or equal to `0`")
108+
collection_formats = {}
109+
110+
path_params = {}
111+
112+
query_params = []
113+
if 'continuation_token' in params:
114+
query_params.append(('continuation_token', params['continuation_token']))
115+
if 'filter' in params:
116+
query_params.append(('filter', params['filter']))
117+
if 'ids' in params:
118+
query_params.append(('ids', params['ids']))
119+
collection_formats['ids'] = 'multi'
120+
if 'limit' in params:
121+
query_params.append(('limit', params['limit']))
122+
if 'names' in params:
123+
query_params.append(('names', params['names']))
124+
collection_formats['names'] = 'multi'
125+
if 'offset' in params:
126+
query_params.append(('offset', params['offset']))
127+
if 'sort' in params:
128+
query_params.append(('sort', params['sort']))
129+
collection_formats['sort'] = 'multi'
130+
131+
header_params = {}
132+
if 'authorization' in params:
133+
header_params['Authorization'] = params['authorization']
134+
if 'x_request_id' in params:
135+
header_params['X-Request-ID'] = params['x_request_id']
136+
137+
form_params = []
138+
local_var_files = {}
139+
140+
body_params = None
141+
# HTTP header `Accept`
142+
header_params['Accept'] = self.api_client.select_header_accept(
143+
['application/json'])
144+
145+
# HTTP header `Content-Type`
146+
header_params['Content-Type'] = self.api_client.select_header_content_type(
147+
['application/json'])
148+
149+
# Authentication setting
150+
auth_settings = ['AuthorizationHeader']
151+
152+
return self.api_client.call_api(
153+
'/api/1.0/alerts', 'GET',
154+
path_params,
155+
query_params,
156+
header_params,
157+
body=body_params,
158+
post_params=form_params,
159+
files=local_var_files,
160+
response_type='AlertsGet',
161+
auth_settings=auth_settings,
162+
async_req=params.get('async_req'),
163+
_return_http_data_only=params.get('_return_http_data_only'),
164+
_preload_content=params.get('_preload_content', True),
165+
_request_timeout=params.get('_request_timeout'),
166+
collection_formats=collection_formats)

0 commit comments

Comments
 (0)