Search code examples
ibm-cloud-infrastructure

How to Name Manual Snapshots via Softlayer Python Lib


I was wondering how one could use the Softlayer API to Gather and Name manual snapshots using the Softlayer_Network_storage service?

It's not clear what mask to use when using "getManualSnapshots" to view a name I've set for a manual snapshot.

example of named snapshot

Currently, my mask is as follows

 mask='mask[serviceResource[serviceResourceName]]'

but this is only yielding errors. Beyond this, I was not sure what else I could use to get the name.

I after I figured out what object ID contained the name, I was thinking that I would use the "editObject" attribute to edit the snapshots name, would this be correct?


Solution

  • you just need to get the notes,

    mask=mask[notes]
    

    and to add the name just edit the object and replace the note, you need to use this method http://sldn.softlayer.com/reference/services/SoftLayer_Network_Storage/editObject

    edit Object:

    import SoftLayer
    import json
    import sys
    
    USERNAME = 'set me'
    API_KEY = 'set me'
    
    client = SoftLayer.create_client_from_env(username=USERNAME, api_key=API_KEY)
    client['SoftLayer_Network_Storage'].editObject({"notes": "testing notes"},id=snapshot
    _id)
    

    Regards