code.cloudfoundry.org/cli@v7.1.0+incompatible/actor/v2action/service_instance_user_provided.go (about)

     1  package v2action
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv2"
     5  )
     6  
     7  // UserProvidedServiceInstance represents an instance of a user-provided service.
     8  type UserProvidedServiceInstance ccv2.UserProvidedServiceInstance
     9  
    10  func (u UserProvidedServiceInstance) WithTags(tags []string) UserProvidedServiceInstance {
    11  	if tags == nil {
    12  		tags = []string{}
    13  	}
    14  
    15  	u.Tags = &tags
    16  	return u
    17  }
    18  
    19  func (u UserProvidedServiceInstance) WithSyslogDrainURL(url string) UserProvidedServiceInstance {
    20  	u.SyslogDrainURL = &url
    21  	return u
    22  }
    23  
    24  func (u UserProvidedServiceInstance) WithRouteServiceURL(url string) UserProvidedServiceInstance {
    25  	u.RouteServiceURL = &url
    26  	return u
    27  }
    28  
    29  func (u UserProvidedServiceInstance) WithCredentials(creds map[string]interface{}) UserProvidedServiceInstance {
    30  	if creds == nil {
    31  		creds = make(map[string]interface{})
    32  	}
    33  
    34  	u.Credentials = creds
    35  	return u
    36  }
    37  
    38  // UpdateUserProvidedServiceInstance requests that the service instance be updated with the specified data
    39  func (actor Actor) UpdateUserProvidedServiceInstance(guid string, instance UserProvidedServiceInstance) (Warnings, error) {
    40  	warnings, err := actor.CloudControllerClient.UpdateUserProvidedServiceInstance(guid, ccv2.UserProvidedServiceInstance(instance))
    41  	return Warnings(warnings), err
    42  }