IBM / keyprotect-nodejs-client

Nodejs SDK for interacting with the IBMCloud KeyProtect service.
Apache License 2.0
0 stars 10 forks source link

How can I use the SDK to get the CRN of the service instance? #13

Closed CarstenLeue closed 2 years ago

CarstenLeue commented 2 years ago

In order to interface with a different API I need the CRN of the service instance. I do have an instance of the SDK object at hand which is configured via the endpoint URL and the service ID (according to doc). But I cannot find a way to use the SDK API to return the CRN of the instance.

As a workaround I was thinking to create a key, read the CRN of the key and delete the key immediately. The from the CRN of the key strip off the CRN of the service. But this seems to be unnecessarily complicated. Is there a better way?

thu2thu2 commented 2 years ago

You should probably use the platform services SDK https://github.com/IBM/platform-services-node-sdk. See:

https://cloud.ibm.com/apidocs/resource-controller/resource-controller?code=node#get-resource-instance

The response of "Get a resource instance" contains the CRN.

CarstenLeue commented 2 years ago

@thu2thu2 thank you for the pointer. I think this is a feasible but inconvenient way, because I have to setup configuration for a completely different service in order to retrieve information about a service I already have an SDK object for.

Would it be possible to expose an API in the SDK that invokes your suggested workaround internally, so as a consumer I only have to deal with one SDK object?

thu2thu2 commented 2 years ago

@CarstenLeue I believe this function should belong to platform services SDK

CarstenLeue commented 2 years ago

hmm ok. I'll close the issue, then