-
Notifications
You must be signed in to change notification settings - Fork 0
/
resource.go
40 lines (29 loc) · 812 Bytes
/
resource.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
// Copyright 2014 ALTOROS
// Licensed under the AGPLv3, see LICENSE file for details.
package gosigma
import (
"fmt"
"github.com/Altoros/gosigma/data"
)
// A Resource interface represents abstract resource in CloudSigma account
type Resource interface {
// Convert to string
fmt.Stringer
// URI of server instance
URI() string
// UUID of server instance
UUID() string
}
// A resource implements abstract CloudSigma resource
type resource struct {
obj *data.Resource
}
var _ Resource = resource{}
// String method implements fmt.Stringer interface
func (r resource) String() string {
return fmt.Sprintf("{URI: %q, UUID: %q}", r.URI(), r.UUID())
}
// URI of instance
func (r resource) URI() string { return r.obj.URI }
// UUID of instance
func (r resource) UUID() string { return r.obj.UUID }