本文整理汇总了Golang中github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/floatingips.Get函数的典型用法代码示例。如果您正苦于以下问题:Golang Get函数的具体用法?Golang Get怎么用?Golang Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: testAccCheckNetworkingV2FloatingIPExists
func testAccCheckNetworkingV2FloatingIPExists(t *testing.T, n string, kp *floatingips.FloatingIP) resource.TestCheckFunc {
return func(s *terraform.State) error {
rs, ok := s.RootModule().Resources[n]
if !ok {
return fmt.Errorf("Not found: %s", n)
}
if rs.Primary.ID == "" {
return fmt.Errorf("No ID is set")
}
config := testAccProvider.Meta().(*Config)
networkClient, err := config.networkingV2Client(OS_REGION_NAME)
if err != nil {
return fmt.Errorf("(testAccCheckNetworkingV2FloatingIPExists) Error creating OpenStack networking client: %s", err)
}
found, err := floatingips.Get(networkClient, rs.Primary.ID).Extract()
if err != nil {
return err
}
if found.ID != rs.Primary.ID {
return fmt.Errorf("FloatingIP not found")
}
*kp = *found
return nil
}
}
开发者ID:RezaDKhan,项目名称:terraform,代码行数:31,代码来源:resource_openstack_networking_floatingip_v2_test.go
示例2: waitForFloatingIPDelete
func waitForFloatingIPDelete(networkingClient *gophercloud.ServiceClient, fId string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
log.Printf("[DEBUG] Attempting to delete OpenStack Floating IP %s.\n", fId)
f, err := floatingips.Get(networkingClient, fId).Extract()
if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError)
if !ok {
return f, "ACTIVE", err
}
if errCode.Actual == 404 {
log.Printf("[DEBUG] Successfully deleted OpenStack Floating IP %s", fId)
return f, "DELETED", nil
}
}
err = floatingips.Delete(networkingClient, fId).ExtractErr()
if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError)
if !ok {
return f, "ACTIVE", err
}
if errCode.Actual == 404 {
log.Printf("[DEBUG] Successfully deleted OpenStack Floating IP %s", fId)
return f, "DELETED", nil
}
}
log.Printf("[DEBUG] OpenStack Floating IP %s still active.\n", fId)
return f, "ACTIVE", nil
}
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:32,代码来源:resource_openstack_networking_floatingip_v2.go
示例3: waitForFloatingIPActive
func waitForFloatingIPActive(networkingClient *gophercloud.ServiceClient, fId string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
f, err := floatingips.Get(networkingClient, fId).Extract()
if err != nil {
return nil, "", err
}
log.Printf("[DEBUG] OpenStack Neutron Floating IP: %+v", f)
if f.Status == "DOWN" || f.Status == "ACTIVE" {
return f, "ACTIVE", nil
}
return f, "", nil
}
}
开发者ID:devendraPSL,项目名称:terraform-api,代码行数:15,代码来源:resource_openstack_networking_floatingip_v2.go
示例4: testAccCheckNetworkingV2FloatingIPDestroy
func testAccCheckNetworkingV2FloatingIPDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
networkClient, err := config.networkingV2Client(OS_REGION_NAME)
if err != nil {
return fmt.Errorf("(testAccCheckNetworkingV2FloatingIPDestroy) Error creating OpenStack floating IP: %s", err)
}
for _, rs := range s.RootModule().Resources {
if rs.Type != "openstack_networking_floatingip_v2" {
continue
}
_, err := floatingips.Get(networkClient, rs.Primary.ID).Extract()
if err == nil {
return fmt.Errorf("FloatingIP still exists")
}
}
return nil
}
开发者ID:RezaDKhan,项目名称:terraform,代码行数:20,代码来源:resource_openstack_networking_floatingip_v2_test.go
示例5: resourceNetworkFloatingIPV2Read
func resourceNetworkFloatingIPV2Read(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
networkClient, err := config.networkingV2Client(d.Get("region").(string))
if err != nil {
return fmt.Errorf("Error creating OpenStack network client: %s", err)
}
floatingIP, err := floatingips.Get(networkClient, d.Id()).Extract()
if err != nil {
return CheckDeleted(d, err, "floating IP")
}
d.Set("address", floatingIP.FloatingIP)
poolName, err := getNetworkName(d, meta, floatingIP.FloatingNetworkID)
if err != nil {
return fmt.Errorf("Error retrieving floating IP pool name: %s", err)
}
d.Set("pool", poolName)
return nil
}
开发者ID:jrperritt,项目名称:terraform,代码行数:21,代码来源:resource_openstack_networking_floatingip_v2.go
示例6: getFloatingIP
func getFloatingIP(t *testing.T, ipID string) {
ip, err := floatingips.Get(base.Client, ipID).Extract()
th.AssertNoErr(t, err)
t.Logf("Getting floating IP: ID [%s] Status [%s]", ip.ID, ip.Status)
}
开发者ID:RomainVabre,项目名称:origin,代码行数:6,代码来源:layer3_test.go
注:本文中的github.com/rackspace/gophercloud/openstack/networking/v2/extensions/layer3/floatingips.Get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论