Skip to content

Commit

Permalink
feat(cloudbuild): update the API
Browse files Browse the repository at this point in the history
#### cloudbuild:v1alpha1
The following keys were added:
- schemas.BuildOptions.properties.dynamicSubstitutions.description
- schemas.BuildOptions.properties.dynamicSubstitutions.type

The following keys were changed:
- schemas.BuildOptions.properties.substitutionOption.description

#### cloudbuild:v1alpha2
The following keys were added:
- schemas.BuildOptions.properties.dynamicSubstitutions.description
- schemas.BuildOptions.properties.dynamicSubstitutions.type

The following keys were changed:
- schemas.BuildOptions.properties.substitutionOption.description

#### cloudbuild:v1
The following keys were added:
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.description
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.flatPath
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.httpMethod
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.id
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.parameterOrder
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.parameters.name.description
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.parameters.name.location
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.parameters.name.pattern
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.parameters.name.required
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.parameters.name.type
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.path
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.request.$ref
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.response.$ref
- resources.vbeta1.resources.projects.resources.locations.resources.operations.methods.cancel.scopes
- schemas.BuildOptions.properties.dynamicSubstitutions.description
- schemas.BuildOptions.properties.dynamicSubstitutions.type

The following keys were changed:
- schemas.BuildOptions.properties.substitutionOption.description
- schemas.PullRequestFilter.properties.commentControl.description
  • Loading branch information
