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 "github.com/cloudfoundry/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,
}
}