Chris Snow
Chris Snow

Reputation: 24606

Service credentials are not populated when service instance is created using cloud foundry rest API

I'm creating a Message Hub service instance using a python cloud foundry client:

$ pip install --user --quiet protobuf
$ pip install --user --quiet cloudfoundry-client

from cloudfoundry_client.client import CloudFoundryClient
target_endpoint = 'https://api.ng.bluemix.net'

client = CloudFoundryClient(target_endpoint, skip_verification=False)
client.init_with_user_credentials(
    ibm_id,
    ibm_id_password
    )

mh_service = client.service_instances.create(
    space_guid, 
    'my_mh2', 
    mh_plan_id
)

The service is created, but when I view the credentials using the management console, they are empty:

enter image description here

I've seen in the integration test code for the python client that parameters and tags can be created:

client.service_instances.create(
   'space_guid', 
   'name', 
   'plan_id',
   parameters=dict(the_service_broker="wants this object"),
   tags=['example']
)

Therefore, I'm guessing I need to pass something extra to tell bluemix to create some default credentials for me?

Upvotes: 0

Views: 238

Answers (1)

Dominic Evans
Dominic Evans

Reputation: 370

I think you'd need to raise another GH issue against that 3rd party Python client for CF to also allow creation of service keys https://github.com/antechrestos/cf-python-client/issues/11

Using the cf cli you'd do this:

cf create-service ${MESSAGE_HUB_SERVICE} ${MESSAGE_HUB_PLAN} ${MESSAGE_HUB_INSTANCE_NAME}
cf create-service-key ${MESSAGE_HUB_INSTANCE_NAME} Credentials-1

Upvotes: 1

Related Questions