Google-cloud-node: Cloud Run API

Created on 9 Jul 2019  路  7Comments  路  Source: googleapis/google-cloud-node

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Is your feature request related to a problem? Please describe.
I would like to manage cloud run via node
A clear and concise description of what you want to happen.
A new API Library released
A clear and concise description of any alternative solutions or features you've considered.
I have looked at the REST client
Add any other context or screenshots about the feature request here.

feature request

Most helpful comment

Hi Guys,
First of all thanks for this great gcloud nodejs libs, i just want to know what is your plan or road map for google cloud run nodejs library.
Thanks.

All 7 comments

Hi Guys,
First of all thanks for this great gcloud nodejs libs, i just want to know what is your plan or road map for google cloud run nodejs library.
Thanks.

Greetings @ekuzu! We plan to build this, but we don't have a timeline just yet. In the meantime: you can actually use the googleapis npm module to work with the Cloud Run API today!
https://github.com/googleapis/google-api-nodejs-client/

oh cool - thanks @JustinBeckwith

For reference i managed to use the googleapis npm package to use cloud run, however keep i mind that it is auto generated and miss completely any sort of tests, indeed i found some "bugs":

  • you have to provide a different rootUrl, the default one is wrong
  • you cannot set the rootUrl because of a bug, it changes the url in unpredictable manner
  • you have to read the rest api documentation because some things aren't obvious, like in this case the name option must be namespaces/${namespace_id}/services/${service_id}
import { run_v1, google } from 'googleapis'

const defaultOptions = {
    rootUrl: 'https://us-central1-run.googleapis.com', // can use different region if you want
}

const CREDENTIALS = {}

const main = async () => {
    const auth = new google.auth.GoogleAuth({
        scopes: ['https://www.googleapis.com/auth/cloud-platform'], // doesn't work without this
        credentials: CREDENTIALS, // you can omit to use creds from environement
    })
    const authClient = await auth.getClient()
    const run = new run_v1.Run({
        auth: authClient,
    })
    try {
        const namespace_id = 'projectId'
        const service_id = 'servicename'
        const x = await run.namespaces.services.get(
            {
                name: `namespaces/${namespace_id}/services/${service_id}`,
            },
            defaultOptions,
        )
        console.log(x)
        console.log('DATA')
        console.error(JSON.stringify(x.data, null, 4))
    } catch (e) {
        // console.error(e)
        console.error(JSON.stringify(e, null, 4))
    }
})

any ETA on when this might be available?

Greetings folks! As of now, the plan is to _not_ build a library here. The reasoning was that the libraries should be the same between Cloud Run and KNative. The toolchain we have today assumes the service runs in GCP, and makes a lot of assumptions about grpc, authentication, and Google's general API platform.

I'm adding @steren who can speak to Cloud Run and it's APIs, and @mattmoor who can speak to KNative specific SDKs you should be able to use.

Of course, feedback on the approach always welcomed :)

@remorses thanks for the feedback on https://github.com/googleapis/google-cloud-node/issues/2941#issuecomment-599235742
Would you mind opening an issue on https://github.com/googleapis/google-api-nodejs-client/ about this?

Was this page helpful?
0 / 5 - 0 ratings