softlayer - Detail information for Auto Scale in SL -


i implementing detail information auto scaling using java api. how can detailed information of member configuration. please refer fields in red box in attached picture. detailed information. example, operation reference code, centos_6_64, how can long type of description centos 6.x - minimal install (64bit). member config group config

try using object mask

mask[id, name, status[name, keyname], regionalgroup[id, name, description], suspendedflag, terminationpolicy, cooldown, regionalgroupid, minimummembercount, maximummembercount, balancedterminationflag, networkvlans[ id, networkvlan[ id, name, vlannumber, networkspace, primaryrouter[id,hostname,datacenter[name,longname]],localdiskstoragecapabilityflag,sanstoragecapabilityflag]],virtualguestmembertemplate[hostname,domain,fullyqualifieddomainname,startcpus,maxmemory,hourlybillingflag,localdiskflag,operatingsystem,datacenter,privatenetworkonlyflag,networkcomponents.maxspeed,sshkeys,operatingsystemreferencecode,blockdevices[device,diskimage.capacity],blockdevicetemplategroup.globalidentifier,postinstallscripturi],policies[id,cooldown,name,scaleactions[id,type[id,keyname,name],amount,scaletype],triggers[id,type],triggers(softlayer_scale_policy_trigger_onetime)[date],triggers(softlayer_scale_policy_trigger_repeating)[schedule],triggers(softlayer_scale_policy_trigger_resourceuse)[watches[id,algorithm,metric,operator,period,value]]],loadbalancers[id,port,healthcheck[id,attributes[value,type.keyname],type[id,keyname,name]],virtualserver[id,port,virtualipaddress.ipaddress.ipaddress,virtualipaddress.id,servicegroups.routingtype.name]],virtualguestmembercount] 

here example using python:

