本文整理汇总了Golang中github.com/cloudwan/gohan/schema.Resource.SetParentID方法的典型用法代码示例。如果您正苦于以下问题:Golang Resource.SetParentID方法的具体用法?Golang Resource.SetParentID怎么用?Golang Resource.SetParentID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cloudwan/gohan/schema.Resource
的用法示例。
在下文中一共展示了Resource.SetParentID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1:
"tenant_id": "blue",
"shared": false,
"route_targets": []string{"1000:10000", "2000:20000"},
"providor_networks": map[string]interface{}{"segmentation_id": 10, "segmentation_type": "vlan"}}
networkResource2, err = manager.LoadResource("network", network2)
Expect(err).ToNot(HaveOccurred())
subnet := map[string]interface{}{
"id": "subnetRed",
"name": "SubnetRed",
"description": "A crimson subnet",
"tenant_id": "red",
"cidr": "10.0.0.0/24"}
subnetResource, err = manager.LoadResource("subnet", subnet)
Expect(err).ToNot(HaveOccurred())
subnetResource.SetParentID("networkRed")
Expect(subnetResource.Path()).To(Equal("/v2.0/subnets/subnetRed"))
server := map[string]interface{}{
"id": "serverRed",
"name": "serverRed",
"tenant_id": "red",
"network_id": "networkRed",
"description": "red server",
"cidr": "10.0.0.0/24"}
serverResource, err = manager.LoadResource("server", server)
Expect(err).ToNot(HaveOccurred())
})
JustBeforeEach(func() {
os.Remove(conn)