github.com/mook-as/cf-cli@v7.0.0-beta.28.0.20200120190804-b91c115fae48+incompatible/cf/api/resources/service_keys.go (about) 1 package resources 2 3 import "code.cloudfoundry.org/cli/cf/models" 4 5 type ServiceKeyResource struct { 6 Resource 7 Entity ServiceKeyEntity 8 } 9 10 type ServiceKeyEntity struct { 11 Name string `json:"name"` 12 ServiceInstanceGUID string `json:"service_instance_guid"` 13 ServiceInstanceURL string `json:"service_instance_url"` 14 Credentials map[string]interface{} `json:"credentials"` 15 } 16 17 func (resource ServiceKeyResource) ToFields() models.ServiceKeyFields { 18 return models.ServiceKeyFields{ 19 Name: resource.Entity.Name, 20 URL: resource.Metadata.URL, 21 GUID: resource.Metadata.GUID, 22 } 23 } 24 25 func (resource ServiceKeyResource) ToModel() models.ServiceKey { 26 return models.ServiceKey{ 27 Fields: models.ServiceKeyFields{ 28 Name: resource.Entity.Name, 29 GUID: resource.Metadata.GUID, 30 URL: resource.Metadata.URL, 31 32 ServiceInstanceGUID: resource.Entity.ServiceInstanceGUID, 33 ServiceInstanceURL: resource.Entity.ServiceInstanceURL, 34 }, 35 Credentials: resource.Entity.Credentials, 36 } 37 }