From 008997a09ab9b04010e1a6990e2027bca81ab5c7 Mon Sep 17 00:00:00 2001 From: Yoshi Automation Date: Tue, 27 Aug 2024 01:35:31 +0000 Subject: [PATCH] feat(run): update the API #### run:v2 The following keys were added: - resources.projects.resources.locations.resources.builds.methods.submit.description - resources.projects.resources.locations.resources.builds.methods.submit.flatPath - resources.projects.resources.locations.resources.builds.methods.submit.httpMethod - resources.projects.resources.locations.resources.builds.methods.submit.id - resources.projects.resources.locations.resources.builds.methods.submit.parameterOrder - resources.projects.resources.locations.resources.builds.methods.submit.parameters.parent.description - resources.projects.resources.locations.resources.builds.methods.submit.parameters.parent.location - resources.projects.resources.locations.resources.builds.methods.submit.parameters.parent.pattern - resources.projects.resources.locations.resources.builds.methods.submit.parameters.parent.required - resources.projects.resources.locations.resources.builds.methods.submit.parameters.parent.type - resources.projects.resources.locations.resources.builds.methods.submit.path - resources.projects.resources.locations.resources.builds.methods.submit.request.$ref - resources.projects.resources.locations.resources.builds.methods.submit.response.$ref - resources.projects.resources.locations.resources.builds.methods.submit.scopes - schemas.GoogleCloudRunV2BuildpacksBuild.description - schemas.GoogleCloudRunV2BuildpacksBuild.id - schemas.GoogleCloudRunV2BuildpacksBuild.properties.baseImage.description - schemas.GoogleCloudRunV2BuildpacksBuild.properties.baseImage.type - schemas.GoogleCloudRunV2BuildpacksBuild.properties.cacheImageUri.description - schemas.GoogleCloudRunV2BuildpacksBuild.properties.cacheImageUri.type - schemas.GoogleCloudRunV2BuildpacksBuild.properties.enableAutomaticUpdates.description - schemas.GoogleCloudRunV2BuildpacksBuild.properties.enableAutomaticUpdates.type - schemas.GoogleCloudRunV2BuildpacksBuild.properties.environmentVariables.additionalProperties.type - schemas.GoogleCloudRunV2BuildpacksBuild.properties.environmentVariables.description - schemas.GoogleCloudRunV2BuildpacksBuild.properties.environmentVariables.type - schemas.GoogleCloudRunV2BuildpacksBuild.properties.functionTarget.description - schemas.GoogleCloudRunV2BuildpacksBuild.properties.functionTarget.type - schemas.GoogleCloudRunV2BuildpacksBuild.properties.runtime.deprecated - schemas.GoogleCloudRunV2BuildpacksBuild.properties.runtime.description - schemas.GoogleCloudRunV2BuildpacksBuild.properties.runtime.type - schemas.GoogleCloudRunV2BuildpacksBuild.type - schemas.GoogleCloudRunV2DockerBuild.description - schemas.GoogleCloudRunV2DockerBuild.id - schemas.GoogleCloudRunV2DockerBuild.type - schemas.GoogleCloudRunV2Service.properties.urls.description - schemas.GoogleCloudRunV2Service.properties.urls.items.type - schemas.GoogleCloudRunV2Service.properties.urls.readOnly - schemas.GoogleCloudRunV2Service.properties.urls.type - schemas.GoogleCloudRunV2StorageSource.description - schemas.GoogleCloudRunV2StorageSource.id - schemas.GoogleCloudRunV2StorageSource.properties.bucket.description - schemas.GoogleCloudRunV2StorageSource.properties.bucket.type - schemas.GoogleCloudRunV2StorageSource.properties.generation.description - schemas.GoogleCloudRunV2StorageSource.properties.generation.format - schemas.GoogleCloudRunV2StorageSource.properties.generation.type - schemas.GoogleCloudRunV2StorageSource.properties.object.description - schemas.GoogleCloudRunV2StorageSource.properties.object.type - schemas.GoogleCloudRunV2StorageSource.type - schemas.GoogleCloudRunV2SubmitBuildRequest.description - schemas.GoogleCloudRunV2SubmitBuildRequest.id - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.buildpackBuild.$ref - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.buildpackBuild.description - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.dockerBuild.$ref - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.dockerBuild.description - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.imageUri.description - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.imageUri.type - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.serviceAccount.description - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.serviceAccount.type - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.storageSource.$ref - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.storageSource.description - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.tags.description - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.tags.items.type - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.tags.type - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.workerPool.description - schemas.GoogleCloudRunV2SubmitBuildRequest.properties.workerPool.type - schemas.GoogleCloudRunV2SubmitBuildRequest.type - schemas.GoogleCloudRunV2SubmitBuildResponse.description - schemas.GoogleCloudRunV2SubmitBuildResponse.id - schemas.GoogleCloudRunV2SubmitBuildResponse.properties.baseImageUri.description - schemas.GoogleCloudRunV2SubmitBuildResponse.properties.baseImageUri.type - schemas.GoogleCloudRunV2SubmitBuildResponse.properties.buildOperation.$ref - schemas.GoogleCloudRunV2SubmitBuildResponse.properties.buildOperation.description - schemas.GoogleCloudRunV2SubmitBuildResponse.type The following keys were changed: - schemas.GoogleCloudRunV2EnvVar.properties.value.description --- discovery/run-v2.json | 158 +++++++++++++++++++++++++++++- src/apis/run/v2.ts | 221 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 376 insertions(+), 3 deletions(-) diff --git a/discovery/run-v2.json b/discovery/run-v2.json index 4b7e89ce83..cd84f8aab0 100644 --- a/discovery/run-v2.json +++ b/discovery/run-v2.json @@ -416,6 +416,38 @@ } }, "resources": { + "builds": { + "methods": { + "submit": { + "description": "Submits a build in a given project.", + "flatPath": "v2/projects/{projectsId}/locations/{locationsId}/builds:submit", + "httpMethod": "POST", + "id": "run.projects.locations.builds.submit", + "parameterOrder": [ + "parent" + ], + "parameters": { + "parent": { + "description": "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}", + "location": "path", + "pattern": "^projects/[^/]+/locations/[^/]+$", + "required": true, + "type": "string" + } + }, + "path": "v2/{+parent}/builds:submit", + "request": { + "$ref": "GoogleCloudRunV2SubmitBuildRequest" + }, + "response": { + "$ref": "GoogleCloudRunV2SubmitBuildResponse" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform" + ] + } + } + }, "jobs": { "methods": { "create": { @@ -1494,7 +1526,7 @@ } } }, - "revision": "20240802", + "revision": "20240816", "rootUrl": "https://run.googleapis.com/", "schemas": { "GoogleCloudRunV2BinaryAuthorization": { @@ -1516,6 +1548,41 @@ }, "type": "object" }, + "GoogleCloudRunV2BuildpacksBuild": { + "description": "Build the source using Buildpacks.", + "id": "GoogleCloudRunV2BuildpacksBuild", + "properties": { + "baseImage": { + "description": "Optional. The base image used to opt into automatic base image updates.", + "type": "string" + }, + "cacheImageUri": { + "description": "Optional. cache_image_uri is the GCR/AR URL where the cache image will be stored. cache_image_uri is optional and omitting it will disable caching. This URL must be stable across builds. It is used to derive a build-specific temporary URL by substituting the tag with the build ID. The build will clean up the temporary image on a best-effort basis.", + "type": "string" + }, + "enableAutomaticUpdates": { + "description": "Optional. Whether or not the application container will be enrolled in automatic base image updates. When true, the application will be built on a scratch base image, so the base layers can be appended at run time.", + "type": "boolean" + }, + "environmentVariables": { + "additionalProperties": { + "type": "string" + }, + "description": "Optional. User-provided build-time environment variables.", + "type": "object" + }, + "functionTarget": { + "description": "Optional. Name of the function target if the source is a function source. Required for function builds.", + "type": "string" + }, + "runtime": { + "deprecated": true, + "description": "The runtime name, e.g. 'go113'. Leave blank for generic builds.", + "type": "string" + } + }, + "type": "object" + }, "GoogleCloudRunV2CancelExecutionRequest": { "description": "Request message for deleting an Execution.", "id": "GoogleCloudRunV2CancelExecutionRequest", @@ -1812,6 +1879,12 @@ }, "type": "object" }, + "GoogleCloudRunV2DockerBuild": { + "description": "Build the source using Docker. This means the source has a Dockerfile.", + "id": "GoogleCloudRunV2DockerBuild", + "properties": {}, + "type": "object" + }, "GoogleCloudRunV2EmptyDirVolumeSource": { "description": "In memory (tmpfs) ephemeral storage. It is ephemeral in the sense that when the sandbox is taken down, the data is destroyed with it (it does not persist across sandbox runs).", "id": "GoogleCloudRunV2EmptyDirVolumeSource", @@ -1844,7 +1917,7 @@ "type": "string" }, "value": { - "description": "Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any route environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to \"\", and the maximum length is 32768 bytes.", + "description": "Literal value of the environment variable. Defaults to \"\", and the maximum length is 32768 bytes. Variable references are not supported in Cloud Run.", "type": "string" }, "valueSource": { @@ -3294,6 +3367,14 @@ "description": "Output only. The main URI in which this Service is serving traffic.", "readOnly": true, "type": "string" + }, + "urls": { + "description": "Output only. All URLs serving traffic for this Service.", + "items": { + "type": "string" + }, + "readOnly": true, + "type": "array" } }, "type": "object" @@ -3321,6 +3402,79 @@ }, "type": "object" }, + "GoogleCloudRunV2StorageSource": { + "description": "Location of the source in an archive file in Google Cloud Storage.", + "id": "GoogleCloudRunV2StorageSource", + "properties": { + "bucket": { + "description": "Required. Google Cloud Storage bucket containing the source (see [Bucket Name Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)).", + "type": "string" + }, + "generation": { + "description": "Optional. Google Cloud Storage generation for the object. If the generation is omitted, the latest generation will be used.", + "format": "int64", + "type": "string" + }, + "object": { + "description": "Required. Google Cloud Storage object containing the source. This object must be a gzipped archive file (`.tar.gz`) containing source to build.", + "type": "string" + } + }, + "type": "object" + }, + "GoogleCloudRunV2SubmitBuildRequest": { + "description": "Request message for submitting a Build.", + "id": "GoogleCloudRunV2SubmitBuildRequest", + "properties": { + "buildpackBuild": { + "$ref": "GoogleCloudRunV2BuildpacksBuild", + "description": "Build the source using Buildpacks." + }, + "dockerBuild": { + "$ref": "GoogleCloudRunV2DockerBuild", + "description": "Build the source using Docker. This means the source has a Dockerfile." + }, + "imageUri": { + "description": "Required. Artifact Registry URI to store the built image.", + "type": "string" + }, + "serviceAccount": { + "description": "Optional. The service account to use for the build. If not set, the default Cloud Build service account for the project will be used.", + "type": "string" + }, + "storageSource": { + "$ref": "GoogleCloudRunV2StorageSource", + "description": "Required. Source for the build." + }, + "tags": { + "description": "Optional. Additional tags to annotate the build.", + "items": { + "type": "string" + }, + "type": "array" + }, + "workerPool": { + "description": "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.", + "type": "string" + } + }, + "type": "object" + }, + "GoogleCloudRunV2SubmitBuildResponse": { + "description": "Response message for submitting a Build.", + "id": "GoogleCloudRunV2SubmitBuildResponse", + "properties": { + "baseImageUri": { + "description": "URI of the base builder image in Artifact Registry being used in the build. Used to opt into automatic base image updates.", + "type": "string" + }, + "buildOperation": { + "$ref": "GoogleLongrunningOperation", + "description": "Cloud Build operation to be polled via CloudBuild API." + } + }, + "type": "object" + }, "GoogleCloudRunV2TCPSocketAction": { "description": "TCPSocketAction describes an action based on opening a socket", "id": "GoogleCloudRunV2TCPSocketAction", diff --git a/src/apis/run/v2.ts b/src/apis/run/v2.ts index b7bffda204..c1d6e59b35 100644 --- a/src/apis/run/v2.ts +++ b/src/apis/run/v2.ts @@ -141,6 +141,35 @@ export namespace run_v2 { */ useDefault?: boolean | null; } + /** + * Build the source using Buildpacks. + */ + export interface Schema$GoogleCloudRunV2BuildpacksBuild { + /** + * Optional. The base image used to opt into automatic base image updates. + */ + baseImage?: string | null; + /** + * Optional. cache_image_uri is the GCR/AR URL where the cache image will be stored. cache_image_uri is optional and omitting it will disable caching. This URL must be stable across builds. It is used to derive a build-specific temporary URL by substituting the tag with the build ID. The build will clean up the temporary image on a best-effort basis. + */ + cacheImageUri?: string | null; + /** + * Optional. Whether or not the application container will be enrolled in automatic base image updates. When true, the application will be built on a scratch base image, so the base layers can be appended at run time. + */ + enableAutomaticUpdates?: boolean | null; + /** + * Optional. User-provided build-time environment variables. + */ + environmentVariables?: {[key: string]: string} | null; + /** + * Optional. Name of the function target if the source is a function source. Required for function builds. + */ + functionTarget?: string | null; + /** + * The runtime name, e.g. 'go113'. Leave blank for generic builds. + */ + runtime?: string | null; + } /** * Request message for deleting an Execution. */ @@ -287,6 +316,10 @@ export namespace run_v2 { */ name?: string | null; } + /** + * Build the source using Docker. This means the source has a Dockerfile. + */ + export interface Schema$GoogleCloudRunV2DockerBuild {} /** * In memory (tmpfs) ephemeral storage. It is ephemeral in the sense that when the sandbox is taken down, the data is destroyed with it (it does not persist across sandbox runs). */ @@ -309,7 +342,7 @@ export namespace run_v2 { */ name?: string | null; /** - * Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any route environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to "", and the maximum length is 32768 bytes. + * Literal value of the environment variable. Defaults to "", and the maximum length is 32768 bytes. Variable references are not supported in Cloud Run. */ value?: string | null; /** @@ -1297,6 +1330,10 @@ export namespace run_v2 { * Output only. The main URI in which this Service is serving traffic. */ uri?: string | null; + /** + * Output only. All URLs serving traffic for this Service. + */ + urls?: string[] | null; } /** * Service mesh configuration. @@ -1316,6 +1353,69 @@ export namespace run_v2 { */ minInstanceCount?: number | null; } + /** + * Location of the source in an archive file in Google Cloud Storage. + */ + export interface Schema$GoogleCloudRunV2StorageSource { + /** + * Required. Google Cloud Storage bucket containing the source (see [Bucket Name Requirements](https://cloud.google.com/storage/docs/bucket-naming#requirements)). + */ + bucket?: string | null; + /** + * Optional. Google Cloud Storage generation for the object. If the generation is omitted, the latest generation will be used. + */ + generation?: string | null; + /** + * Required. Google Cloud Storage object containing the source. This object must be a gzipped archive file (`.tar.gz`) containing source to build. + */ + object?: string | null; + } + /** + * Request message for submitting a Build. + */ + export interface Schema$GoogleCloudRunV2SubmitBuildRequest { + /** + * Build the source using Buildpacks. + */ + buildpackBuild?: Schema$GoogleCloudRunV2BuildpacksBuild; + /** + * Build the source using Docker. This means the source has a Dockerfile. + */ + dockerBuild?: Schema$GoogleCloudRunV2DockerBuild; + /** + * Required. Artifact Registry URI to store the built image. + */ + imageUri?: string | null; + /** + * Optional. The service account to use for the build. If not set, the default Cloud Build service account for the project will be used. + */ + serviceAccount?: string | null; + /** + * Required. Source for the build. + */ + storageSource?: Schema$GoogleCloudRunV2StorageSource; + /** + * Optional. Additional tags to annotate the build. + */ + tags?: string[] | null; + /** + * 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. + */ + workerPool?: string | null; + } + /** + * Response message for submitting a Build. + */ + export interface Schema$GoogleCloudRunV2SubmitBuildResponse { + /** + * URI of the base builder image in Artifact Registry being used in the build. Used to opt into automatic base image updates. + */ + baseImageUri?: string | null; + /** + * Cloud Build operation to be polled via CloudBuild API. + */ + buildOperation?: Schema$GoogleLongrunningOperation; + } /** * Task represents a single run of a container to completion. */ @@ -2719,11 +2819,13 @@ export namespace run_v2 { export class Resource$Projects$Locations { context: APIRequestContext; + builds: Resource$Projects$Locations$Builds; jobs: Resource$Projects$Locations$Jobs; operations: Resource$Projects$Locations$Operations; services: Resource$Projects$Locations$Services; constructor(context: APIRequestContext) { this.context = context; + this.builds = new Resource$Projects$Locations$Builds(this.context); this.jobs = new Resource$Projects$Locations$Jobs(this.context); this.operations = new Resource$Projects$Locations$Operations( this.context @@ -3148,6 +3250,123 @@ export namespace run_v2 { name?: string; } + export class Resource$Projects$Locations$Builds { + context: APIRequestContext; + constructor(context: APIRequestContext) { + this.context = context; + } + + /** + * Submits a build in a given project. + * + * @param params - Parameters for request + * @param options - Optionally override request options, such as `url`, `method`, and `encoding`. + * @param callback - Optional callback that handles the response. + * @returns A promise if used with async/await, or void if used with a callback. + */ + submit( + params: Params$Resource$Projects$Locations$Builds$Submit, + options: StreamMethodOptions + ): GaxiosPromise; + submit( + params?: Params$Resource$Projects$Locations$Builds$Submit, + options?: MethodOptions + ): GaxiosPromise; + submit( + params: Params$Resource$Projects$Locations$Builds$Submit, + options: StreamMethodOptions | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + submit( + params: Params$Resource$Projects$Locations$Builds$Submit, + options: + | MethodOptions + | BodyResponseCallback, + callback: BodyResponseCallback + ): void; + submit( + params: Params$Resource$Projects$Locations$Builds$Submit, + callback: BodyResponseCallback + ): void; + submit( + callback: BodyResponseCallback + ): void; + submit( + paramsOrCallback?: + | Params$Resource$Projects$Locations$Builds$Submit + | BodyResponseCallback + | BodyResponseCallback, + optionsOrCallback?: + | MethodOptions + | StreamMethodOptions + | BodyResponseCallback + | BodyResponseCallback, + callback?: + | BodyResponseCallback + | BodyResponseCallback + ): + | void + | GaxiosPromise + | GaxiosPromise { + let params = (paramsOrCallback || + {}) as Params$Resource$Projects$Locations$Builds$Submit; + let options = (optionsOrCallback || {}) as MethodOptions; + + if (typeof paramsOrCallback === 'function') { + callback = paramsOrCallback; + params = {} as Params$Resource$Projects$Locations$Builds$Submit; + options = {}; + } + + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + options = {}; + } + + const rootUrl = options.rootUrl || 'https://run.googleapis.com/'; + const parameters = { + options: Object.assign( + { + url: (rootUrl + '/v2/{+parent}/builds:submit').replace( + /([^:]\/)\/+/g, + '$1' + ), + method: 'POST', + apiVersion: '', + }, + options + ), + params, + requiredParams: ['parent'], + pathParams: ['parent'], + context: this.context, + }; + if (callback) { + createAPIRequest( + parameters, + callback as BodyResponseCallback + ); + } else { + return createAPIRequest( + parameters + ); + } + } + } + + export interface Params$Resource$Projects$Locations$Builds$Submit + extends StandardParameters { + /** + * 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\} + */ + parent?: string; + + /** + * Request body metadata + */ + requestBody?: Schema$GoogleCloudRunV2SubmitBuildRequest; + } + export class Resource$Projects$Locations$Jobs { context: APIRequestContext; executions: Resource$Projects$Locations$Jobs$Executions;