Cloud Run Build Control Plane API v2
Package
@google-cloud/runConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of BuildsClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
auth
auth: gax.GoogleAuth;
buildsStub
buildsStub?: Promise<{
[name: string]: Function;
}>;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
locationsClient
locationsClient: LocationsClient;
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
universeDomain
get universeDomain(): string;
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Returns | |
---|---|
Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
executionPath(project, location, job, execution)
executionPath(project: string, location: string, job: string, execution: string): string;
Return a fully-qualified execution resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
job |
string
|
execution |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
getLocation(request, options, callback)
getLocation(request: LocationProtos.google.cloud.location.IGetLocationRequest, options?: gax.CallOptions | Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>, callback?: Callback<LocationProtos.google.cloud.location.ILocation, LocationProtos.google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>): Promise<LocationProtos.google.cloud.location.ILocation>;
Gets information about a location.
Parameters | |
---|---|
Name | Description |
request |
LocationProtos.google.cloud.location.IGetLocationRequest
The request object that will be sent. |
options |
CallOptions | Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Call options. See CallOptions for more details. |
callback |
Callback<google.cloud.location.ILocation, google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
Promise<google.cloud.location.ILocation> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the documentation for more details and examples. |
const [response] = await client.getLocation(request);
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Returns | |
---|---|
Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
jobPath(project, location, job)
jobPath(project: string, location: string, job: string): string;
Return a fully-qualified job resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
job |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
listLocationsAsync(request, options)
listLocationsAsync(request: LocationProtos.google.cloud.location.IListLocationsRequest, options?: CallOptions): AsyncIterable<LocationProtos.google.cloud.location.ILocation>;
Lists information about the supported locations for this service. Returns an iterable object.
for
-await
-of
syntax is used with the iterable to get response elements on-demand.
Parameters | |
---|---|
Name | Description |
request |
LocationProtos.google.cloud.location.IListLocationsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
AsyncIterable<google.cloud.location.ILocation> |
{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing . The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples. |
const iterable = client.listLocationsAsync(request);
for await (const response of iterable) {
// process response
}
matchExecutionFromExecutionName(executionName)
matchExecutionFromExecutionName(executionName: string): string | number;
Parse the execution from Execution resource.
Parameter | |
---|---|
Name | Description |
executionName |
string
A fully-qualified path representing Execution resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the execution. |
matchExecutionFromTaskName(taskName)
matchExecutionFromTaskName(taskName: string): string | number;
Parse the execution from Task resource.
Parameter | |
---|---|
Name | Description |
taskName |
string
A fully-qualified path representing Task resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the execution. |
matchJobFromExecutionName(executionName)
matchJobFromExecutionName(executionName: string): string | number;
Parse the job from Execution resource.
Parameter | |
---|---|
Name | Description |
executionName |
string
A fully-qualified path representing Execution resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the job. |
matchJobFromJobName(jobName)
matchJobFromJobName(jobName: string): string | number;
Parse the job from Job resource.
Parameter | |
---|---|
Name | Description |
jobName |
string
A fully-qualified path representing Job resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the job. |
matchJobFromTaskName(taskName)
matchJobFromTaskName(taskName: string): string | number;
Parse the job from Task resource.
Parameter | |
---|---|
Name | Description |
taskName |
string
A fully-qualified path representing Task resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the job. |
matchLocationFromExecutionName(executionName)
matchLocationFromExecutionName(executionName: string): string | number;
Parse the location from Execution resource.
Parameter | |
---|---|
Name | Description |
executionName |
string
A fully-qualified path representing Execution resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromJobName(jobName)
matchLocationFromJobName(jobName: string): string | number;
Parse the location from Job resource.
Parameter | |
---|---|
Name | Description |
jobName |
string
A fully-qualified path representing Job resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromRevisionName(revisionName)
matchLocationFromRevisionName(revisionName: string): string | number;
Parse the location from Revision resource.
Parameter | |
---|---|
Name | Description |
revisionName |
string
A fully-qualified path representing Revision resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromServiceName(serviceName)
matchLocationFromServiceName(serviceName: string): string | number;
Parse the location from Service resource.
Parameter | |
---|---|
Name | Description |
serviceName |
string
A fully-qualified path representing Service resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromTaskName(taskName)
matchLocationFromTaskName(taskName: string): string | number;
Parse the location from Task resource.
Parameter | |
---|---|
Name | Description |
taskName |
string
A fully-qualified path representing Task resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the location. |
matchLocationFromWorkerPoolName(workerPoolName)
matchLocationFromWorkerPoolName(workerPoolName: string): string | number;
Parse the location from WorkerPool resource.
Parameter | |
---|---|
Name | Description |
workerPoolName |
string
A fully-qualified path representing WorkerPool resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the location. |
matchProjectFromExecutionName(executionName)
matchProjectFromExecutionName(executionName: string): string | number;
Parse the project from Execution resource.
Parameter | |
---|---|
Name | Description |
executionName |
string
A fully-qualified path representing Execution resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromJobName(jobName)
matchProjectFromJobName(jobName: string): string | number;
Parse the project from Job resource.
Parameter | |
---|---|
Name | Description |
jobName |
string
A fully-qualified path representing Job resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromRevisionName(revisionName)
matchProjectFromRevisionName(revisionName: string): string | number;
Parse the project from Revision resource.
Parameter | |
---|---|
Name | Description |
revisionName |
string
A fully-qualified path representing Revision resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromServiceName(serviceName)
matchProjectFromServiceName(serviceName: string): string | number;
Parse the project from Service resource.
Parameter | |
---|---|
Name | Description |
serviceName |
string
A fully-qualified path representing Service resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromTaskName(taskName)
matchProjectFromTaskName(taskName: string): string | number;
Parse the project from Task resource.
Parameter | |
---|---|
Name | Description |
taskName |
string
A fully-qualified path representing Task resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchProjectFromWorkerPoolName(workerPoolName)
matchProjectFromWorkerPoolName(workerPoolName: string): string | number;
Parse the project from WorkerPool resource.
Parameter | |
---|---|
Name | Description |
workerPoolName |
string
A fully-qualified path representing WorkerPool resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the project. |
matchRevisionFromRevisionName(revisionName)
matchRevisionFromRevisionName(revisionName: string): string | number;
Parse the revision from Revision resource.
Parameter | |
---|---|
Name | Description |
revisionName |
string
A fully-qualified path representing Revision resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the revision. |
matchServiceFromRevisionName(revisionName)
matchServiceFromRevisionName(revisionName: string): string | number;
Parse the service from Revision resource.
Parameter | |
---|---|
Name | Description |
revisionName |
string
A fully-qualified path representing Revision resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the service. |
matchServiceFromServiceName(serviceName)
matchServiceFromServiceName(serviceName: string): string | number;
Parse the service from Service resource.
Parameter | |
---|---|
Name | Description |
serviceName |
string
A fully-qualified path representing Service resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the service. |
matchTaskFromTaskName(taskName)
matchTaskFromTaskName(taskName: string): string | number;
Parse the task from Task resource.
Parameter | |
---|---|
Name | Description |
taskName |
string
A fully-qualified path representing Task resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the task. |
matchWorkerPoolFromWorkerPoolName(workerPoolName)
matchWorkerPoolFromWorkerPoolName(workerPoolName: string): string | number;
Parse the worker_pool from WorkerPool resource.
Parameter | |
---|---|
Name | Description |
workerPoolName |
string
A fully-qualified path representing WorkerPool resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the worker_pool. |
revisionPath(project, location, service, revision)
revisionPath(project: string, location: string, service: string, revision: string): string;
Return a fully-qualified revision resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
service |
string
|
revision |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
servicePath(project, location, service)
servicePath(project: string, location: string, service: string): string;
Return a fully-qualified service resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
service |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
submitBuild(request, options)
submitBuild(request?: protos.google.cloud.run.v2.ISubmitBuildRequest, options?: CallOptions): Promise<[
protos.google.cloud.run.v2.ISubmitBuildResponse,
protos.google.cloud.run.v2.ISubmitBuildRequest | undefined,
{} | undefined
]>;
Submits a build in a given project.
Parameters | |
---|---|
Name | Description |
request |
ISubmitBuildRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.cloud.run.v2.ISubmitBuildResponse,
protos.google.cloud.run.v2.ISubmitBuildRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing SubmitBuildResponse. Please see the documentation for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The project and location to build in. Location must be a region,
* e.g., 'us-central1' or 'global' if the global builder is to be used.
* Format:
* `projects/{project}/locations/{location}`
*/
// const parent = 'abc123'
/**
* Required. Source for the build.
*/
// const storageSource = {}
/**
* Required. Artifact Registry URI to store the built image.
*/
// const imageUri = 'abc123'
/**
* Build the source using Buildpacks.
*/
// const buildpackBuild = {}
/**
* Build the source using Docker. This means the source has a Dockerfile.
*/
// const dockerBuild = {}
/**
* Optional. The service account to use for the build. If not set, the default
* Cloud Build service account for the project will be used.
*/
// const serviceAccount = 'abc123'
/**
* Optional. Name of the Cloud Build Custom Worker Pool that should be used to
* build the function. The format of this field is
* `projects/{project}/locations/{region}/workerPools/{workerPool}` where
* `{project}` and `{region}` are the project id and region respectively where
* the worker pool is defined and `{workerPool}` is the short name of the
* worker pool.
*/
// const workerPool = 'abc123'
/**
* Optional. Additional tags to annotate the build.
*/
// const tags = ['abc','def']
// Imports the Run library
const {BuildsClient} = require('@google-cloud/run').v2;
// Instantiates a client
const runClient = new BuildsClient();
async function callSubmitBuild() {
// Construct request
const request = {
parent,
storageSource,
imageUri,
};
// Run request
const response = await runClient.submitBuild(request);
console.log(response);
}
callSubmitBuild();
submitBuild(request, options, callback)
submitBuild(request: protos.google.cloud.run.v2.ISubmitBuildRequest, options: CallOptions, callback: Callback<protos.google.cloud.run.v2.ISubmitBuildResponse, protos.google.cloud.run.v2.ISubmitBuildRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ISubmitBuildRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.cloud.run.v2.ISubmitBuildResponse, protos.google.cloud.run.v2.ISubmitBuildRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
submitBuild(request, callback)
submitBuild(request: protos.google.cloud.run.v2.ISubmitBuildRequest, callback: Callback<protos.google.cloud.run.v2.ISubmitBuildResponse, protos.google.cloud.run.v2.ISubmitBuildRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
ISubmitBuildRequest
|
callback |
Callback<protos.google.cloud.run.v2.ISubmitBuildResponse, protos.google.cloud.run.v2.ISubmitBuildRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
taskPath(project, location, job, execution, task)
taskPath(project: string, location: string, job: string, execution: string, task: string): string;
Return a fully-qualified task resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
job |
string
|
execution |
string
|
task |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |
workerPoolPath(project, location, workerPool)
workerPoolPath(project: string, location: string, workerPool: string): string;
Return a fully-qualified workerPool resource name string.
Parameters | |
---|---|
Name | Description |
project |
string
|
location |
string
|
workerPool |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |