sonatype-nexus-community/nexus-blobstore-google-cloud

API doesn't work with "credentials" field

Leshii82 opened this issue · 3 comments

Thanks for creating an issue! Please fill out this form so we can be
sure to have all the information we need, and to minimize back and forth.

  • What are you trying to do?
    I'm trying to configure Google Storage blobstore via Nexus API.

  • What feature or behavior is this required for?
    As part of our automatisation , I'm trying to configure Nexus with a script. Also, we're using your plugin.
    When creating and configuring Google Cloud Storage blobstore manually, everything works as expected. But when trying for example, to create Google Cloud Storage blobstore using Nexus API, if entering field named "credentials", it doesn't seem like accepting this field.* I'm trying to use for test , the API in Nexus dashboard, by POST /v1/blobstores/google
    This are the fields that exists in Nexus API -
    {
    "name": "string",
    "bucketName": "string",
    "region": "string",
    "softQuota": {
    "type": "string",
    "limit": 0
    }
    }

If I will enter additional field "credentials", which is a must, it won't accept this field. Is there any workaround?
Could you help please?

Looking at the code, I think you're right, that field can't be passed in via API, that's an oversight on my part.

The preferred route to provide IAM credentials to NXRM for this plugin is to use the environment to set GOOGLE_APPLICATION_CREDENTIALS to point to a file on disk the user running NXRM can read. That's the typical path case I've grown accustomed to, so overriding via the UI (or API in the case) was unnecessary.
Would you be able to use that in the interim? I'll try to queue up some time to make the changes to the API, but I can't promise an immediate turnaround.

The reference document on Authentication covers the multiple routes that the underlying client this plugin uses can authenticate. The code sample in the Java section is pretty similar to what the plugin uses; if the credential_file attribute is present use it, otherwise default to letting the client source from the environment.

@nblair , thanks a lot for your quick response!
I will wait when you will make it work via API.

Thanks a lot for your support once again!