2017-03-15 1 views

Antwort

0

Um Notizen hinzuzufügen oder zu ändern, andere SoftLayer_Hardware_Server Eigenschaften Sie die Methode SoftLayer_Hardware_Server verwenden müssen :: editObject.

Im folgenden finden Sie ein Beispiel siehe Anhang mit der ID an die GLT hinzufügen 123456.

""" 
Edit a bare metal server's basic information 

This example shows how to edit the property 'notes' for a single bare metal server by 
using the editObject() method in the SoftLayer_Hardware_Server API service. 
See below for more details. 

Important manual pages: 
http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/editObject 

License: http://sldn.softlayer.com/article/License 
Author: SoftLayer Technologies, Inc. <[email protected]> 
""" 
import SoftLayer 


# Your SoftLayer API username and key. 
USERNAME = 'set me' 
API_KEY = 'set me' 

# The id of the bare metal you wish to edit 
hardwareId = 123456 

''' 
The template object used to edit a SoftLayer_Hardware_Server. 
Take account you can edit other properties by using a similar skeleton 
''' 
templateObject = { 
    'notes': 'This is my bare metal server!' 
} 

# Declare a new API service object 
client = SoftLayer.create_client_from_env(username=USERNAME, api_key=API_KEY) 

try: 
    # Add notes to the Bare Metal server 
    result = client['SoftLayer_Hardware_Server'].editObject(templateObject, 
                  id=hardwareId) 
    print('Bare Metal Server edited') 
except SoftLayer.SoftLayerAPIError as e: 
    print("Unable to edit the server: %s, %s" % (e.faultCode, e.faultString)) 

Referenzen:

http://sldn.softlayer.com/reference/services/SoftLayer_Hardware_Server/editObject
http://sldn.softlayer.com/reference/datatypes/SoftLayer_Hardware_Server

Ich hoffe, dass diese Ihnen helfen.

Grüße,

Verwandte Themen