本文整理汇总了Golang中github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas_v2/loadbalancers.Get函数的典型用法代码示例。如果您正苦于以下问题:Golang Get函数的具体用法?Golang Get怎么用?Golang Get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Get函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: waitForLoadBalancerDelete
func waitForLoadBalancerDelete(networkingClient *gophercloud.ServiceClient, lbID string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
log.Printf("[DEBUG] Attempting to delete OpenStack LoadBalancerV2 %s", lbID)
lb, err := loadbalancers.Get(networkingClient, lbID).Extract()
if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError)
if !ok {
return lb, "ACTIVE", err
}
if errCode.Actual == 404 {
log.Printf("[DEBUG] Successfully deleted OpenStack LoadBalancerV2 %s", lbID)
return lb, "DELETED", nil
}
}
log.Printf("[DEBUG] Openstack LoadBalancerV2: %+v", lb)
err = loadbalancers.Delete(networkingClient, lbID).ExtractErr()
if err != nil {
errCode, ok := err.(*gophercloud.UnexpectedResponseCodeError)
if !ok {
return lb, "ACTIVE", err
}
if errCode.Actual == 404 {
log.Printf("[DEBUG] Successfully deleted OpenStack LoadBalancerV2 %s", lbID)
return lb, "DELETED", nil
}
}
log.Printf("[DEBUG] OpenStack LoadBalancerV2 %s still active.", lbID)
return lb, "ACTIVE", nil
}
}
开发者ID:RezaDKhan,项目名称:terraform,代码行数:33,代码来源:resource_openstack_lb_loadbalancer_v2.go
示例2: resourceLoadBalancerV2Read
func resourceLoadBalancerV2Read(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
networkingClient, err := config.networkingV2Client(d.Get("region").(string))
if err != nil {
return fmt.Errorf("Error creating OpenStack networking client: %s", err)
}
lb, err := loadbalancers.Get(networkingClient, d.Id()).Extract()
if err != nil {
return CheckDeleted(d, err, "LoadBalancerV2")
}
log.Printf("[DEBUG] Retreived OpenStack LoadBalancerV2 %s: %+v", d.Id(), lb)
d.Set("name", lb.Name)
d.Set("description", lb.Description)
d.Set("vip_subnet_id", lb.VipSubnetID)
d.Set("tenant_id", lb.TenantID)
d.Set("vip_address", lb.VipAddress)
d.Set("admin_state_up", lb.AdminStateUp)
d.Set("flavor", lb.Flavor)
d.Set("provider", lb.Provider)
return nil
}
开发者ID:RezaDKhan,项目名称:terraform,代码行数:25,代码来源:resource_openstack_lb_loadbalancer_v2.go
示例3: testAccCheckLBV2LoadBalancerExists
func testAccCheckLBV2LoadBalancerExists(t *testing.T, n string, lb *loadbalancers.LoadBalancer) 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)
networkingClient, err := config.networkingV2Client(OS_REGION_NAME)
if err != nil {
return fmt.Errorf("(testAccCheckLBV2LoadBalancerExists) Error creating OpenStack networking client: %s", err)
}
found, err := loadbalancers.Get(networkingClient, rs.Primary.ID).Extract()
if err != nil {
return err
}
if found.ID != rs.Primary.ID {
return fmt.Errorf("Member not found")
}
*lb = *found
return nil
}
}
开发者ID:Originate,项目名称:terraform,代码行数:31,代码来源:resource_openstack_lb_loadbalancer_v2_test.go
示例4: waitForLoadBalancerActive
func waitForLoadBalancerActive(networkingClient *gophercloud.ServiceClient, lbID string) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
lb, err := loadbalancers.Get(networkingClient, lbID).Extract()
if err != nil {
return nil, "", err
}
log.Printf("[DEBUG] OpenStack LoadBalancer: %+v", lb)
if lb.ProvisioningStatus == "ACTIVE" {
return lb, "ACTIVE", nil
}
return lb, lb.ProvisioningStatus, nil
}
}
开发者ID:RezaDKhan,项目名称:terraform,代码行数:15,代码来源:resource_openstack_lb_loadbalancer_v2.go
示例5: getLoadbalancerWaitActive
func getLoadbalancerWaitActive(t *testing.T, loadbalancerID string) {
start := time.Now().Second()
for {
time.Sleep(1 * time.Second)
if time.Now().Second()-start >= loadbalancerActiveTimeoutSeconds {
t.Errorf("Loadbalancer failed to go into ACTIVE provisioning status")
return
}
loadbalancer, err := loadbalancers.Get(base.Client, loadbalancerID).Extract()
th.AssertNoErr(t, err)
if loadbalancer.ProvisioningStatus == "ACTIVE" {
t.Logf("Retrieved Loadbalancer, ID [%s]: OperatingStatus [%s]", loadbalancer.ID, loadbalancer.ProvisioningStatus)
return
}
}
}
开发者ID:sstrato,项目名称:gophercloud,代码行数:18,代码来源:loadbalancer_test.go
示例6: waitLoadbalancerActiveProvisioningStatus
func waitLoadbalancerActiveProvisioningStatus(client *gophercloud.ServiceClient, loadbalancerID string) error {
start := time.Now().Second()
for {
loadbalancer, err := loadbalancers.Get(client, loadbalancerID).Extract()
if err != nil {
return err
}
if loadbalancer.ProvisioningStatus == "ACTIVE" {
return nil
}
time.Sleep(1 * time.Second)
if time.Now().Second()-start >= loadbalancerActiveTimeoutSeconds {
return fmt.Errorf("Loadbalancer failed to go into ACTIVE provisioning status within alloted time")
}
}
}
开发者ID:RyanBinfeng,项目名称:kubernetes,代码行数:19,代码来源:openstack_loadbalancer.go
示例7: waitLoadbalancerDeleted
func waitLoadbalancerDeleted(client *gophercloud.ServiceClient, loadbalancerID string) error {
start := time.Now().Second()
for {
_, err := loadbalancers.Get(client, loadbalancerID).Extract()
if err != nil {
if err == ErrNotFound {
return nil
} else {
return err
}
}
time.Sleep(1 * time.Second)
if time.Now().Second()-start >= loadbalancerDeleteTimeoutSeconds {
return fmt.Errorf("Loadbalancer failed to delete within the alloted time")
}
}
}
开发者ID:nak3,项目名称:kubernetes,代码行数:20,代码来源:openstack_loadbalancer.go
示例8: getLoadbalancerWaitDeleted
func getLoadbalancerWaitDeleted(t *testing.T, loadbalancerID string) {
start := time.Now().Second()
for {
time.Sleep(1 * time.Second)
if time.Now().Second()-start >= loadbalancerDeleteTimeoutSeconds {
t.Errorf("Loadbalancer failed to delete")
return
}
_, err := loadbalancers.Get(base.Client, loadbalancerID).Extract()
if err != nil {
if errData, ok := err.(*(gophercloud.UnexpectedResponseCodeError)); ok {
if errData.Actual == 404 {
return
}
} else {
th.AssertNoErr(t, err)
}
}
}
}
开发者ID:sstrato,项目名称:gophercloud,代码行数:22,代码来源:loadbalancer_test.go
示例9: testAccCheckLBV2LoadBalancerDestroy
func testAccCheckLBV2LoadBalancerDestroy(s *terraform.State) error {
config := testAccProvider.Meta().(*Config)
networkingClient, err := config.networkingV2Client(OS_REGION_NAME)
if err != nil {
return fmt.Errorf("(testAccCheckLBV2LoadBalancerDestroy) Error creating OpenStack networking client: %s", err)
}
for _, rs := range s.RootModule().Resources {
log.Printf("[FINDME] rs TYPE is: %#v", rs.Type)
if rs.Type != "openstack_lb_loadbalancer_v2" {
continue
}
_, err := loadbalancers.Get(networkingClient, rs.Primary.ID).Extract()
if err == nil {
return fmt.Errorf("LoadBalancer still exists: %s", rs.Primary.ID)
}
}
return nil
}
开发者ID:Originate,项目名称:terraform,代码行数:22,代码来源:resource_openstack_lb_loadbalancer_v2_test.go
注:本文中的github.com/rackspace/gophercloud/openstack/networking/v2/extensions/lbaas_v2/loadbalancers.Get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论