""" scale group details (configuration).  important manual pages: http://sldn.softlayer.com/reference/services/softlayer_scale_group http://sldn.softlayer.com/reference/services/softlayer_scale_group/getobject http://sldn.softlayer.com/reference/datatypes/softlayer_scale_group  license: http://sldn.softlayer.com/article/license author: softlayer technologies, inc. <sldn@softlayer.com> """  import softlayer import json  username = 'set me' api_key = 'set me'  scalegroupid = 595465  # create softlayer api client object client = softlayer.client(username=username, api_key=api_key) scalegroupservice = client['softlayer_scale_group']  objectmask = "mask[id, name, status[name, keyname], regionalgroup[id, name, description], suspendedflag, terminationpolicy, cooldown, regionalgroupid, minimummembercount, maximummembercount, balancedterminationflag, networkvlans[ id, networkvlan[ id, name, vlannumber, networkspace, primaryrouter[id,hostname,datacenter[name,longname]],localdiskstoragecapabilityflag,sanstoragecapabilityflag]],virtualguestmembertemplate[hostname,domain,fullyqualifieddomainname,startcpus,maxmemory,hourlybillingflag,localdiskflag,operatingsystem,datacenter,privatenetworkonlyflag,networkcomponents.maxspeed,sshkeys,operatingsystemreferencecode,blockdevices[device,diskimage.capacity],blockdevicetemplategroup.globalidentifier,postinstallscripturi],policies[id,cooldown,name,scaleactions[id,type[id,keyname,name],amount,scaletype],triggers[id,type],triggers(softlayer_scale_policy_trigger_onetime)[date],triggers(softlayer_scale_policy_trigger_repeating)[schedule],triggers(softlayer_scale_policy_trigger_resourceuse)[watches[id,algorithm,metric,operator,period,value]]],loadbalancers[id,port,healthcheck[id,attributes[value,type.keyname],type[id,keyname,name]],virtualserver[id,port,virtualipaddress.ipaddress.ipaddress,virtualipaddress.id,servicegroups.routingtype.name]],virtualguestmembercount]"  try:     scalegroup = scalegroupservice.getobject(id=scalegroupid, mask=objectmask)     config = {}     config['groupdetails'] = {}     config['groupdetails']['groupname'] = scalegroup['name']     config['groupdetails']['region'] = scalegroup['regionalgroup']['name']     config['groupdetails']['datacenter'] = scalegroup['regionalgroup']['name']     config['groupdetails']['terminationpolicy'] = scalegroup['terminationpolicy']['name']     config['groupsettings'] = {}     config['groupsettings']['minimummembercount'] = scalegroup['minimummembercount']     config['groupsettings']['maximummembercount'] = scalegroup['maximummembercount']     config['groupsettings']['cooldown'] = str(scalegroup['cooldown'] / 60) + " minutes"     config['memberdetails'] = {}     config['memberdetails']['hostname'] = scalegroup['virtualguestmembertemplate']['hostname']     config['memberdetails']['domain'] = scalegroup['virtualguestmembertemplate']['domain']     config['computinginstance'] = {}     config['computinginstance']['cores'] = str(scalegroup['virtualguestmembertemplate']['startcpus']) + "x 2.0 ghz core"     config['computinginstance']['ram'] = str(scalegroup['virtualguestmembertemplate']['maxmemory'] / 1024) + "gb"     if 'networkcomponents' in scalegroup['virtualguestmembertemplate']:         config['computinginstance']['speed'] = scalegroup['virtualguestmembertemplate']['networkcomponents'][0]['maxspeed']     else:         config['computinginstance']['speed'] = "default"     if 'sshkeys' in scalegroup['virtualguestmembertemplate']:         config['computinginstance']['sshkeys'] = scalegroup['virtualguestmembertemplate']['sshkeys']     else:         config['computinginstance']['sshkeys'] = 'none'     config['storage'] = {}     if scalegroup['virtualguestmembertemplate']['localdiskflag']:         config['storage']['selectedstorage'] = 'local storage'     else:         config['storage']['selectedstorage'] = 'san storage'     config['operatingsystem'] = {}     config['operatingsystem']['selectedoperatingsystem'] = scalegroup['virtualguestmembertemplate']['operatingsystemreferencecode']     config['postinstallscript'] = {}     config['postinstallscript']['url'] = scalegroup['virtualguestmembertemplate']['postinstallscripturi']     config['policies'] = scalegroup['policies']     print(json.dumps(config, sort_keys=true, indent=2, separators=(',', ': '))) except softlayer.softlayerapierror e:     print("unable scale group details. faultcode=%s, faultstring=%s" % (e.faultcode, e.faultstring)) 

but if try copy same information portal, have fun :).

regarding os information cannot via softlayer_scale_group service, need use softlayer_virtual_guest::getcreateobjectoptions method. if see result of method see this:

{             "itemprice": {                 "hourlyrecurringfee": "0",                 "recurringfee": "0",                 "item": {                     "description": "centos 6.x - minimal install (64 bit)"                 }             },             "template": {                 "id": null,                 "operatingsystemreferencecode": "centos_6_64"             }         } 

as can see result contains "operatingsystemreferencecode" , description want to, need record match "operatingsystemreferencecode" value got using softlayer_scale_group::getobject method.

regarding network private or public, here can have scenarios: 1.- public , private has been set. 2.- private has been set.

to determinate have check "privatenetworkonlyflag" property: 1.- if property true, network private 2.- if property has not been set (the default value false) network public , private.

in order same description portal need use softlayer_virtual_guest::getcreateobjectoptions method, result got:

"networkcomponents": [         {             "itemprice": {                 "hourlyrecurringfee": "0",                 "recurringfee": "0",                 "item": {                     "description": "10 mbps public & private network uplinks"                 }             },             "template": {                 "id": null,                 "networkcomponents": [                     {                         "maxspeed": 10                     }                 ],                 "privatenetworkonlyflag": false             }         } 

as can see idea same operating system.

and regard datacenter "first available", guess when call softlayer_scale_group::getobject guess virtualguestmembertemplate.datacenter property empty or not exist, if see can display value "first available".

regards


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -