更改Softlayer快照属性

时间:2016-12-12 11:33:01

标签: ibm-cloud-infrastructure

我想通过API更改 softlayer WEEKLY快照计划属性。我正在使用, client['SoftLayer_Network_Storage'].enableSnapshots(scheduleType, retentionCount, minute, hour, dayOfWeek, id=storageId)

通过使用上述API,我的保留属性已成功更改但其他属性未更改。 有人可以帮我这个,为什么其他属性喜欢; minutehour& dayOfWeek没有改变

或者,还有其他方法吗?

1 个答案:

答案 0 :(得分:0)

这种方法对我来说很好。

以下是我用于启用快照的脚本:

import SoftLayer
from pprint import pprint as pp

USERNAME = 'set me'
API_KEY = 'set me'

client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)

storageId = 5805095
scheduleType = 'WEEKLY'
retentionCount = 4
minute = 3
hour = 3
dayOfWeek = 3

try:
    result = client['SoftLayer_Network_Storage'].enableSnapshots(scheduleType, retentionCount, minute, hour, dayOfWeek, id=storageId)
    pp(result)
except SoftLayer.SoftLayerAPIError as e:
    pp('Unable to enable snapshots faultCode=%s, faultString=%s' 
    % (e.faultCode, e.faultString))

以下是我用于检索更新的网络存储的脚本:

import SoftLayer
from pprint import pprint as pp

USERNAME = 'set me'
API_KEY = 'set me'

client = SoftLayer.Client(username=USERNAME, api_key=API_KEY)

storageId = 5805095
objectMask = 'mask[weeklySchedule[retentionCount,minute,hour,dayOfWeek]]'

try:
    result = client['SoftLayer_Network_Storage'].getObject(id=storageId, mask=objectMask)
    pp(result)
except SoftLayer.SoftLayerAPIError as e:
    pp('Unable to get Network Storage=%s, faultString=%s' 
    % (e.faultCode, e.faultString))

您还可以尝试使用控制门户编辑计划,看看是否可行,如果不是,我建议您提交与DEV-API或API不同的其他主题的票证