-
Notifications
You must be signed in to change notification settings - Fork 2
/
application.go
48 lines (40 loc) · 1.29 KB
/
application.go
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
package iis
import (
"context"
"encoding/json"
"fmt"
)
func (r *Application) Marshal() ([]byte, error) {
return json.Marshal(r)
}
type ResourceReferences map[string]*ResourceReference
type ResourceReference struct {
Href string `json:"href"`
}
type Application struct {
Location string `json:"location"`
Path string `json:"path"`
ID string `json:"id"`
PhysicalPath string `json:"physical_path"`
EnabledProtocols string `json:"enabled_protocols"`
Website ApplicationReference `json:"website"`
ApplicationPool ApplicationReference `json:"application_pool"`
Links ResourceReferences `json:"_links,omitempty"`
}
type ApplicationReference struct {
Name string `json:"name"`
ID string `json:"id"`
Status string `json:"status"`
}
func (client Client) ReadApplication(ctx context.Context, id string) (*Application, error) {
url := fmt.Sprintf("/api/webserver/webapps/%s", id)
var app Application
if err := getJson(ctx, client, url, &app); err != nil {
return nil, err
}
return &app, nil
}
func (client Client) DeleteApplication(ctx context.Context, id string) error {
url := fmt.Sprintf("/api/webserver/webapps/%s", id)
return httpDelete(ctx, client, url)
}