2017-12-13 11 views
0

Ich brauche ImageId aus dem folgenden Stück Code, in Strato zu erhalten:SoftLayer: Wie bekomme ich 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() 

niemanden wissen, wie die imageId zu bekommen?

Vielen Dank im Voraus.

Antwort

0

Sie können die Bild ids durch das Steuerportalseite erhalten, müssen Sie nur alle privaten Bilder hier https://control.softlayer.com/devices/images

Durch API um zu sehen, können Sie die Methode SoftLayer_Account verwenden :: getPrivateBlockDeviceTemplateGroups

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

Und mit Python sollte es in etwa so sein:

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