2016-10-21 25 views
0

我使用ruby API獲取帶寬摘要。 我創建一個客戶端對象,並嘗試從Virtual_Guest服務得到currentBandwidthSummary:Softlayer服務器的帶寬摘要

client.service_named("Virtual_Guest").object_mask('mask[currentBandwidthSummary]').object_with_id(server_id).getObject 

但它不返回currentBandwidthSummary對象。我已經看到它適用於我有的舊服務器,但我想要做的是從剛剛創建的新服務器上獲取currentBandwidthSummar。

請注意,服務器處於ACTIVE狀態,因此它不處於部署狀態或其他狀態。 客戶對象初始化這樣的:

client = ::SoftLayer::Client.new(username: user, api_key: api_key, endpoint_url: url) 

的provisionDate設置:

client.service_named("Virtual_Guest").object_mask('mask[currentBandwidthSummary]').object_with_id(@server.server_id).getObject 
=> {"accountId"=>"removed", 
"createDate"=>"2016-10-21T08:48:03-05:00", 
"dedicatedAccountHostOnlyFlag"=>false, 
"domain"=>"please.delete.com", 
"fullyQualifiedDomainName"=>"removed", 
"hostname"=>"removed", 
"id"=>"removed", 
"lastPowerStateId"=>"", 
"lastVerifiedDate"=>"", 
"maxCpu"=>1, 
"maxCpuUnits"=>"CORE", 
"maxMemory"=>1024, 
"metricPollDate"=>"", 
"modifyDate"=>"2016-10-21T08:51:19-05:00", 
"provisionDate"=>"2016-10-21T08:51:19-05:00", 
"startCpus"=>1, 
"statusId"=>1001, 
"uuid"=>"removed", 
"globalIdentifier"=>"removed", 
"managedResourceFlag"=>false, 
"primaryBackendIpAddress"=>"removed", 
"status"=>{"keyName"=>"ACTIVE", "name"=>"Active"}} 

好像一些過濾器工作得很好,但有些被忽略。 我錯過了什麼?

回答

0

這可能是因爲服務器仍在配置過程中,ACTIVE狀態並不意味着服務器已準備好,如果此值爲空或需要檢查「provisionDate」屬性,否則服務器仍處於配置進程。查看此博客,瞭解有關檢查新CCI是否已完成配置的更多信息。

http://sldn.softlayer.com/blog/phil/simplified-cci-creation

在該provisioningDate屬性有值的情況下,請更新您的問題將您從API得到的結果。

如果您在Solftlayer的門戶中看不到數據,則API將不會顯示「currentBandwidthSummary」,此屬性將在服務器具有帶寬數據時創建。

Regards

+0

我不知道有關provisionDate,但它在那裏,所以必須是不同的 –

+0

你有什麼結果?是空的 ?是一個錯誤消息? –

+0

請檢查問題,我試圖獲得總結帶寬時添加了結果。看來currentBandwidthSummary屬性不會再次返回。沒有錯誤,只是沒有 –

1

只要有人需要那個。我正在查找currentBandwidthSummary.allocationAmount,但事實證明它與bandwidthAllocation相同。如上所述,currentBandwidthSummary由於某種原因不可用,但帶寬分配是。

我不好意思,在提問之前我沒有注意到。 :)