Softlayer:标记设备 [英] Softlayer : tagging device

查看:34
本文介绍了Softlayer:标记设备的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在客户门户中创建设备时找不到任何标记设备的选项,因此我正在使用 SoftLayer_Tag :: setTags 用于标记设备的Rest API:

POST: https://Username:API_KEY@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags.json
BODY: 
resourceTableId : 29756959
keyName : march22

但是出现错误提示:

{错误":您无权标记该对象.",
"code":"SoftLayer_Exception_PermissionDenied"}

解决方案

发送正文的方式有误(缺少 tags 参数,并且 keyName ),请尝试以下操作:

虚拟访客

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags

Method: Post

{  
   "parameters":[  
      "tag1,tag2",
      "GUEST",
      29756959
   ]
}

硬件

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags

Method: Post

{  
   "parameters":[  
      "tag1,tag2",
      "HARDWARE",
      29756959
   ]
}

已更新

要设置标签,您需要检查以下内容:

  1. 访问设备
  2. 已启用设备类型(Vsi/硬件)的权限:

    • 硬件-> 查看硬件详细信息
    • VSI-> 查看虚拟服务器详细信息

下订单时无法设置标签,您可以在提交订单后进行设置

设备>>设备列表>>搜索设备(例如:rcvtagtest)

另一种方法是通过API下订单,可以在此时通过它设置标签以创建服务器,这里是VSI的示例:


已更新2


SoftLayer_Tag :: getTagByTagName 方法提供有关标签的信息,而不是带有此标签的设备.

它将基于标签名称提供来自标签的信息,因此不必发送标识符,因此正确的方法是:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/getTagByTagName

Method: Post

{  
   "parameters":[  
      "test1,test2"
   ]
}

替换:用您自己的信息替换 $ user,$ apiKey ,并用您要检索的标记名 test1 test2 /p>

如果您想检索设备,请浏览此论坛(对于Vsis,BMS应该采用相同的想法):

如果这对您没有帮助,请提供有关您的要求的更多信息,以便我为您提供帮助

I couldn't find any option to Tag a device while creating the device in Customer portal, so I am Using SoftLayer_Tag::setTags Rest API to tag a device:

POST: https://Username:API_KEY@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags.json
BODY: 
resourceTableId : 29756959
keyName : march22

But getting error saying:

{ "error": "You do not have permissions to tag this object.",
"code": "SoftLayer_Exception_PermissionDenied" }

解决方案

There is a mistake in the way that you are sending the body(tags parameter is missing and there is a wrong value for keyName), try this:

Virtual Guests

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags

Method: Post

{  
   "parameters":[  
      "tag1,tag2",
      "GUEST",
      29756959
   ]
}

Hardware

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/setTags

Method: Post

{  
   "parameters":[  
      "tag1,tag2",
      "HARDWARE",
      29756959
   ]
}

Updated

To set tags you need to check the following:

  1. Access to device
  2. Permission enabled for Device Type (Vsi/Hardware):

    • Hardware -> View Hardware Details
    • VSI -> View Virtual Server Details

There is no way to set tags at the moment to place the order, you can set them after submit the order

Devices >> Device List >> Search the device (e.g: rcvtagtest)

Another way would be to place the order through API, in which it's possible to set tags through it at the moment to create the server, here an example for VSI:


Updated2


The SoftLayer_Tag::getTagByTagName method provides information about the tag, not the devices which have being tagged with this.

It will provide information from the tag based on tag name, so it's not necessary to send an identifier, so the correct way for this is:

https://$user:$apiKey@api.softlayer.com/rest/v3/SoftLayer_Tag/getTagByTagName

Method: Post

{  
   "parameters":[  
      "test1,test2"
   ]
}

Replace: $user, $apiKey with you own information and test1 and test2 with the tag names that you would like to retrieve

In case that you would like to retrieve devices, take a look this forum(for Vsis, the same idea should be applied for BMS):

If this doesn't help you, please provide more information about your requirements, in order that I can help you

这篇关于Softlayer:标记设备的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