2017-12-13 10 views
0

私はSOFTLAYERに、次のコード片からIMAGEIDを取得する必要があります:SoftLayer:imageIdを取得するには?

import SoftLayer 
from pprint import pprint as pp 

class example(): 

def __init__(self): 
    self.client = SoftLayer.Client() 

def main(self): 
    """ 
    Will reload the operating system with a new imageTemplate, 
    along with a set of sshKeys. This will erease all data. 
    """ 
    # Change these IDs 
    imageId = 1234567 
    sshKey1 = 123 
    sshKey2 = 456 
    serverId = 102938 
    config = { 
     'imageTemplateId': imageId, 
     'sshKeyIds': [sshKey1, sshKey2] 
    } 

    output = self.client['Hardware_Server'].reloadOperatingSystem('FORCE', config, id=serverId) 

    pp(config) 
    print "RESULT\n" 
    pp(output) 

if __name__ == "__main__": 
main = example() 
main.main() 

誰でもIMAGEIDを取得する方法を知っていますか?

ありがとうございます。 APIを通じて

答えて

0

あなたがコントロールポータルページから画像IDを取得することができ、あなただけのすべてのプライベート画像を参照してくださいする必要があり、ここでhttps://control.softlayer.com/devices/images

あなたは、メソッドSoftLayer_Accountを使用することができます:: getPrivateBlockDeviceTemplateGroups

GET https://[userName]:[apiKey]@api.softlayer.com/rest/v3/SoftLayer_Account/getPrivateBlockDeviceTemplateGroups 

と使用pythonそれはこのようなものでなければなりません:

images = client['SoftLayer_Account'].getPrivateBlockDeviceTemplateGroups() 
関連する問題