2017-12-13 21 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을 얻는 방법을 알고 있나요?

미리 감사드립니다.

당신은 제어 포털 페이지를 통해 이미지 ID를 얻을, 당신은 모든 개인 여기 https://control.softlayer.com/devices/images

이미지 API를 통해 당신이 방법 SoftLayer_Account :: getPrivateBlockDeviceTemplateGroups을 사용할 수 있습니다 볼 필요가 있습니다

답변

0

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

그리고 사용 파이썬 그것은 이런 식이어야합니다 :

images = client['SoftLayer_Account'].getPrivateBlockDeviceTemplateGroups()