Skip to content

Commit ae7e8f8

Browse files
authored
Merge pull request #73 from yunify/add-sdwan-monitor-api
add sdwan api
2 parents 357e164 + 7a0e607 commit ae7e8f8

File tree

2 files changed

+47
-2
lines changed

2 files changed

+47
-2
lines changed

qingcloud/iaas/actions/sdwan.py

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def describe_wan_accesss(self,
3737
search_word=None,
3838
offset=None,
3939
limit=None,
40+
verbose=0,
4041
**params):
4142
''' Action: DescribeWanAccesss
4243
@param wan_accesss: IDs of the wan accesss you want describe.
@@ -52,16 +53,17 @@ def describe_wan_accesss(self,
5253
@param search_word: the search_word of resource
5354
@param offset: the starting offset of the returning results.
5455
@param limit: specify the number of the returning results.
56+
@param verbose: the number to specify the verbose level. eg: 0/1
5557
'''
5658
action = const.ACTION_DESCRIBE_WAN_ACCESS
5759
valid_keys = ['wan_accesss', 'wan_access_name', 'wan_nets',
5860
'wan_pops', 'status', 'access_type', 'location_nation',
5961
'location_province', 'location_city', 'owner',
60-
'search_word', 'offset', 'limit']
62+
'search_word', 'offset', 'limit', 'verbose']
6163
body = filter_out_none(locals(), valid_keys)
6264
if not self.conn.req_checker.check_params(
6365
body,
64-
integer_params=["offset", "limit"],
66+
integer_params=["offset", "limit", "verbose"],
6567
list_params=["wan_accesss",
6668
"wan_nets",
6769
"wan_pops",
@@ -121,3 +123,45 @@ def upgrade_wan_access(self,
121123
return None
122124

123125
return self.conn.send_request(action, body)
126+
127+
def get_wan_monitor(self,
128+
resource=None,
129+
access_type=None,
130+
meters=None,
131+
step=None,
132+
start_time=None,
133+
end_time=None,
134+
interface_name=None,
135+
monitor_type=None,
136+
ha_member_index=None,
137+
**params):
138+
""" Action: GetWanMonitor
139+
@param resource: the ID of resource whose monitoring data
140+
you want to get.
141+
@param access_type: the wan access type. eg: line, vpc, cpe.
142+
@param meters: a list of metering types you want to get.
143+
e.g. "flow", "pps"
144+
@param step: the metering time step. e.g. "1m", "5m", "15m",
145+
"30m", "1h", "2h", "1d"
146+
@param start_time: the starting time stamp.
147+
@param end_time: the ending time stamp.
148+
@param interface_name: interface name, eg: eth0, eth1
149+
@param monitor_type: CPE's monitor type, eg: internet, pop
150+
@param ha_member_index: the ha member index. eg: 0/1
151+
"""
152+
action = const.ACTION_GET_WAN_MONITOR
153+
valid_keys = ['resource', 'access_type', 'meters', 'step',
154+
'start_time', 'end_time', 'interface_name',
155+
'monitor_type', 'ha_member_index']
156+
body = filter_out_none(locals(), valid_keys)
157+
if not self.conn.req_checker.check_params(
158+
body,
159+
required_params=["resource", "access_type",
160+
"meters", "step",
161+
"start_time", "end_time"],
162+
list_params=["meters"],
163+
datetime_params=["start_time", "end_time"]
164+
):
165+
return None
166+
167+
return self.conn.send_request(action, body)

qingcloud/iaas/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@
348348
ACTION_DESCRIBE_WAN_ACCESS = "DescribeWanAccesss"
349349
ACTION_CHANGE_WAN_ACCESS_BANDWIDTH = "ChangeWanAccessBandwidth"
350350
ACTION_UPGRADE_WAN_ACCESS = "UpgradeWanAccess"
351+
ACTION_GET_WAN_MONITOR = "GetWanMonitor"
351352

352353
# migrate
353354
ACTION_MIGRATE_RESOURCES = "MigrateResources"

0 commit comments

Comments
 (0)