forked from cloudfoundry-community/cloudfoundry-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
service_keys.go
37 lines (31 loc) · 1.02 KB
/
service_keys.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
package resources
import "code.cloudfoundry.org/cli/cf/models"
type ServiceKeyResource struct {
Resource
Entity ServiceKeyEntity
}
type ServiceKeyEntity struct {
Name string `json:"name"`
ServiceInstanceGUID string `json:"service_instance_guid"`
ServiceInstanceURL string `json:"service_instance_url"`
Credentials map[string]interface{} `json:"credentials"`
}
func (resource ServiceKeyResource) ToFields() models.ServiceKeyFields {
return models.ServiceKeyFields{
Name: resource.Entity.Name,
URL: resource.Metadata.URL,
GUID: resource.Metadata.GUID,
}
}
func (resource ServiceKeyResource) ToModel() models.ServiceKey {
return models.ServiceKey{
Fields: models.ServiceKeyFields{
Name: resource.Entity.Name,
GUID: resource.Metadata.GUID,
URL: resource.Metadata.URL,
ServiceInstanceGUID: resource.Entity.ServiceInstanceGUID,
ServiceInstanceURL: resource.Entity.ServiceInstanceURL,
},
Credentials: resource.Entity.Credentials,
}
}