本文整理汇总了Golang中github.com/pearkes/digitalocean.Client类的典型用法代码示例。如果您正苦于以下问题:Golang Client类的具体用法?Golang Client怎么用?Golang Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Client类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: resource_digitalocean_record_retrieve
func resource_digitalocean_record_retrieve(domain string, id string, client *digitalocean.Client) (*digitalocean.Record, error) {
record, err := client.RetrieveRecord(domain, id)
if err != nil {
return nil, err
}
return &record, nil
}
开发者ID:GeorgeErickson,项目名称:terraform-1,代码行数:8,代码来源:resource_digitalocean_record.go
示例2: resource_digitalocean_droplet_retrieve
// retrieves an ELB by its ID
func resource_digitalocean_droplet_retrieve(id string, client *digitalocean.Client) (*digitalocean.Droplet, error) {
// Retrieve the ELB properties for updating the state
droplet, err := client.RetrieveDroplet(id)
if err != nil {
return nil, fmt.Errorf("Error retrieving droplet: %s", err)
}
return &droplet, nil
}
开发者ID:GeorgeErickson,项目名称:terraform-1,代码行数:11,代码来源:resource_digitalocean_droplet.go
示例3: power_on_and_wait
// Powers on the droplet and waits for it to be active
func power_on_and_wait(id string, client *digitalocean.Client) error {
err := client.PowerOn(id)
if err != nil {
return err
}
// Wait for power on
_, err = WaitForDropletAttribute(
id, "active", []string{"off"}, "status", client)
if err != nil {
return err
}
return nil
}
开发者ID:GeorgeErickson,项目名称:terraform-1,代码行数:18,代码来源:resource_digitalocean_droplet.go
示例4: new_droplet_state_refresh_func
func new_droplet_state_refresh_func(id string, attribute string, client *digitalocean.Client) resource.StateRefreshFunc {
return func() (interface{}, string, error) {
// Retrieve the ELB properties for updating the state
droplet, err := client.RetrieveDroplet(id)
if err != nil {
log.Printf("Error on retrieving droplet when waiting: %s", err)
return nil, "", err
}
// If the droplet is locked, continue waiting. We can
// only perform actions on unlocked droplets, so it's
// pointless to look at that status
if droplet.IsLocked() == "true" {
log.Println("[DEBUG] Droplet is locked, skipping status check and retrying")
return nil, "", nil
}
// Use our mapping to get back a map of the
// droplet properties
resourceMap, err := resource_digitalocean_droplet_update_state(
&terraform.ResourceState{Attributes: map[string]string{}}, &droplet)
if err != nil {
log.Printf("Error creating map from droplet: %s", err)
return nil, "", err
}
// See if we can access our attribute
if attr, ok := resourceMap.Attributes[attribute]; ok {
return &droplet, attr, nil
}
return nil, "", nil
}
}
开发者ID:GeorgeErickson,项目名称:terraform-1,代码行数:36,代码来源:resource_digitalocean_droplet.go
注:本文中的github.com/pearkes/digitalocean.Client类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论