-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy pathdomains.go
More file actions
72 lines (55 loc) · 1.44 KB
/
domains.go
File metadata and controls
72 lines (55 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package cmd
import "github.com/deis/controller-sdk-go/domains"
// DomainsList lists domains registered with an app.
func (d *DeisCmd) DomainsList(appID string, results int) error {
s, appID, err := load(d.ConfigFile, appID)
if err != nil {
return err
}
if results == defaultLimit {
results = s.Limit
}
domains, count, err := domains.List(s.Client, appID, results)
if d.checkAPICompatibility(s.Client, err) != nil {
return err
}
d.Printf("=== %s Domains%s", appID, limitCount(len(domains), count))
for _, domain := range domains {
d.Println(domain.Domain)
}
return nil
}
// DomainsAdd adds a domain to an app.
func (d *DeisCmd) DomainsAdd(appID, domain string) error {
s, appID, err := load(d.ConfigFile, appID)
if err != nil {
return err
}
d.Printf("Adding %s to %s... ", domain, appID)
quit := progress(d.WOut)
_, err = domains.New(s.Client, appID, domain)
quit <- true
<-quit
if d.checkAPICompatibility(s.Client, err) != nil {
return err
}
d.Println("done")
return nil
}
// DomainsRemove removes a domain registered with an app.
func (d *DeisCmd) DomainsRemove(appID, domain string) error {
s, appID, err := load(d.ConfigFile, appID)
if err != nil {
return err
}
d.Printf("Removing %s from %s... ", domain, appID)
quit := progress(d.WOut)
err = domains.Delete(s.Client, appID, domain)
quit <- true
<-quit
if d.checkAPICompatibility(s.Client, err) != nil {
return err
}
d.Println("done")
return nil
}