yoshi-automation authored and JustinBeckwith committed Jun 5, 2020
1 parent fa57e04 commit 4cba781
Show file tree
Hide file tree
Showing 6 changed files with 266 additions and 11 deletions.
54 changes: 51 additions & 3 deletions discovery/cloudbuild-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,53 @@
}
}
}
},
"vbeta1": {
"resources": {
"projects": {
"resources": {
"locations": {
"resources": {
"operations": {
"methods": {
"cancel": {
"description": "Starts asynchronous cancellation on a long-running operation. The server\nmakes a best effort to cancel the operation, but success is not\nguaranteed. If the server doesn't support this method, it returns\n`google.rpc.Code.UNIMPLEMENTED`. Clients can use\nOperations.GetOperation or\nother methods to check whether the cancellation succeeded or whether the\noperation completed despite cancellation. On successful cancellation,\nthe operation is not deleted; instead, it becomes an operation with\nan Operation.error value with a google.rpc.Status.code of 1,\ncorresponding to `Code.CANCELLED`.",
"flatPath": "vbeta1/projects/{projectsId}/locations/{locationsId}/operations/{operationsId}:cancel",
"httpMethod": "POST",
"id": "cloudbuild.vbeta1.projects.locations.operations.cancel",
"parameterOrder": [
"name"
],
"parameters": {
"name": {
"description": "The name of the operation resource to be cancelled.",
"location": "path",
"pattern": "^projects/[^/]+/locations/[^/]+/operations/[^/]+$",
"required": true,
"type": "string"
}
},
"path": "vbeta1/{+name}:cancel",
"request": {
"$ref": "CancelOperationRequest"
},
"response": {
"$ref": "Empty"
},
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
}
}
}
}
}
}
}
}
},
"revision": "20200520",
"revision": "20200601",
"rootUrl": "https://cloudbuild.googleapis.com/",
"schemas": {
"ArtifactObjects": {
Expand Down Expand Up @@ -901,6 +945,10 @@
"format": "int64",
"type": "string"
},
"dynamicSubstitutions": {
"description": "Option to specify whether or not to apply bash style string\noperations to the substitutions.\n\nNOTE: this is always enabled for triggered builds and cannot be\noverridden in the build configuration file.",
"type": "boolean"
},
"env": {
"description": "A list of global environment variable definitions that will exist for all\nbuild steps in this build. If a variable is defined in both globally and in\na build step, the variable will use the build step value.\n\nThe elements are of the form \"KEY=VALUE\" for the environment variable \"KEY\"\nbeing given the value \"VALUE\".",
"items": {
Expand Down Expand Up @@ -987,7 +1035,7 @@
"type": "array"
},
"substitutionOption": {
"description": "Option to specify behavior when there is an error in the substitution\nchecks.",
"description": "Option to specify behavior when there is an error in the substitution\nchecks.\n\nNOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot\nbe overridden in the build configuration file.",
"enum": [
"MUST_MATCH",
"ALLOW_LOOSE"
Expand Down Expand Up @@ -1384,7 +1432,7 @@
"type": "string"
},
"commentControl": {
"description": "Configure builds to run only when a repository owner or collaborator\ncomments `/gcbrun`.",
"description": "Configure builds to run whether a repository owner or collaborator need to\ncomment `/gcbrun`.",
"enum": [
"COMMENTS_DISABLED",
"COMMENTS_ENABLED"
Expand Down
8 changes: 6 additions & 2 deletions discovery/cloudbuild-v1alpha1.json
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@
}
}
},
"revision": "20200520",
"revision": "20200601",
"rootUrl": "https://cloudbuild.googleapis.com/",
"schemas": {
"ArtifactObjects": {
Expand Down Expand Up @@ -572,6 +572,10 @@
"format": "int64",
"type": "string"
},
"dynamicSubstitutions": {
"description": "Option to specify whether or not to apply bash style string\noperations to the substitutions.\n\nNOTE: this is always enabled for triggered builds and cannot be\noverridden in the build configuration file.",
"type": "boolean"
},
"env": {
"description": "A list of global environment variable definitions that will exist for all\nbuild steps in this build. If a variable is defined in both globally and in\na build step, the variable will use the build step value.\n\nThe elements are of the form \"KEY=VALUE\" for the environment variable \"KEY\"\nbeing given the value \"VALUE\".",
"items": {
Expand Down Expand Up @@ -658,7 +662,7 @@
"type": "array"
},
"substitutionOption": {
"description": "Option to specify behavior when there is an error in the substitution\nchecks.",
"description": "Option to specify behavior when there is an error in the substitution\nchecks.\n\nNOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot\nbe overridden in the build configuration file.",
"enum": [
"MUST_MATCH",
"ALLOW_LOOSE"
Expand Down
8 changes: 6 additions & 2 deletions discovery/cloudbuild-v1alpha2.json
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@
}
}
},
"revision": "20200520",
"revision": "20200601",
"rootUrl": "https://cloudbuild.googleapis.com/",
"schemas": {
"ArtifactObjects": {
Expand Down Expand Up @@ -583,6 +583,10 @@
"format": "int64",
"type": "string"
},
"dynamicSubstitutions": {
"description": "Option to specify whether or not to apply bash style string\noperations to the substitutions.\n\nNOTE: this is always enabled for triggered builds and cannot be\noverridden in the build configuration file.",
"type": "boolean"
},
"env": {
"description": "A list of global environment variable definitions that will exist for all\nbuild steps in this build. If a variable is defined in both globally and in\na build step, the variable will use the build step value.\n\nThe elements are of the form \"KEY=VALUE\" for the environment variable \"KEY\"\nbeing given the value \"VALUE\".",
"items": {
Expand Down Expand Up @@ -669,7 +673,7 @@
"type": "array"
},
"substitutionOption": {
"description": "Option to specify behavior when there is an error in the substitution\nchecks.",
"description": "Option to specify behavior when there is an error in the substitution\nchecks.\n\nNOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot\nbe overridden in the build configuration file.",
"enum": [
"MUST_MATCH",
"ALLOW_LOOSE"
Expand Down
195 changes: 193 additions & 2 deletions src/apis/cloudbuild/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export namespace cloudbuild_v1 {
context: APIRequestContext;
operations: Resource$Operations;
projects: Resource$Projects;
vbeta1: Resource$Vbeta1;

constructor(options: GlobalOptions, google?: GoogleConfigurable) {
this.context = {
Expand All @@ -126,6 +127,7 @@ export namespace cloudbuild_v1 {

this.operations = new Resource$Operations(this.context);
this.projects = new Resource$Projects(this.context);
this.vbeta1 = new Resource$Vbeta1(this.context);
}
}

Expand Down Expand Up @@ -286,6 +288,10 @@ export namespace cloudbuild_v1 {
* Requested disk size for the VM that runs the build. Note that this is *NOT* "disk free"; some of the space will be used by the operating system and build utilities. Also note that this is the minimum disk size that will be allocated for the build -- the build may run with a larger disk than requested. At present, the maximum disk size is 1000GB; builds that request more than the maximum are rejected with an error.
*/
diskSizeGb?: string | null;
/**
* Option to specify whether or not to apply bash style string operations to the substitutions. NOTE: this is always enabled for triggered builds and cannot be overridden in the build configuration file.
*/
dynamicSubstitutions?: boolean | null;
/**
* A list of global environment variable definitions that will exist for all build steps in this build. If a variable is defined in both globally and in a build step, the variable will use the build step value. The elements are of the form "KEY=VALUE" for the environment variable "KEY" being given the value "VALUE".
*/
Expand Down Expand Up @@ -315,7 +321,7 @@ export namespace cloudbuild_v1 {
*/
sourceProvenanceHash?: string[] | null;
/**
* Option to specify behavior when there is an error in the substitution checks.
* Option to specify behavior when there is an error in the substitution checks. NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot be overridden in the build configuration file.
*/
substitutionOption?: string | null;
/**
Expand Down Expand Up @@ -590,7 +596,7 @@ export namespace cloudbuild_v1 {
*/
branch?: string | null;
/**
* Configure builds to run only when a repository owner or collaborator comments `/gcbrun`.
* Configure builds to run whether a repository owner or collaborator need to comment `/gcbrun`.
*/
commentControl?: string | null;
/**
Expand Down Expand Up @@ -3566,4 +3572,189 @@ export namespace cloudbuild_v1 {
*/
requestBody?: Schema$RepoSource;
}

export class Resource$Vbeta1 {
context: APIRequestContext;
projects: Resource$Vbeta1$Projects;
constructor(context: APIRequestContext) {
this.context = context;
this.projects = new Resource$Vbeta1$Projects(this.context);
}
}

export class Resource$Vbeta1$Projects {
context: APIRequestContext;
locations: Resource$Vbeta1$Projects$Locations;
constructor(context: APIRequestContext) {
this.context = context;
this.locations = new Resource$Vbeta1$Projects$Locations(this.context);
}
}

export class Resource$Vbeta1$Projects$Locations {
context: APIRequestContext;
operations: Resource$Vbeta1$Projects$Locations$Operations;
constructor(context: APIRequestContext) {
this.context = context;
this.operations = new Resource$Vbeta1$Projects$Locations$Operations(
this.context
);
}
}

export class Resource$Vbeta1$Projects$Locations$Operations {
context: APIRequestContext;
constructor(context: APIRequestContext) {
this.context = context;
}

/**
* cloudbuild.vbeta1.projects.locations.operations.cancel
* @desc Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
* @example
* // Before running the sample:
* // - Enable the API at:
* // https://console.developers.google.com/apis/api/cloudbuild.googleapis.com
* // - Login into gcloud by running:
* // `$ gcloud auth application-default login`
* // - Install the npm module by running:
* // `$ npm install googleapis`
*
* const {google} = require('googleapis');
* const cloudbuild = google.cloudbuild('v1');
*
* async function main() {
* const auth = new google.auth.GoogleAuth({
* // Scopes can be specified either as an array or as a single, space-delimited string.
* scopes: ['https://www.googleapis.com/auth/cloud-platform'],
* });
*
* // Acquire an auth client, and bind it to all future calls
* const authClient = await auth.getClient();
* google.options('auth', authClient);
*
* // Do the magic
* const res = await cloudbuild.vbeta1.projects.locations.operations.cancel({
* // The name of the operation resource to be cancelled.
* name: 'projects/my-project/locations/my-location/operations/my-operation',
*
* // Request body metadata
* requestBody: {
* // request body parameters
* // {}
* },
* });
* console.log(res.data);
*
* // Example response
* // {}
* }
*
* main().catch(e => {
* console.error(e);
* throw e;
* });
*
* @alias cloudbuild.vbeta1.projects.locations.operations.cancel
* @memberOf! ()
*
* @param {object} params Parameters for request
* @param {string} params.name The name of the operation resource to be cancelled.
* @param {().CancelOperationRequest} params.requestBody Request body data
* @param {object} [options] Optionally override request options, such as `url`, `method`, and `encoding`.
* @param {callback} callback The callback that handles the response.
* @return {object} Request object
*/
cancel(
params: Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel,
options: StreamMethodOptions
): GaxiosPromise<Readable>;
cancel(
params?: Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel,
options?: MethodOptions
): GaxiosPromise<Schema$Empty>;
cancel(
params: Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel,
options: StreamMethodOptions | BodyResponseCallback<Readable>,
callback: BodyResponseCallback<Readable>
): void;
cancel(
params: Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel,
options: MethodOptions | BodyResponseCallback<Schema$Empty>,
callback: BodyResponseCallback<Schema$Empty>
): void;
cancel(
params: Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel,
callback: BodyResponseCallback<Schema$Empty>
): void;
cancel(callback: BodyResponseCallback<Schema$Empty>): void;
cancel(
paramsOrCallback?:
| Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>,
optionsOrCallback?:
| MethodOptions
| StreamMethodOptions
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>,
callback?:
| BodyResponseCallback<Schema$Empty>
| BodyResponseCallback<Readable>
): void | GaxiosPromise<Schema$Empty> | GaxiosPromise<Readable> {
let params = (paramsOrCallback ||
{}) as Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel;
let options = (optionsOrCallback || {}) as MethodOptions;

if (typeof paramsOrCallback === 'function') {
callback = paramsOrCallback;
params = {} as Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel;
options = {};
}

if (typeof optionsOrCallback === 'function') {
callback = optionsOrCallback;
options = {};
}

const rootUrl = options.rootUrl || 'https://cloudbuild.googleapis.com/';
const parameters = {
options: Object.assign(
{
url: (rootUrl + '/vbeta1/{+name}:cancel').replace(
/([^:]\/)\/+/g,
'$1'
),
method: 'POST',
},
options
),
params,
requiredParams: ['name'],
pathParams: ['name'],
context: this.context,
};
if (callback) {
createAPIRequest<Schema$Empty>(
parameters,
callback as BodyResponseCallback<{} | void>
);
} else {
return createAPIRequest<Schema$Empty>(parameters);
}
}
}

export interface Params$Resource$Vbeta1$Projects$Locations$Operations$Cancel
extends StandardParameters {
/**
* The name of the operation resource to be cancelled.
*/
name?: string;

/**
* Request body metadata
*/
requestBody?: Schema$CancelOperationRequest;
}
}
6 changes: 5 additions & 1 deletion src/apis/cloudbuild/v1alpha1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ export namespace cloudbuild_v1alpha1 {
* Requested disk size for the VM that runs the build. Note that this is *NOT* &quot;disk free&quot;; some of the space will be used by the operating system and build utilities. Also note that this is the minimum disk size that will be allocated for the build -- the build may run with a larger disk than requested. At present, the maximum disk size is 1000GB; builds that request more than the maximum are rejected with an error.
*/
diskSizeGb?: string | null;
/**
* Option to specify whether or not to apply bash style string operations to the substitutions. NOTE: this is always enabled for triggered builds and cannot be overridden in the build configuration file.
*/
dynamicSubstitutions?: boolean | null;
/**
* A list of global environment variable definitions that will exist for all build steps in this build. If a variable is defined in both globally and in a build step, the variable will use the build step value. The elements are of the form &quot;KEY=VALUE&quot; for the environment variable &quot;KEY&quot; being given the value &quot;VALUE&quot;.
*/
Expand Down Expand Up @@ -313,7 +317,7 @@ export namespace cloudbuild_v1alpha1 {
*/
sourceProvenanceHash?: string[] | null;
/**
* Option to specify behavior when there is an error in the substitution checks.
* Option to specify behavior when there is an error in the substitution checks. NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot be overridden in the build configuration file.
*/
substitutionOption?: string | null;
/**
Expand Down
Loading

0 comments on commit 4cba781

Please sign in to comment.